mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
UI 2.0
This commit is contained in:
parent
c3c0a05ac0
commit
3d859555ad
324 changed files with 13886 additions and 7446 deletions
|
@ -10,7 +10,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public string defName = "Undefined";
|
||||
public string label = "Undefined";
|
||||
public bool sounds = false;
|
||||
public bool sounds = true;
|
||||
|
||||
[XmlArray("sexTypes"), XmlArrayItem("li")] public List<string> sexTypes = new List<string>();
|
||||
[XmlArray("interactionDefTypes"), XmlArrayItem("li")] public List<string> interactionDefTypes = new List<string>();
|
||||
|
|
22
Assets/Scripts/ButtonWithKeyCode.cs
Normal file
22
Assets/Scripts/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(); }
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/ButtonWithKeyCode.cs.meta
Normal file
11
Assets/Scripts/ButtonWithKeyCode.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1bfc022fc38c6474db2a742159e458f4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
32
Assets/Scripts/DropdownMenu.cs
Normal file
32
Assets/Scripts/DropdownMenu.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
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 DropdownMenu : MonoBehaviour, IDeselectHandler
|
||||
{
|
||||
public Transform dropdownMenu;
|
||||
|
||||
public void OpenMenu()
|
||||
{
|
||||
dropdownMenu.gameObject.SetActive(true);
|
||||
EventSystem.current.SetSelectedGameObject(this.gameObject);
|
||||
}
|
||||
|
||||
public void CloseMenu()
|
||||
{
|
||||
dropdownMenu.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void OnDeselect(BaseEventData eventData)
|
||||
{
|
||||
Invoke("CloseMenu", 0.15f);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/DropdownMenu.cs.meta
Normal file
11
Assets/Scripts/DropdownMenu.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7367efff96a6a9043ac1c6b3a25dcc39
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -23,7 +23,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (clip == null || clip.keyframes.NullOrEmpty())
|
||||
{
|
||||
Debug.Log("Clip was empty");
|
||||
//Debug.Log("Clip was empty");
|
||||
|
||||
clip = new PawnAnimationClip();
|
||||
clip.keyframes.Add(new PawnKeyframe());
|
||||
|
@ -61,7 +61,7 @@ namespace RimWorldAnimationStudio
|
|||
{ GetComponent<Image>().color = Constants.ColorGoldYellow; }
|
||||
|
||||
else
|
||||
{ GetComponent<Image>().color = Constants.ColorGrey; }
|
||||
{ GetComponent<Image>().color = Constants.ColorMidGrey; }
|
||||
}
|
||||
|
||||
public void InitiateUpdateOfGhostFrames()
|
||||
|
|
|
@ -45,8 +45,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
if (type == LogType.Warning)
|
||||
{
|
||||
currentMessage.color = Constants.ColorOrange;
|
||||
logMessage.color = Constants.ColorOrange;
|
||||
currentMessage.color = Constants.ColorRichOrange;
|
||||
logMessage.color = Constants.ColorRichOrange;
|
||||
}
|
||||
|
||||
else if (type == LogType.Exception || type == LogType.Error)
|
||||
|
|
|
@ -50,10 +50,17 @@ namespace RimWorldAnimationStudio
|
|||
customTags.Add(field.text);
|
||||
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
public void RemoveCustomTag(ref List<string> customTags, string tag)
|
||||
{
|
||||
customTags.Remove(tag);
|
||||
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
public void AddCustomRace(InputField field)
|
||||
{
|
||||
if (field?.text == null || field.text == "")
|
||||
|
@ -62,7 +69,6 @@ namespace RimWorldAnimationStudio
|
|||
AlienRaceDefs.AddDef(new AlienRaceDef(field.text));
|
||||
|
||||
ApplicationManager.Instance.SaveAlienRaceDefs();
|
||||
|
||||
Initialize(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
Debug.Log("Init");
|
||||
|
||||
Reset();
|
||||
|
||||
AlienRaceDef alienRaceDef = GetCurrentRaceDef();
|
||||
|
|
|
@ -39,6 +39,13 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Actor bodyDef type");
|
||||
});
|
||||
|
||||
if (CustomTags.bodyDefTypes.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.bodyDefTypes, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
|
|
@ -53,6 +53,13 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Actor required body part");
|
||||
});
|
||||
|
||||
if (CustomTags.bodyParts.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.bodyParts, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public override void Initialize(bool addedNewTag = false)
|
||||
{
|
||||
IEnumerable<string> allTags = AlienRaceDefs.allDefs.Select(x => x.defName);
|
||||
IEnumerable<string> allTags = Tags.defNames.Concat(CustomTags.defNames);
|
||||
string placeHolderText = "Enter new def name...";
|
||||
|
||||
Actor actor = Workspace.animationDef.actors[Workspace.actorID];
|
||||
|
@ -39,6 +39,13 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Actor def name");
|
||||
});
|
||||
|
||||
if (CustomTags.defNames.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.defNames, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
@ -47,7 +54,11 @@ namespace RimWorldAnimationStudio
|
|||
_optionField.Find("Placeholder").GetComponent<Text>().text = placeHolderText;
|
||||
|
||||
InputField fieldComp = _optionField.GetComponent<InputField>();
|
||||
fieldComp.onEndEdit.AddListener(delegate { AddCustomRace(fieldComp); });
|
||||
fieldComp.onEndEdit.AddListener(delegate
|
||||
{
|
||||
AddCustomTag(fieldComp, ref Tags.defNames, ref CustomTags.defNames);
|
||||
AddCustomRace(fieldComp);
|
||||
});
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
|
|
@ -40,16 +40,11 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Animation InteractionDef");
|
||||
});
|
||||
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
if (deleteButton != null && CustomTags.interactionDefTypes.Contains(tag))
|
||||
if (CustomTags.interactionDefTypes.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate
|
||||
{
|
||||
CustomTags.interactionDefTypes.Remove(tag);
|
||||
ApplicationManager.Instance.SaveCustomArrays();
|
||||
Initialize();
|
||||
});
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.interactionDefTypes, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
|
|
|
@ -40,6 +40,13 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Animation sex type");
|
||||
});
|
||||
|
||||
if (CustomTags.sexTypes.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.sexTypes, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
}
|
||||
|
|
|
@ -39,10 +39,17 @@ namespace RimWorldAnimationStudio
|
|||
Workspace.Instance.RecordEvent("Keyframe sound effect");
|
||||
});
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
if (CustomTags.soundDefs.Contains(tag))
|
||||
{
|
||||
Button deleteButton = _optionToggle.Find("DeleteButton").GetComponent<Button>();
|
||||
deleteButton.gameObject.SetActive(true);
|
||||
deleteButton.onClick.AddListener(delegate { RemoveCustomTag(ref CustomTags.soundDefs, tag); });
|
||||
}
|
||||
|
||||
if (addedNewTag && i == allTags.Count() - 1)
|
||||
{ toggleComp.isOn = true; }
|
||||
|
||||
toggleComp.group = contentWindow.GetComponent<ToggleGroup>();
|
||||
}
|
||||
|
||||
Transform _optionField = AddCloneObjectToParent(contentWindow, 1).transform;
|
||||
|
|
23
Assets/Scripts/GUI/KeybindLabel.cs
Normal file
23
Assets/Scripts/GUI/KeybindLabel.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
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 KeybindLabel : MonoBehaviour
|
||||
{
|
||||
public string command;
|
||||
|
||||
private Text keybindLabel;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
keybindLabel = GetComponent<Text>();
|
||||
keybindLabel.text = KeybindConfig.Instance.GetKeybindLabel(command);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/GUI/KeybindLabel.cs.meta
Normal file
11
Assets/Scripts/GUI/KeybindLabel.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2aa5d5fba80ba8346882964ef3756de3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -164,7 +164,7 @@ namespace RimWorldAnimationStudio
|
|||
{ handleImage.color = Constants.ColorPink; }
|
||||
|
||||
else
|
||||
{ handleImage.color = Constants.ColorWhite; }
|
||||
{ handleImage.color = Constants.ColorGrey; }
|
||||
|
||||
string soundDef = Workspace.Instance.GetPawnKeyframe(actorID, keyframeID)?.soundEffect;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
|
@ -24,7 +24,7 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
if (actorID != Workspace.actorID || hashcode != AlienRaceDefs.allDefs.GetHashCode())
|
||||
if (actorID != Workspace.actorID || hashcode != CustomTags.defNames.GetHashCode())
|
||||
{ UpdateDropdown(); }
|
||||
}
|
||||
|
||||
|
@ -40,15 +40,15 @@ namespace RimWorldAnimationStudio
|
|||
dropdown.value = 0;
|
||||
label.text = alienRaceDefName;
|
||||
|
||||
List<AlienRaceDef> optionsList = AlienRaceDefs.allDefs;
|
||||
foreach (AlienRaceDef alienRaceDef in optionsList)
|
||||
IEnumerable<string> optionsList = Tags.defNames.Concat(CustomTags.defNames);
|
||||
foreach (string defName in optionsList)
|
||||
{
|
||||
if (alienRaceDef.defName != alienRaceDefName)
|
||||
{ dropdown.options.Add(new Dropdown.OptionData(alienRaceDef.defName)); }
|
||||
if (defName != alienRaceDefName)
|
||||
{ dropdown.options.Add(new Dropdown.OptionData(defName)); }
|
||||
}
|
||||
|
||||
actorID = Workspace.actorID;
|
||||
hashcode = AlienRaceDefs.allDefs.GetHashCode();
|
||||
hashcode = CustomTags.defNames.GetHashCode();
|
||||
}
|
||||
|
||||
public void UpdateActorRace()
|
||||
|
|
|
@ -63,7 +63,10 @@ namespace RimWorldAnimationStudio
|
|||
}
|
||||
|
||||
if (Workspace.stageID != transform.GetSiblingIndex())
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
{
|
||||
AnimationController.Instance.stageTick = 1;
|
||||
Workspace.Instance.RecordEvent("Stage selected");
|
||||
}
|
||||
|
||||
Workspace.stageID = transform.GetSiblingIndex();
|
||||
}
|
||||
|
|
34
Assets/Scripts/Keybind.cs
Normal file
34
Assets/Scripts/Keybind.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class Keybind
|
||||
{
|
||||
public string command;
|
||||
public bool requiresAnimationDef = true;
|
||||
public bool repeatable = false;
|
||||
public KeybindData win;
|
||||
public KeybindData mac;
|
||||
|
||||
[XmlIgnore] public List<KeyCode> keyModifiers { get { return GetKeybindData().keyModifiers; } }
|
||||
[XmlIgnore] public KeyCode keyCode { get { return GetKeybindData().keyCode; } }
|
||||
|
||||
private KeybindData GetKeybindData()
|
||||
{
|
||||
bool runningOSX = Application.platform == RuntimePlatform.OSXPlayer || Application.platform == RuntimePlatform.OSXEditor;
|
||||
return runningOSX ? mac : win;
|
||||
}
|
||||
}
|
||||
|
||||
public class KeybindData
|
||||
{
|
||||
[XmlArray("keyModifiers"), XmlArrayItem("li")] public List<KeyCode> keyModifiers = new List<KeyCode>();
|
||||
public KeyCode keyCode = KeyCode.None;
|
||||
}
|
||||
}
|
11
Assets/Scripts/Keybind.cs.meta
Normal file
11
Assets/Scripts/Keybind.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c58a5b7884732464c9e5c1e1b226e68a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
55
Assets/Scripts/KeybindConfig.cs
Normal file
55
Assets/Scripts/KeybindConfig.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public class KeybindConfig : Singleton<KeybindConfig>
|
||||
{
|
||||
private static List<Keybind> keybinds = new List<Keybind>();
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
string path = Path.Combine(Application.streamingAssetsPath, "keybindConfig.xml");
|
||||
|
||||
keybinds = XmlUtility.ReadXML<List<Keybind>>(path);
|
||||
}
|
||||
|
||||
public List<Keybind> GetAllKeybinds()
|
||||
{
|
||||
return keybinds;
|
||||
}
|
||||
|
||||
public string GetKeybindLabel(string command)
|
||||
{
|
||||
string label = "";
|
||||
Keybind keybind = keybinds.FirstOrDefault(x => x.command == command);
|
||||
|
||||
if (keybind == null) return label;
|
||||
|
||||
List<KeyCode> keyModifiers = keybind.keyModifiers;
|
||||
KeyCode keyCode = keybind.keyCode;
|
||||
|
||||
foreach (KeyCode modKeyCode in keyModifiers)
|
||||
{
|
||||
switch (modKeyCode)
|
||||
{
|
||||
case KeyCode.LeftShift: label += "Shift + "; break;
|
||||
case KeyCode.LeftControl: label += "Ctrl + "; break;
|
||||
case KeyCode.LeftAlt: label += "Alt + "; break;
|
||||
case KeyCode.LeftCommand: label += "Cmd + "; break;
|
||||
case KeyCode.RightShift: label += "Right shift + "; break;
|
||||
case KeyCode.RightControl: label += "Right ctrl + "; break;
|
||||
case KeyCode.RightAlt: label += "Right alt + "; break;
|
||||
case KeyCode.RightCommand: label += "Right cmd + "; break;
|
||||
}
|
||||
}
|
||||
|
||||
return label += keyCode.ToString();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/KeybindConfig.cs.meta
Normal file
11
Assets/Scripts/KeybindConfig.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7e87ce98f12877c4d932352535e01268
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -31,7 +31,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
[Header("Prefabs")]
|
||||
public ActorBody actorBodyPrefab;
|
||||
public AnimationTimeline animationTimelinePrefab;
|
||||
public GameObject animationTimelinePrefab;
|
||||
|
||||
// Private timing variables
|
||||
private int lastStageTick = 1;
|
||||
|
@ -57,6 +57,8 @@ namespace RimWorldAnimationStudio
|
|||
{ Initialize(); }
|
||||
|
||||
// Update tick if animating
|
||||
stageTick = Mathf.Clamp(stageTick, 1, Workspace.StageWindowSize);
|
||||
|
||||
if (isAnimating)
|
||||
{
|
||||
timeSinceLastUpdate += Time.deltaTime;
|
||||
|
@ -240,15 +242,12 @@ namespace RimWorldAnimationStudio
|
|||
ActorBody actorBody = Instantiate(actorBodyPrefab, actorBodies.transform);
|
||||
actorBody.Initialize(actorID);
|
||||
|
||||
AnimationTimeline animationTimeline = Instantiate(animationTimelinePrefab, animationTimelines);
|
||||
AnimationTimeline animationTimeline = Instantiate(animationTimelinePrefab, animationTimelines).GetComponentInChildren<AnimationTimeline>();
|
||||
animationTimeline.Initialize(actorID);
|
||||
}
|
||||
|
||||
animationClipLengthField.text = Workspace.StageWindowSize.ToString();
|
||||
animationClipTimeField.text = "1";
|
||||
stageTimelineSlider.maxValue = Workspace.StageWindowSize;
|
||||
stageTimelineSlider.value = 1;
|
||||
stageTick = 1;
|
||||
|
||||
isTimelineDirty = false;
|
||||
}
|
||||
|
@ -270,7 +269,7 @@ namespace RimWorldAnimationStudio
|
|||
{ Destroy(actorBody.gameObject); }
|
||||
|
||||
foreach (AnimationTimeline animationTimeline in animationTimelines.GetComponentsInChildren<AnimationTimeline>())
|
||||
{ Destroy(animationTimeline.gameObject); }
|
||||
{ Destroy(animationTimeline.transform.parent.gameObject); }
|
||||
}
|
||||
|
||||
public void AddActor()
|
||||
|
@ -412,6 +411,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
clip.BuildSimpleCurves();
|
||||
}
|
||||
|
||||
Workspace.Instance.RecordEvent("Keyframe pasted");
|
||||
}
|
||||
|
||||
public void RemovePawnKeyframe()
|
||||
|
|
|
@ -16,11 +16,6 @@ namespace RimWorldAnimationStudio
|
|||
public DialogBox newAnimationDialog;
|
||||
public SelectAnimationDialog selectAnimationDialog;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void TryToCloseApplication()
|
||||
{
|
||||
exitDialog.Pop();
|
||||
|
@ -39,14 +34,22 @@ namespace RimWorldAnimationStudio
|
|||
if (paths == null || paths.Any() == false)
|
||||
{ Debug.LogWarning("Selected file was null or invalid"); return; }
|
||||
|
||||
Defs defs = XmlUtility.ReadXML<Defs>(paths[0]);
|
||||
|
||||
Defs defs = null;
|
||||
|
||||
try
|
||||
{ defs = XmlUtility.ReadXML<Defs>(paths[0]); }
|
||||
|
||||
catch
|
||||
{ Debug.LogError("Could not read .xml file '" + paths[0] + "' - this file either uses a schema which is outdated, incorrect, or contains empty fields"); return; }
|
||||
|
||||
if (defs?.animationDefs == null)
|
||||
{ Debug.LogError("Selected file contains no animation data"); return; }
|
||||
|
||||
if (defs.animationDefs.Count == 1)
|
||||
{ LoadAnimation(defs.animationDefs[0]); return; }
|
||||
|
||||
Workspace.animationSavePath = paths[0];
|
||||
|
||||
selectAnimationDialog.Initialize(defs);
|
||||
selectAnimationDialog.Pop();
|
||||
}
|
||||
|
@ -80,10 +83,23 @@ namespace RimWorldAnimationStudio
|
|||
if (Workspace.animationDef == null)
|
||||
{ return; }
|
||||
|
||||
string path = Workspace.animationSavePath;
|
||||
|
||||
if (path != null && path != "" && File.Exists(path))
|
||||
{ SaveAnimation(path); }
|
||||
|
||||
else
|
||||
{ TryToSaveAnimationAs(); }
|
||||
}
|
||||
|
||||
public void TryToSaveAnimationAs()
|
||||
{
|
||||
if (Workspace.animationDef == null)
|
||||
{ return; }
|
||||
|
||||
string defName = Workspace.animationDef.defName != null && Workspace.animationDef.defName != "" ? Workspace.animationDef.defName : "newAnimationDef";
|
||||
|
||||
var path = StandaloneFileBrowser.SaveFilePanel("Save AnimationDef File", "", defName, "xml");
|
||||
|
||||
string path = StandaloneFileBrowser.SaveFilePanel("Save AnimationDef File", "", defName, "xml");
|
||||
|
||||
if (path != null && path != "")
|
||||
{ SaveAnimation(path); }
|
||||
}
|
||||
|
@ -99,6 +115,8 @@ namespace RimWorldAnimationStudio
|
|||
defs.animationDefs.Add(animationDef);
|
||||
|
||||
XmlUtility.WriteXML(defs, path);
|
||||
|
||||
Workspace.animationSavePath = path;
|
||||
}
|
||||
|
||||
public void RunPreSaveOperations(AnimationDef animationDef)
|
||||
|
@ -140,6 +158,8 @@ namespace RimWorldAnimationStudio
|
|||
{ Debug.LogError("Default animation def file contains no animation data"); return; }
|
||||
|
||||
LoadAnimation(defs.animationDefs[0]);
|
||||
|
||||
Workspace.animationSavePath = null;
|
||||
}
|
||||
|
||||
public void SaveCustomArrays()
|
||||
|
@ -148,6 +168,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
CustomTagsHelper helper = new CustomTagsHelper();
|
||||
|
||||
helper.defNames = CustomTags.defNames;
|
||||
helper.bodyParts = CustomTags.bodyParts;
|
||||
helper.bodyDefTypes = CustomTags.bodyDefTypes;
|
||||
helper.sexTypes = CustomTags.sexTypes;
|
||||
|
@ -172,6 +193,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
CustomTagsHelper helper = XmlUtility.ReadXML<CustomTagsHelper>(path);
|
||||
|
||||
CustomTags.defNames = helper.defNames;
|
||||
CustomTags.bodyParts = helper.bodyParts;
|
||||
CustomTags.bodyDefTypes = helper.bodyDefTypes;
|
||||
CustomTags.sexTypes = helper.sexTypes;
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public void ResetCamera()
|
||||
{
|
||||
cam.transform.position = new Vector3(0, 0, -10);
|
||||
cam.transform.position = new Vector3(-1, 0, -10);
|
||||
curZoom = zoom;
|
||||
|
||||
mouseDragActive = false;
|
||||
|
|
|
@ -9,12 +9,14 @@ namespace RimWorldAnimationStudio
|
|||
{
|
||||
public class InputManager : Singleton<InputManager>
|
||||
{
|
||||
public Transform dialogBoxes;
|
||||
|
||||
private float lastUpdate = -1f;
|
||||
private float timeBetweenUpdates = 0.15f;
|
||||
private float largeStep = 0.1f;
|
||||
private float smallStep = 0.03f;
|
||||
|
||||
public bool CanUpdate()
|
||||
public bool CanRepeatThisUpdate()
|
||||
{
|
||||
if (Time.unscaledTime > lastUpdate + timeBetweenUpdates)
|
||||
{
|
||||
|
@ -25,204 +27,290 @@ namespace RimWorldAnimationStudio
|
|||
return false;
|
||||
}
|
||||
|
||||
public bool IsModifierKeyHeld()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift)) return true;
|
||||
if (Input.GetKey(KeyCode.LeftControl)) return true;
|
||||
if (Input.GetKey(KeyCode.LeftAlt)) return true;
|
||||
if (Input.GetKey(KeyCode.LeftCommand)) return true;
|
||||
if (Input.GetKey(KeyCode.RightShift)) return true;
|
||||
if (Input.GetKey(KeyCode.RightControl)) return true;
|
||||
if (Input.GetKey(KeyCode.RightAlt)) return true;
|
||||
if (Input.GetKey(KeyCode.RightCommand)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool IsDialogBoxIsActive()
|
||||
{
|
||||
foreach (Transform child in dialogBoxes)
|
||||
{ if (child.gameObject.activeSelf) return true; }
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
// Make new animation
|
||||
if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand)) && Input.GetKeyDown(KeyCode.N))
|
||||
{ ApplicationManager.Instance.TryToMakeNewAnimation(); }
|
||||
if (IsDialogBoxIsActive()) return;
|
||||
|
||||
// Save animation
|
||||
else if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand)) && Input.GetKeyDown(KeyCode.S))
|
||||
{ ApplicationManager.Instance.TryToSaveAnimation(); }
|
||||
bool canRepeatThisUpdate = CanRepeatThisUpdate();
|
||||
|
||||
// Load animation
|
||||
else if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand)) && Input.GetKeyDown(KeyCode.L))
|
||||
{ ApplicationManager.Instance.TryToLoadAnimation(); }
|
||||
foreach (Keybind keybind in KeybindConfig.Instance.GetAllKeybinds())
|
||||
{
|
||||
if (IsModifierKeyHeld() && keybind.keyModifiers.NullOrEmpty()) goto nextKeybind;
|
||||
|
||||
// Exit if animationDef has not be loaded
|
||||
foreach (KeyCode modKeyCode in keybind.keyModifiers)
|
||||
{ if (Input.GetKey(modKeyCode) == false) goto nextKeybind; }
|
||||
|
||||
if (keybind.repeatable && canRepeatThisUpdate)
|
||||
{ if (Input.GetKey(keybind.keyCode) == false) goto nextKeybind; }
|
||||
|
||||
else
|
||||
{ if (Input.GetKeyDown(keybind.keyCode) == false) goto nextKeybind; }
|
||||
|
||||
//Debug.Log(keybind.command);
|
||||
Invoke(keybind.command, 0f); return;
|
||||
|
||||
nextKeybind:;
|
||||
}
|
||||
}
|
||||
|
||||
public void QuitApplication()
|
||||
{
|
||||
ApplicationManager.Instance.TryToCloseApplication();
|
||||
}
|
||||
|
||||
public void NewAnimation()
|
||||
{
|
||||
ApplicationManager.Instance.TryToMakeNewAnimation();
|
||||
}
|
||||
|
||||
public void SaveAnimation()
|
||||
{
|
||||
ApplicationManager.Instance.TryToSaveAnimation();
|
||||
}
|
||||
|
||||
public void SaveAnimationAs()
|
||||
{
|
||||
ApplicationManager.Instance.TryToSaveAnimationAs();
|
||||
}
|
||||
|
||||
public void LoadAnimation()
|
||||
{
|
||||
ApplicationManager.Instance.TryToLoadAnimation();
|
||||
}
|
||||
|
||||
public void UndoAction()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
Workspace.Instance.Undo();
|
||||
}
|
||||
|
||||
public void RedoAction()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
Workspace.Instance.Redo();
|
||||
}
|
||||
|
||||
public void ToggleAnimationPreview()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleAnimation();
|
||||
}
|
||||
|
||||
public void CopyKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.CopyPawnKeyframes();
|
||||
}
|
||||
|
||||
public void PasteKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.PastePawnKeyframes();
|
||||
}
|
||||
|
||||
public void DeleteKeyframes()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.RemovePawnKeyframe();
|
||||
}
|
||||
|
||||
public void ActorMovementMode()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(0);
|
||||
}
|
||||
|
||||
public void ActorRotateMode()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(1);
|
||||
}
|
||||
|
||||
public void ActorFacingMode()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.ToggleActorManipulationMode(2);
|
||||
}
|
||||
|
||||
public void AdjustActorUpward()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.up * largeStep);
|
||||
}
|
||||
|
||||
public void AdjustActorDownward()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.down * largeStep);
|
||||
}
|
||||
|
||||
public void AdjustActorLeftward()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.left * largeStep);
|
||||
}
|
||||
|
||||
public void AdjustActorRightward()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.right * largeStep);
|
||||
}
|
||||
|
||||
public void AdjustActorUpwardSmall()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.up * smallStep);
|
||||
}
|
||||
|
||||
public void AdjustActorDownwardSmall()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.down * smallStep);
|
||||
}
|
||||
|
||||
public void AdjustActorLeftwardSmall()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.left * smallStep);
|
||||
}
|
||||
|
||||
public void AdjustActorRightwardSmall()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
ActorKeyframeCard.Instance.AdjustActor(Vector2.right * smallStep);
|
||||
}
|
||||
|
||||
public void CycleActorBodyPartSelecion()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
// Play / pause
|
||||
if (Input.GetKeyDown(KeyCode.Space))
|
||||
{ AnimationController.Instance.ToggleAnimation(); }
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetChild(Workspace.actorID).GetComponent<ActorBody>();
|
||||
List<ActorBodyPart> actorBodyParts = actorBody.GetComponentsInChildren<ActorBodyPart>().Where(x => x.gameObject.activeInHierarchy)?.ToList();
|
||||
|
||||
// Move / switch actors
|
||||
else if (Input.GetKey(KeyCode.UpArrow) && CanUpdate())
|
||||
if (actorBodyParts.NullOrEmpty()) return;
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ actorBodyParts[0].Activate(); return; }
|
||||
|
||||
else
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand))
|
||||
for (int i = 0; i < actorBodyParts.Count; i++)
|
||||
{
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID - 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
}
|
||||
ActorBodyPart part = actorBodyParts[i];
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftShift))
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.up * smallStep); }
|
||||
|
||||
else
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.up * largeStep); }
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.DownArrow) && CanUpdate())
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand))
|
||||
{
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID + 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftShift))
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.down * smallStep); }
|
||||
|
||||
else
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.down * largeStep); }
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftArrow) && CanUpdate())
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.left * smallStep); }
|
||||
|
||||
else
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.left * largeStep); }
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.RightArrow) && CanUpdate())
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.right * smallStep); }
|
||||
|
||||
else
|
||||
{ ActorKeyframeCard.Instance.AdjustActor(Vector2.right * largeStep); }
|
||||
}
|
||||
|
||||
// Switch to actor panning
|
||||
else if (Input.GetKeyDown(KeyCode.Q))
|
||||
{ AnimationController.Instance.ToggleActorManipulationMode(0); }
|
||||
|
||||
// Switch to actor rotating
|
||||
else if (Input.GetKeyDown(KeyCode.W))
|
||||
{ AnimationController.Instance.ToggleActorManipulationMode(1); }
|
||||
|
||||
// SWitch to actor facing
|
||||
else if (Input.GetKeyDown(KeyCode.E))
|
||||
{ AnimationController.Instance.ToggleActorManipulationMode(2); }
|
||||
|
||||
// Switch between body parts
|
||||
else if (Input.GetKeyDown(KeyCode.Tab))
|
||||
{
|
||||
ActorBody actorBody = AnimationController.Instance.actorBodies.GetChild(Workspace.actorID).GetComponent<ActorBody>();
|
||||
List<ActorBodyPart> actorBodyParts = actorBody.GetComponentsInChildren<ActorBodyPart>().Where(x => x.gameObject.activeInHierarchy)?.ToList();
|
||||
|
||||
foreach(Transform c in actorBody.transform)
|
||||
{
|
||||
Debug.Log(c.gameObject + " " + c.gameObject.activeSelf);
|
||||
}
|
||||
|
||||
if (actorBodyParts.NullOrEmpty()) return;
|
||||
|
||||
if (Workspace.selectedBodyPart == null)
|
||||
{ actorBodyParts[0].Activate(); return; }
|
||||
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < actorBodyParts.Count; i++)
|
||||
if (part == Workspace.selectedBodyPart)
|
||||
{
|
||||
ActorBodyPart part = actorBodyParts[i];
|
||||
if (i < actorBodyParts.Count - 1)
|
||||
{ actorBodyParts[i + 1].Activate(); return; }
|
||||
|
||||
if (part == Workspace.selectedBodyPart)
|
||||
{
|
||||
if (i < actorBodyParts.Count - 1)
|
||||
{ actorBodyParts[i + 1].Activate(); return; }
|
||||
|
||||
else
|
||||
{ actorBody.Activate(); return; }
|
||||
}
|
||||
else
|
||||
{ actorBody.Activate(); return; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Move along time lines
|
||||
else if (Input.GetKey(KeyCode.PageUp) && CanUpdate())
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPreviousKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
}
|
||||
public void ToPreviousActor()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand))
|
||||
{ AnimationController.Instance.stageTick = 1; }
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID - 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
}
|
||||
|
||||
else
|
||||
{ AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick - 1, 1, Workspace.StageWindowSize); }
|
||||
}
|
||||
public void ToNextActor()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
else if (Input.GetKey(KeyCode.PageDown) && CanUpdate())
|
||||
{
|
||||
if (Input.GetKey(KeyCode.LeftShift))
|
||||
{
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetNextKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
}
|
||||
Workspace.selectedBodyPart = null;
|
||||
Workspace.actorID = Mathf.Clamp(Workspace.actorID + 1, 0, Workspace.animationDef.actors.Count - 1);
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.LeftCommand))
|
||||
{ AnimationController.Instance.stageTick = Workspace.StageWindowSize; }
|
||||
public void ToPreviousTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick - 1, 1, Workspace.StageWindowSize);
|
||||
}
|
||||
|
||||
else
|
||||
{ AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick + 1, 1, Workspace.StageWindowSize); }
|
||||
}
|
||||
public void ToNextTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Mathf.Clamp(AnimationController.Instance.stageTick + 1, 1, Workspace.StageWindowSize);
|
||||
}
|
||||
|
||||
// Switch stages
|
||||
else if (Input.GetKeyDown(KeyCode.Home))
|
||||
{
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID - 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
public void ToFirstTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = 1;
|
||||
}
|
||||
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
}
|
||||
public void ToLastTick()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
AnimationController.Instance.stageTick = Workspace.StageWindowSize;
|
||||
}
|
||||
|
||||
else if (Input.GetKeyDown(KeyCode.End))
|
||||
{
|
||||
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID + 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
public void ToPreviousKey()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetPreviousKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
}
|
||||
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
}
|
||||
public void ToNextKey()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
PawnKeyframe keyframe = Workspace.Instance.GetNextKeyframe(Workspace.actorID);
|
||||
if (keyframe != null) AnimationController.Instance.stageTick = keyframe.atTick.Value;
|
||||
}
|
||||
|
||||
// Undo
|
||||
else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Z))
|
||||
{ Workspace.Instance.Undo(); }
|
||||
public void ToPreviousStage()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftCommand) && Input.GetKeyDown(KeyCode.Z))
|
||||
{ Workspace.Instance.Undo(); }
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID - 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
|
||||
// Redo
|
||||
else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.Y))
|
||||
{ Workspace.Instance.Redo(); }
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
}
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftCommand) && Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Z))
|
||||
{ Workspace.Instance.Redo(); }
|
||||
public void ToNextStage()
|
||||
{
|
||||
if (Workspace.animationDef == null) return;
|
||||
|
||||
// Copy keyframes
|
||||
else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.C))
|
||||
{ AnimationController.Instance.CopyPawnKeyframes(); }
|
||||
int prevStageID = Workspace.stageID;
|
||||
Workspace.stageID = Mathf.Clamp(Workspace.stageID + 1, 0, Workspace.animationDef.animationStages.Count - 1);
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftCommand) && Input.GetKeyDown(KeyCode.C))
|
||||
{ AnimationController.Instance.CopyPawnKeyframes(); }
|
||||
if (Workspace.stageID != prevStageID)
|
||||
{ Workspace.Instance.RecordEvent("Stage selected"); }
|
||||
}
|
||||
|
||||
// Paste keyframes
|
||||
else if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.V))
|
||||
{ AnimationController.Instance.PastePawnKeyframes(); }
|
||||
|
||||
else if (Input.GetKey(KeyCode.LeftCommand) && Input.GetKeyDown(KeyCode.X))
|
||||
{ AnimationController.Instance.PastePawnKeyframes(); }
|
||||
|
||||
// Delete keyframes
|
||||
else if (Input.GetKey(KeyCode.Backspace) || Input.GetKey(KeyCode.Delete))
|
||||
{ AnimationController.Instance.RemovePawnKeyframe(); }
|
||||
public void CenterView()
|
||||
{
|
||||
Camera.main.GetComponent<CameraController>().ResetCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,9 +75,9 @@ namespace RimWorldAnimationStudio
|
|||
{ return false; }
|
||||
|
||||
AnimationStage stage = Workspace.animationDef.animationStages[startIndex];
|
||||
|
||||
Workspace.animationDef.animationStages[startIndex] = Workspace.animationDef.animationStages[startIndex + delta];
|
||||
Workspace.animationDef.animationStages[startIndex + delta] = stage;
|
||||
|
||||
Workspace.stageID = startIndex + delta;
|
||||
|
||||
Workspace.Instance.RecordEvent("Stage move");
|
||||
|
|
|
@ -14,6 +14,9 @@ namespace RimWorldAnimationStudio
|
|||
public static Color ColorWhite = new Color(1f, 1f, 1f);
|
||||
public static Color ColorGreen = new Color(0f, 1f, 0f);
|
||||
public static Color ColorGoldYellow = new Color(1f, 0.85f, 0f);
|
||||
public static Color ColorDarkGold = new Color(0.75f, 0.64f, 0f);
|
||||
public static Color ColorLightGrey = new Color(0.9f, 0.9f, 0.9f);
|
||||
public static Color ColorMidGrey = new Color(0.75f, 0.75f, 0.75f);
|
||||
public static Color ColorGrey = new Color(0.5f, 0.5f, 0.5f);
|
||||
public static Color ColorDarkGrey = new Color(0.2f, 0.2f, 0.2f);
|
||||
public static Color ColorPink = new Color(1.0f, 0.5f, 0.5f);
|
||||
|
@ -21,12 +24,13 @@ namespace RimWorldAnimationStudio
|
|||
public static Color ColorRichOrange = new Color(1.0f, 0.4f, 0.1f);
|
||||
public static Color ColorCyan = new Color(0.0f, 1.0f, 1.0f);
|
||||
public static Color ColorPurple = new Color(0.85f, 0.0f, 1.0f);
|
||||
public static Color ColorGhost = new Color(0.5f, 0.5f, 0.5f, 0.5f);
|
||||
public static Color ColorGhost = new Color(0.5f, 0f, 0f, 0.5f);
|
||||
public static Color ColorRed = new Color(0.9f, 0f, 0f);
|
||||
}
|
||||
|
||||
public static class Tags
|
||||
{
|
||||
public static List<string> defNames = new List<string>() { "Human", "Wolf_Timber", "Horse"};
|
||||
public static List<string> bodyParts = new List<string>() { "Penis", "Vagina", "Anus", "Breasts", "Mouth" };
|
||||
public static List<string> bodyDefTypes = new List<string>() { "Human", "Bird", "BeetleLike", "BeetleLikeWithClaw", "MechanicalCentipede", "MechanicalTermite", "Lancer", "Pikeman", "Monkey", "QuadrupedAnimalWithClawsTailAndJowl", "QuadrupedAnimalWithHooves", "QuadrupedAnimalWithHoovesAndHorn", "QuadrupedAnimalWithHoovesAndHump", "QuadrupedAnimalWithHoovesAndTusks", "QuadrupedAnimalWithHoovesTusksAndTrunk", "QuadrupedAnimalWithPaws", "QuadrupedAnimalWithPawsAndTail", "Scyther", "Snake", "TurtleLike" };
|
||||
public static List<string> sexTypes = new List<string>() { "None", "Vaginal", "Anal", "Oral", "Masturbation", "DoublePenetration", "Boobjob", "Handjob", "Footjob", "Fingering", "Scissoring", "MutualMasturbation", "Fisting", "MechImplant", "Rimming", "Fellatio", "Cunnilingus", "Sixtynine" };
|
||||
|
@ -38,6 +42,7 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public static class CustomTags
|
||||
{
|
||||
public static List<string> defNames = new List<string>();
|
||||
public static List<string> bodyParts = new List<string>();
|
||||
public static List<string> bodyDefTypes = new List<string>();
|
||||
public static List<string> sexTypes = new List<string>();
|
||||
|
@ -49,6 +54,7 @@ namespace RimWorldAnimationStudio
|
|||
[XmlRoot("CustomTagsHelper", IsNullable = false)]
|
||||
public class CustomTagsHelper
|
||||
{
|
||||
[XmlArray("defNames"), XmlArrayItem("li")] public List<string> defNames = new List<string>();
|
||||
[XmlArray("bodyParts"), XmlArrayItem("li")] public List<string> bodyParts = new List<string>();
|
||||
[XmlArray("bodyDefTypes"), XmlArrayItem("li")] public List<string> bodyDefTypes = new List<string>();
|
||||
[XmlArray("sexTypes"), XmlArrayItem("li")] public List<string> sexTypes = new List<string>();
|
||||
|
|
79
Assets/Scripts/Tooltip.cs
Normal file
79
Assets/Scripts/Tooltip.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
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 Tooltip : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
public string message = "Undefined";
|
||||
public string executedCommand;
|
||||
public float delay = 0f;
|
||||
|
||||
private GameObject tooltip;
|
||||
private Text tooltipText;
|
||||
private bool isActive;
|
||||
private bool isDisplayed;
|
||||
private float activeTime = -1f;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
tooltip = Workspace.Instance.transform.Find("TooltipMessage")?.gameObject;
|
||||
tooltipText = tooltip?.GetComponentInChildren<Text>();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (tooltip == null || isActive == false || (activeTime + delay) > Time.unscaledTime) return;
|
||||
|
||||
if (isDisplayed == false)
|
||||
{
|
||||
tooltipText.text = message;
|
||||
|
||||
if (executedCommand != null && executedCommand != "")
|
||||
{ tooltipText.text += " (" + KeybindConfig.Instance.GetKeybindLabel(executedCommand) + ")"; }
|
||||
|
||||
tooltip.transform.position = (Vector2)transform.position + new Vector2(5f, -15f);
|
||||
tooltip.gameObject.SetActive(true);
|
||||
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(tooltip.GetComponent<RectTransform>());
|
||||
|
||||
isDisplayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
if (isActive)
|
||||
{ OnPointerExit(new PointerEventData(EventSystem.current)); }
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData pointerEventData)
|
||||
{
|
||||
isActive = true;
|
||||
activeTime = Time.unscaledTime;
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData pointerEventData)
|
||||
{
|
||||
isActive = false;
|
||||
isDisplayed = false;
|
||||
tooltip.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputHorizontal()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void CalculateLayoutInputVertical()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Tooltip.cs.meta
Normal file
11
Assets/Scripts/Tooltip.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c05e9ac2a2f311549b12f094d2785a20
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -22,6 +22,8 @@ namespace RimWorldAnimationStudio
|
|||
|
||||
public static List<PawnKeyframe> copiedKeyframes = new List<PawnKeyframe>();
|
||||
|
||||
public static string animationSavePath;
|
||||
|
||||
private static int _actorID = 0;
|
||||
public static int actorID { get { return Mathf.Clamp(_actorID, 0, animationDef.actors.Count - 1); } set { _actorID = value; } }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue