Code refactor

This commit is contained in:
AbstractConcept 2022-10-28 00:28:51 -05:00
parent 757badf4f6
commit a55ba7b95b
232 changed files with 1282 additions and 936 deletions

View file

@ -28,7 +28,7 @@ namespace RimWorldAnimationStudio
public void Start()
{
// General events
EventsManager.onAnimationDefChanged.AddListener(delegate { UpdateGUI(); });
EventsManager.onAnimationChanged.AddListener(delegate { UpdateGUI(); });
EventsManager.onActorIDChanged.AddListener(delegate { UpdateGUI(); });
EventsManager.onDefNamesChanged.AddListener(delegate { UpdateRaceDropdown(); });
@ -69,6 +69,8 @@ namespace RimWorldAnimationStudio
actor.SetPawnRaceOffset(new Vector2(x, z));
Workspace.RecordEvent("Actor offset");
UpdateGUI();
}
public void OnDropdownChanged()
@ -107,8 +109,8 @@ namespace RimWorldAnimationStudio
string bodyType = actor.bodyType;
bodyTypeDropdown.SetValueWithoutNotify(bodyTypeDropdown.options.FindIndex(x => x.text == bodyType));
bodyOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).x.ToString()));
bodyOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).z.ToString()));
bodyOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).x));
bodyOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.BodyTypeOffset.GetOffset(bodyType).z));
bodyTypeDropdown.interactable = actor.GetPawnRaceDef().isHumanoid;
bodyOffsetXField.interactable = actor.GetPawnRaceDef().isHumanoid;
@ -117,8 +119,8 @@ namespace RimWorldAnimationStudio
string race = actor.GetPawnRaceDef().defName;
raceDropdown.SetValueWithoutNotify(raceDropdown.options.FindIndex(x => x.text == race));
raceOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().x.ToString()));
raceOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().z.ToString()));
raceOffsetXField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().x));
raceOffsetZField.SetTextWithoutNotify(string.Format("{0:0.000}", actor.GetPawnRaceOffset().z));
}
}
}