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