mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Code refactor
This commit is contained in:
parent
757badf4f6
commit
a55ba7b95b
232 changed files with 1282 additions and 936 deletions
|
@ -9,34 +9,40 @@ namespace RimWorldAnimationStudio
|
|||
public class ActorBody : MonoBehaviour, IPointerClickHandler, IDragHandler, IEndDragHandler
|
||||
{
|
||||
public int actorID;
|
||||
public bool isSelected = false;
|
||||
|
||||
public SpriteRenderer bodyRenderer;
|
||||
public SpriteRenderer headRenderer;
|
||||
public SpriteRenderer appendageRenderer;
|
||||
|
||||
private Vector3 delta = new Vector3();
|
||||
private Vector3 dragDelta = new Vector3();
|
||||
|
||||
public bool actorBodyPartSelected { get { return GetComponentsInChildren<ActorBodyPart>().Any(x => x.isSelected); } }
|
||||
|
||||
public void Initialize(int actorID)
|
||||
private void Start()
|
||||
{
|
||||
this.actorID = actorID;
|
||||
EventsManager.onActorBodyPartSelected.AddListener(delegate(ActorBodyPart bodyPart) { OnActorBodyPartSelected(bodyPart); });
|
||||
EventsManager.onActorBodySelected.AddListener(delegate(ActorBody actorBody) { OnActorBodySelected(actorBody); });
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void OnActorBodySelected(ActorBody actorBody)
|
||||
{
|
||||
if (Workspace.ActorID == actorID && Workspace.selectedBodyPart == null)
|
||||
if (actorBody == this)
|
||||
{ bodyRenderer.color = Constants.ColorGreen; }
|
||||
|
||||
else
|
||||
{ bodyRenderer.color = Constants.ColorWhite; }
|
||||
}
|
||||
|
||||
foreach (ActorAddon addon in Workspace.GetCurrentAnimationStage().AnimationClips[actorID].Addons)
|
||||
{
|
||||
ActorBodyPart bodyPart = GetComponentsInChildren<ActorBodyPart>(true).FirstOrDefault(x => x.addonName == addon.AddonName);
|
||||
bodyPart?.gameObject?.SetActive(addon.Render);
|
||||
}
|
||||
public void OnActorBodyPartSelected(ActorBodyPart bodyPart)
|
||||
{
|
||||
if (bodyPart.parent == this)
|
||||
{ bodyRenderer.color = Constants.ColorLightGreen; }
|
||||
|
||||
else
|
||||
{ bodyRenderer.color = Constants.ColorWhite; }
|
||||
}
|
||||
|
||||
public void Initialize(int actorID)
|
||||
{
|
||||
this.actorID = actorID;
|
||||
|
||||
if (actorID == Workspace.ActorID)
|
||||
{ Activate(); }
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
|
@ -52,19 +58,15 @@ namespace RimWorldAnimationStudio
|
|||
Activate();
|
||||
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (keyframe == null)
|
||||
{ Debug.LogWarning("Cannot alter actor - no keyframe data available"); return; }
|
||||
|
||||
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
|
||||
if (delta == Vector3.zero)
|
||||
{ delta = mousePosition - transform.position; }
|
||||
if (dragDelta == Vector3.zero)
|
||||
{ dragDelta = mousePosition - transform.position; }
|
||||
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
keyframe.BodyOffsetX = mousePosition.x - delta.x - Workspace.animationDef.Actors[actorID].GetFinalTransformOffset().x;
|
||||
keyframe.BodyOffsetZ = mousePosition.y - delta.y - Workspace.animationDef.Actors[actorID].GetFinalTransformOffset().y;
|
||||
keyframe.BodyOffsetX = mousePosition.x - dragDelta.x - Workspace.GetActor(actorID).GetFinalTransformOffset().x;
|
||||
keyframe.BodyOffsetZ = mousePosition.y - dragDelta.y - Workspace.GetActor(actorID).GetFinalTransformOffset().y;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
|
@ -84,18 +86,27 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
EventsManager.OnPawnKeyframeChanged(keyframe);
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
dragDelta = Vector3.zero;
|
||||
}
|
||||
|
||||
public ActorBodyPart GetBodyPart(string bodyPart)
|
||||
{
|
||||
return GetComponentsInChildren<ActorBodyPart>(true)?.FirstOrDefault(x => x.bodyPart.ToLower() == bodyPart);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Workspace.ActorID = actorID;
|
||||
Workspace.selectedBodyPart = null;
|
||||
|
||||
EventsManager.OnActorBodySelected(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,22 +10,39 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public SpriteRenderer bodyPartRenderer;
|
||||
public ActorBody parent;
|
||||
public bool isHead = false;
|
||||
public string addonName;
|
||||
public bool isSelected = false;
|
||||
public string bodyPart;
|
||||
|
||||
private Vector3 delta = new Vector3();
|
||||
private Vector3 dragDelta = new Vector3();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
//Workspace.onActorChanged.AddListener(delegate { });
|
||||
EventsManager.onActorBodyPartSelected.AddListener(delegate (ActorBodyPart bodyPart) { OnActorBodyPartSelected(bodyPart); });
|
||||
EventsManager.onActorBodySelected.AddListener(delegate (ActorBody actorBody) { OnActorBodySelected(actorBody); });
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void OnActorAddonChange(ActorAddon actorAddon)
|
||||
{
|
||||
if ((Workspace.ActorID == parent.actorID && Workspace.selectedBodyPart == null) || Workspace.selectedBodyPart == this)
|
||||
if (actorAddon.AddonName == bodyPart)
|
||||
{ gameObject?.SetActive(actorAddon.Render); }
|
||||
}
|
||||
|
||||
public void OnActorBodySelected(ActorBody actorBody)
|
||||
{
|
||||
if (actorBody == parent)
|
||||
{ bodyPartRenderer.color = Constants.ColorLightGreen; }
|
||||
|
||||
else
|
||||
{ bodyPartRenderer.color = Constants.ColorWhite; }
|
||||
}
|
||||
|
||||
public void OnActorBodyPartSelected(ActorBodyPart bodyPart)
|
||||
{
|
||||
if (bodyPart == this)
|
||||
{ bodyPartRenderer.color = Constants.ColorGreen; }
|
||||
|
||||
else if (bodyPart.parent == parent)
|
||||
{ bodyPartRenderer.color = Constants.ColorLightGreen; }
|
||||
|
||||
else
|
||||
{ bodyPartRenderer.color = Constants.ColorWhite; }
|
||||
}
|
||||
|
@ -43,71 +60,18 @@ namespace RimWorldAnimationStudio
|
|||
Activate();
|
||||
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (keyframe == null)
|
||||
{ Debug.LogWarning("Cannot alter actor - no keyframe data available"); return; }
|
||||
|
||||
Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
|
||||
|
||||
if (delta == Vector3.zero)
|
||||
{ delta = mousePosition - transform.position; }
|
||||
if (dragDelta == Vector3.zero)
|
||||
{ dragDelta = mousePosition - transform.position; }
|
||||
|
||||
if (addonName != null && addonName != "")
|
||||
{
|
||||
AddonKeyframe addonKeyframe = keyframe.GetAddonKeyframe(addonName);
|
||||
ActorAddon addon = Workspace.GetCurrentPawnAnimationClip().GetActorAddon(addonName);
|
||||
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
Vector3 anchor;
|
||||
|
||||
ActorBody anchoringActorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()?.FirstOrDefault(x => x.actorID == addon.AnchoringActor);
|
||||
Vector3 bodyPos = new Vector3(anchoringActorBody.transform.position.x, anchoringActorBody.transform.position.y, 0);
|
||||
PawnRaceDef pawnRaceDef = Workspace.animationDef.Actors[addon.AnchoringActor].GetPawnRaceDef();
|
||||
Actor anchoringActor = Workspace.animationDef.Actors[addon.AnchoringActor];
|
||||
int bodyFacing = (int)Workspace.GetCurrentAnimationStage().AnimationClips[addon.AnchoringActor].BodyFacing.Evaluate((float)Workspace.StageTick / Workspace.StageWindowSize);
|
||||
|
||||
switch (addon.AnchorName)
|
||||
{
|
||||
case "torso": anchor = bodyPos; break;
|
||||
case "head": anchor = new Vector3(anchoringActorBody.transform.Find("ActorHead").position.x, anchoringActorBody.transform.Find("ActorHead").position.y, 0); break;
|
||||
case "groin": anchor = bodyPos + Quaternion.AngleAxis(anchoringActorBody.transform.rotation.eulerAngles.z, Vector3.forward) * PawnUtility.GroinOffsetAt(anchoringActor.bodyType, bodyFacing).FlipAxes(); break;
|
||||
case "left breast": anchor = bodyPos + Quaternion.AngleAxis(anchoringActorBody.transform.rotation.eulerAngles.z, Vector3.forward) * PawnUtility.BreastLeftOffsetAt(anchoringActor.bodyType, bodyFacing).FlipAxes(); break;
|
||||
case "right breast": anchor = bodyPos + Quaternion.AngleAxis(anchoringActorBody.transform.rotation.eulerAngles.z, Vector3.forward) * PawnUtility.BreastRightOffsetAt(anchoringActor.bodyType, bodyFacing).FlipAxes(); break;
|
||||
default: anchor = new Vector3(); break;
|
||||
}
|
||||
|
||||
transform.position = new Vector3(mousePosition.x, mousePosition.y, 0f);
|
||||
|
||||
addonKeyframe.PosX = transform.position.x - anchor.x;
|
||||
addonKeyframe.PosZ = transform.position.y - anchor.y;
|
||||
|
||||
ActorKeyframeCard.Instance.transform.GetComponentsInChildren<ActorAddonCard>()?.FirstOrDefault(x => x.addonName == addonName)?.OnKeyframeValueChanged();
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
addonKeyframe.Rotation = angle;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Face)
|
||||
{
|
||||
//float angle = Vector2.SignedAngle(Vector2.up, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
//int facing = -Mathf.RoundToInt(angle / 90f);
|
||||
//facing = facing < 0 ? facing + 4 : facing;
|
||||
|
||||
//keyframe.headFacing = facing;
|
||||
}
|
||||
}
|
||||
|
||||
else if (isHead)
|
||||
if (bodyPart.ToLower() == "head")
|
||||
{
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
// It's stupid but it works
|
||||
// It's stupid, but it works
|
||||
Vector3 localPosA = transform.localPosition;
|
||||
transform.position = mousePosition - delta;
|
||||
transform.position = mousePosition - dragDelta;
|
||||
Vector3 localPosB = transform.localPosition;
|
||||
transform.localPosition = localPosA;
|
||||
|
||||
|
@ -130,31 +94,55 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
}
|
||||
|
||||
else
|
||||
else if (bodyPart.ToLower() == "appendage")
|
||||
{
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.up, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.GenitalAngle = angle;
|
||||
}
|
||||
}
|
||||
|
||||
Workspace.GetCurrentActor().ControlGenitalAngle = Workspace.animationDef.AnimationStages.Any(x => x.AnimationClips[Workspace.ActorID].Keyframes.Any(y => y.GenitalAngle != 0));
|
||||
else
|
||||
{
|
||||
AddonKeyframe addonKeyframe = keyframe.GetAddonKeyframe(bodyPart);
|
||||
ActorAddon addon = Workspace.GetCurrentPawnAnimationClip().GetActorAddon(bodyPart);
|
||||
|
||||
if (Workspace.actorManipulationMode == ActorManipulationMode.Pan)
|
||||
{
|
||||
ActorBody anchoringActorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()?.FirstOrDefault(x => x.actorID == addon.AnchoringActor);
|
||||
Vector3 anchor = PawnUtility.GetBodyPartAnchor(anchoringActorBody, addon.addonName);
|
||||
transform.position = new Vector3(mousePosition.x, mousePosition.y, 0f);
|
||||
|
||||
addonKeyframe.PosX = transform.position.x - anchor.x;
|
||||
addonKeyframe.PosZ = transform.position.y - anchor.y;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
addonKeyframe.Rotation = angle;
|
||||
}
|
||||
}
|
||||
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(parent.actorID);
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
EventsManager.OnPawnKeyframeChanged(keyframe);
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
dragDelta = Vector3.zero;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Workspace.ActorID = parent.actorID;
|
||||
Workspace.selectedBodyPart = this;
|
||||
|
||||
EventsManager.OnActorBodyPartSelected(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
35
Assets/Scripts/GUI/AnimationLengthDisplay.cs
Normal file
35
Assets/Scripts/GUI/AnimationLengthDisplay.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
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 AnimationLengthDisplay : MonoBehaviour
|
||||
{
|
||||
public Text stageLengthNormalText;
|
||||
public Text animationLengthNormalText;
|
||||
public Text stageLengthQuickText;
|
||||
public Text animationLengthQuickText;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void UpdateGUI()
|
||||
{
|
||||
stageLengthNormalText.text = "Stage length (normal): " + Workspace.GetCurrentAnimationStage().PlayTimeTicks + " (" + Workspace.GetCurrentAnimationStage().PlayTimeTicks / 60f + " s)";
|
||||
animationLengthNormalText.text = "Animation length (normal): " + Workspace.animationDef.animationTimeTicks + " (" + Workspace.animationDef.animationTimeTicks / 60f + " s)";
|
||||
|
||||
stageLengthQuickText.text = "Stage length (quickie): " + Workspace.GetCurrentAnimationStage().PlayTimeTicksQuick + " (" + Workspace.GetCurrentAnimationStage().PlayTimeTicksQuick / 60f + " s)";
|
||||
animationLengthQuickText.text = "Animation length (quickie): " + Workspace.animationDef.animationTimeTicksQuick + " (" + Workspace.animationDef.animationTimeTicksQuick / 60f + " s)";
|
||||
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(stageLengthQuickText.GetComponent<RectTransform>());
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(animationLengthQuickText.GetComponent<RectTransform>());
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/AnimationLengthDisplay.cs.meta
Normal file
11
Assets/Scripts/GUI/AnimationLengthDisplay.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 060e49b40b1097e46b662059e4e29cdf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -75,7 +75,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void InitiateUpdateOfGhostFrames()
|
||||
{
|
||||
if (AnimationController.Instance.IsTimelineDirty()) return;
|
||||
//if (AnimationController.Instance.IsTimelineDirty()) return;
|
||||
|
||||
BroadcastMessage("UpdateGhostFrames");
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace RimWorldAnimationStudio
|
|||
int? siblingCount = anchorTransform.parent.GetComponentsInChildren<AnimationTimeline>()?.ToList()?.Count();
|
||||
|
||||
if (siblingIndex != null && siblingCount != null && MoveAnimationTimeline(siblingIndex.Value, delta))
|
||||
{ AnimationController.Instance.InitializeAnimationTimeline(); }
|
||||
{ AnimationController.Instance.Initialize(); }
|
||||
}
|
||||
|
||||
public bool MoveAnimationTimeline(int startIndex, int delta)
|
||||
|
|
|
@ -8,7 +8,7 @@ using UnityEngine.UI;
|
|||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorAddonCard : MonoBehaviour
|
||||
public class ActorAddonKeyframeCard : MonoBehaviour
|
||||
{
|
||||
public string addonName;
|
||||
public InputField xOffsetField;
|
||||
|
@ -17,30 +17,33 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Start()
|
||||
{
|
||||
xOffsetField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
zOffsetField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
rotationField.onEndEdit.AddListener(delegate { OnFieldValueChanged(); });
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageTickChanged.AddListener(delegate { Debug.Log("stagetick"); UpdateGUI(); });
|
||||
|
||||
AnimationController.Instance.animationClipTimeField.onValueChanged.AddListener(delegate { OnKeyframeValueChanged(); });
|
||||
xOffsetField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
zOffsetField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
rotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void OnFieldValueChanged()
|
||||
public void OnValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
keyframe.GetAddonKeyframe(addonName).PosX = float.Parse(xOffsetField.text);
|
||||
keyframe.GetAddonKeyframe(addonName).PosZ = float.Parse(zOffsetField.text);
|
||||
keyframe.GetAddonKeyframe(addonName).Rotation = float.Parse(rotationField.text);
|
||||
|
||||
clip.BuildSimpleCurves();
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
|
||||
Workspace.RecordEvent("Actor addon position / orientation");
|
||||
}
|
||||
|
||||
public void OnKeyframeValueChanged()
|
||||
public void UpdateGUI()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
xOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosX.Evaluate((float)Workspace.StageTick / Workspace.StageWindowSize).ToString());
|
|
@ -28,7 +28,7 @@ namespace RimWorldAnimationStudio
|
|||
public void Start()
|
||||
{
|
||||
// General events
|
||||
EventsManager.onAnimationDefChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onDefNamesChanged.AddListener(delegate { UpdateRaceDropdown(); });
|
||||
|
||||
|
@ -69,6 +69,8 @@ namespace RimWorldAnimationStudio
|
|||
actor.SetPawnRaceOffset(new Vector2(x, z));
|
||||
|
||||
Workspace.RecordEvent("Actor offset");
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void OnDropdownChanged()
|
||||
|
@ -107,8 +109,8 @@ namespace RimWorldAnimationStudio
|
|||
string bodyType = actor.bodyType;
|
||||
bodyTypeDropdown.SetValueWithoutNotify(bodyTypeDropdown.options.FindIndex(x => x.text == bodyType));
|
||||
|
||||
bodyOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).x.ToString()));
|
||||
bodyOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).z.ToString()));
|
||||
bodyOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).x));
|
||||
bodyOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).z));
|
||||
|
||||
bodyTypeDropdown.interactable = actor.GetPawnRaceDef().isHumanoid;
|
||||
bodyOffsetXField.interactable = actor.GetPawnRaceDef().isHumanoid;
|
||||
|
@ -117,8 +119,8 @@ namespace RimWorldAnimationStudio
|
|||
string race = actor.GetPawnRaceDef().defName;
|
||||
raceDropdown.SetValueWithoutNotify(raceDropdown.options.FindIndex(x => x.text == race));
|
||||
|
||||
raceOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().x.ToString()));
|
||||
raceOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().z.ToString()));
|
||||
raceOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().x));
|
||||
raceOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,17 +15,25 @@ namespace RimWorldAnimationStudio
|
|||
public InputField headRotationField;
|
||||
public InputField appendageRotationField;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.animationDef == null)
|
||||
{ return; }
|
||||
private Actor actor { get { return Workspace.GetCurrentActor(); } }
|
||||
|
||||
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;
|
||||
private void Start()
|
||||
{
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onStageTickChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onKeyframeCountChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onPawnKeyframeChanged.AddListener(delegate { UpdateGUI(); });
|
||||
|
||||
positionXField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
positionZField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
rotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
headBobField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
headRotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
appendageRotationField.onEndEdit.AddListener(delegate { OnValueChanged(); });
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
|
@ -39,70 +47,21 @@ namespace RimWorldAnimationStudio
|
|||
keyframe.HeadAngle = float.Parse(headRotationField.text);
|
||||
keyframe.GenitalAngle = float.Parse(appendageRotationField.text);
|
||||
|
||||
Workspace.animationDef.Actors[Workspace.ActorID].ControlGenitalAngle = keyframe.GenitalAngle != 0;
|
||||
Workspace.GetPawnAnimationClip(Workspace.ActorID).BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void AdjustActor(Vector2 deltaOffset)
|
||||
{
|
||||
float deltaAngle = -deltaOffset.x * 33.3333f + deltaOffset.y * 33.3333f;
|
||||
int facing = deltaOffset.x < 0 ? 3 : deltaOffset.y < 0 ? 2 : deltaOffset.x > 0 ? 1 : 0;
|
||||
|
||||
switch (Workspace.actorManipulationMode)
|
||||
{
|
||||
case ActorManipulationMode.Pan: MoveActor(deltaOffset); break;
|
||||
case ActorManipulationMode.Rotate: RotateActor(deltaAngle); break;
|
||||
case ActorManipulationMode.Face: FaceActor(facing); break;
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveActor(Vector2 deltaOffset)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{
|
||||
keyframe.BodyOffsetX += deltaOffset.x;
|
||||
keyframe.BodyOffsetZ += deltaOffset.y;
|
||||
}
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.HeadBob += deltaOffset.y; }
|
||||
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void RotateActor(float deltaAngle)
|
||||
public void UpdateGUI()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
ActorPosition actorPosition = actor.GetCurrentPosition();
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ keyframe.BodyAngle += deltaAngle; }
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.HeadAngle += deltaAngle; }
|
||||
|
||||
else
|
||||
{ keyframe.GenitalAngle -= deltaAngle; }
|
||||
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void FaceActor(int facing)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ keyframe.BodyFacing = facing; }
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.HeadFacing = facing; }
|
||||
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
positionXField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyOffsetX));
|
||||
positionZField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyOffsetZ));
|
||||
rotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.bodyAngle));
|
||||
headBobField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.headBob));
|
||||
headRotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.headAngle));
|
||||
appendageRotationField.SetTextWithoutNotify(string.Format("{0:0.000}", actorPosition.genitalAngle));
|
||||
}
|
||||
}
|
||||
}
|
103
Assets/Scripts/GUI/Cards/AnimationControlCard.cs
Normal file
103
Assets/Scripts/GUI/Cards/AnimationControlCard.cs
Normal file
|
@ -0,0 +1,103 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class AnimationControlCard : MonoBehaviour
|
||||
{
|
||||
public Dropdown stageLoopDropdown;
|
||||
public InputField animationClipTimeField;
|
||||
public InputField animationClipLengthField;
|
||||
public Toggle stretchKeyframesToggle;
|
||||
public InputField playBackSpeedField;
|
||||
public Button playToggleButton;
|
||||
public Slider stageTimelineSlider;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
EventsManager.onStageTickChanged.AddListener(delegate
|
||||
{
|
||||
animationClipTimeField.SetTextWithoutNotify(Workspace.StageTick.ToString());
|
||||
stageTimelineSlider.SetValueWithoutNotify(Workspace.StageTick);
|
||||
});
|
||||
|
||||
EventsManager.onAnimationToggled.AddListener(delegate
|
||||
{
|
||||
playToggleButton.image.color = Workspace.isAnimating ? Constants.ColorGoldYellow : Constants.ColorWhite;
|
||||
});
|
||||
|
||||
animationClipLengthField.text = Workspace.StageWindowSize.ToString();
|
||||
stageTimelineSlider.maxValue = Workspace.StageWindowSize;
|
||||
}
|
||||
|
||||
public void ToggleAnimation(bool forceOff = false)
|
||||
{
|
||||
Workspace.isAnimating = !Workspace.isAnimating;
|
||||
if (forceOff) Workspace.isAnimating = false;
|
||||
}
|
||||
|
||||
public void OnStageTimelineSliderChange()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (Workspace.StageTick != (int)stageTimelineSlider.value)
|
||||
{
|
||||
Workspace.StageTick = (int)stageTimelineSlider.value;
|
||||
animationClipTimeField.text = Workspace.StageTick.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnAnimationClipTimeFieldChange()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
int.TryParse(animationClipTimeField.text, out int newStageTick);
|
||||
Workspace.StageTick = Mathf.Clamp(newStageTick, Constants.minTick, Workspace.StageWindowSize);
|
||||
stageTimelineSlider.value = Workspace.StageTick;
|
||||
}
|
||||
|
||||
public void OnAnimationClipLengthFieldChange()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
int.TryParse(animationClipLengthField.text, out int newStageWindowSize);
|
||||
newStageWindowSize = Mathf.Clamp(newStageWindowSize, Constants.minAnimationClipLength, Constants.maxAnimationClipLength);
|
||||
|
||||
Debug.Log("Resizing animation clip length to " + newStageWindowSize.ToString() + " ticks.");
|
||||
|
||||
if (stretchKeyframesToggle.isOn)
|
||||
{ Workspace.GetCurrentAnimationStage().StretchStageWindow(newStageWindowSize); }
|
||||
|
||||
else
|
||||
{
|
||||
foreach (PawnAnimationClip clip in Workspace.GetCurrentAnimationStage().AnimationClips)
|
||||
{
|
||||
List<PawnKeyframe> keyframes = clip.Keyframes.Where(x => x.atTick > newStageWindowSize)?.ToList();
|
||||
|
||||
if (keyframes.NullOrEmpty())
|
||||
{ continue; }
|
||||
|
||||
foreach (PawnKeyframe keyframe in keyframes)
|
||||
{
|
||||
if (clip.Keyframes.Count <= 2)
|
||||
{ break; }
|
||||
|
||||
clip.RemovePawnKeyframe(keyframe.keyframeID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Workspace.GetCurrentAnimationStage().ResizeStageWindow(newStageWindowSize);
|
||||
Workspace.RecordEvent("Stage length");
|
||||
}
|
||||
|
||||
public void OnPlayBackSpeedChange()
|
||||
{
|
||||
Workspace.PlayBackSpeed = float.Parse(playBackSpeedField.text);
|
||||
playBackSpeedField.SetTextWithoutNotify(Workspace.PlayBackSpeed.ToString());
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/Cards/AnimationControlCard.cs.meta
Normal file
11
Assets/Scripts/GUI/Cards/AnimationControlCard.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 6b414452bfd6c9b4bb99542a51d77468
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -15,7 +15,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Start()
|
||||
{
|
||||
EventsManager.onAnimationDefChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
|
||||
defNameField.onEndEdit.AddListener(delegate {
|
||||
Workspace.animationDef.DefName = defNameField.text;
|
||||
|
|
|
@ -12,6 +12,30 @@ namespace RimWorldAnimationStudio
|
|||
public InputField stageNameField;
|
||||
public Image banner;
|
||||
|
||||
private int stageID { get { return transform.GetSiblingIndex(); } }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
EventsManager.onStageIDChanged.AddListener(delegate { Initialize(stageName.text); });
|
||||
stageNameField.onEndEdit.AddListener(delegate { OnNameChange(); });
|
||||
}
|
||||
|
||||
public void Initialize(string stageName)
|
||||
{
|
||||
this.stageName.text = stageName;
|
||||
|
||||
if (Workspace.StageID == transform.GetSiblingIndex())
|
||||
{
|
||||
banner.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
banner.gameObject.SetActive(false);
|
||||
stageNameField.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnNameChange()
|
||||
{
|
||||
stageName.text = stageNameField.text;
|
||||
|
@ -23,27 +47,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnMoveStage(int delta)
|
||||
{
|
||||
int siblingCount = transform.parent.childCount;
|
||||
int index = Mathf.Clamp(transform.GetSiblingIndex() + delta, 0, siblingCount - 1);
|
||||
|
||||
transform.SetSiblingIndex(index);
|
||||
}
|
||||
|
||||
public void Initialize(string stageName)
|
||||
{
|
||||
this.stageName.text = stageName;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.StageID == transform.GetSiblingIndex())
|
||||
{ banner.gameObject.SetActive(true); }
|
||||
|
||||
else
|
||||
{
|
||||
banner.gameObject.SetActive(false);
|
||||
stageNameField.gameObject.SetActive(false);
|
||||
}
|
||||
Workspace.animationDef.MoveAnimationStage(stageID, delta);
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
|
|
58
Assets/Scripts/GUI/Cards/StageLoopsCard.cs
Normal file
58
Assets/Scripts/GUI/Cards/StageLoopsCard.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
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 StageLoopsCard : MonoBehaviour
|
||||
{
|
||||
public InputField stageLoopsNormalField;
|
||||
public InputField stageLoopsQuickField;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
EventsManager.onAnimationChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
EventsManager.onStageIDChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
EventsManager.onAnimationStageChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
|
||||
stageLoopsNormalField.onEndEdit.AddListener(delegate { OnStageLoopsNormalFieldChange(); });
|
||||
stageLoopsQuickField.onEndEdit.AddListener(delegate { OnStageLoopsFastFieldChange(); });
|
||||
|
||||
UpdateInputFields();
|
||||
}
|
||||
|
||||
public void OnStageLoopsNormalFieldChange()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.GetCurrentAnimationStage().StageLoopsNormal = int.Parse(stageLoopsNormalField.text);
|
||||
|
||||
EventsManager.OnAnimationStageChanged(Workspace.GetCurrentAnimationStage());
|
||||
Workspace.RecordEvent("Cycle count (normal)");
|
||||
|
||||
UpdateInputFields();
|
||||
}
|
||||
|
||||
public void OnStageLoopsFastFieldChange()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.GetCurrentAnimationStage().StageLoopsQuick = int.Parse(stageLoopsQuickField.text);
|
||||
|
||||
EventsManager.OnAnimationStageChanged(Workspace.GetCurrentAnimationStage());
|
||||
Workspace.RecordEvent("Cycle count (fast)");
|
||||
|
||||
UpdateInputFields();
|
||||
}
|
||||
|
||||
public void UpdateInputFields()
|
||||
{
|
||||
stageLoopsNormalField.SetTextWithoutNotify(Workspace.GetCurrentAnimationStage().StageLoopsNormal.ToString());
|
||||
stageLoopsQuickField.SetTextWithoutNotify(Workspace.GetCurrentAnimationStage().StageLoopsQuick.ToString());
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/Cards/StageLoopsCard.cs.meta
Normal file
11
Assets/Scripts/GUI/Cards/StageLoopsCard.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 38691dc973d99734f8f0f2a240df73fe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -35,12 +35,12 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
this.timeline = timeline;
|
||||
this.clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
this.keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
|
||||
this.keyframe = Workspace.GetPawnKeyframe(keyframeID);
|
||||
|
||||
this.actorID = actorID;
|
||||
this.keyframeID = keyframeID;
|
||||
|
||||
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
|
||||
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(keyframeID);
|
||||
maxValue = Workspace.StageWindowSize;
|
||||
value = keyframe.atTick.Value;
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (unlinkedSlider != null)
|
||||
{
|
||||
if (AnimationController.Instance.stretchKeyframesToggle.isOn && unlinkedSlider.keyframe.atTick == pivotKeyframe.atTick) continue;
|
||||
if (Workspace.stretchKeyframes && unlinkedSlider.keyframe.atTick == pivotKeyframe.atTick) continue;
|
||||
|
||||
unlinkedSlider.linkedSlider = this;
|
||||
unlinkedSlider.linkedOffset = unlinkedSlider.keyframe.atTick.Value - keyframe.atTick.Value;
|
||||
|
@ -176,7 +176,7 @@ namespace RimWorldAnimationStudio
|
|||
foreach (PawnKeyframe _keyframe in keyframesToCheck)
|
||||
{
|
||||
if (_keyframe != keyframe)
|
||||
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); }
|
||||
{ Workspace.GetAnimationClipThatOwnsKeyframe(_keyframe.keyframeID).RemovePawnKeyframe(_keyframe.keyframeID); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ namespace RimWorldAnimationStudio
|
|||
foreach (PawnKeyframe _keyframe in keyframesToCheck)
|
||||
{
|
||||
if (_keyframe.keyframeID != linkedKeyframe.keyframeID)
|
||||
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); Debug.Log("delete"); }
|
||||
{ Workspace.GetAnimationClipThatOwnsKeyframe(_keyframe.keyframeID).RemovePawnKeyframe(_keyframe.keyframeID); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -219,10 +219,10 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.keyframeID.NullOrEmpty() || Workspace.keyframeID.Contains(keyframeID) == false)
|
||||
{ linkedSlider = null; }
|
||||
|
||||
else if (AnimationController.Instance.stretchKeyframesToggle.isOn && linkedSlider != null)
|
||||
else if (Workspace.stretchKeyframes && linkedSlider != null)
|
||||
{ value = Mathf.CeilToInt(linkedSlider.keyframe.atTick.Value + linkedOffset * linkedSlider.ScaledOffsetFromPivot()); }
|
||||
|
||||
else if (AnimationController.Instance.stretchKeyframesToggle.isOn == false && linkedSlider != null)
|
||||
else if (Workspace.stretchKeyframes == false && linkedSlider != null)
|
||||
{ value = Mathf.Clamp(linkedSlider.keyframe.atTick.Value + linkedOffset, Constants.minTick + 1, Workspace.StageWindowSize); }
|
||||
|
||||
else if (keyframe.atTick.Value != value)
|
||||
|
@ -242,7 +242,7 @@ namespace RimWorldAnimationStudio
|
|||
{ handleImage.color = Constants.ColorGrey; }
|
||||
|
||||
// Show sound symbol
|
||||
string soundDef = Workspace.GetPawnKeyframe(actorID, keyframeID)?.SoundEffect;
|
||||
string soundDef = Workspace.GetPawnKeyframe(keyframeID)?.SoundEffect;
|
||||
soundIcon.SetActive(soundDef != null && soundDef != "" && soundDef != "None");
|
||||
}
|
||||
|
||||
|
|
|
@ -16,21 +16,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
private List<int> divisions = new List<int>();
|
||||
private float minDiff = -1f;
|
||||
private RectTransform rect;
|
||||
private int lastStageWindowSize = -1;
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
rect = GetComponent<RectTransform>();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (lastStageWindowSize != Workspace.StageWindowSize)
|
||||
{
|
||||
UpdateLinearScale();
|
||||
lastStageWindowSize = Workspace.StageWindowSize;
|
||||
}
|
||||
EventsManager.onStageWindowSizeChanged.AddListener(delegate { UpdateLinearScale(); });
|
||||
}
|
||||
|
||||
public void UpdateLinearScale()
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class InactiveDuringAnimationPreview : MonoBehaviour
|
||||
{
|
||||
private InputField inputfield;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
inputfield = GetComponent<InputField>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
inputfield.interactable = AnimationController.Instance.isAnimating == false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 92068b39ed172084296a595f5a09e54b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue