2022-09-21 05:40:58 +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 SelectActorLayerDialog : DialogBox
|
|
|
|
|
{
|
|
|
|
|
public void Initialize()
|
|
|
|
|
{
|
|
|
|
|
if (Workspace.animationDef == null) return;
|
|
|
|
|
|
|
|
|
|
Transform contentWindow = transform.FindDeepChild("Content");
|
|
|
|
|
Reset();
|
|
|
|
|
|
2022-09-21 21:15:25 +00:00
|
|
|
|
for (int i = 0; i < Tags.actorLayers.Count; i++)
|
2022-09-21 05:40:58 +00:00
|
|
|
|
{
|
2022-09-21 21:15:25 +00:00
|
|
|
|
string actorLayer = Tags.actorLayers[i];
|
2022-09-21 05:40:58 +00:00
|
|
|
|
|
|
|
|
|
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
|
|
|
|
_optionToggle.Find("Text").GetComponent<Text>().text = actorLayer;
|
|
|
|
|
|
|
|
|
|
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
|
|
|
|
toggleComp.isOn = Workspace.Instance.GetCurrentPawnAnimationClip().layer == actorLayer;
|
|
|
|
|
toggleComp.onValueChanged.AddListener(delegate {
|
|
|
|
|
|
|
|
|
|
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
|
|
|
|
|
|
|
|
|
if (clip != null)
|
|
|
|
|
{ clip.layer = actorLayer; }
|
|
|
|
|
|
|
|
|
|
Workspace.Instance.RecordEvent("Actor layer set");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Reset()
|
|
|
|
|
{
|
|
|
|
|
Transform contentWindow = transform.FindDeepChild("Content");
|
|
|
|
|
RemoveCloneObjectsFromParent(contentWindow);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|