石头Day2
This commit is contained in:
@@ -9,11 +9,13 @@ namespace AibisDream.SystemEditor
|
||||
{
|
||||
private int _selectedIndex;
|
||||
private string _inputText = "";
|
||||
private string[] _options;
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
// 获取目标对象
|
||||
SystemHasData example = (SystemHasData)target;
|
||||
_options = example.GetDataKeyOptions();
|
||||
|
||||
// 绘制默认的 Inspector
|
||||
DrawDefaultInspector();
|
||||
@@ -21,14 +23,14 @@ namespace AibisDream.SystemEditor
|
||||
GUILayout.Label("数据加载与保存");
|
||||
// 绘制下拉选择和输入框
|
||||
EditorGUILayout.BeginHorizontal();
|
||||
int newIndex = EditorGUILayout.Popup(_selectedIndex, example.GetDataKeyOptions());
|
||||
int newIndex = EditorGUILayout.Popup(_selectedIndex, _options);
|
||||
_inputText = EditorGUILayout.TextField(_inputText);
|
||||
EditorGUILayout.EndHorizontal();
|
||||
|
||||
if (newIndex != _selectedIndex)
|
||||
{
|
||||
_selectedIndex = newIndex;
|
||||
_inputText = example.GetDataKeyOptions()[newIndex];
|
||||
_inputText = _options[newIndex];
|
||||
}
|
||||
|
||||
// 保存按钮
|
||||
|
||||
Reference in New Issue
Block a user