2022-10-25 04:43:25 +00:00
|
|
|
|
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;
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("left hand") != null)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
switch (clip.GetActorAddon("left hand").AnchorName)
|
2022-10-25 04:43:25 +00:00
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
switch (clip.GetActorAddon("right hand").AnchorName)
|
2022-10-25 04:43:25 +00:00
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
switch (clip.GetActorAddon("dildo").AnchorName)
|
2022-10-25 04:43:25 +00:00
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
handLeftLayer.value = handLeftLayer.options.IndexOf(handLeftLayer.options.First(x => x.text == clip.GetActorAddon("left hand").Layer));
|
|
|
|
|
handLeftAnchoringPawn.text = clip.GetActorAddon("left hand").AnchoringActor.ToString();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("right hand") != null)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
handRightLayer.value = handRightLayer.options.IndexOf(handRightLayer.options.First(x => x.text == clip.GetActorAddon("right hand").Layer));
|
|
|
|
|
handRightAnchoringPawn.text = clip.GetActorAddon("right hand").AnchoringActor.ToString();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("dildo") != null)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
sexToyLayer.value = sexToyLayer.options.IndexOf(sexToyLayer.options.First(x => x.text == clip.GetActorAddon("dildo").Layer));
|
|
|
|
|
sexToyAnchoringPawn.text = clip.GetActorAddon("dildo").AnchoringActor.ToString();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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()
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
clip.ShowOrHideActorAddon("left hand", handLeftToggle.isOn);
|
|
|
|
|
clip.ShowOrHideActorAddon("right hand", handRightToggle.isOn);
|
|
|
|
|
clip.ShowOrHideActorAddon("dildo", sexToyToggle.isOn);
|
|
|
|
|
|
|
|
|
|
//Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnValueChanged()
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("left hand") != null)
|
|
|
|
|
{
|
|
|
|
|
switch (handLeftAnchor.value)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
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;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("right hand") != null)
|
|
|
|
|
{
|
|
|
|
|
switch (handRightAnchor.value)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
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;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("dildo") != null)
|
|
|
|
|
{
|
|
|
|
|
switch (sexToyAnchor.value)
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
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;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnLayerChanged()
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("left hand") != null)
|
2022-10-27 05:56:04 +00:00
|
|
|
|
{ clip.GetActorAddon("left hand").Layer = handLeftLayer.options[handLeftLayer.value].text; }
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("right hand") != null)
|
2022-10-27 05:56:04 +00:00
|
|
|
|
{ clip.GetActorAddon("right hand").Layer = handRightLayer.options[handRightLayer.value].text; }
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("dildo") != null)
|
2022-10-27 05:56:04 +00:00
|
|
|
|
{ clip.GetActorAddon("dildo").Layer = sexToyLayer.options[sexToyLayer.value].text; }
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
//Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnAnchoringPawnChanged()
|
|
|
|
|
{
|
2022-10-27 05:56:04 +00:00
|
|
|
|
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("left hand") != null)
|
|
|
|
|
{
|
|
|
|
|
int i = int.Parse(handLeftAnchoringPawn.text);
|
|
|
|
|
|
|
|
|
|
if (i < 0) { i = clip.GetOwningActorID(); }
|
2022-10-27 05:56:04 +00:00
|
|
|
|
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
2022-10-27 05:56:04 +00:00
|
|
|
|
clip.GetActorAddon("left hand").AnchoringActor = i;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
handLeftAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("right hand") != null)
|
|
|
|
|
{
|
|
|
|
|
int i = int.Parse(handRightAnchoringPawn.text);
|
|
|
|
|
|
|
|
|
|
if (i < 0) { i = clip.GetOwningActorID(); }
|
2022-10-27 05:56:04 +00:00
|
|
|
|
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
2022-10-27 05:56:04 +00:00
|
|
|
|
clip.GetActorAddon("right hand").AnchoringActor = i;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
handRightAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (clip?.GetActorAddon("dildo") != null)
|
|
|
|
|
{
|
|
|
|
|
int i = int.Parse(sexToyAnchoringPawn.text);
|
|
|
|
|
|
|
|
|
|
if (i < 0) { i = clip.GetOwningActorID(); }
|
2022-10-27 05:56:04 +00:00
|
|
|
|
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
2022-10-25 04:43:25 +00:00
|
|
|
|
|
2022-10-27 05:56:04 +00:00
|
|
|
|
clip.GetActorAddon("dildo").AnchoringActor = i;
|
2022-10-25 04:43:25 +00:00
|
|
|
|
sexToyAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|