mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Actor addons and animation
- Includes addons for hands and sex toys - WIP and very buggy
This commit is contained in:
parent
d9e6288e3a
commit
cd4711a8e5
400 changed files with 10269 additions and 661 deletions
|
@ -20,6 +20,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Pop()
|
||||
{
|
||||
Initialize();
|
||||
gameObject.SetActive(gameObject.activeSelf == false);
|
||||
}
|
||||
|
||||
|
|
215
Assets/Scripts/GUI/DialogBoxes/SelectActorAddonsDialog.cs
Normal file
215
Assets/Scripts/GUI/DialogBoxes/SelectActorAddonsDialog.cs
Normal file
|
@ -0,0 +1,215 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SelectActorAddonsDialog : DialogBox
|
||||
{
|
||||
public Toggle handLeftToggle;
|
||||
public Toggle handRightToggle;
|
||||
public Toggle sexToyToggle;
|
||||
|
||||
public Dropdown handLeftAnchor;
|
||||
public Dropdown handRightAnchor;
|
||||
public Dropdown sexToyAnchor;
|
||||
|
||||
public InputField handLeftAnchoringPawn;
|
||||
public InputField handRightAnchoringPawn;
|
||||
public InputField sexToyAnchoringPawn;
|
||||
|
||||
public Dropdown handLeftLayer;
|
||||
public Dropdown handRightLayer;
|
||||
public Dropdown sexToyLayer;
|
||||
|
||||
public GameObject handLeftControls;
|
||||
public GameObject handRightControls;
|
||||
public GameObject sexToyControls;
|
||||
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("left hand").anchorName)
|
||||
{
|
||||
case "torso": handLeftAnchor.value = 1; break;
|
||||
case "head": handLeftAnchor.value = 2; break;
|
||||
case "groin": handLeftAnchor.value = 3; break;
|
||||
case "left breast": handLeftAnchor.value = 4; break;
|
||||
case "right breast": handLeftAnchor.value = 5; break;
|
||||
default: handLeftAnchor.value = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("right hand").anchorName)
|
||||
{
|
||||
case "torso": handRightAnchor.value = 1; break;
|
||||
case "head": handRightAnchor.value = 2; break;
|
||||
case "groin": handRightAnchor.value = 3; break;
|
||||
case "left breast": handRightAnchor.value = 4; break;
|
||||
case "right breast": handRightAnchor.value = 5; break;
|
||||
default: handRightAnchor.value = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("dildo").anchorName)
|
||||
{
|
||||
case "torso": sexToyAnchor.value = 1; break;
|
||||
case "head": sexToyAnchor.value = 2; break;
|
||||
case "groin": sexToyAnchor.value = 3; break;
|
||||
case "left breast": sexToyAnchor.value = 4; break;
|
||||
case "right breast": sexToyAnchor.value = 5; break;
|
||||
default: sexToyAnchor.value = 0; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
handLeftLayer.value = handLeftLayer.options.IndexOf(handLeftLayer.options.First(x => x.text == clip.GetActorAddon("left hand").layer));
|
||||
handLeftAnchoringPawn.text = clip.GetActorAddon("left hand").anchoringActor.ToString();
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
handRightLayer.value = handRightLayer.options.IndexOf(handRightLayer.options.First(x => x.text == clip.GetActorAddon("right hand").layer));
|
||||
handRightAnchoringPawn.text = clip.GetActorAddon("right hand").anchoringActor.ToString();
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
sexToyLayer.value = sexToyLayer.options.IndexOf(sexToyLayer.options.First(x => x.text == clip.GetActorAddon("dildo").layer));
|
||||
sexToyAnchoringPawn.text = clip.GetActorAddon("dildo").anchoringActor.ToString();
|
||||
}
|
||||
|
||||
handLeftToggle.isOn = clip.IsActorAddonVisible("left hand");
|
||||
handRightToggle.isOn = clip.IsActorAddonVisible("right hand");
|
||||
sexToyToggle.isOn = clip.IsActorAddonVisible("dildo");
|
||||
|
||||
//handLeftControls.SetActive(handLeftToggle.isOn);
|
||||
//handRightControls.SetActive(handRightToggle.isOn);
|
||||
//sexToyControls.SetActive(sexToyToggle.isOn);
|
||||
}
|
||||
|
||||
public void OnToggleChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
|
||||
clip.ShowOrHideActorAddon("left hand", handLeftToggle.isOn);
|
||||
clip.ShowOrHideActorAddon("right hand", handRightToggle.isOn);
|
||||
clip.ShowOrHideActorAddon("dildo", sexToyToggle.isOn);
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
switch (handLeftAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("left hand").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("left hand").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("left hand").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("left hand").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("left hand").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("left hand").anchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
switch (handRightAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("right hand").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("right hand").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("right hand").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("right hand").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("right hand").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("right hand").anchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
switch (sexToyAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("dildo").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("dildo").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("dildo").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("dildo").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("dildo").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("dildo").anchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
public void OnLayerChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{ clip.GetActorAddon("left hand").layer = handLeftLayer.options[handLeftLayer.value].text; }
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{ clip.GetActorAddon("right hand").layer = handRightLayer.options[handRightLayer.value].text; }
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{ clip.GetActorAddon("dildo").layer = sexToyLayer.options[sexToyLayer.value].text; }
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
public void OnAnchoringPawnChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
int i = int.Parse(handLeftAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("left hand").anchoringActor = i;
|
||||
handLeftAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
int i = int.Parse(handRightAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("right hand").anchoringActor = i;
|
||||
handRightAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
int i = int.Parse(sexToyAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("dildo").anchoringActor = i;
|
||||
sexToyAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 869b2cd91a545c142b38856695c4257a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue