Inspector内容开始填充完善

This commit is contained in:
SoulliesOfficial
2025-02-17 14:46:14 -05:00
parent d77e1a0f70
commit 8d4772532f
84 changed files with 4340 additions and 208 deletions

View File

@@ -26,7 +26,14 @@ namespace Ichni.Editor
{
this.connectedBaseElement = baseElement;
this.parameterName = parameterName;
this.title.text = title;
if (title != string.Empty)
{
this.title.text = title;
}
else
{
this.title.gameObject.SetActive(false);
}
}
//public abstract void ApplyParameters();

View File

@@ -5,10 +5,11 @@ using System.Linq;
using Ichni.RhythmGame;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
namespace Ichni.Editor
{
public class DynamicUIDropdown : DynamicUIElement
public class DynamicUIEnumDropdown : DynamicUIElement
{
public TMP_Dropdown dropdown;
@@ -31,5 +32,10 @@ namespace Ichni.Editor
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
connectedBaseElement.Refresh();
}
public void AddListenerFunction(UnityAction<int> action)
{
dropdown.onValueChanged.AddListener(action);
}
}
}

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame;
using TMPro;
using UnityEngine;
namespace Ichni.Editor
{
public class DynamicUIHintText : DynamicUIElement
{
public TMP_Text text;
public void SetContent(string content)
{
text.text = content;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e581b946f0ff64cccafda0d2e8d76681
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -7,7 +7,7 @@ using UnityEngine;
namespace Ichni.Editor
{
public class DynamicUIText : DynamicUIElement
public class DynamicUIParameterText : DynamicUIElement
{
public TMP_Text text;

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
namespace Ichni.Editor
{
public class DynamicUIStringListDropdown : DynamicUIElement
{
public TMP_Dropdown dropdown;
public List<string> stringList;
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
{
base.Initialize(baseElement, title, parameterName);
string connectedValue = (string)connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement);
dropdown.value = stringList.Contains(connectedValue) ? stringList.IndexOf(connectedValue) : 0;
dropdown.onValueChanged.AddListener((value) => ApplyParameters(dropdown.options[value].text) );
}
public void SetUpStringList(List<string> stringList)
{
this.stringList = stringList;
this.stringList.Insert(0, "Please Select..."); // Add a default value "Please Select...
dropdown.ClearOptions();
dropdown.AddOptions(stringList);
}
private void ApplyParameters(string value)
{
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
connectedBaseElement.Refresh();
}
public void AddListenerFunction(UnityAction<int> action)
{
dropdown.onValueChanged.AddListener(action);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eb5b5a5c290f54bb2a6a25c02bd64d86
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: