mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Remove and save custom tags
This commit is contained in:
parent
e36ef6a368
commit
2f3f807911
264 changed files with 1118 additions and 498 deletions
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -17,5 +17,10 @@ namespace RimWorldAnimationStudio
|
|||
public abstract void BuildSimpleCurves();
|
||||
|
||||
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
|
||||
|
||||
public virtual void ValidateData()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,6 +88,11 @@ namespace RimWorldAnimationStudio
|
|||
keyframes[keyframes.Count - 1].tickDuration = 1;
|
||||
}
|
||||
|
||||
public override void ValidateData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public bool MakeNew()
|
||||
{
|
||||
PawnKeyframe keyframeA = new PawnKeyframe();
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -14,5 +14,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public bool ShouldSerializeatTick() { return atTick != null; }
|
||||
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
|
||||
|
||||
public virtual void ValidateData()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -15,5 +15,22 @@ public static class IListExtensions
|
|||
{
|
||||
return NullOrEmpty<T>(list) == false;
|
||||
}
|
||||
|
||||
public static void AddDistinct<T>(this IList<T> list, T item)
|
||||
{
|
||||
if (item == null || list.Contains(item))
|
||||
{ return; }
|
||||
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
public static void AddRangeDistinct<T>(this IList<T> list, IEnumerable<T> collection)
|
||||
{
|
||||
if (collection == null)
|
||||
{ return; }
|
||||
|
||||
foreach(T item in collection)
|
||||
{ AddDistinct(list, item); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace RimWorldAnimationStudio
|
|||
else
|
||||
{ bodyRenderer.color = Constants.ColorWhite; }
|
||||
|
||||
appendageRenderer.gameObject.SetActive(Workspace.animationDef.actors[actorID].requiredGenitals.Any(x => x == "Penis" || x == "Any appendage"));
|
||||
appendageRenderer.gameObject.SetActive(Workspace.animationDef.actors[actorID].requiredGenitals.Any(x => x == "Penis") || Workspace.animationDef.actors[actorID].isFucking);
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
|
@ -87,27 +87,6 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.selectedBodyPart = null;
|
||||
|
||||
/*foreach (ActorBody actorBody in AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>())
|
||||
{
|
||||
if (actorBody == this)
|
||||
{ continue; }
|
||||
|
||||
actorBody.bodyRenderer.color = Constants.ColorWhite;
|
||||
actorBody.headRenderer.color = Constants.ColorWhite;
|
||||
actorBody.appendageRenderer.color = Constants.ColorWhite;
|
||||
|
||||
actorBody.isSelected = false;
|
||||
}
|
||||
|
||||
bodyRenderer.color = Constants.ColorGreen;
|
||||
headRenderer.color = Constants.ColorGreen;
|
||||
appendageRenderer.color = Constants.ColorGreen;
|
||||
|
||||
foreach (ActorBodyPart actorBodyPartSelected in GetComponentsInChildren<ActorBodyPart>())
|
||||
{ actorBodyPartSelected.isSelected = false; }
|
||||
|
||||
isSelected = true;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
float angle = Vector2.SignedAngle(Vector2.up, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.genitalAngle = angle;
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].controlGenitalAngle = Workspace.animationDef.animationStages.Any(x => x.animationClips[Workspace.actorID].keyframes.Any(y => y.genitalAngle != 0));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,22 +93,6 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
Workspace.actorID = parent.actorID;
|
||||
Workspace.selectedBodyPart = this;
|
||||
|
||||
/*foreach (ActorBodyPart actorBodyPart in AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBodyPart>())
|
||||
{
|
||||
actorBodyPart.isSelected = false;
|
||||
}
|
||||
|
||||
foreach (ActorBody actorBody in AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>())
|
||||
{
|
||||
actorBody.bodyRenderer.color = Constants.ColorWhite;
|
||||
actorBody.headRenderer.color = Constants.ColorWhite;
|
||||
actorBody.appendageRenderer.color = Constants.ColorWhite;
|
||||
}
|
||||
|
||||
bodyPartRenderer.color = Constants.ColorGreen;
|
||||
|
||||
isSelected = true;*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,59 +6,26 @@ using UnityEngine.UI;
|
|||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorKeyframeCard : MonoBehaviour
|
||||
public class ActorKeyframeCard : Singleton<ActorKeyframeCard>
|
||||
{
|
||||
public InputField positionXField;
|
||||
public InputField positionZField;
|
||||
public InputField rotationField;
|
||||
public InputField headBobField;
|
||||
public InputField headRotationField;
|
||||
public InputField headRotationField;
|
||||
public InputField appendageRotationField;
|
||||
|
||||
private int lastTick = -1;
|
||||
private bool isDirty = false;
|
||||
|
||||
// Move to anim controller
|
||||
public void Update()
|
||||
{
|
||||
if ((Workspace.animationDef == null || AnimationController.Instance.stageTick == lastTick) && isDirty == false)
|
||||
if (Workspace.animationDef == null)
|
||||
{ return; }
|
||||
|
||||
if (Workspace.actorID >= AnimationController.Instance.transform.childCount)
|
||||
{ return; }
|
||||
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()[Workspace.actorID];
|
||||
string bodyType = actorBody.bodyType;
|
||||
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
float clipPercent = (float)(AnimationController.Instance.stageTick % clip.duration) / clip.duration;
|
||||
|
||||
Vector3 deltaPos = new Vector3(clip.BodyOffsetX.Evaluate(clipPercent), 0, clip.BodyOffsetZ.Evaluate(clipPercent));
|
||||
deltaPos += Workspace.animationDef.actors[Workspace.actorID].bodyTypeOffset.GetOffset(bodyType);
|
||||
|
||||
float bodyAngle = clip.BodyAngle.Evaluate(clipPercent);
|
||||
float headAngle = clip.HeadAngle.Evaluate(clipPercent);
|
||||
|
||||
if (bodyAngle < 0) bodyAngle = 360 - ((-1f * bodyAngle) % 360);
|
||||
if (bodyAngle > 360) bodyAngle %= 360;
|
||||
|
||||
if (headAngle < 0) headAngle = 360 - ((-1f * headAngle) % 360);
|
||||
if (headAngle > 360) headAngle %= 360;
|
||||
|
||||
float headBob = clip.HeadBob.Evaluate(clipPercent);
|
||||
Vector3 bodyPos = new Vector3(deltaPos.x, deltaPos.z, 0);
|
||||
|
||||
float appendageRotation = clip.GenitalAngle.Evaluate(clipPercent);
|
||||
|
||||
positionXField.text = bodyPos.x.ToString("0.000");
|
||||
positionZField.text = bodyPos.y.ToString("0.000");
|
||||
rotationField.text = bodyAngle.ToString("0.000");
|
||||
headBobField.text = headBob.ToString("0.000");
|
||||
headRotationField.text = headAngle.ToString("0.000");
|
||||
appendageRotationField.text = appendageRotation.ToString("0.000");
|
||||
|
||||
lastTick = AnimationController.Instance.stageTick;
|
||||
isDirty = false;
|
||||
positionXField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
positionZField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
rotationField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
headBobField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
headRotationField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
appendageRotationField.interactable = AnimationController.Instance.isAnimating == false;
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
|
@ -72,9 +39,8 @@ namespace RimWorldAnimationStudio
|
|||
keyframe.headAngle = float.Parse(headRotationField.text);
|
||||
keyframe.genitalAngle = float.Parse(appendageRotationField.text);
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].controlGenitalAngle = keyframe.genitalAngle != 0;
|
||||
Workspace.Instance.GetPawnAnimationClip(Workspace.actorID).BuildSimpleCurves();
|
||||
isDirty = true;
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
|
@ -12,6 +13,11 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public List<GameObject> cloneObjects;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void Pop()
|
||||
{
|
||||
gameObject.SetActive(gameObject.activeSelf == false);
|
||||
|
@ -32,5 +38,22 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
return cloneObject;
|
||||
}
|
||||
|
||||
public void AddCustomTag(InputField field, ref List<string> tags, ref List<string> customTags)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (tags.Contains(field.text) || customTags.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
customTags.Add(field.text);
|
||||
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public virtual void Initialize(bool addedNewTag = false) { }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,9 +22,9 @@ namespace RimWorldAnimationStudio
|
|||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.actorLayers.Count; i++)
|
||||
for (int i = 0; i < Tags.actorLayers.Count; i++)
|
||||
{
|
||||
string actorLayer = Workspace.actorLayers[i];
|
||||
string actorLayer = Tags.actorLayers[i];
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = actorLayer;
|
||||
|
|
|
@ -10,66 +10,44 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectBodyDefTypesDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.bodyDefTypes.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new body def type...";
|
||||
|
||||
public void AddBodyDefType(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (Workspace.bodyDefTypes.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
Workspace.bodyDefTypes.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string bodyDefType in actor.bodyDefTypes)
|
||||
{
|
||||
if (Workspace.bodyDefTypes.Contains(bodyDefType) == false)
|
||||
{ Workspace.bodyDefTypes.Add(bodyDefType); }
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.bodyDefTypes.Count; i++)
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string bodyDefType = Workspace.bodyDefTypes[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = bodyDefType;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.bodyDefTypes.Contains(bodyDefType);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
if (toggleComp.isOn && actor.bodyDefTypes.Contains(bodyDefType) == false)
|
||||
{ actor.bodyDefTypes.Add(bodyDefType); }
|
||||
toggleComp.isOn = actor.bodyDefTypes.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.bodyDefTypes.Contains(tag) == false)
|
||||
{ actor.bodyDefTypes.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.bodyDefTypes.Contains(bodyDefType))
|
||||
{ actor.bodyDefTypes.Remove(bodyDefType); }
|
||||
else if (toggleComp.isOn == false && actor.bodyDefTypes.Contains(tag))
|
||||
{ actor.bodyDefTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor bodyDef type");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new body def type...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddBodyDefType(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.bodyDefTypes, ref CustomTags.bodyDefTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -10,69 +10,58 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectBodyPartsDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.bodyParts.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new body part name...";
|
||||
|
||||
public void AddBodyPart(InputField field)
|
||||
{
|
||||
Debug.Log("Attempting to add new body part");
|
||||
|
||||
if (field?.text == null || field.text == "")
|
||||
{ Debug.LogWarning("Input field is null"); return; }
|
||||
|
||||
if (Workspace.bodyParts.Contains(field.text))
|
||||
{ Debug.LogWarning("Body part is null"); field.text = ""; return; }
|
||||
|
||||
Debug.Log("Add new body part: " + field.text);
|
||||
Workspace.bodyParts.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string bodyPart in actor.requiredGenitals)
|
||||
{
|
||||
if (Workspace.bodyParts.Contains(bodyPart) == false)
|
||||
{ Workspace.bodyParts.Add(bodyPart); }
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.bodyParts.Count; i++)
|
||||
Transform _appendageToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_appendageToggle.Find("Text").GetComponent<Text>().text = "Any appendage";
|
||||
|
||||
Toggle appendageToggleComp = _appendageToggle.GetComponent<Toggle>();
|
||||
appendageToggleComp.isOn = actor.isFucking;
|
||||
appendageToggleComp.onValueChanged.AddListener(delegate { actor.isFucking = appendageToggleComp.isOn; Workspace.Instance.RecordEvent("Actor required body part");});
|
||||
|
||||
Transform _orificeToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_orificeToggle.Find("Text").GetComponent<Text>().text = "Any orifice";
|
||||
|
||||
Toggle orificeToggleComp = _orificeToggle.GetComponent<Toggle>();
|
||||
orificeToggleComp.isOn = actor.isFucked;
|
||||
orificeToggleComp.onValueChanged.AddListener(delegate { actor.isFucked = orificeToggleComp.isOn; Workspace.Instance.RecordEvent("Actor required body part"); });
|
||||
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string bodyPart = Workspace.bodyParts[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = bodyPart;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.requiredGenitals.Contains(bodyPart);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
if (toggleComp.isOn && actor.requiredGenitals.Contains(bodyPart) == false)
|
||||
{ actor.requiredGenitals.Add(bodyPart); }
|
||||
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(bodyPart))
|
||||
{ actor.requiredGenitals.Remove(bodyPart); }
|
||||
else if (toggleComp.isOn == false && actor.requiredGenitals.Contains(tag))
|
||||
{ actor.requiredGenitals.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor required body part");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new body part name...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddBodyPart(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.bodyParts, ref CustomTags.bodyParts); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -10,67 +10,44 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectDefNamesDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Debug.Log("enabled");
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
public void AddDefName(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (Workspace.defNames.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
Workspace.defNames.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
foreach (string defName in actor.defNames)
|
||||
{
|
||||
if (Workspace.defNames.Contains(defName) == false)
|
||||
{ Workspace.defNames.Add(defName); }
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.defNames.Count; i++)
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string defName = Workspace.defNames[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = defName;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.defNames.Contains(defName);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
if (toggleComp.isOn && actor.defNames.Contains(defName) == false)
|
||||
{ actor.defNames.Add(defName); }
|
||||
toggleComp.isOn = actor.defNames.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.defNames.Contains(tag) == false)
|
||||
{ actor.defNames.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.defNames.Contains(defName))
|
||||
{ actor.defNames.Remove(defName); }
|
||||
else if (toggleComp.isOn == false && actor.defNames.Contains(tag))
|
||||
{ actor.defNames.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new def name...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddDefName(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -10,66 +10,57 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectInteractionDefsDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.interactionDefTypes.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new interaction def type...";
|
||||
|
||||
public void AddInteractionDef(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (Workspace.interactionDefTypes.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
Workspace.interactionDefTypes.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
foreach (string interactionDefType in Workspace.animationDef.interactionDefTypes)
|
||||
{
|
||||
if (Workspace.interactionDefTypes.Contains(interactionDefType) == false)
|
||||
{ Workspace.interactionDefTypes.Add(interactionDefType); }
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.interactionDefTypes.Count; i++)
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string interactionDefType = Workspace.interactionDefTypes[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = interactionDefType;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.animationDef.interactionDefTypes.Contains(interactionDefType);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
if (toggleComp.isOn && Workspace.animationDef.interactionDefTypes.Contains(interactionDefType) == false)
|
||||
{ Workspace.animationDef.interactionDefTypes.Add(interactionDefType); }
|
||||
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(interactionDefType))
|
||||
{ Workspace.animationDef.interactionDefTypes.Remove(interactionDefType); }
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.interactionDefTypes.Contains(tag))
|
||||
{ Workspace.animationDef.interactionDefTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Animation InteractionDef");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
if (deleteButton != null && CustomTags.interactionDefTypes.Contains(tag))
|
||||
{
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate
|
||||
{
|
||||
CustomTags.interactionDefTypes.Remove(tag);
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
Initialize();
|
||||
});
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new interaction def type...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddInteractionDef(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.interactionDefTypes, ref CustomTags.interactionDefTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
59
Assets/Scripts/GUI/DialogBoxes/SelectRaceDialog.cs
Normal file
59
Assets/Scripts/GUI/DialogBoxes/SelectRaceDialog.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
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 SelectRaceDialog : DialogBox
|
||||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
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>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.defNames.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.defNames.Contains(tag) == false)
|
||||
{ actor.defNames.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.defNames.Contains(tag))
|
||||
{ actor.defNames.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
RemoveCloneObjectsFromParent(contentWindow);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/DialogBoxes/SelectRaceDialog.cs.meta
Normal file
11
Assets/Scripts/GUI/DialogBoxes/SelectRaceDialog.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 983d00d4d240d6c4780e903708f27c06
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -10,66 +10,45 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectSexTypesDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.sexTypes.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new sex type...";
|
||||
|
||||
public void AddSexType(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (Workspace.sexTypes.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
Workspace.sexTypes.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
foreach (string sexType in Workspace.animationDef.sexTypes)
|
||||
{
|
||||
if (Workspace.sexTypes.Contains(sexType) == false)
|
||||
{ Workspace.sexTypes.Add(sexType); }
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.sexTypes.Count; i++)
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string sexType = Workspace.sexTypes[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = sexType;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.animationDef.sexTypes.Contains(sexType);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
if (toggleComp.isOn && Workspace.animationDef.sexTypes.Contains(sexType) == false)
|
||||
{ Workspace.animationDef.sexTypes.Add(sexType); }
|
||||
toggleComp.isOn = Workspace.animationDef.sexTypes.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && Workspace.animationDef.sexTypes.Contains(tag) == false)
|
||||
{ Workspace.animationDef.sexTypes.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.sexTypes.Contains(sexType))
|
||||
{ Workspace.animationDef.sexTypes.Remove(sexType); }
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.sexTypes.Contains(tag))
|
||||
{ Workspace.animationDef.sexTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Animation sex type");
|
||||
});
|
||||
|
||||
if (addedNewTag && i == Workspace.sexTypes.Count - 1)
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new sex type...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddSexType(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.sexTypes, ref CustomTags.sexTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -10,73 +10,46 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectSoundDefDialog : DialogBox
|
||||
{
|
||||
public void OnEnable()
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
IEnumerable<string> allTags = Tags.soundDefs.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new sound def...";
|
||||
|
||||
public void AddSoundDef(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
if (Workspace.soundDefs.Contains(field.text))
|
||||
{ field.text = ""; return; }
|
||||
|
||||
Workspace.soundDefs.Add(field.text);
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
foreach (AnimationStage stage in Workspace.animationDef.animationStages)
|
||||
{
|
||||
foreach (PawnAnimationClip clip in stage.animationClips)
|
||||
{
|
||||
foreach (string soundDef in clip.keyframes.Select(x => x.soundEffect))
|
||||
{
|
||||
if (Workspace.soundDefs.Contains(soundDef) == false && soundDef != "")
|
||||
{ Workspace.soundDefs.Add(soundDef); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Workspace.soundDefs.Count; i++)
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
string soundDef = Workspace.soundDefs[i];
|
||||
string tag = allTags.ElementAt(i);
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = soundDef;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.animationDef.sexTypes.Contains(soundDef);
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
toggleComp.isOn = Workspace.Instance.GetCurrentPawnKeyframe()?.soundEffect == tag;
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe();
|
||||
|
||||
if (keyframe != null)
|
||||
{ keyframe.soundEffect = soundDef; }
|
||||
{ keyframe.soundEffect = tag; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe sound effect");
|
||||
});
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
|
||||
if (addedNewTag && i == Workspace.soundDefs.Count - 1)
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = "Enter new sound def...";
|
||||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddSoundDef(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.soundDefs, ref CustomTags.soundDefs); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -155,6 +155,7 @@ namespace RimWorldAnimationStudio
|
|||
Vector3 headPos = new Vector3(headBob.x, headBob.z, 0);
|
||||
|
||||
Vector3 appendagePos = PawnUtility.AppendageOffsetAt(bodyType, bodyFacing);
|
||||
float appendageRotation = clip.GenitalAngle.Evaluate(clipPercent);
|
||||
|
||||
actorBody.transform.position = bodyPos;
|
||||
actorBody.transform.eulerAngles = new Vector3(0, 0, bodyAngle);
|
||||
|
@ -163,7 +164,7 @@ namespace RimWorldAnimationStudio
|
|||
actorBody.headRenderer.transform.eulerAngles = new Vector3(0, 0, headAngle);
|
||||
|
||||
actorBody.appendageRenderer.transform.localPosition = new Vector3(appendagePos.x, appendagePos.z, 0f);
|
||||
actorBody.appendageRenderer.transform.eulerAngles = new Vector3(0,0,clip.GenitalAngle.Evaluate(clipPercent));
|
||||
actorBody.appendageRenderer.transform.eulerAngles = new Vector3(0, 0, appendageRotation);
|
||||
|
||||
actorBody.bodyRenderer.sprite = Resources.Load<Sprite>("Textures/Humanlike/Bodies/" + bodyType + bodyFacing);
|
||||
actorBody.headRenderer.sprite = Resources.Load<Sprite>("Textures/Humanlike/Heads/Head" + headFacing);
|
||||
|
@ -172,6 +173,15 @@ namespace RimWorldAnimationStudio
|
|||
actorBody.bodyRenderer.sortingLayerName = clip.layer;
|
||||
actorBody.headRenderer.sortingLayerName = clip.layer;
|
||||
actorBody.headRenderer.sortingOrder = bodyFacing == 0 ? -1 : 1;
|
||||
actorBody.appendageRenderer.sortingLayerName = clip.layer;
|
||||
|
||||
// ActorKeyframeCard update
|
||||
if (ActorKeyframeCard.Instance.positionXField.isFocused == false) { ActorKeyframeCard.Instance.positionXField.text = bodyPos.x.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.positionZField.isFocused == false) { ActorKeyframeCard.Instance.positionZField.text = bodyPos.y.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.rotationField.isFocused == false) { ActorKeyframeCard.Instance.rotationField.text = bodyAngle.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.headBobField.isFocused == false) { ActorKeyframeCard.Instance.headBobField.text = headBob.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.headRotationField.isFocused == false) { ActorKeyframeCard.Instance.headRotationField.text = headAngle.ToString("0.000"); }
|
||||
if (ActorKeyframeCard.Instance.appendageRotationField.isFocused == false) { ActorKeyframeCard.Instance.appendageRotationField.text = appendageRotation.ToString("0.000"); }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,11 @@ namespace RimWorldAnimationStudio
|
|||
public DialogBox exitDialog;
|
||||
public SelectAnimationDialog selectAnimationDialog;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
LoadCustomArrays();
|
||||
}
|
||||
|
||||
public void TryToCloseApplication()
|
||||
{
|
||||
exitDialog.Pop();
|
||||
|
@ -47,7 +52,9 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void LoadAnimation(AnimationDef animationDef)
|
||||
{
|
||||
animationDef.RunPostLoadOperations();
|
||||
UpdateCustomArrays(animationDef);
|
||||
RunPostLoadOperations(animationDef);
|
||||
|
||||
Debug.Log("Loaded AnimationDef: " + animationDef.defName);
|
||||
|
||||
Workspace.animationDef = animationDef;
|
||||
|
@ -67,6 +74,11 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void RunPostLoadOperations(AnimationDef animationDef)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void TrySaveAnimation()
|
||||
{
|
||||
if (Workspace.animationDef == null)
|
||||
|
@ -82,10 +94,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void SaveAnimation(string path)
|
||||
{
|
||||
Debug.Log("Saving AnimationDef: " + Workspace.animationDef.defName);
|
||||
|
||||
AnimationDef animationDef = Workspace.animationDef.Copy();
|
||||
animationDef.RunPreSaveOperations();
|
||||
RunPreSaveOperations(animationDef);
|
||||
|
||||
Debug.Log("Saving AnimationDef: " + Workspace.animationDef.defName);
|
||||
|
||||
Defs defs = new Defs();
|
||||
defs.animationDefs.Add(animationDef);
|
||||
|
@ -93,6 +105,22 @@ namespace RimWorldAnimationStudio
|
|||
XmlUtility.WriteXML(defs, path);
|
||||
}
|
||||
|
||||
public void RunPreSaveOperations(AnimationDef animationDef)
|
||||
{
|
||||
foreach (AnimationStage stage in animationDef.animationStages)
|
||||
{
|
||||
stage.ValidateData();
|
||||
|
||||
foreach (PawnAnimationClip clip in stage.animationClips)
|
||||
{
|
||||
clip.ValidateData();
|
||||
|
||||
foreach (PawnKeyframe keyframe in clip.keyframes)
|
||||
{ keyframe.ValidateData(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void NewAnimation()
|
||||
{
|
||||
var path = Path.Combine(Application.streamingAssetsPath, "AnimationDefs/newAnimationDef.xml");
|
||||
|
@ -104,5 +132,50 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
LoadAnimation(defs.animationDefs[0]);
|
||||
}
|
||||
|
||||
public void SaveCustomArrays()
|
||||
{
|
||||
var path = Path.Combine(Application.streamingAssetsPath, "customTags.xml");
|
||||
|
||||
CustomTagsHelper helper = new CustomTagsHelper();
|
||||
|
||||
helper.defNames = CustomTags.defNames;
|
||||
helper.bodyParts = CustomTags.bodyParts;
|
||||
helper.bodyDefTypes = CustomTags.bodyDefTypes;
|
||||
helper.sexTypes = CustomTags.sexTypes;
|
||||
helper.interactionDefTypes = CustomTags.interactionDefTypes;
|
||||
helper.soundDefs = CustomTags.soundDefs;
|
||||
|
||||
XmlUtility.WriteXML(helper, path);
|
||||
}
|
||||
|
||||
public void LoadCustomArrays()
|
||||
{
|
||||
var path = Path.Combine(Application.streamingAssetsPath, "customTags.xml");
|
||||
|
||||
if (File.Exists(path) == false)
|
||||
{ SaveCustomArrays(); return; }
|
||||
|
||||
CustomTagsHelper helper = XmlUtility.ReadXML<CustomTagsHelper>(path);
|
||||
|
||||
CustomTags.defNames = helper.defNames;
|
||||
CustomTags.bodyParts = helper.bodyParts;
|
||||
CustomTags.bodyDefTypes = helper.bodyDefTypes;
|
||||
CustomTags.sexTypes = helper.sexTypes;
|
||||
CustomTags.interactionDefTypes = helper.interactionDefTypes;
|
||||
CustomTags.soundDefs = helper.soundDefs;
|
||||
}
|
||||
|
||||
public void UpdateCustomArrays(AnimationDef animationDef)
|
||||
{
|
||||
CustomTags.defNames.AddRangeDistinct(animationDef.actors.SelectMany(x => x.defNames).Except(Tags.defNames));
|
||||
CustomTags.bodyParts.AddRangeDistinct(animationDef.actors.SelectMany(x => x.requiredGenitals).Except(Tags.bodyParts));
|
||||
CustomTags.bodyDefTypes.AddRangeDistinct(animationDef.actors.SelectMany(x => x.bodyDefTypes).Except(Tags.bodyDefTypes));
|
||||
CustomTags.sexTypes.AddRangeDistinct(animationDef.sexTypes.Except(Tags.sexTypes));
|
||||
CustomTags.interactionDefTypes.AddRangeDistinct(animationDef.interactionDefTypes.Except(Tags.interactionDefTypes));
|
||||
CustomTags.soundDefs.AddRangeDistinct(animationDef.animationStages.SelectMany(x => x.animationClips.SelectMany(y => y.keyframes.Select(z => z.soundEffect))).Except(Tags.soundDefs));
|
||||
|
||||
SaveCustomArrays();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
|
@ -21,4 +23,36 @@ namespace RimWorldAnimationStudio
|
|||
public static Color ColorGhost = new Color(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
public static Color ColorRed = new Color(0.9f, 0f, 0f);
|
||||
}
|
||||
|
||||
public static class Tags
|
||||
{
|
||||
public static List<string> defNames = new List<string>() { "Human" };
|
||||
public static List<string> bodyParts = new List<string>() { "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
|
||||
public static List<string> bodyDefTypes = new List<string>() { "Human", "Bird", "BeetleLike", "BeetleLikeWithClaw", "MechanicalCentipede", "MechanicalTermite", "Lancer", "Pikeman", "Monkey", "QuadrupedAnimalWithClawsTailAndJowl", "QuadrupedAnimalWithHooves", "QuadrupedAnimalWithHoovesAndHorn", "QuadrupedAnimalWithHoovesAndHump", "QuadrupedAnimalWithHoovesAndTusks", "QuadrupedAnimalWithHoovesTusksAndTrunk", "QuadrupedAnimalWithPaws", "QuadrupedAnimalWithPawsAndTail", "Scyther", "Snake", "TurtleLike" };
|
||||
public static List<string> sexTypes = new List<string>() { "None", "Vaginal", "Anal", "Oral", "Masturbation", "DoublePenetration", "Boobjob", "Handjob", "Footjob", "Fingering", "Scissoring", "MutualMasturbation", "Fisting", "MechImplant", "Rimming", "Fellatio", "Cunnilingus", "Sixtynine" };
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
public static List<string> soundDefs = new List<string>() { "None", "Sex", "Fuck", "Slimy", "Suck", "Cum" };
|
||||
public static List<string> actorLayers = new List<string>() { "Building", "BuildingOnTop", "MoteBelowThings", "Item", "ItemImportant", "LayingPawn", "PawnRope", "Projectile", "Pawn", "PawnUnused", "PawnState" };
|
||||
}
|
||||
|
||||
public static class CustomTags
|
||||
{
|
||||
public static List<string> defNames = new List<string>();
|
||||
public static List<string> bodyParts = new List<string>();
|
||||
public static List<string> bodyDefTypes = new List<string>();
|
||||
public static List<string> sexTypes = new List<string>();
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
public static List<string> soundDefs = new List<string>();
|
||||
}
|
||||
|
||||
[XmlRoot("CustomTagsHelper", IsNullable = false)]
|
||||
public class CustomTagsHelper
|
||||
{
|
||||
[XmlArray("defNames"), XmlArrayItem("li")] public List<string> defNames = new List<string>();
|
||||
[XmlArray("bodyParts"), XmlArrayItem("li")] public List<string> bodyParts = new List<string>();
|
||||
[XmlArray("bodyDefTypes"), XmlArrayItem("li")] public List<string> bodyDefTypes = new List<string>();
|
||||
[XmlArray("sexTypes"), XmlArrayItem("li")] public List<string> sexTypes = new List<string>();
|
||||
[XmlArray("interactionDefTypes"), XmlArrayItem("li")] public List<string> interactionDefTypes = new List<string>();
|
||||
[XmlArray("soundDefs"), XmlArrayItem("li")] public List<string> soundDefs = new List<string>();
|
||||
}
|
||||
}
|
||||
|
|
30
Assets/Scripts/NumberValidator.cs
Normal file
30
Assets/Scripts/NumberValidator.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NumberValidator : MonoBehaviour
|
||||
{
|
||||
public InputField.CharacterValidation valiationType = InputField.CharacterValidation.Decimal;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
InputField inputField = GetComponent<InputField>();
|
||||
|
||||
if (inputField)
|
||||
{
|
||||
inputField.characterValidation = valiationType;
|
||||
|
||||
if (valiationType == InputField.CharacterValidation.Decimal)
|
||||
{ inputField.onEndEdit.AddListener(delegate { MakeDecimal(); }); }
|
||||
}
|
||||
}
|
||||
|
||||
public void MakeDecimal()
|
||||
{
|
||||
InputField inputField = GetComponent<InputField>();
|
||||
|
||||
if (inputField)
|
||||
{ inputField.text = string.Format("{0:0.000}", float.Parse(inputField.text)); }
|
||||
}
|
||||
}
|
11
Assets/Scripts/NumberValidator.cs.meta
Normal file
11
Assets/Scripts/NumberValidator.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1f3886223a697384abc8109a51c855e2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -20,17 +20,17 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
public static void WriteXML(Defs defs, string path)
|
||||
public static void WriteXML<T>(T obj, string path)
|
||||
{
|
||||
if (defs == null || path == null || path == "")
|
||||
if (obj == null || path == null || path == "")
|
||||
{ return; }
|
||||
|
||||
XmlSerializer writer = new XmlSerializer(typeof(Defs));
|
||||
XmlSerializer writer = new XmlSerializer(typeof(T));
|
||||
XmlSerializerNamespaces nameSpaces = new XmlSerializerNamespaces();
|
||||
nameSpaces.Add("", "");
|
||||
|
||||
FileStream file = File.Create(path);
|
||||
writer.Serialize(file, defs, nameSpaces);
|
||||
writer.Serialize(file, obj, nameSpaces);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,14 +14,6 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public static int keyframeID = 0;
|
||||
|
||||
public static List<string> defNames = new List<string>() { "Human" };
|
||||
public static List<string> bodyParts = new List<string>() { "Any appendage", "Any orifice", "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
|
||||
public static List<string> bodyDefTypes = new List<string>() { "Human", "Bird", "BeetleLike", "BeetleLikeWithClaw", "MechanicalCentipede", "MechanicalTermite", "Lancer", "Pikeman", "Monkey", "QuadrupedAnimalWithClawsTailAndJowl", "QuadrupedAnimalWithHooves", "QuadrupedAnimalWithHoovesAndHorn", "QuadrupedAnimalWithHoovesAndHump", "QuadrupedAnimalWithHoovesAndTusks", "QuadrupedAnimalWithHoovesTusksAndTrunk", "QuadrupedAnimalWithPaws", "QuadrupedAnimalWithPawsAndTail", "Scyther", "Snake", "TurtleLike" };
|
||||
public static List<string> sexTypes = new List<string>() { "None", "Vaginal", "Anal", "Oral", "Masturbation", "DoublePenetration", "Boobjob", "Handjob", "Footjob", "Fingering", "Scissoring", "MutualMasturbation", "Fisting", "MechImplant", "Rimming", "Fellatio", "Cunnilingus", "Sixtynine" };
|
||||
public static List<string> interactionDefTypes = new List<string>();
|
||||
public static List<string> soundDefs = new List<string>() { "None", "Sex", "Fuck", "Slimy", "Suck", "Cum" };
|
||||
public static List<string> actorLayers = new List<string>() { "Building", "BuildingOnTop", "MoteBelowThings", "Item", "ItemImportant", "LayingPawn", "PawnRope", "Projectile", "Pawn", "PawnUnused", "PawnState" };
|
||||
|
||||
[SerializeField] private List<HistoricRecord> workspaceHistory = new List<HistoricRecord>();
|
||||
[SerializeField] private int historyIndex = 0;
|
||||
[SerializeField] private int maxHistoryDepth = 100;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue