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
cd4711a8e5
commit
757badf4f6
517 changed files with 2534 additions and 2221 deletions
|
@ -1,135 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorCard : MonoBehaviour
|
||||
{
|
||||
//public Dropdown genderDropdown;
|
||||
public Dropdown bodyTypeDropdown;
|
||||
public InputField bodyOffsetXField;
|
||||
public InputField bodyOffsetZField;
|
||||
public InputField raceOffsetXField;
|
||||
public InputField raceOffsetZField;
|
||||
public Toggle initiatorToggle;
|
||||
public Dropdown selectActorLayerDropdown;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
string bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
|
||||
initiatorToggle.isOn = actor.initiator;
|
||||
bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString();
|
||||
bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString();
|
||||
}
|
||||
|
||||
public void OnBodyTypeChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
string bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].bodyType = bodyType;
|
||||
|
||||
bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString();
|
||||
bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString();
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
||||
string bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
|
||||
float.TryParse(bodyOffsetXField.text, out float x);
|
||||
float.TryParse(bodyOffsetZField.text, out float z);
|
||||
actor.bodyTypeOffset.SetOffset(bodyType, new Vector2(x, z));
|
||||
|
||||
actor.initiator = initiatorToggle.isOn;
|
||||
|
||||
//switch (genderDropdown.value)
|
||||
//{
|
||||
// case 0: actor.requiredGender = new List<string>() { "Female" }; break;
|
||||
// case 2: actor.requiredGender = new List<string>() { "Male" }; break;
|
||||
// default: actor.requiredGender = null; break;
|
||||
//}
|
||||
|
||||
float.TryParse(raceOffsetXField.text, out x);
|
||||
float.TryParse(raceOffsetZField.text, out z);
|
||||
actor.SetAlienRaceOffset(new Vector2(x, z));
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor body offset data");
|
||||
}
|
||||
|
||||
public void OnActorLayerChange()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip == null) return;
|
||||
clip.layer = selectActorLayerDropdown.captionText.text;
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor render layer " + clip.layer);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (Workspace.actorID >= AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>().Count())
|
||||
{ Debug.Log("Waiting for actors to initialize..."); return; }
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetComponentsInChildren<ActorBody>()[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
|
||||
string bodyType = actor.bodyType;
|
||||
bodyType = bodyType == null || bodyType == "" ? "Male" : bodyType;
|
||||
|
||||
bodyTypeDropdown.value = bodyTypeDropdown.options.IndexOf(bodyTypeDropdown.options.First(x => x.text == bodyType));
|
||||
|
||||
if (bodyOffsetXField.isFocused == false)
|
||||
{ bodyOffsetXField.text = actor.bodyTypeOffset.GetOffset(bodyType).x.ToString(); }
|
||||
|
||||
if (bodyOffsetZField.isFocused == false)
|
||||
{ bodyOffsetZField.text = actor.bodyTypeOffset.GetOffset(bodyType).z.ToString(); }
|
||||
|
||||
bodyTypeDropdown.interactable = actor.GetAlienRaceDef().isHumanoid;
|
||||
bodyOffsetXField.interactable = actor.GetAlienRaceDef().isHumanoid;
|
||||
bodyOffsetZField.interactable = actor.GetAlienRaceDef().isHumanoid;
|
||||
|
||||
if (raceOffsetXField.isFocused == false)
|
||||
{ raceOffsetXField.text = actor.GetAlienRaceOffset().x.ToString(); }
|
||||
|
||||
if (raceOffsetZField.isFocused == false)
|
||||
{ raceOffsetZField.text = actor.GetAlienRaceOffset().z.ToString(); }
|
||||
|
||||
initiatorToggle.isOn = actor.initiator;
|
||||
|
||||
//if (actor.requiredGender.NotNullOrEmpty() && actor.requiredGender.Contains("Female"))
|
||||
//{ genderDropdown.SetValueWithoutNotify(0); }
|
||||
|
||||
//else if (actor.requiredGender.NotNullOrEmpty() && actor.requiredGender.Contains("Male"))
|
||||
//{ genderDropdown.SetValueWithoutNotify(2); }
|
||||
|
||||
//else
|
||||
//{ genderDropdown.SetValueWithoutNotify(1); }
|
||||
|
||||
for (int i = 0; i < selectActorLayerDropdown.options.Count; i++)
|
||||
{
|
||||
if (selectActorLayerDropdown.options[i].text == clip.layer)
|
||||
{ selectActorLayerDropdown.SetValueWithoutNotify(i); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Scripts/GUI/Actors.meta
Normal file
8
Assets/Scripts/GUI/Actors.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: f3c96477ef8cc42468ea6a39764a2e81
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -26,20 +26,17 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.actorID == actorID && Workspace.selectedBodyPart == null)
|
||||
if (Workspace.ActorID == actorID && Workspace.selectedBodyPart == null)
|
||||
{ bodyRenderer.color = Constants.ColorGreen; }
|
||||
|
||||
else
|
||||
{ bodyRenderer.color = Constants.ColorWhite; }
|
||||
|
||||
foreach (ActorAddon addon in Workspace.animationDef.animationStages[Workspace.stageID].animationClips[actorID].addons)
|
||||
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);
|
||||
ActorBodyPart bodyPart = GetComponentsInChildren<ActorBodyPart>(true).FirstOrDefault(x => x.addonName == addon.AddonName);
|
||||
bodyPart?.gameObject?.SetActive(addon.Render);
|
||||
}
|
||||
|
||||
//headRenderer.gameObject.SetActive(Workspace.animationDef.actors[actorID].GetAlienRaceDef().isHumanoid);
|
||||
//appendageRenderer.gameObject.SetActive(Workspace.animationDef.actors[actorID].requiredGenitals.Any(x => x == "Penis") || Workspace.animationDef.actors[actorID].isFucking);
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
|
@ -54,7 +51,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
Activate();
|
||||
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (keyframe == null)
|
||||
{ Debug.LogWarning("Cannot alter actor - no keyframe data available"); return; }
|
||||
|
@ -66,14 +63,14 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
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 - delta.x - Workspace.animationDef.Actors[actorID].GetFinalTransformOffset().x;
|
||||
keyframe.BodyOffsetZ = mousePosition.y - delta.y - Workspace.animationDef.Actors[actorID].GetFinalTransformOffset().y;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.bodyAngle = angle;
|
||||
keyframe.BodyAngle = angle;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Face)
|
||||
|
@ -82,22 +79,22 @@ namespace RimWorldAnimationStudio
|
|||
int facing = -Mathf.RoundToInt(angle / 90f );
|
||||
facing = facing < 0 ? facing + 4 : facing;
|
||||
|
||||
keyframe.bodyFacing = facing;
|
||||
keyframe.BodyFacing = facing;
|
||||
}
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(actorID);
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
clip.BuildSimpleCurves();
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.ActorID = actorID;
|
||||
Workspace.selectedBodyPart = null;
|
||||
}
|
||||
}
|
|
@ -16,9 +16,14 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
private Vector3 delta = new Vector3();
|
||||
|
||||
public void Start()
|
||||
{
|
||||
//Workspace.onActorChanged.AddListener(delegate { });
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if ((Workspace.actorID == parent.actorID && Workspace.selectedBodyPart == null) || Workspace.selectedBodyPart == this)
|
||||
if ((Workspace.ActorID == parent.actorID && Workspace.selectedBodyPart == null) || Workspace.selectedBodyPart == this)
|
||||
{ bodyPartRenderer.color = Constants.ColorGreen; }
|
||||
|
||||
else
|
||||
|
@ -37,7 +42,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
Activate();
|
||||
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (keyframe == null)
|
||||
{ Debug.LogWarning("Cannot alter actor - no keyframe data available"); return; }
|
||||
|
@ -50,19 +55,19 @@ namespace RimWorldAnimationStudio
|
|||
if (addonName != null && addonName != "")
|
||||
{
|
||||
AddonKeyframe addonKeyframe = keyframe.GetAddonKeyframe(addonName);
|
||||
ActorAddon addon = Workspace.Instance.GetCurrentPawnAnimationClip().GetActorAddon(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);
|
||||
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);
|
||||
AlienRaceDef alienRaceDef = Workspace.animationDef.actors[addon.anchoringActor].GetAlienRaceDef();
|
||||
Actor anchoringActor = Workspace.animationDef.actors[addon.anchoringActor];
|
||||
int bodyFacing = (int)Workspace.animationDef.animationStages[Workspace.stageID].animationClips[addon.anchoringActor].BodyFacing.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize);
|
||||
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)
|
||||
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;
|
||||
|
@ -74,8 +79,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
transform.position = new Vector3(mousePosition.x, mousePosition.y, 0f);
|
||||
|
||||
addonKeyframe.posX = transform.position.x - anchor.x;
|
||||
addonKeyframe.posZ = transform.position.y - anchor.y;
|
||||
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();
|
||||
}
|
||||
|
@ -83,7 +88,7 @@ namespace RimWorldAnimationStudio
|
|||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
addonKeyframe.rotation = angle;
|
||||
addonKeyframe.Rotation = angle;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Face)
|
||||
|
@ -106,13 +111,13 @@ namespace RimWorldAnimationStudio
|
|||
Vector3 localPosB = transform.localPosition;
|
||||
transform.localPosition = localPosA;
|
||||
|
||||
keyframe.headBob += localPosB.y - localPosA.y;
|
||||
keyframe.HeadBob += localPosB.y - localPosA.y;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.down, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.headAngle = angle;
|
||||
keyframe.HeadAngle = angle;
|
||||
}
|
||||
|
||||
else if (Workspace.actorManipulationMode == ActorManipulationMode.Face)
|
||||
|
@ -121,7 +126,7 @@ namespace RimWorldAnimationStudio
|
|||
int facing = -Mathf.RoundToInt(angle / 90f);
|
||||
facing = facing < 0 ? facing + 4 : facing;
|
||||
|
||||
keyframe.headFacing = facing;
|
||||
keyframe.HeadFacing = facing;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -130,25 +135,25 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.actorManipulationMode == ActorManipulationMode.Rotate)
|
||||
{
|
||||
float angle = -Vector2.SignedAngle(Vector2.up, (Vector2)mousePosition - (Vector2)transform.position);
|
||||
keyframe.genitalAngle = angle;
|
||||
keyframe.GenitalAngle = angle;
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].controlGenitalAngle = Workspace.animationDef.animationStages.Any(x => x.animationClips[Workspace.actorID].keyframes.Any(y => y.genitalAngle != 0));
|
||||
Workspace.GetCurrentActor().ControlGenitalAngle = Workspace.animationDef.AnimationStages.Any(x => x.AnimationClips[Workspace.ActorID].Keyframes.Any(y => y.GenitalAngle != 0));
|
||||
}
|
||||
}
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(parent.actorID);
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(parent.actorID);
|
||||
clip.BuildSimpleCurves();
|
||||
}
|
||||
|
||||
public void OnEndDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
delta = Vector3.zero;
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
Workspace.actorID = parent.actorID;
|
||||
Workspace.ActorID = parent.actorID;
|
||||
Workspace.selectedBodyPart = this;
|
||||
}
|
||||
}
|
|
@ -16,10 +16,10 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
void Update()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentOrPreviousKeyframe(Workspace.ActorID);
|
||||
|
||||
if (keyframe != null)
|
||||
{ text.text = keyframe.soundEffect == null || keyframe.soundEffect == "" ? "None" : keyframe.soundEffect; }
|
||||
{ text.text = keyframe.SoundEffect == null || keyframe.SoundEffect == "" ? "None" : keyframe.SoundEffect; }
|
||||
|
||||
else
|
||||
{ text.text = "None"; }
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
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 AnimationDefCard : MonoBehaviour
|
||||
{
|
||||
public InputField defNameField;
|
||||
public InputField labelField;
|
||||
//public Toggle playSoundsToggle;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (defNameField.isFocused == false)
|
||||
{ defNameField.text = Workspace.animationDef.defName; }
|
||||
|
||||
if (labelField.isFocused == false)
|
||||
{ labelField.text = Workspace.animationDef.label; }
|
||||
|
||||
//playSoundsToggle.isOn = Workspace.animationDef.sounds;
|
||||
}
|
||||
|
||||
public void UpdateAnimationDef()
|
||||
{
|
||||
Workspace.animationDef.defName = defNameField.text;
|
||||
Workspace.animationDef.label = labelField.text;
|
||||
//Workspace.animationDef.sounds = playSoundsToggle.isOn;
|
||||
|
||||
Workspace.Instance.MakeHistoricRecord("AnimationDef update");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -21,13 +21,13 @@ namespace RimWorldAnimationStudio
|
|||
anchorTransform = transform.parent;
|
||||
this.actorID = actorID;
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(actorID);
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
clip.BuildSimpleCurves();
|
||||
|
||||
foreach (KeyframeSlider slider in GetComponentsInChildren<KeyframeSlider>())
|
||||
{ RemovePawnKeyFrame(slider.keyframeID);}
|
||||
|
||||
foreach (PawnKeyframe keyframe in clip.keyframes)
|
||||
foreach (PawnKeyframe keyframe in clip.Keyframes)
|
||||
{ AddPawnKeyFrame(keyframe.keyframeID); }
|
||||
|
||||
/*int keyframeCount = clip.keyframes.Count;
|
||||
|
@ -66,7 +66,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void Update()
|
||||
{
|
||||
if (Workspace.actorID == actorID)
|
||||
if (Workspace.ActorID == actorID)
|
||||
{ GetComponent<Image>().color = Constants.ColorGoldYellow; }
|
||||
|
||||
else
|
||||
|
@ -91,27 +91,27 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public bool MoveAnimationTimeline(int startIndex, int delta)
|
||||
{
|
||||
if (startIndex + delta < 0 || startIndex + delta >= Workspace.animationDef.animationStages[Workspace.stageID].animationClips.Count)
|
||||
if (startIndex + delta < 0 || startIndex + delta >= Workspace.GetCurrentAnimationStage().AnimationClips.Count)
|
||||
{ Debug.Log("Cannot move animation timeline - movement would exceed bounds"); return false; }
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[startIndex];
|
||||
Workspace.animationDef.actors[startIndex] = Workspace.animationDef.actors[startIndex + delta];
|
||||
Workspace.animationDef.actors[startIndex + delta] = actor;
|
||||
Actor actor = Workspace.animationDef.Actors[startIndex];
|
||||
Workspace.animationDef.Actors[startIndex] = Workspace.animationDef.Actors[startIndex + delta];
|
||||
Workspace.animationDef.Actors[startIndex + delta] = actor;
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetPawnAnimationClip(startIndex);
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex] = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex + delta];
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].animationClips[startIndex + delta] = clip;
|
||||
PawnAnimationClip clip = Workspace.GetPawnAnimationClip(startIndex);
|
||||
Workspace.GetCurrentAnimationStage().AnimationClips[startIndex] = Workspace.GetCurrentAnimationStage().AnimationClips[startIndex + delta];
|
||||
Workspace.GetCurrentAnimationStage().AnimationClips[startIndex + delta] = clip;
|
||||
|
||||
Workspace.actorID = startIndex + delta;
|
||||
Workspace.ActorID = startIndex + delta;
|
||||
|
||||
Workspace.Instance.RecordEvent("Timeline move");
|
||||
Workspace.RecordEvent("Timeline move");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.ActorID = actorID;
|
||||
Workspace.keyframeID.Clear();
|
||||
}
|
||||
}
|
||||
|
|
8
Assets/Scripts/GUI/Cards.meta
Normal file
8
Assets/Scripts/GUI/Cards.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c026d569e32726d4eb8821db713d0aac
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -27,25 +27,25 @@ namespace RimWorldAnimationStudio
|
|||
public void OnFieldValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
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);
|
||||
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.Instance.RecordEvent("Actor addon position / orientation");
|
||||
Workspace.RecordEvent("Actor addon position / orientation");
|
||||
}
|
||||
|
||||
public void OnKeyframeValueChanged()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
xOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosX.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
zOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosZ.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
rotationField.SetTextWithoutNotify(clip.GetActorAddon(addonName).Rotation.Evaluate((float)AnimationController.Instance.stageTick / Workspace.StageWindowSize).ToString());
|
||||
xOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosX.Evaluate((float)Workspace.StageTick / Workspace.StageWindowSize).ToString());
|
||||
zOffsetField.SetTextWithoutNotify(clip.GetActorAddon(addonName).PosZ.Evaluate((float)Workspace.StageTick / Workspace.StageWindowSize).ToString());
|
||||
rotationField.SetTextWithoutNotify(clip.GetActorAddon(addonName).Rotation.Evaluate((float)Workspace.StageTick / Workspace.StageWindowSize).ToString());
|
||||
}
|
||||
}
|
||||
}
|
124
Assets/Scripts/GUI/Cards/ActorCard.cs
Normal file
124
Assets/Scripts/GUI/Cards/ActorCard.cs
Normal file
|
@ -0,0 +1,124 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ActorCard : MonoBehaviour
|
||||
{
|
||||
public Toggle initiatorToggle;
|
||||
public Dropdown selectActorLayerDropdown;
|
||||
public Dropdown bodyTypeDropdown;
|
||||
public InputField bodyOffsetXField;
|
||||
public InputField bodyOffsetZField;
|
||||
public Dropdown raceDropdown;
|
||||
public InputField raceOffsetXField;
|
||||
public InputField raceOffsetZField;
|
||||
|
||||
private Actor actor { get { return Workspace.GetCurrentActor(); } }
|
||||
private PawnAnimationClip clip { get { return Workspace.GetCurrentPawnAnimationClip(); } }
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
UpdateRaceDropdown();
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// General events
|
||||
EventsManager.onAnimationDefChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
|
||||
EventsManager.onDefNamesChanged.AddListener(delegate { UpdateRaceDropdown(); });
|
||||
|
||||
// Local events
|
||||
initiatorToggle.onValueChanged.AddListener(delegate {
|
||||
actor.initiator = initiatorToggle.isOn;
|
||||
Workspace.RecordEvent("Change in actor sex initiator status ");
|
||||
});
|
||||
|
||||
selectActorLayerDropdown.onValueChanged.AddListener(delegate {
|
||||
clip.Layer = selectActorLayerDropdown.options[selectActorLayerDropdown.value].text;
|
||||
Workspace.RecordEvent("Change in actor render layer");
|
||||
});
|
||||
|
||||
bodyTypeDropdown.onValueChanged.AddListener(delegate { OnDropdownChanged(); });
|
||||
bodyOffsetXField.onEndEdit.AddListener(delegate { OnInputFieldChanged(); });
|
||||
bodyOffsetZField.onEndEdit.AddListener(delegate { OnInputFieldChanged(); });
|
||||
|
||||
raceDropdown.onValueChanged.AddListener(delegate { OnDropdownChanged(); });
|
||||
raceOffsetXField.onEndEdit.AddListener(delegate { OnInputFieldChanged(); });
|
||||
raceOffsetZField.onEndEdit.AddListener(delegate { OnInputFieldChanged(); });
|
||||
|
||||
// Initialize
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void OnInputFieldChanged()
|
||||
{
|
||||
string bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
||||
bodyType = string.IsNullOrEmpty(bodyType) ? "Male" : bodyType;
|
||||
|
||||
float.TryParse(bodyOffsetXField.text, out float x);
|
||||
float.TryParse(bodyOffsetZField.text, out float z);
|
||||
actor.BodyTypeOffset.SetOffset(bodyType, new Vector2(x, z));
|
||||
|
||||
float.TryParse(raceOffsetXField.text, out x);
|
||||
float.TryParse(raceOffsetZField.text, out z);
|
||||
actor.SetPawnRaceOffset(new Vector2(x, z));
|
||||
|
||||
Workspace.RecordEvent("Actor offset");
|
||||
}
|
||||
|
||||
public void OnDropdownChanged()
|
||||
{
|
||||
actor.bodyType = bodyTypeDropdown.options[bodyTypeDropdown.value].text;
|
||||
|
||||
if (raceDropdown.options[raceDropdown.value].text != actor.GetPawnRaceDef().defName)
|
||||
{ Workspace.selectedBodyPart = null; }
|
||||
|
||||
actor.SetPawnRaceDef(raceDropdown.options[raceDropdown.value].text);
|
||||
|
||||
Workspace.RecordEvent("Actor body type/race change");
|
||||
|
||||
UpdateGUI();
|
||||
}
|
||||
|
||||
public void UpdateRaceDropdown()
|
||||
{
|
||||
raceDropdown.ClearOptions();
|
||||
int index = raceDropdown.value;
|
||||
|
||||
IEnumerable<string> optionsList = DefaultTags.defNames.Concat(CustomTags.defNames);
|
||||
foreach (string defName in optionsList)
|
||||
{ raceDropdown.options.Add(new Dropdown.OptionData(defName)); }
|
||||
|
||||
raceDropdown.value = Mathf.Clamp(index, 0, raceDropdown.options.Count - 1);
|
||||
}
|
||||
|
||||
public void UpdateGUI()
|
||||
{
|
||||
initiatorToggle.isOn = actor.Initiator;
|
||||
|
||||
string layer = clip.Layer;
|
||||
selectActorLayerDropdown.SetValueWithoutNotify(selectActorLayerDropdown.options.FindIndex(x => x.text == layer));
|
||||
|
||||
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()));
|
||||
|
||||
bodyTypeDropdown.interactable = actor.GetPawnRaceDef().isHumanoid;
|
||||
bodyOffsetXField.interactable = actor.GetPawnRaceDef().isHumanoid;
|
||||
bodyOffsetZField.interactable = actor.GetPawnRaceDef().isHumanoid;
|
||||
|
||||
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()));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,18 +30,18 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
keyframe.bodyOffsetX = float.Parse(positionXField.text);
|
||||
keyframe.bodyOffsetZ = float.Parse(positionZField.text);
|
||||
keyframe.bodyAngle = float.Parse(rotationField.text);
|
||||
keyframe.headBob = float.Parse(headBobField.text);
|
||||
keyframe.headAngle = float.Parse(headRotationField.text);
|
||||
keyframe.genitalAngle = float.Parse(appendageRotationField.text);
|
||||
keyframe.BodyOffsetX = float.Parse(positionXField.text);
|
||||
keyframe.BodyOffsetZ = float.Parse(positionZField.text);
|
||||
keyframe.BodyAngle = float.Parse(rotationField.text);
|
||||
keyframe.HeadBob = float.Parse(headBobField.text);
|
||||
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();
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.animationDef.Actors[Workspace.ActorID].ControlGenitalAngle = keyframe.GenitalAngle != 0;
|
||||
Workspace.GetPawnAnimationClip(Workspace.ActorID).BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void AdjustActor(Vector2 deltaOffset)
|
||||
|
@ -59,50 +59,50 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void MoveActor(Vector2 deltaOffset)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{
|
||||
keyframe.bodyOffsetX += deltaOffset.x;
|
||||
keyframe.bodyOffsetZ += deltaOffset.y;
|
||||
keyframe.BodyOffsetX += deltaOffset.x;
|
||||
keyframe.BodyOffsetZ += deltaOffset.y;
|
||||
}
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.headBob += deltaOffset.y; }
|
||||
{ keyframe.HeadBob += deltaOffset.y; }
|
||||
|
||||
Workspace.Instance.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void RotateActor(float deltaAngle)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ keyframe.bodyAngle += deltaAngle; }
|
||||
{ keyframe.BodyAngle += deltaAngle; }
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.headAngle += deltaAngle; }
|
||||
{ keyframe.HeadAngle += deltaAngle; }
|
||||
|
||||
else
|
||||
{ keyframe.genitalAngle -= deltaAngle; }
|
||||
{ keyframe.GenitalAngle -= deltaAngle; }
|
||||
|
||||
Workspace.Instance.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
|
||||
public void FaceActor(int facing)
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentPawnKeyframe(true);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentPawnKeyframe(true);
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ keyframe.bodyFacing = facing; }
|
||||
{ keyframe.BodyFacing = facing; }
|
||||
|
||||
else if (Workspace.selectedBodyPart.isHead)
|
||||
{ keyframe.headFacing = facing; }
|
||||
{ keyframe.HeadFacing = facing; }
|
||||
|
||||
Workspace.Instance.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.Instance.RecordEvent("Actor position / orientation");
|
||||
Workspace.GetCurrentPawnAnimationClip().BuildSimpleCurves();
|
||||
Workspace.RecordEvent("Actor position / orientation");
|
||||
}
|
||||
}
|
||||
}
|
39
Assets/Scripts/GUI/Cards/AnimationDefCard.cs
Normal file
39
Assets/Scripts/GUI/Cards/AnimationDefCard.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
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 AnimationDefCard : MonoBehaviour
|
||||
{
|
||||
public InputField defNameField;
|
||||
public InputField labelField;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
EventsManager.onAnimationDefChanged.AddListener(delegate { UpdateInputFields(); });
|
||||
|
||||
defNameField.onEndEdit.AddListener(delegate {
|
||||
Workspace.animationDef.DefName = defNameField.text;
|
||||
Workspace.MakeHistoricRecord("AnimationDef update");
|
||||
});
|
||||
|
||||
labelField.onEndEdit.AddListener(delegate {
|
||||
Workspace.animationDef.Label = labelField.text;
|
||||
Workspace.MakeHistoricRecord("AnimationDef update");
|
||||
});
|
||||
|
||||
UpdateInputFields();
|
||||
}
|
||||
|
||||
public void UpdateInputFields()
|
||||
{
|
||||
defNameField.SetTextWithoutNotify(Workspace.animationDef.DefName);
|
||||
labelField.SetTextWithoutNotify(Workspace.animationDef.Label);
|
||||
}
|
||||
}
|
||||
}
|
63
Assets/Scripts/GUI/Cards/StageCard.cs
Normal file
63
Assets/Scripts/GUI/Cards/StageCard.cs
Normal file
|
@ -0,0 +1,63 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class StageCard : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
public Text stageName;
|
||||
public InputField stageNameField;
|
||||
public Image banner;
|
||||
|
||||
public void OnNameChange()
|
||||
{
|
||||
stageName.text = stageNameField.text;
|
||||
stageNameField.gameObject.SetActive(false);
|
||||
|
||||
Workspace.GetCurrentAnimationStage().StageName = stageName.text;
|
||||
Workspace.RecordEvent("Stage renamed");
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.clickCount >= 2)
|
||||
{
|
||||
stageNameField.text = stageName.text;
|
||||
stageNameField.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (Workspace.StageID != transform.GetSiblingIndex())
|
||||
{ Workspace.RecordEvent("Stage selected"); }
|
||||
|
||||
Workspace.StageID = transform.GetSiblingIndex();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -67,9 +67,9 @@ namespace RimWorldAnimationStudio
|
|||
if (field?.text == null || field.text == "")
|
||||
{ return; }
|
||||
|
||||
AlienRaceDefs.AddDef(new AlienRaceDef(field.text));
|
||||
PawnRaceDefs.AddDef(new PawnRaceDef(field.text));
|
||||
|
||||
ApplicationManager.Instance.SaveAlienRaceDefs();
|
||||
ApplicationManager.Instance.SavePawnRaceDefs();
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,21 +21,21 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
Reset();
|
||||
|
||||
AlienRaceDef alienRaceDef = GetCurrentRaceDef();
|
||||
if (alienRaceDef == null) return;
|
||||
PawnRaceDef pawnRaceDef = GetCurrentRaceDef();
|
||||
if (pawnRaceDef == null) return;
|
||||
|
||||
isHumanoidToggle.SetIsOnWithoutNotify(alienRaceDef.isHumanoid);
|
||||
isHumanoidToggle.SetIsOnWithoutNotify(pawnRaceDef.isHumanoid);
|
||||
|
||||
Text bodyGraphicsTitle = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
bodyGraphicsTitle.text = "Body graphic filepaths";
|
||||
|
||||
List<string> allTags = alienRaceDef.isHumanoid ? Tags.bodyTypes : new List<string>() { "None" };
|
||||
List<string> allTags = pawnRaceDef.isHumanoid ? DefaultTags.bodyTypes : new List<string>() { "None" };
|
||||
|
||||
foreach (string bodyType in allTags)
|
||||
{
|
||||
string _bodyType = bodyType;
|
||||
|
||||
if (alienRaceDef.isHumanoid)
|
||||
if (pawnRaceDef.isHumanoid)
|
||||
{
|
||||
Text bodyTypeTitle = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
bodyTypeTitle.text = bodyType;
|
||||
|
@ -49,15 +49,15 @@ namespace RimWorldAnimationStudio
|
|||
filepath.GetComponent<Text>().text = facing.ToString();
|
||||
filepath.transform.Find("FilepathButton").GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
SetBodyTypeGraphicPath(alienRaceDef, facing, _bodyType);
|
||||
SetBodyTypeGraphicPath(pawnRaceDef, facing, _bodyType);
|
||||
});
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = alienRaceDef.GetBodyTypeGraphicPath(facing, _bodyType);
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = pawnRaceDef.GetBodyTypeGraphicPath(facing, _bodyType);
|
||||
}
|
||||
|
||||
AddCloneObjectToParent(raceSettingsWindow, 3);
|
||||
}
|
||||
|
||||
if (alienRaceDef.isHumanoid)
|
||||
if (pawnRaceDef.isHumanoid)
|
||||
{
|
||||
Text headGraphics = AddCloneObjectToParent(raceSettingsWindow, 2).GetComponent<Text>();
|
||||
headGraphics.text = "Head graphic filepaths";
|
||||
|
@ -70,15 +70,15 @@ namespace RimWorldAnimationStudio
|
|||
filepath.GetComponent<Text>().text = facing.ToString();
|
||||
filepath.transform.Find("FilepathButton").GetComponent<Button>().onClick.AddListener(delegate
|
||||
{
|
||||
SetHeadGraphicPath(alienRaceDef, facing);
|
||||
SetHeadGraphicPath(pawnRaceDef, facing);
|
||||
});
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = alienRaceDef.GetHeadGraphicPath(facing);
|
||||
filepath.transform.FindDeepChild("FilepathLabel").GetComponent<Text>().text = pawnRaceDef.GetHeadGraphicPath(facing);
|
||||
}
|
||||
|
||||
AddCloneObjectToParent(raceSettingsWindow, 3);
|
||||
}
|
||||
|
||||
scaleField.text = string.Format("{0:0.000}", alienRaceDef.scale.ToString());
|
||||
scaleField.text = string.Format("{0:0.000}", pawnRaceDef.scale.ToString());
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
@ -88,53 +88,53 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void SetIsHumanoid()
|
||||
{
|
||||
AlienRaceDef alienRaceDef = GetCurrentRaceDef();
|
||||
if (alienRaceDef == null) return;
|
||||
PawnRaceDef pawnRaceDef = GetCurrentRaceDef();
|
||||
if (pawnRaceDef == null) return;
|
||||
|
||||
alienRaceDef.isHumanoid = isHumanoidToggle.isOn;
|
||||
pawnRaceDef.isHumanoid = isHumanoidToggle.isOn;
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void SetHeadGraphicPath(AlienRaceDef alienRaceDef, CardinalDirection direction)
|
||||
public void SetHeadGraphicPath(PawnRaceDef pawnRaceDef, CardinalDirection direction)
|
||||
{
|
||||
var paths = StandaloneFileBrowser.OpenFilePanel("Select texture File", "", "png", false);
|
||||
|
||||
if (paths == null || paths.Any() == false || File.Exists(paths[0]) == false)
|
||||
{ Debug.LogWarning("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetHeadGraphicPath(paths[0], direction);
|
||||
pawnRaceDef.SetHeadGraphicPath(paths[0], direction);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void SetBodyTypeGraphicPath(AlienRaceDef alienRaceDef, CardinalDirection direction, string bodyType)
|
||||
public void SetBodyTypeGraphicPath(PawnRaceDef pawnRaceDef, CardinalDirection direction, string bodyType)
|
||||
{
|
||||
var paths = StandaloneFileBrowser.OpenFilePanel("Select texture File", "", "png", false);
|
||||
|
||||
if (paths == null || paths.Any() == false || File.Exists(paths[0]) == false)
|
||||
{ Debug.LogWarning("Selected file was null or invalid"); return; }
|
||||
|
||||
alienRaceDef.SetBodyTypeGraphicPath(paths[0], direction, bodyType);
|
||||
pawnRaceDef.SetBodyTypeGraphicPath(paths[0], direction, bodyType);
|
||||
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public AlienRaceDef GetCurrentRaceDef()
|
||||
public PawnRaceDef GetCurrentRaceDef()
|
||||
{
|
||||
string alienRaceDefName = raceSelectDropdown.value < raceSelectDropdown.options.Count ? raceSelectDropdown.options[raceSelectDropdown.value].text : "Human";
|
||||
if (alienRaceDefName == null || alienRaceDefName == "") alienRaceDefName = "Human";
|
||||
string pawnRaceDefName = raceSelectDropdown.value < raceSelectDropdown.options.Count ? raceSelectDropdown.options[raceSelectDropdown.value].text : "Human";
|
||||
if (pawnRaceDefName == null || pawnRaceDefName == "") pawnRaceDefName = "Human";
|
||||
|
||||
return AlienRaceDefs.GetNamed(alienRaceDefName);
|
||||
return PawnRaceDefs.GetNamed(pawnRaceDefName);
|
||||
}
|
||||
|
||||
public void SetRaceScale()
|
||||
{
|
||||
AlienRaceDef alienRaceDef = GetCurrentRaceDef();
|
||||
if (alienRaceDef == null) return;
|
||||
PawnRaceDef pawnRaceDef = GetCurrentRaceDef();
|
||||
if (pawnRaceDef == null) return;
|
||||
|
||||
float scale = float.Parse(scaleField.text);
|
||||
alienRaceDef.scale = Mathf.Clamp(scale, 0.05f, 100f);
|
||||
pawnRaceDef.scale = Mathf.Clamp(scale, 0.05f, 100f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ namespace RimWorldAnimationStudio
|
|||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("left hand").anchorName)
|
||||
switch (clip.GetActorAddon("left hand").AnchorName)
|
||||
{
|
||||
case "torso": handLeftAnchor.value = 1; break;
|
||||
case "head": handLeftAnchor.value = 2; break;
|
||||
|
@ -50,7 +50,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("right hand").anchorName)
|
||||
switch (clip.GetActorAddon("right hand").AnchorName)
|
||||
{
|
||||
case "torso": handRightAnchor.value = 1; break;
|
||||
case "head": handRightAnchor.value = 2; break;
|
||||
|
@ -63,7 +63,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
switch (clip.GetActorAddon("dildo").anchorName)
|
||||
switch (clip.GetActorAddon("dildo").AnchorName)
|
||||
{
|
||||
case "torso": sexToyAnchor.value = 1; break;
|
||||
case "head": sexToyAnchor.value = 2; break;
|
||||
|
@ -76,20 +76,20 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
handLeftLayer.value = handLeftLayer.options.IndexOf(handLeftLayer.options.First(x => x.text == clip.GetActorAddon("left hand").layer));
|
||||
handLeftAnchoringPawn.text = clip.GetActorAddon("left hand").anchoringActor.ToString();
|
||||
handLeftLayer.value = handLeftLayer.options.IndexOf(handLeftLayer.options.First(x => x.text == clip.GetActorAddon("left hand").Layer));
|
||||
handLeftAnchoringPawn.text = clip.GetActorAddon("left hand").AnchoringActor.ToString();
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{
|
||||
handRightLayer.value = handRightLayer.options.IndexOf(handRightLayer.options.First(x => x.text == clip.GetActorAddon("right hand").layer));
|
||||
handRightAnchoringPawn.text = clip.GetActorAddon("right hand").anchoringActor.ToString();
|
||||
handRightLayer.value = handRightLayer.options.IndexOf(handRightLayer.options.First(x => x.text == clip.GetActorAddon("right hand").Layer));
|
||||
handRightAnchoringPawn.text = clip.GetActorAddon("right hand").AnchoringActor.ToString();
|
||||
}
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{
|
||||
sexToyLayer.value = sexToyLayer.options.IndexOf(sexToyLayer.options.First(x => x.text == clip.GetActorAddon("dildo").layer));
|
||||
sexToyAnchoringPawn.text = clip.GetActorAddon("dildo").anchoringActor.ToString();
|
||||
sexToyLayer.value = sexToyLayer.options.IndexOf(sexToyLayer.options.First(x => x.text == clip.GetActorAddon("dildo").Layer));
|
||||
sexToyAnchoringPawn.text = clip.GetActorAddon("dildo").AnchoringActor.ToString();
|
||||
}
|
||||
|
||||
handLeftToggle.isOn = clip.IsActorAddonVisible("left hand");
|
||||
|
@ -103,7 +103,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnToggleChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
clip.ShowOrHideActorAddon("left hand", handLeftToggle.isOn);
|
||||
clip.ShowOrHideActorAddon("right hand", handRightToggle.isOn);
|
||||
|
@ -114,18 +114,18 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
switch (handLeftAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("left hand").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("left hand").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("left hand").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("left hand").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("left hand").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("left hand").anchorName = null; break;
|
||||
case 1: clip.GetActorAddon("left hand").AnchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("left hand").AnchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("left hand").AnchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("left hand").AnchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("left hand").AnchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("left hand").AnchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,12 +133,12 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
switch (handRightAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("right hand").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("right hand").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("right hand").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("right hand").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("right hand").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("right hand").anchorName = null; break;
|
||||
case 1: clip.GetActorAddon("right hand").AnchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("right hand").AnchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("right hand").AnchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("right hand").AnchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("right hand").AnchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("right hand").AnchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,12 +146,12 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
switch (sexToyAnchor.value)
|
||||
{
|
||||
case 1: clip.GetActorAddon("dildo").anchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("dildo").anchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("dildo").anchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("dildo").anchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("dildo").anchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("dildo").anchorName = null; break;
|
||||
case 1: clip.GetActorAddon("dildo").AnchorName = "torso"; break;
|
||||
case 2: clip.GetActorAddon("dildo").AnchorName = "head"; break;
|
||||
case 3: clip.GetActorAddon("dildo").AnchorName = "groin"; break;
|
||||
case 4: clip.GetActorAddon("dildo").AnchorName = "left breast"; break;
|
||||
case 5: clip.GetActorAddon("dildo").AnchorName = "right breast"; break;
|
||||
default: clip.GetActorAddon("dildo").AnchorName = null; break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,32 +160,32 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnLayerChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{ clip.GetActorAddon("left hand").layer = handLeftLayer.options[handLeftLayer.value].text; }
|
||||
{ clip.GetActorAddon("left hand").Layer = handLeftLayer.options[handLeftLayer.value].text; }
|
||||
|
||||
if (clip?.GetActorAddon("right hand") != null)
|
||||
{ clip.GetActorAddon("right hand").layer = handRightLayer.options[handRightLayer.value].text; }
|
||||
{ clip.GetActorAddon("right hand").Layer = handRightLayer.options[handRightLayer.value].text; }
|
||||
|
||||
if (clip?.GetActorAddon("dildo") != null)
|
||||
{ clip.GetActorAddon("dildo").layer = sexToyLayer.options[sexToyLayer.value].text; }
|
||||
{ clip.GetActorAddon("dildo").Layer = sexToyLayer.options[sexToyLayer.value].text; }
|
||||
|
||||
//Initialize();
|
||||
}
|
||||
|
||||
public void OnAnchoringPawnChanged()
|
||||
{
|
||||
PawnAnimationClip clip = Workspace.animationDef.animationStages[Workspace.stageID].animationClips[Workspace.actorID];
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip?.GetActorAddon("left hand") != null)
|
||||
{
|
||||
int i = int.Parse(handLeftAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("left hand").anchoringActor = i;
|
||||
clip.GetActorAddon("left hand").AnchoringActor = i;
|
||||
handLeftAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
|
@ -194,9 +194,9 @@ namespace RimWorldAnimationStudio
|
|||
int i = int.Parse(handRightAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("right hand").anchoringActor = i;
|
||||
clip.GetActorAddon("right hand").AnchoringActor = i;
|
||||
handRightAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
|
||||
|
@ -205,9 +205,9 @@ namespace RimWorldAnimationStudio
|
|||
int i = int.Parse(sexToyAnchoringPawn.text);
|
||||
|
||||
if (i < 0) { i = clip.GetOwningActorID(); }
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.actors.Count - 1);
|
||||
i = Mathf.Clamp(i, 0, Workspace.animationDef.Actors.Count - 1);
|
||||
|
||||
clip.GetActorAddon("dildo").anchoringActor = i;
|
||||
clip.GetActorAddon("dildo").AnchoringActor = i;
|
||||
sexToyAnchoringPawn.SetTextWithoutNotify(i.ToString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,23 +17,23 @@ namespace RimWorldAnimationStudio
|
|||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
for (int i = 0; i < Tags.actorLayers.Count; i++)
|
||||
for (int i = 0; i < DefaultTags.actorLayers.Count; i++)
|
||||
{
|
||||
string actorLayer = Tags.actorLayers[i];
|
||||
string actorLayer = DefaultTags.actorLayers[i];
|
||||
|
||||
Transform _optionToggle = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionToggle.Find("Text").GetComponent<Text>().text = actorLayer;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.Instance.GetCurrentPawnAnimationClip().layer == actorLayer;
|
||||
toggleComp.isOn = Workspace.GetCurrentPawnAnimationClip().Layer == actorLayer;
|
||||
toggleComp.onValueChanged.AddListener(delegate {
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip != null)
|
||||
{ clip.layer = actorLayer; }
|
||||
{ clip.Layer = actorLayer; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor layer set");
|
||||
Workspace.RecordEvent("Actor layer set");
|
||||
});
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class SelectAnimationDialog : DialogBox
|
||||
{
|
||||
public void Initialize(Defs defs)
|
||||
public void Initialize(AnimationDefs defs)
|
||||
{
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
@ -20,7 +20,7 @@ namespace RimWorldAnimationStudio
|
|||
AnimationDef animationDef = defs.animationDefs[i];
|
||||
|
||||
Transform _optionButton = AddCloneObjectToParent(contentWindow).transform;
|
||||
_optionButton.Find("Text").GetComponent<Text>().text = animationDef.defName;
|
||||
_optionButton.Find("Text").GetComponent<Text>().text = animationDef.DefName;
|
||||
|
||||
Button buttonComp = _optionButton.GetComponent<Button>();
|
||||
buttonComp.onClick.AddListener(delegate { Pop(); ApplicationManager.Instance.LoadAnimation(animationDef); });
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.bodyDefTypes.Concat(CustomTags.bodyDefTypes);
|
||||
IEnumerable<string> allTags = DefaultTags.bodyDefTypes.Concat(CustomTags.bodyDefTypes);
|
||||
string placeHolderText = "Enter new body def type...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
Actor actor = Workspace.animationDef.Actors[Workspace.ActorID];
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
|
@ -27,16 +27,16 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.bodyDefTypes.Contains(tag);
|
||||
toggleComp.isOn = actor.BodyDefTypes.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.bodyDefTypes.Contains(tag) == false)
|
||||
{ actor.bodyDefTypes.Add(tag); }
|
||||
if (toggleComp.isOn && actor.BodyDefTypes.Contains(tag) == false)
|
||||
{ actor.BodyDefTypes.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.bodyDefTypes.Contains(tag))
|
||||
{ actor.bodyDefTypes.Remove(tag); }
|
||||
else if (toggleComp.isOn == false && actor.BodyDefTypes.Contains(tag))
|
||||
{ actor.BodyDefTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor bodyDef type");
|
||||
Workspace.RecordEvent("Actor bodyDef type");
|
||||
});
|
||||
|
||||
if (CustomTags.bodyDefTypes.Contains(tag))
|
||||
|
@ -54,7 +54,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.bodyDefTypes, ref CustomTags.bodyDefTypes); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref DefaultTags.bodyDefTypes, ref CustomTags.bodyDefTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.bodyParts.Concat(CustomTags.bodyParts);
|
||||
IEnumerable<string> allTags = DefaultTags.bodyParts.Concat(CustomTags.bodyParts);
|
||||
string placeHolderText = "Enter new body part name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
Actor actor = Workspace.animationDef.Actors[Workspace.ActorID];
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
|
@ -23,15 +23,15 @@ namespace RimWorldAnimationStudio
|
|||
_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");});
|
||||
appendageToggleComp.isOn = actor.IsFucking;
|
||||
appendageToggleComp.onValueChanged.AddListener(delegate { actor.IsFucking = appendageToggleComp.isOn; Workspace.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"); });
|
||||
orificeToggleComp.isOn = actor.IsFucked;
|
||||
orificeToggleComp.onValueChanged.AddListener(delegate { actor.IsFucked = orificeToggleComp.isOn; Workspace.RecordEvent("Actor required body part"); });
|
||||
|
||||
for (int i = 0; i < allTags.Count(); i++)
|
||||
{
|
||||
|
@ -41,16 +41,16 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.requiredGenitals.Contains(tag);
|
||||
toggleComp.isOn = actor.RequiredGenitals.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.requiredGenitals.Contains(tag) == false)
|
||||
{ actor.requiredGenitals.Add(tag); }
|
||||
if (toggleComp.isOn && actor.RequiredGenitals.Contains(tag) == false)
|
||||
{ actor.RequiredGenitals.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && actor.requiredGenitals.Contains(tag))
|
||||
{ actor.requiredGenitals.Remove(tag); }
|
||||
else if (toggleComp.isOn == false && actor.RequiredGenitals.Contains(tag))
|
||||
{ actor.RequiredGenitals.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor required body part");
|
||||
Workspace.RecordEvent("Actor required body part");
|
||||
});
|
||||
|
||||
if (CustomTags.bodyParts.Contains(tag))
|
||||
|
@ -68,7 +68,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.bodyParts, ref CustomTags.bodyParts); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref DefaultTags.bodyParts, ref CustomTags.bodyParts); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -12,10 +12,10 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.defNames);
|
||||
IEnumerable<string> allTags = DefaultTags.defNames.Concat(CustomTags.defNames);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
Actor actor = Workspace.animationDef.Actors[Workspace.ActorID];
|
||||
Transform contentWindow = transform.FindDeepChild("Content");
|
||||
Reset();
|
||||
|
||||
|
@ -27,16 +27,16 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = actor.defNames.Contains(tag);
|
||||
toggleComp.isOn = actor.DefNames.Contains(tag);
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
if (toggleComp.isOn && actor.defNames.Contains(tag) == false)
|
||||
{ actor.defNames.Add(tag); }
|
||||
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); }
|
||||
else if (toggleComp.isOn == false && actor.DefNames.Contains(tag))
|
||||
{ actor.DefNames.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
Workspace.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (CustomTags.defNames.Contains(tag))
|
||||
|
@ -56,7 +56,7 @@ namespace RimWorldAnimationStudio
|
|||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate
|
||||
{
|
||||
AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames);
|
||||
AddCustomTag(fieldComp, ref DefaultTags.defNames, ref CustomTags.defNames);
|
||||
AddCustomRace(fieldComp);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.interactionDefTypes.Concat(CustomTags.interactionDefTypes);
|
||||
IEnumerable<string> allTags = DefaultTags.interactionDefTypes.Concat(CustomTags.interactionDefTypes);
|
||||
string placeHolderText = "Enter new interaction def type...";
|
||||
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
@ -28,16 +28,16 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.animationDef.interactionDefTypes.Contains(tag);
|
||||
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); }
|
||||
if (toggleComp.isOn && Workspace.animationDef.InteractionDefTypes.Contains(tag) == false)
|
||||
{ Workspace.animationDef.InteractionDefTypes.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.interactionDefTypes.Contains(tag))
|
||||
{ Workspace.animationDef.interactionDefTypes.Remove(tag); }
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.InteractionDefTypes.Contains(tag))
|
||||
{ Workspace.animationDef.InteractionDefTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Animation InteractionDef");
|
||||
Workspace.RecordEvent("Animation InteractionDef");
|
||||
});
|
||||
|
||||
if (CustomTags.interactionDefTypes.Contains(tag))
|
||||
|
@ -55,7 +55,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.interactionDefTypes, ref CustomTags.interactionDefTypes); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref DefaultTags.interactionDefTypes, ref CustomTags.interactionDefTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.sexTypes.Concat(CustomTags.sexTypes);
|
||||
IEnumerable<string> allTags = DefaultTags.sexTypes.Concat(CustomTags.sexTypes);
|
||||
string placeHolderText = "Enter new sex type...";
|
||||
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
@ -28,16 +28,16 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.animationDef.sexTypes.Contains(tag);
|
||||
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); }
|
||||
if (toggleComp.isOn && Workspace.animationDef.SexTypes.Contains(tag) == false)
|
||||
{ Workspace.animationDef.SexTypes.Add(tag); }
|
||||
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.sexTypes.Contains(tag))
|
||||
{ Workspace.animationDef.sexTypes.Remove(tag); }
|
||||
else if (toggleComp.isOn == false && Workspace.animationDef.SexTypes.Contains(tag))
|
||||
{ Workspace.animationDef.SexTypes.Remove(tag); }
|
||||
|
||||
Workspace.Instance.RecordEvent("Animation sex type");
|
||||
Workspace.RecordEvent("Animation sex type");
|
||||
});
|
||||
|
||||
if (CustomTags.sexTypes.Contains(tag))
|
||||
|
@ -55,7 +55,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.sexTypes, ref CustomTags.sexTypes); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref DefaultTags.sexTypes, ref CustomTags.sexTypes); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = Tags.soundDefs.Concat(CustomTags.soundDefs);
|
||||
IEnumerable<string> allTags = DefaultTags.soundDefs.Concat(CustomTags.soundDefs);
|
||||
string placeHolderText = "Enter new sound def...";
|
||||
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
@ -28,15 +28,15 @@ namespace RimWorldAnimationStudio
|
|||
_optionToggle.Find("Text").GetComponent<Text>().text = tag;
|
||||
|
||||
Toggle toggleComp = _optionToggle.GetComponent<Toggle>();
|
||||
toggleComp.isOn = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID)?.soundEffect == tag;
|
||||
toggleComp.isOn = Workspace.GetCurrentOrPreviousKeyframe(Workspace.ActorID)?.SoundEffect == tag;
|
||||
toggleComp.onValueChanged.AddListener(delegate
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentOrPreviousKeyframe(Workspace.ActorID);
|
||||
|
||||
if (keyframe != null)
|
||||
{ keyframe.soundEffect = tag; }
|
||||
{ keyframe.SoundEffect = tag; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe sound effect");
|
||||
Workspace.RecordEvent("Keyframe sound effect");
|
||||
});
|
||||
|
||||
if (CustomTags.soundDefs.Contains(tag))
|
||||
|
@ -56,7 +56,7 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref Tags.soundDefs, ref CustomTags.soundDefs); });
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomTag(fieldComp, ref DefaultTags.soundDefs, ref CustomTags.soundDefs); });
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -28,19 +28,19 @@ namespace RimWorldAnimationStudio
|
|||
private int dragTickStart = -1;
|
||||
|
||||
public KeyframeSlider linkedSlider;
|
||||
public Keyframe pivotKeyframe;
|
||||
public PawnKeyframe pivotKeyframe;
|
||||
public int linkedOffset;
|
||||
|
||||
public void Initialize(AnimationTimeline timeline, int actorID, int keyframeID)
|
||||
{
|
||||
this.timeline = timeline;
|
||||
this.clip = Workspace.Instance.GetPawnAnimationClip(actorID);
|
||||
this.keyframe = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID);
|
||||
this.clip = Workspace.GetPawnAnimationClip(actorID);
|
||||
this.keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
|
||||
|
||||
this.actorID = actorID;
|
||||
this.keyframeID = keyframeID;
|
||||
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID);
|
||||
PawnKeyframe keyframe = Workspace.GetPawnKeyframe(actorID, keyframeID);
|
||||
maxValue = Workspace.StageWindowSize;
|
||||
value = keyframe.atTick.Value;
|
||||
|
||||
|
@ -85,7 +85,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public int GetGhostFramesRequired()
|
||||
{
|
||||
if (Workspace.animationDef.animationStages[Workspace.stageID].isLooping == false)
|
||||
if (Workspace.animationDef.AnimationStages[Workspace.StageID].IsLooping == false)
|
||||
{ return 0; }
|
||||
|
||||
if (clip.duration <= 1)
|
||||
|
@ -96,7 +96,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.ActorID = actorID;
|
||||
|
||||
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand))
|
||||
{ Workspace.keyframeID.Add(keyframeID); }
|
||||
|
@ -105,19 +105,19 @@ namespace RimWorldAnimationStudio
|
|||
{ Workspace.keyframeID = new List<int> { keyframeID }; }
|
||||
|
||||
if (eventData.clickCount >= 2)
|
||||
{ AnimationController.Instance.stageTick = keyframe.atTick.Value; }
|
||||
{ Workspace.StageTick = keyframe.atTick.Value; }
|
||||
}
|
||||
|
||||
public void OnBeginDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.ActorID = actorID;
|
||||
dragTimeStart = Time.unscaledTime;
|
||||
dragTickStart = keyframe.atTick.Value;
|
||||
|
||||
if (Workspace.keyframeID.NullOrEmpty() || Workspace.keyframeID.Contains(keyframeID) == false)
|
||||
{ Workspace.keyframeID = new List<int> { keyframeID }; }
|
||||
|
||||
List<PawnKeyframe> selectedKeyframes = Workspace.Instance.GetPawnKeyframesByID(Workspace.keyframeID).Except(new List<PawnKeyframe>() { keyframe })?.ToList();
|
||||
List<PawnKeyframe> selectedKeyframes = Workspace.GetPawnKeyframesByID(Workspace.keyframeID).Except(new List<PawnKeyframe>() { keyframe })?.ToList();
|
||||
|
||||
// Link other slected keyframes to the movement of this one
|
||||
if (selectedKeyframes.NotNullOrEmpty())
|
||||
|
@ -143,7 +143,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public override void OnDrag(PointerEventData eventData)
|
||||
{
|
||||
Workspace.actorID = actorID;
|
||||
Workspace.ActorID = actorID;
|
||||
|
||||
// The first keyframe can't be moved
|
||||
if (keyframe.atTick == Constants.minTick)
|
||||
|
@ -157,7 +157,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
// Snap to nearest keyframe (on another timeline)
|
||||
int targetTick = Workspace.FindClosestKeyFrameAtTick(keyframe.atTick.Value, Mathf.CeilToInt(Workspace.StageWindowSize * 0.01f), actorID);
|
||||
if (Input.GetKey(KeyCode.LeftShift) && Workspace.Instance.DoesPawnKeyframeExistAtTick(Workspace.stageID, actorID, targetTick) == false)
|
||||
if (Input.GetKey(KeyCode.LeftShift) && Workspace.DoesPawnKeyframeExistAtTick(Workspace.StageID, actorID, targetTick) == false)
|
||||
{ value = (float)targetTick; }
|
||||
|
||||
// Prevent other frames from being moved to the first keyframe
|
||||
|
@ -170,13 +170,13 @@ namespace RimWorldAnimationStudio
|
|||
if (keyframe.atTick == Constants.minTick)
|
||||
{ value = Constants.minTick; return; }
|
||||
|
||||
List<PawnKeyframe> keyframesToCheck = Workspace.Instance.GetPawnKeyframesAtTick(actorID, keyframe.atTick.Value);
|
||||
List<PawnKeyframe> keyframesToCheck = Workspace.GetAllPawnKeyframesAtTick(actorID, keyframe.atTick.Value);
|
||||
if (keyframesToCheck.NotNullOrEmpty())
|
||||
{
|
||||
foreach (PawnKeyframe _keyframe in keyframesToCheck)
|
||||
{
|
||||
if (_keyframe != keyframe)
|
||||
{ AnimationController.Instance.RemovePawnKeyframe(actorID, _keyframe.keyframeID); }
|
||||
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,14 +189,14 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (linkedSlider.linkedSlider != null)
|
||||
{
|
||||
keyframesToCheck = Workspace.Instance.GetPawnKeyframesAtTick(actorID, linkedKeyframe.atTick.Value);
|
||||
keyframesToCheck = Workspace.GetAllPawnKeyframesAtTick(actorID, linkedKeyframe.atTick.Value);
|
||||
|
||||
if (keyframesToCheck.NotNullOrEmpty() && keyframesToCheck.Count > 1)
|
||||
{
|
||||
foreach (PawnKeyframe _keyframe in keyframesToCheck)
|
||||
{
|
||||
if (_keyframe.keyframeID != linkedKeyframe.keyframeID)
|
||||
{ AnimationController.Instance.RemovePawnKeyframe(actorID, _keyframe.keyframeID); Debug.Log("delete"); }
|
||||
{ Workspace.GetCurrentPawnAnimationClip().RemovePawnKeyframe(actorID, _keyframe.keyframeID); Debug.Log("delete"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
interactable = false;
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe move");
|
||||
Workspace.RecordEvent("Keyframe move");
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
@ -229,20 +229,20 @@ namespace RimWorldAnimationStudio
|
|||
{ value = keyframe.atTick.Value; }
|
||||
|
||||
// Update key color
|
||||
if (keyframe.atTick.HasValue && Workspace.keyframeID.Contains(keyframeID) && AnimationController.Instance.stageTick == keyframe.atTick.Value)
|
||||
if (keyframe.atTick.HasValue && Workspace.keyframeID.Contains(keyframeID) && Workspace.StageTick == keyframe.atTick.Value)
|
||||
{ handleImage.color = Constants.ColorPurple; }
|
||||
|
||||
else if (Workspace.keyframeID.Contains(keyframeID))
|
||||
{ handleImage.color = Constants.ColorCyan; }
|
||||
|
||||
else if (AnimationController.Instance.stageTick == keyframe.atTick.Value)
|
||||
else if (Workspace.StageTick == keyframe.atTick.Value)
|
||||
{ handleImage.color = Constants.ColorPink; }
|
||||
|
||||
else
|
||||
{ handleImage.color = Constants.ColorGrey; }
|
||||
|
||||
// Show sound symbol
|
||||
string soundDef = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID)?.soundEffect;
|
||||
string soundDef = Workspace.GetPawnKeyframe(actorID, keyframeID)?.SoundEffect;
|
||||
soundIcon.SetActive(soundDef != null && soundDef != "" && soundDef != "None");
|
||||
}
|
||||
|
||||
|
@ -253,7 +253,7 @@ namespace RimWorldAnimationStudio
|
|||
return (float)(keyframe.atTick.Value - pivotKeyframe.atTick.Value) / (dragTickStart - pivotKeyframe.atTick.Value);
|
||||
}
|
||||
|
||||
public bool IsPivotKeyframe(Keyframe otherKeyframe)
|
||||
public bool IsPivotKeyframe(PawnKeyframe otherKeyframe)
|
||||
{
|
||||
return pivotKeyframe == otherKeyframe;
|
||||
}
|
||||
|
|
|
@ -9,18 +9,18 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public void Update()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
|
||||
GetComponent<Toggle>().isOn = keyframe != null && keyframe.quiver.HasValue && keyframe.quiver.Value;
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentOrPreviousKeyframe(Workspace.ActorID);
|
||||
GetComponent<Toggle>().isOn = keyframe != null && keyframe.Quiver;
|
||||
}
|
||||
|
||||
public void OnValueChanged()
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetCurrentOrPreviousKeyframe(Workspace.actorID);
|
||||
PawnKeyframe keyframe = Workspace.GetCurrentOrPreviousKeyframe(Workspace.ActorID);
|
||||
|
||||
if (keyframe != null)
|
||||
{ keyframe.quiver = GetComponent<Toggle>().isOn; }
|
||||
{ keyframe.Quiver = GetComponent<Toggle>().isOn; }
|
||||
|
||||
Workspace.Instance.RecordEvent("Actor quiver");
|
||||
Workspace.RecordEvent("Actor quiver");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
PawnAnimationClip clip = Workspace.Instance.GetCurrentPawnAnimationClip();
|
||||
PawnAnimationClip clip = Workspace.GetCurrentPawnAnimationClip();
|
||||
|
||||
if (clip != null)
|
||||
{ text.text = clip.layer; }
|
||||
{ text.text = clip.Layer; }
|
||||
|
||||
else
|
||||
{ text.text = "Pawn"; }
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SelectRaceDropdown : MonoBehaviour
|
||||
{
|
||||
private Dropdown dropdown;
|
||||
private Text label;
|
||||
|
||||
private int actorID = -1;
|
||||
private int hashcode = -1;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
dropdown = GetComponent<Dropdown>();
|
||||
label = transform.Find("Label").GetComponent<Text>();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
//if (Workspace.animationDef == null) return;
|
||||
|
||||
//if (actorID != Workspace.actorID || hashcode != CustomTags.defNames.GetHashCode())
|
||||
//{ UpdateDropdown(); }
|
||||
|
||||
if (hashcode != CustomTags.defNames.GetHashCode())
|
||||
{ UpdateDropdown(); }
|
||||
}
|
||||
|
||||
public void UpdateDropdown()
|
||||
{
|
||||
if (dropdown == null)
|
||||
{ OnEnable(); }
|
||||
|
||||
dropdown.ClearOptions();
|
||||
|
||||
/*string alienRaceDefName = Workspace.animationDef.actors[Workspace.actorID].GetAlienRaceDef().defName;
|
||||
|
||||
dropdown.ClearOptions();
|
||||
dropdown.options.Add(new Dropdown.OptionData(alienRaceDefName));*/
|
||||
|
||||
IEnumerable<string> optionsList = Tags.defNames.Concat(CustomTags.defNames);
|
||||
foreach (string defName in optionsList)
|
||||
{
|
||||
//if (defName != alienRaceDefName)
|
||||
//{ dropdown.options.Add(new Dropdown.OptionData(defName)); }
|
||||
|
||||
dropdown.options.Add(new Dropdown.OptionData(defName));
|
||||
}
|
||||
|
||||
dropdown.value = 0;
|
||||
label.text = dropdown.options[0].text;
|
||||
|
||||
//actorID = Workspace.actorID;
|
||||
hashcode = CustomTags.defNames.GetHashCode();
|
||||
}
|
||||
|
||||
public void UpdateActorRace()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
Workspace.animationDef.actors[Workspace.actorID].SetAlienRaceDef(label.text);
|
||||
Workspace.selectedBodyPart = null;
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Scripts/GUI/SelfContained.meta
Normal file
8
Assets/Scripts/GUI/SelfContained.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 96cc86ae315a7c34c91b9af2499fa23c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
22
Assets/Scripts/GUI/SelfContained/ButtonWithKeyCode.cs
Normal file
22
Assets/Scripts/GUI/SelfContained/ButtonWithKeyCode.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class ButtonWithKeyCode : Button
|
||||
{
|
||||
public KeyCode keyCode;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(keyCode))
|
||||
{ onClick.Invoke(); }
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0ba5b69d448f9434ca7d74d4022f3dcd
|
||||
guid: 1bfc022fc38c6474db2a742159e458f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
24
Assets/Scripts/GUI/SelfContained/Chaser.cs
Normal file
24
Assets/Scripts/GUI/SelfContained/Chaser.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class Chaser : MonoBehaviour
|
||||
{
|
||||
public GameObject target;
|
||||
public bool chaseAlongX = true;
|
||||
public bool chaseAlongY = false;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (target == null)
|
||||
{ return; }
|
||||
|
||||
float x = chaseAlongX ? target.transform.position.x : transform.position.x;
|
||||
float y = chaseAlongY ? target.transform.position.y : transform.position.y;
|
||||
|
||||
transform.position = new Vector3(x, y, 0f);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/SelfContained/Chaser.cs.meta
Normal file
11
Assets/Scripts/GUI/SelfContained/Chaser.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9584d659e560b88409843604ae04229b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/GUI/SexProps.meta
Normal file
8
Assets/Scripts/GUI/SexProps.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9171c89c691f71d4eb37426db074efc8
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
12
Assets/Scripts/GUI/SexProps/SexProp.cs
Normal file
12
Assets/Scripts/GUI/SexProps/SexProp.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
[Serializable]
|
||||
public class SexProp
|
||||
{
|
||||
public string label;
|
||||
public Sprite sprite;
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/SexProps/SexProp.cs.meta
Normal file
11
Assets/Scripts/GUI/SexProps/SexProp.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 94f6b7ad49adabe428c011abfcf4da53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
28
Assets/Scripts/GUI/SexProps/SexPropManager.cs
Normal file
28
Assets/Scripts/GUI/SexProps/SexPropManager.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class SexPropManager : MonoBehaviour
|
||||
{
|
||||
public List<SexProp> sexProps = new List<SexProp>();
|
||||
public Dropdown sexPropDropdown;
|
||||
|
||||
private SpriteRenderer spriteRenderer;
|
||||
|
||||
public void OnEnable()
|
||||
{
|
||||
spriteRenderer = GetComponent<SpriteRenderer>();
|
||||
|
||||
foreach (SexProp sexProp in sexProps)
|
||||
{ sexPropDropdown.options.Add(new Dropdown.OptionData(sexProp.label)); }
|
||||
}
|
||||
|
||||
public void OnOptionChanged()
|
||||
{
|
||||
spriteRenderer.sprite = sexProps[sexPropDropdown.value].sprite;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/SexProps/SexPropManager.cs.meta
Normal file
11
Assets/Scripts/GUI/SexProps/SexPropManager.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 587f7397b0c3ecf4495edb8af5dbd777
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -1,74 +0,0 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class StageCard : MonoBehaviour, IPointerClickHandler
|
||||
{
|
||||
private Text stageName;
|
||||
private InputField stageNameField;
|
||||
private Image banner;
|
||||
|
||||
public void OnNameChange()
|
||||
{
|
||||
stageName.text = stageNameField.text;
|
||||
stageNameField.gameObject.SetActive(false);
|
||||
|
||||
Workspace.animationDef.animationStages[Workspace.stageID].stageName = stageName.text;
|
||||
|
||||
Workspace.Instance.RecordEvent("Stage renamed");
|
||||
}
|
||||
|
||||
public void OnMoveStage(int delta)
|
||||
{
|
||||
if (StageCardManager.Instance.MoveAnimationStage(transform.GetSiblingIndex(), 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 = transform.Find("StageName").GetComponent<Text>();
|
||||
this.stageNameField = transform.Find("StageNameField").GetComponent<InputField>();
|
||||
this.banner = transform.Find("Banner").GetComponent<Image>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.clickCount >= 2)
|
||||
{
|
||||
stageNameField.text = stageName.text;
|
||||
stageNameField.gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
if (Workspace.stageID != transform.GetSiblingIndex())
|
||||
{
|
||||
AnimationController.Instance.stageTick = Constants.minTick;
|
||||
Workspace.Instance.RecordEvent("Stage selected");
|
||||
}
|
||||
|
||||
Workspace.stageID = transform.GetSiblingIndex();
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Scripts/GUI/Tooltips.meta
Normal file
8
Assets/Scripts/GUI/Tooltips.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3b338b9ecc1c2584d82563578794ad43
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -17,15 +17,15 @@ namespace RimWorldAnimationStudio
|
|||
public Vector2 offset = new Vector2(5f, -15f);
|
||||
public bool flipX = false;
|
||||
|
||||
private GameObject tooltip;
|
||||
private Text tooltipText;
|
||||
public GameObject tooltip;
|
||||
public Text tooltipText;
|
||||
private bool isActive;
|
||||
private bool isDisplayed;
|
||||
private float activeTime = -1f;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
tooltip = Workspace.Instance.transform.Find("TooltipMessage")?.gameObject;
|
||||
tooltip = Resources.FindObjectsOfTypeAll<TooltipMessage>()?.FirstOrDefault().gameObject;
|
||||
tooltipText = tooltip?.GetComponentInChildren<Text>();
|
||||
}
|
||||
|
||||
|
@ -68,15 +68,5 @@ namespace RimWorldAnimationStudio
|
|||
isDisplayed = false;
|
||||
tooltip.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputVertical()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
8
Assets/Scripts/GUI/Tooltips/TooltipMessage.cs
Normal file
8
Assets/Scripts/GUI/Tooltips/TooltipMessage.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class TooltipMessage : MonoBehaviour
|
||||
{
|
||||
|
||||
}
|
11
Assets/Scripts/GUI/Tooltips/TooltipMessage.cs.meta
Normal file
11
Assets/Scripts/GUI/Tooltips/TooltipMessage.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ec8ec1002bf0dda4aa55bfb75b152066
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue