效果模块,以及代码位置整理
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
@@ -20,7 +21,19 @@ namespace Ichni.Editor
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
Type type = connectedBaseElement.GetType().GetField(parameterName).FieldType;
|
||||
if (type == typeof(int))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, int.Parse(text));
|
||||
}
|
||||
else if (type == typeof(float))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, float.Parse(text));
|
||||
}
|
||||
else if (type == typeof(string))
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
}
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
@@ -22,5 +23,10 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
|
||||
public void AddListenerFunction(UnityAction<bool> action)
|
||||
{
|
||||
toggle.onValueChanged.AddListener(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user