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 SelectBodyPartsDialog : DialogBox { public override void Initialize(bool addedNewTag = false) { IEnumerable allTags = DefaultTags.bodyParts.Concat(CustomTags.bodyParts); string placeHolderText = "Enter new body part name..."; Actor actor = Workspace.animationDef.Actors[Workspace.ActorID]; Transform contentWindow = transform.FindDeepChild("Content"); Reset(); Transform _appendageToggle = AddCloneObjectToParent(contentWindow).transform; _appendageToggle.Find("Text").GetComponent().text = "Any appendage"; Toggle appendageToggleComp = _appendageToggle.GetComponent(); appendageToggleComp.isOn = actor.IsFucking; appendageToggleComp.onValueChanged.AddListener(delegate { actor.IsFucking = appendageToggleComp.isOn; Workspace.RecordEvent("Actor required body part");}); Transform _orificeToggle = AddCloneObjectToParent(contentWindow).transform; _orificeToggle.Find("Text").GetComponent().text = "Any orifice"; Toggle orificeToggleComp = _orificeToggle.GetComponent(); orificeToggleComp.isOn = actor.IsFucked; orificeToggleComp.onValueChanged.AddListener(delegate { actor.IsFucked = orificeToggleComp.isOn; Workspace.RecordEvent("Actor required body part"); }); 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 = actor.RequiredGenitals.Contains(tag); toggleComp.onValueChanged.AddListener(delegate { if (toggleComp.isOn && actor.RequiredGenitals.Contains(tag) == false) { actor.RequiredGenitals.Add(tag); } else if (toggleComp.isOn == false && actor.RequiredGenitals.Contains(tag)) { actor.RequiredGenitals.Remove(tag); } Workspace.RecordEvent("Actor required body part"); }); if (CustomTags.bodyParts.Contains(tag)) { Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent