存档功能
This commit is contained in:
@@ -8,4 +8,4 @@ public class ConditionalFieldAttribute : PropertyAttribute
|
||||
{
|
||||
this.conditionField = conditionField;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@ using UnityEngine;
|
||||
public class ConditionalFieldDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
ConditionalFieldAttribute conditional = (ConditionalFieldAttribute)attribute;
|
||||
SerializedProperty conditionProperty = property.serializedObject.FindProperty(conditional.conditionField);
|
||||
|
||||
if (conditionProperty != null && conditionProperty.boolValue)
|
||||
{
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
ConditionalFieldAttribute conditional = (ConditionalFieldAttribute)attribute;
|
||||
SerializedProperty conditionProperty = property.serializedObject.FindProperty(conditional.conditionField);
|
||||
|
||||
if (conditionProperty != null && conditionProperty.boolValue)
|
||||
{
|
||||
EditorGUI.PropertyField(position, property, label, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
@@ -28,4 +28,4 @@ public class ConditionalFieldDrawer : PropertyDrawer
|
||||
|
||||
return 0f; // 隐藏字段时的高度
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.SystemEditor
|
||||
{
|
||||
public class TalkSceneSoAttribute : PropertyAttribute
|
||||
{
|
||||
public TalkSceneSO talkSceneSo;
|
||||
|
||||
public TalkSceneSoAttribute(TalkSceneSO talkSceneSo)
|
||||
{
|
||||
this.talkSceneSo = talkSceneSo;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97f24a0248134470b3577a2e43388c1a
|
||||
timeCreated: 1736223837
|
||||
@@ -0,0 +1,20 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AibisDream.SystemEditor
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(TalkSceneSoAttribute))]
|
||||
public class TalkSceneSoDrawer : PropertyDrawer
|
||||
{
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b6932bbd2554b218f62df463960853e
|
||||
timeCreated: 1736223992
|
||||
Reference in New Issue
Block a user