Inspector
初步测试Inspector
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public abstract class DynamicUIElement : MonoBehaviour
|
||||
{
|
||||
public GameElement connectedGameElement => EditorManager.instance.uiManager.inspector.connectedGameElement;
|
||||
public bool isAlwaysUpdated;
|
||||
public abstract void Initialize(string parameterName);
|
||||
//public abstract void ApplyParameters();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff19cfc4963444c2e8aa109adef5c68d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIInputField : DynamicUIElement
|
||||
{
|
||||
public string parameterName;
|
||||
public TMP_InputField inputField;
|
||||
|
||||
public override void Initialize(string parameterName)
|
||||
{
|
||||
this.parameterName = parameterName;
|
||||
inputField.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString();
|
||||
inputField.onEndEdit.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedGameElement.GetType().GetField(parameterName).SetValue(connectedGameElement, text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c820db94e3df4f9aa6ab10ef435bb5a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user