Bug fix for menu items

This commit is contained in:
AbstractConcept 2022-10-12 01:16:08 -05:00
parent 3d859555ad
commit 3d2c11f469
57 changed files with 73 additions and 172 deletions

View file

@ -22,9 +22,12 @@ namespace RimWorldAnimationStudio
public void Update()
{
if (Workspace.animationDef == null) return;
//if (Workspace.animationDef == null) return;
if (actorID != Workspace.actorID || hashcode != CustomTags.defNames.GetHashCode())
//if (actorID != Workspace.actorID || hashcode != CustomTags.defNames.GetHashCode())
//{ UpdateDropdown(); }
if (hashcode != CustomTags.defNames.GetHashCode())
{ UpdateDropdown(); }
}
@ -33,21 +36,26 @@ namespace RimWorldAnimationStudio
if (dropdown == null)
{ OnEnable(); }
string alienRaceDefName = Workspace.animationDef.actors[Workspace.actorID].GetAlienRaceDef().defName;
dropdown.ClearOptions();
/*string alienRaceDefName = Workspace.animationDef.actors[Workspace.actorID].GetAlienRaceDef().defName;
dropdown.ClearOptions();
dropdown.options.Add(new Dropdown.OptionData(alienRaceDefName));
dropdown.value = 0;
label.text = alienRaceDefName;
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)); }
//if (defName != alienRaceDefName)
//{ dropdown.options.Add(new Dropdown.OptionData(defName)); }
dropdown.options.Add(new Dropdown.OptionData(defName));
}
actorID = Workspace.actorID;
dropdown.value = 0;
label.text = dropdown.options[0].text;
//actorID = Workspace.actorID;
hashcode = CustomTags.defNames.GetHashCode();
}

View file

@ -16,6 +16,12 @@ namespace RimWorldAnimationStudio
public DialogBox newAnimationDialog;
public SelectAnimationDialog selectAnimationDialog;
public void Start()
{
LoadAlienRaceDefs();
LoadCustomArrays();
}
public void TryToCloseApplication()
{
exitDialog.Pop();
@ -56,10 +62,7 @@ namespace RimWorldAnimationStudio
public void LoadAnimation(AnimationDef animationDef)
{
LoadAlienRaceDefs();
LoadCustomArrays();
UpdateCustomArrays(animationDef);
RunPostLoadOperations(animationDef);
Debug.Log("Loaded AnimationDef: " + animationDef.defName);

View file

@ -138,19 +138,19 @@ namespace RimWorldAnimationStudio
public void ActorMovementMode()
{
if (Workspace.animationDef == null) return;
//if (Workspace.animationDef == null) return;
AnimationController.Instance.ToggleActorManipulationMode(0);
}
public void ActorRotateMode()
{
if (Workspace.animationDef == null) return;
//if (Workspace.animationDef == null) return;
AnimationController.Instance.ToggleActorManipulationMode(1);
}
public void ActorFacingMode()
{
if (Workspace.animationDef == null) return;
//if (Workspace.animationDef == null) return;
AnimationController.Instance.ToggleActorManipulationMode(2);
}