特效范例
This commit is contained in:
@@ -4,6 +4,7 @@ using Ichni.RhythmGame;
|
||||
using JetBrains.Annotations;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UIElements.Experimental;
|
||||
|
||||
@@ -34,5 +35,12 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newValue);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
|
||||
public void AddListenerFunction(UnityAction action)
|
||||
{
|
||||
inputFieldX.onEndEdit.AddListener(_ => action());
|
||||
inputFieldY.onEndEdit.AddListener(_ => action());
|
||||
inputFieldZ.onEndEdit.AddListener(_ => action());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,5 +112,74 @@ namespace Ichni.Editor
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newFlexibleFloat);
|
||||
};
|
||||
}
|
||||
|
||||
public void SetAsFlexibleInt()
|
||||
{
|
||||
void GenerateUnit(AnimatedInt content)
|
||||
{
|
||||
DynamicUIAnimatedIntUnit unit = Instantiate(unitPrefab, windowRect).GetComponent<DynamicUIAnimatedIntUnit>();
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedIntUnit;
|
||||
|
||||
FlexibleInt flexibleInt = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleInt;
|
||||
foreach (AnimatedInt animatedInt in flexibleInt.animations)
|
||||
{
|
||||
GenerateUnit(animatedInt);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedInt(0, 0));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleInt newFlexibleInt = new FlexibleInt();
|
||||
foreach (var unit in unitList)
|
||||
{
|
||||
newFlexibleInt.animations.Add((unit as DynamicUIAnimatedIntUnit).GetValue());
|
||||
}
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newFlexibleInt);
|
||||
};
|
||||
}
|
||||
|
||||
public void SetAsFlexibleBool()
|
||||
{
|
||||
void GenerateUnit(AnimatedBool content)
|
||||
{
|
||||
DynamicUIAnimatedBoolUnit unit = Instantiate(unitPrefab, windowRect).GetComponent<DynamicUIAnimatedBoolUnit>();
|
||||
unitList.Add(unit);
|
||||
unit.SetUnit(this, content);
|
||||
}
|
||||
|
||||
unitPrefab = EditorManager.instance.basePrefabs.animatedBoolUnit;
|
||||
FlexibleBool flexibleBool = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement) as FlexibleBool;
|
||||
foreach (AnimatedBool animatedBool in flexibleBool.animations)
|
||||
{
|
||||
GenerateUnit(animatedBool);
|
||||
}
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
|
||||
addNewUnitButton.onClick.AddListener(() =>
|
||||
{
|
||||
GenerateUnit(new AnimatedBool(0, false));
|
||||
addNewUnitButton.GetComponent<RectTransform>().SetAsLastSibling();
|
||||
});
|
||||
|
||||
ApplyParameters = () =>
|
||||
{
|
||||
FlexibleBool newFlexibleBool = new FlexibleBool();
|
||||
foreach (var unit in unitList)
|
||||
{
|
||||
newFlexibleBool.animations.Add((unit as DynamicUIAnimatedBoolUnit).GetValue());
|
||||
}
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, newFlexibleBool);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,13 @@ namespace Ichni.Editor
|
||||
{
|
||||
logTexts = new Queue<LogText>();
|
||||
}
|
||||
|
||||
public static void Log(string text, Color color = default)
|
||||
{
|
||||
EditorManager.instance.uiManager.mainPage.logWindow.AddLog(text, color);
|
||||
}
|
||||
|
||||
public void AddLog(string text, Color color = default)
|
||||
private void AddLog(string text, Color color = default)
|
||||
{
|
||||
CheckLogTextCapacity();
|
||||
LogText logText = LeanPool.Spawn(logTextPrefab, textRect).GetComponent<LogText>();
|
||||
|
||||
Reference in New Issue
Block a user