mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
cd4711a8e5
commit
757badf4f6
517 changed files with 2534 additions and 2221 deletions
|
@ -33,11 +33,11 @@ namespace RimWorldAnimationStudio
|
|||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("left hand").anchorName)
|
||||
switch (clip.GetActorAddon("left hand").AnchorName)
|
||||
{
|
||||
case "torso": handLeftAnchor.value = 1; break;
|
||||
case "head": handLeftAnchor.value = 2; break;
|
||||
|
@ -50,7 +50,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("right hand").anchorName)
|
||||
switch (clip.GetActorAddon("right hand").AnchorName)
|
||||
{
|
||||
case "torso": handRightAnchor.value = 1; break;
|
||||
case "head": handRightAnchor.value = 2; break;
|
||||
|
@ -63,7 +63,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("dildo").anchorName)
|
||||
switch (clip.GetActorAddon("dildo").AnchorName)
|
||||
{
|
||||
case "torso": sexToyAnchor.value = 1; break;
|
||||
case "head": sexToyAnchor.value = 2; break;
|
||||
|
@ -76,20 +76,20 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
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();
|
||||
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();
|
||||
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();
|
||||
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");
|
||||
|
@ -103,7 +103,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnToggleChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
clip.ShowOrHideActorAddon("left hand", handLeftToggle.isOn);
|
||||
clip.ShowOrHideActorAddon("right hand", handRightToggle.isOn);
|
||||
|
@ -114,18 +114,18 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,12 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,12 +146,12 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,32 +160,32 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnLayerChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{ clip.GetActorAddon("left hand").layer = handLeftLayer.options[handLeftLayer.value].text; }
|
||||
{ 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; }
|
||||
{ clip.GetActorAddon("right hand").Layer = handRightLayer.options[handRightLayer.value].text; }
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{ clip.GetActorAddon("dildo").layer = sexToyLayer.options[sexToyLayer.value].text; }
|
||||
{ clip.GetActorAddon("dildo").Layer = sexToyLayer.options[sexToyLayer.value].text; }
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
public void OnAnchoringPawnChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
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);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("left hand").anchoringActor = i;
|
||||
clip.GetActorAddon("left hand").AnchoringActor = i;
|
||||
handLeftAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
|
@ -194,9 +194,9 @@ namespace RimWorldAnimationStudio
|
|||
int i = int.Parse(handRightAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("right hand").anchoringActor = i;
|
||||
clip.GetActorAddon("right hand").AnchoringActor = i;
|
||||
handRightAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
|
@ -205,9 +205,9 @@ namespace RimWorldAnimationStudio
|
|||
int i = int.Parse(sexToyAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("dildo").anchoringActor = i;
|
||||
clip.GetActorAddon("dildo").AnchoringActor = i;
|
||||
sexToyAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue