using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace RimWorldAnimationStudio { public class ActorCard : MonoBehaviour { public Dropdown genderDropdown; public Dropdown bodyTypeDropdown; public InputField bodyOffsetXField; public InputField bodyOffsetZField; public Toggle initiatorToggle; private Actor actor; public string bodyType { get { string _bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text; if (_bodyType == "") return "Male"; return _bodyType; } } public void Initialize(Actor actor) { this.actor = actor; initiatorToggle.isOn = actor.initiator; bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString(); bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString(); } public void UpdateAnimationDef() { float.TryParse(bodyOffsetXField.text, out float x); float.TryParse(bodyOffsetZField.text, out float z); actor.bodyTypeOffset.SetOffset(bodyType, new Vector2(x, z)); actor.initiator = initiatorToggle.isOn; if (actor.isFucking == null) { } } public void OpenSelectBodyPartsDialog() { var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectBodyPartsDialog)) as SelectBodyPartsDialog[]; if (dialog != null) { dialog[0].Initialize(actor); dialog[0].Pop(); } } public void OpenSelectDefNamesDialog() { var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectDefNamesDialog)) as SelectDefNamesDialog[]; if (dialog != null) { dialog[0].Initialize(actor); dialog[0].Pop(); } } public void OpenSelectBodyDefTypesDialog() { var dialog = Resources.FindObjectsOfTypeAll(typeof(SelectBodyDefTypesDialog)) as SelectBodyDefTypesDialog[]; if (dialog != null) { dialog[0].Initialize(actor); dialog[0].Pop(); } } } }