using System.Collections.Generic; using System.Linq; using System.Xml; using System.Xml.Serialization; using UnityEngine; namespace RimWorldAnimationStudio { public class AnimationDef { public string defName = "Undefined"; public string label = "Undefined"; public bool sounds = false; [XmlArray("sexTypes"), XmlArrayItem("li")] public List sexTypes = new List(); [XmlArray("interactionDefTypes"), XmlArrayItem("li")] public List interactionDefTypes = new List(); [XmlArray("actors"), XmlArrayItem("li")] public List actors = new List(); [XmlArray("animationStages"), XmlArrayItem("li")] public List animationStages = new List(); [XmlIgnore] public int animationTimeTicks = 0; public bool ShouldSerializesexTypes() { return sexTypes.NotNullOrEmpty(); } public bool ShouldSerializeinteractionDefTypes() { return interactionDefTypes.NotNullOrEmpty(); } public bool ShouldSerializeactors() { return actors.NotNullOrEmpty(); } public bool ShouldSerializeanimationStages() { return animationStages.NotNullOrEmpty(); } public void Initialize() { animationTimeTicks = 0; foreach (AnimationStage stage in animationStages) { stage.Initialize(); animationTimeTicks += stage.playTimeTicks; } } public void ValidateData() { sexTypes = sexTypes.Intersect(Tags.sexTypes.Concat(CustomTags.sexTypes))?.ToList(); interactionDefTypes = interactionDefTypes.Intersect(Tags.interactionDefTypes.Concat(CustomTags.interactionDefTypes))?.ToList(); } } }