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
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue