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 SelectInteractionDefsDialog : DialogBox { public override void Initialize(bool addedNewTag = false) { IEnumerable allTags = Tags.interactionDefTypes.Concat(CustomTags.interactionDefTypes); string placeHolderText = "Enter new interaction def type..."; if (Workspace.animationDef == null) return; Transform contentWindow = transform.FindDeepChild("Content"); Reset(); for (int i = 0; i < allTags.Count(); i++) { string tag = allTags.ElementAt(i); Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform; _optionToggle.Find("Text").GetComponent().text = tag; Toggle toggleComp = _optionToggle.GetComponent(); toggleComp.isOn = Workspace.animationDef.interactionDefTypes.Contains(tag); toggleComp.onValueChanged.AddListener(delegate { if (toggleComp.isOn && Workspace.animationDef.interactionDefTypes.Contains(tag) == false) { Workspace.animationDef.interactionDefTypes.Add(tag); } else if (toggleComp.isOn == false && Workspace.animationDef.interactionDefTypes.Contains(tag)) { Workspace.animationDef.interactionDefTypes.Remove(tag); } Workspace.Instance.RecordEvent("Animation InteractionDef"); }); Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent