存档功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -15,7 +16,7 @@ namespace AibisDream.SystemEditor
|
||||
{
|
||||
// 获取目标对象
|
||||
SystemHasData example = (SystemHasData)target;
|
||||
_options = example.GetDataKeyOptions();
|
||||
_options ??= GetDataKeysByPath(example.GetConfigPath());
|
||||
|
||||
// 绘制默认的 Inspector
|
||||
DrawDefaultInspector();
|
||||
@@ -38,7 +39,7 @@ namespace AibisDream.SystemEditor
|
||||
{
|
||||
Undo.RecordObject(example, "Save Input Value");
|
||||
example.CurDataKey = _inputText;
|
||||
example.Save();
|
||||
example.SaveLevel();
|
||||
Debug.Log("Saved: " + _inputText);
|
||||
}
|
||||
|
||||
@@ -46,11 +47,16 @@ namespace AibisDream.SystemEditor
|
||||
if (GUILayout.Button("加载"))
|
||||
{
|
||||
example.CurDataKey = _inputText;
|
||||
_selectedIndex = System.Array.IndexOf(example.GetDataKeyOptions(), _inputText);
|
||||
_selectedIndex = System.Array.IndexOf(_options, _inputText);
|
||||
if (_selectedIndex < 0) _selectedIndex = 0;
|
||||
example.Load();
|
||||
example.LoadLevel();
|
||||
Debug.Log("Loaded: " + _inputText);
|
||||
}
|
||||
}
|
||||
|
||||
private static string[] GetDataKeysByPath(string path)
|
||||
{
|
||||
return ConfigUtil.Instance.GetFileNames(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user