存档功能

This commit is contained in:
2025-01-08 11:41:20 +08:00
parent c67366664c
commit 43b99f98e7
49 changed files with 2498 additions and 5762 deletions
+10 -4
View File
@@ -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);
}
}
}