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