Inspector内容开始填充完善
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e581b946f0ff64cccafda0d2e8d76681
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -7,7 +7,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIText : DynamicUIElement
|
||||
public class DynamicUIParameterText : DynamicUIElement
|
||||
{
|
||||
public TMP_Text text;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb5b5a5c290f54bb2a6a25c02bd64d86
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user