Remove and save custom tags

This commit is contained in:
AbstractConcept 2022-09-21 16:15:25 -05:00
parent e36ef6a368
commit 2f3f807911
264 changed files with 1118 additions and 498 deletions

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using UnityEngine;
@ -16,11 +17,13 @@ namespace RimWorldAnimationStudio
[XmlArray("tags"), XmlArrayItem("li")] public List<string> tags;
[XmlIgnore] public ActorGender gender;
[XmlIgnore] public string raceDef;
public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset();
public bool initiator = false;
public bool? controlGenitalAngle;
public bool? isFucking;
public bool? isFucked;
public bool controlGenitalAngle;
public bool isFucking;
public bool isFucked;
public bool ShouldSerializedefNames() { return defNames.NotNullOrEmpty(); }
public bool ShouldSerializebodyDefTypes() { return bodyDefTypes.NotNullOrEmpty(); }
@ -30,9 +33,16 @@ namespace RimWorldAnimationStudio
public bool ShouldSerializeblacklistedRaces() { return blacklistedRaces.NotNullOrEmpty(); }
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
public bool ShouldSerializecontrolGenitalAngle() { return controlGenitalAngle != null; }
public bool ShouldSerializeisFucking() { return isFucking != null; }
public bool ShouldSerializeisFucked() { return isFucked != null; }
public bool ShouldSerializecontrolGenitalAngle() { return controlGenitalAngle; }
public bool ShouldSerializeisFucking() { return isFucking; }
public bool ShouldSerializeisFucked() { return isFucked; }
public void ValidateData()
{
defNames = defNames.Intersect(Tags.defNames.Concat(CustomTags.defNames))?.ToList();
bodyDefTypes = bodyDefTypes.Intersect(Tags.bodyDefTypes.Concat(CustomTags.bodyDefTypes))?.ToList();
requiredGenitals = requiredGenitals.Intersect(Tags.bodyParts.Concat(CustomTags.bodyParts))?.ToList();
}
public bool MakeNew()
{

View file

@ -17,5 +17,10 @@ namespace RimWorldAnimationStudio
public abstract void BuildSimpleCurves();
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
public virtual void ValidateData()
{
}
}
}

View file

@ -88,6 +88,11 @@ namespace RimWorldAnimationStudio
keyframes[keyframes.Count - 1].tickDuration = 1;
}
public override void ValidateData()
{
}
public bool MakeNew()
{
PawnKeyframe keyframeA = new PawnKeyframe();

View file

@ -14,9 +14,8 @@ namespace RimWorldAnimationStudio
[XmlArray("sexTypes"), XmlArrayItem("li")] public List<string> sexTypes = new List<string>();
[XmlArray("interactionDefTypes"), XmlArrayItem("li")] public List<string> interactionDefTypes = new List<string>();
[XmlArray("actors"), XmlArrayItem("li")] public List<Actor> actors = new List<Actor>();
[XmlArray("actors"), XmlArrayItem("li")] public List<Actor> actors = new List<Actor>();
[XmlArray("animationStages"), XmlArrayItem("li")] public List<AnimationStage> animationStages = new List<AnimationStage>();
[XmlIgnore] public int animationTimeTicks = 0;
public void Initialize()
@ -30,60 +29,10 @@ namespace RimWorldAnimationStudio
}
}
// move to app manager
public void RunPreSaveOperations()
public void ValidateData()
{
// Stage edits
for (int i = 0; i < animationStages.Count; i++)
{
AnimationStage stage = animationStages[i];
// Sort keyframes by atTick
foreach (PawnAnimationClip clip in stage.animationClips)
{ clip.keyframes = clip.keyframes.OrderBy(x => x.atTick).ToList(); }
// Check if looping
int stageWindowSize = animationStages[i].stageWindowSize > 0 ? animationStages[i].stageWindowSize : animationStages[i].animationClips.Select(x => x.duration).Max();
int cycles = Mathf.CeilToInt(animationStages[i].playTimeTicks / stageWindowSize);
stage.isLooping = cycles > 1;
}
// Actor edits
for (int i = 0; i < actors.Count; i++)
{
Actor actor = actors[i];
actor.isFucking = actor.requiredGenitals.Contains("Any appendage") ? (bool?)true : null;
if (actor.isFucking == true)
{ actor.requiredGenitals.Remove("Any appendage"); }
actor.isFucked = actor.requiredGenitals.Contains("Any orifice") ? (bool?)true : null;
if (actor.isFucked == true)
{ actor.requiredGenitals.Remove("Any orifice"); }
actor.controlGenitalAngle = animationStages.Any(x => x.animationClips[i].keyframes.Any(y => y.genitalAngle != 0)) ? (bool?)true : null;
//if (actor.requiredGender.Contains("Female")) actor.gender = ActorGender.Female;
//else if (actor.requiredGender.Contains("Male")) actor.gender = ActorGender.Male;
//else actor.gender = ActorGender.None;
}
//actors.OrderBy(x => (int)x.gender);
}
public void RunPostLoadOperations()
{
foreach (Actor actor in actors)
{
if (actor.isFucking == true)
{ actor.requiredGenitals.Add("Any appendage"); }
if (actor.isFucked == true)
{ actor.requiredGenitals.Add("Any orifice"); }
}
sexTypes = interactionDefTypes.Intersect(Tags.sexTypes.Concat(CustomTags.sexTypes))?.ToList();
interactionDefTypes = interactionDefTypes.Intersect(Tags.interactionDefTypes.Concat(CustomTags.interactionDefTypes))?.ToList();
}
}
}

View file

@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
using UnityEngine;
@ -28,6 +29,18 @@ namespace RimWorldAnimationStudio
}
}
public void ValidateData()
{
// Sort keyframes by atTick
foreach (PawnAnimationClip clip in animationClips)
{ clip.keyframes = clip.keyframes.OrderBy(x => x.atTick).ToList(); }
// Check if looping
stageWindowSize = stageWindowSize > 0 ? stageWindowSize : animationClips.Select(x => x.duration).Max();
int cycles = Mathf.CeilToInt(playTimeTicks / stageWindowSize);
isLooping = cycles > 1;
}
public bool MakeNew()
{
if (Workspace.animationDef == null)

View file

@ -14,5 +14,10 @@ namespace RimWorldAnimationStudio
public bool ShouldSerializeatTick() { return atTick != null; }
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
public virtual void ValidateData()
{
}
}
}

View file

@ -18,11 +18,15 @@ namespace RimWorldAnimationStudio
public float genitalAngle;
public bool? quiver;
[XmlIgnore] public int keyframeID;
public bool ShouldSerializegenitalAngle() { return genitalAngle != null; }
public bool ShouldSerializegenitalAngle() { return genitalAngle != 0; }
public bool ShouldSerializequiver() { return quiver != null; }
[XmlIgnore] public int keyframeID;
public override void ValidateData()
{
soundEffect = Tags.soundDefs.Concat(CustomTags.soundDefs).Contains(soundEffect) ? soundEffect : null;
}
public void GenerateKeyframeID()
{