From 6925badfeccd2caf4710fd6599ae70b30649e5fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Tue, 18 Nov 2025 11:27:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4odin=E4=BE=9D=E8=B5=96=20?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Editor/Inspector/AnimationFlowInspector.cs | 19 ++ .../Inspector/AnimationFlowInspector.cs.meta | 3 + Editor/Inspector/GraphInspector.cs | 172 ++++++++++++++++-- Runtime/AnimationFlow.cs | 10 +- Runtime/Core/Animation/CanvasGroupAlphaTo.cs | 55 +++--- Runtime/Core/Animation/GraphicAlphaTo.cs | 60 +++--- Runtime/Core/Animation/GraphicColorTo.cs | 30 ++- Runtime/Core/Animation/RotateTo.cs | 45 ++--- Runtime/Core/Animation/ScaleTo.cs | 43 +++-- .../Core/Animation/SpriteRendererAlphaTo.cs | 44 +++-- .../Core/Animation/SpriteRendererColorTo.cs | 45 ++--- Runtime/Core/Animation/TranslateTo.cs | 17 +- Runtime/Core/Animation/UISizeDelta.cs | 9 +- Runtime/Core/Base.meta | 3 + Runtime/Core/Base/AnimationBaseNode.cs | 18 ++ Runtime/Core/Base/AnimationBaseNode.cs.meta | 3 + Runtime/Core/Node/ActionNode.cs | 8 +- 17 files changed, 375 insertions(+), 209 deletions(-) create mode 100644 Editor/Inspector/AnimationFlowInspector.cs create mode 100644 Editor/Inspector/AnimationFlowInspector.cs.meta create mode 100644 Runtime/Core/Base.meta create mode 100644 Runtime/Core/Base/AnimationBaseNode.cs create mode 100644 Runtime/Core/Base/AnimationBaseNode.cs.meta diff --git a/Editor/Inspector/AnimationFlowInspector.cs b/Editor/Inspector/AnimationFlowInspector.cs new file mode 100644 index 0000000..e0cc664 --- /dev/null +++ b/Editor/Inspector/AnimationFlowInspector.cs @@ -0,0 +1,19 @@ +using UnityEditor; +using UnityEngine; + +namespace AlicizaX.AnimationFlow.Editor +{ + [CanEditMultipleObjects] + [CustomEditor(typeof(Runtime.AnimationFlow), true)] + public class AnimationFlowInspector : UnityEditor.Editor + { + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + if (GUILayout.Button("Open Graph")) + { + UnityEditor.EditorApplication.ExecuteMenuItem("Window/AnimationGraph"); + } + } + } +} diff --git a/Editor/Inspector/AnimationFlowInspector.cs.meta b/Editor/Inspector/AnimationFlowInspector.cs.meta new file mode 100644 index 0000000..a544b56 --- /dev/null +++ b/Editor/Inspector/AnimationFlowInspector.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: bc1dbfa84fd94a41b4895ad2d058ac5d +timeCreated: 1763433819 \ No newline at end of file diff --git a/Editor/Inspector/GraphInspector.cs b/Editor/Inspector/GraphInspector.cs index 77dfe7a..2135095 100644 --- a/Editor/Inspector/GraphInspector.cs +++ b/Editor/Inspector/GraphInspector.cs @@ -1,7 +1,6 @@ using System; -using System.Linq; +using System.Reflection; using AlicizaX.AnimationFlow.Runtime; -using Sirenix.OdinInspector.Editor; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; @@ -10,36 +9,175 @@ namespace AlicizaX.AnimationFlow.Editor { public class GraphInspector : VisualElement { - private PropertyTree propertyTree; + private ActionNode currentActionNode; + private NodeView currentNodeView; public void DrawNode(NodeView nodeView) { Clear(); - if (nodeView.actionNode == null) + if (nodeView?.actionNode == null) { return; } - // 使用 Odin PropertyTree 来处理非 UnityEngine.Object 对象 - propertyTree = PropertyTree.Create(nodeView.actionNode); + currentActionNode = nodeView.actionNode; + currentNodeView = nodeView; var imguiContainer = new IMGUIContainer(() => { - if (propertyTree == null) + if (currentActionNode == null) return; + + EditorGUI.BeginChangeCheck(); + + DrawActionNodeInspector(); + + if (EditorGUI.EndChangeCheck()) { - return; - } - - propertyTree.Draw(false); - // 手动调用 Odin 的 Apply,处理数据更新后的逻辑 - if (propertyTree.ApplyChanges()) - { - nodeView.RefreshState(); + currentNodeView?.RefreshState(); } }); Add(imguiContainer); - propertyTree.Dispose(); + } + + private void DrawActionNodeInspector() + { + EditorGUILayout.BeginVertical(GUI.skin.box); + + DrawQualifiedFields(currentActionNode); + + EditorGUILayout.EndVertical(); + } + + private void DrawQualifiedFields(object targetObject) + { + if (targetObject == null) return; + + Type objectType = targetObject.GetType(); + + // 获取所有实例字段(公共和非公共) + var allFields = objectType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic); + + foreach (var field in allFields) + { + // 跳过不应该绘制的字段 + if (ShouldSkipField(field)) continue; + + DrawFieldViaReflection(targetObject, field); + } + } + + private bool ShouldSkipField(FieldInfo field) + { + // 跳过编译器生成的字段 + if (field.IsDefined(typeof(System.Runtime.CompilerServices.CompilerGeneratedAttribute), false)) + return true; + + // 跳过非序列化字段(但如果标记了SerializeField,则仍然绘制) + if (field.IsDefined(typeof(System.NonSerializedAttribute), false) && !field.IsDefined(typeof(SerializeField), false)) + return true; + + // 跳过静态字段 + if (field.IsStatic) + return true; + + // 跳过在ActionNode基类中声明的字段 + if (field.DeclaringType == typeof(ActionNode)) + return true; + + // 跳过受保护字段(protected) + if (field.IsFamily) + return true; + + // 关键修改:只绘制公共字段,或者私有但包含SerializeField特性的字段 + if (!field.IsPublic && !field.IsDefined(typeof(SerializeField), false)) + return true; + + return false; + } + + private void DrawFieldViaReflection(object targetObject, FieldInfo field) + { + try + { + var fieldValue = field.GetValue(targetObject); + var fieldType = field.FieldType; + string displayName = GetFieldDisplayName(field); + + EditorGUILayout.BeginHorizontal(); + + var newValue = DrawFieldByType(displayName, fieldValue, fieldType); + + if (!Equals(newValue, fieldValue)) + { + field.SetValue(targetObject, newValue); + } + + EditorGUILayout.EndHorizontal(); + } + catch (Exception e) + { + EditorGUILayout.LabelField(field.Name, $"绘制错误: {e.Message}"); + } + } + + private string GetFieldDisplayName(FieldInfo field) + { + // 检查是否有Header特性 + var headerAttr = field.GetCustomAttribute(); + if (headerAttr != null) + { + return headerAttr.header; + } + + // 将驼峰命名转换为空格分隔的友好名称 + return ObjectNames.NicifyVariableName(field.Name); + } + + private object DrawFieldByType(string label, object value, Type fieldType) + { + if (fieldType == typeof(string)) + { + return EditorGUILayout.TextField(label, (string)value); + } + else if (fieldType == typeof(int)) + { + return EditorGUILayout.IntField(label, (int)value); + } + else if (fieldType == typeof(float)) + { + return EditorGUILayout.FloatField(label, (float)value); + } + else if (fieldType == typeof(bool)) + { + return EditorGUILayout.Toggle(label, (bool)value); + } + else if (fieldType == typeof(Vector2)) + { + return EditorGUILayout.Vector2Field(label, (Vector2)value); + } + else if (fieldType == typeof(Vector3)) + { + return EditorGUILayout.Vector3Field(label, (Vector3)value); + } + else if (fieldType == typeof(Color)) + { + return EditorGUILayout.ColorField(label, (Color)value); + } + else if (fieldType.IsEnum) + { + return EditorGUILayout.EnumPopup(label, (Enum)value); + } + else if (fieldType == typeof(UnityEngine.Object) || fieldType.IsSubclassOf(typeof(UnityEngine.Object))) + { + return EditorGUILayout.ObjectField(label, (UnityEngine.Object)value, fieldType, true); + } + else + { + // 对于不支持的类型,显示为只读标签 + EditorGUILayout.LabelField(label, value?.ToString() ?? "null"); + return value; + } } } -} \ No newline at end of file +} diff --git a/Runtime/AnimationFlow.cs b/Runtime/AnimationFlow.cs index 013a122..80783b9 100644 --- a/Runtime/AnimationFlow.cs +++ b/Runtime/AnimationFlow.cs @@ -3,7 +3,6 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using Cysharp.Threading.Tasks; -using Sirenix.OdinInspector; using UnityEngine; namespace AlicizaX.AnimationFlow.Runtime @@ -32,11 +31,6 @@ namespace AlicizaX.AnimationFlow.Runtime } } - [Button("节点编辑器", ButtonSizes.Large), GUIColor(0, 1, 0)] - private void OpenGraphWindow() - { - UnityEditor.EditorApplication.ExecuteMenuItem("Window/AnimationGraph"); - } #endif #endregion @@ -44,10 +38,10 @@ namespace AlicizaX.AnimationFlow.Runtime [HideInInspector] [SerializeReference] public List AnimationNodes = new List(); - [LabelText("动画片段")] [BoxGroup("基础设置", true)] [ValueDropdown("GetAllAnimationClips", ExpandAllMenuItems = true)] [SerializeField] + private string _defaultPlayName = "None"; - [LabelText("自动播放")] [BoxGroup("基础设置", true)] [SerializeField] + private bool _enableAutoPlay; diff --git a/Runtime/Core/Animation/CanvasGroupAlphaTo.cs b/Runtime/Core/Animation/CanvasGroupAlphaTo.cs index 991e812..b59448a 100644 --- a/Runtime/Core/Animation/CanvasGroupAlphaTo.cs +++ b/Runtime/Core/Animation/CanvasGroupAlphaTo.cs @@ -1,60 +1,61 @@ using UnityEngine; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class CanvasGroupAlphaTo : ActionNode { - public float duration = 1f; - public EaseType easyType; - public CanvasGroup target; - public bool setFrom; - public float from; - public float to; - - protected float orgValue; - protected float enterValue; + public class CanvasGroupAlphaTo : AnimationBaseNode + { + [SerializeField] + private CanvasGroup _target; public override void OnInit() { - orgValue = target.alpha; + orgValue = _target.alpha; } public override void OnReset() { - target.alpha = orgValue; + _target.alpha = orgValue; } - public override void OnEnter() { - if (setFrom) { - target.alpha = from; + public override void OnEnter() + { + if (setFrom) + { + _target.alpha = from; } if (Condition()) { - target.alpha = to; + _target.alpha = to; } - enterValue = target.alpha; + enterValue = _target.alpha; } - public override void OnUpdate(float dt) { - target.alpha = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); + public override void OnUpdate(float dt) + { + _target.alpha = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); } - public override bool Valid() { - return target != null; + public override bool Valid() + { + return _target != null; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { - return target != null ? target.name : null; + public override string SubTitle() + { + return _target != null ? _target.name : null; } } } - diff --git a/Runtime/Core/Animation/GraphicAlphaTo.cs b/Runtime/Core/Animation/GraphicAlphaTo.cs index cf37b66..0030ff0 100644 --- a/Runtime/Core/Animation/GraphicAlphaTo.cs +++ b/Runtime/Core/Animation/GraphicAlphaTo.cs @@ -1,54 +1,58 @@ using UnityEngine; using UnityEngine.UI; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class GraphicAlphaTo : ActionNode { - public float duration = 1f; - public EaseType easyType; - public Graphic target; - public bool setFrom; - public float from; - public float to; + public class GraphicAlphaTo : AnimationBaseNode + { + [SerializeField] + private Graphic _target; - protected float orgValue; - protected float enterValue; - - public override void OnInit() { - orgValue = target.color.a; + public override void OnInit() + { + orgValue = _target.color.a; } - public override void OnReset() { - target.color = new Color(target.color.r, target.color.g, target.color.b, orgValue); + public override void OnReset() + { + _target.color = new Color(_target.color.r, _target.color.g, _target.color.b, orgValue); } - public override void OnEnter() { - if (setFrom) { - target.color = new Color(target.color.r, target.color.g, target.color.b, from); + public override void OnEnter() + { + if (setFrom) + { + _target.color = new Color(_target.color.r, _target.color.g, _target.color.b, from); } - enterValue = target.color.a; + + enterValue = _target.color.a; } - public override void OnUpdate(float dt) { + public override void OnUpdate(float dt) + { float a = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); - target.color = new Color(target.color.r, target.color.g, target.color.b, a); + _target.color = new Color(_target.color.r, _target.color.g, _target.color.b, a); } - public override bool Valid() { - return target != null && duration > 0; + public override bool Valid() + { + return _target != null && duration > 0; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { - return target != null ? target.name : null; + public override string SubTitle() + { + return _target != null ? _target.name : null; } } } - diff --git a/Runtime/Core/Animation/GraphicColorTo.cs b/Runtime/Core/Animation/GraphicColorTo.cs index aa46991..8545f37 100644 --- a/Runtime/Core/Animation/GraphicColorTo.cs +++ b/Runtime/Core/Animation/GraphicColorTo.cs @@ -4,50 +4,44 @@ using UnityEngine.UI; namespace AlicizaX.AnimationFlow.Runtime { [Category("Animation")] - public class GraphicColorTo : ActionNode + public class GraphicColorTo : AnimationBaseNode { - public float duration = 1f; - public EaseType easyType; - public Graphic target; - public bool setFrom; - public Color from = Color.white; - public Color to = Color.white; - - protected Color orgValue; - protected Color enterValue; + [SerializeField] + private Graphic _target; public override void OnInit() { - orgValue = target.color; + orgValue = _target.color; } public override void OnReset() { - target.color = orgValue; + _target.color = orgValue; } public override void OnEnter() { if (setFrom) { - target.color = from; + _target.color = from; } if (Condition()) { - target.color = to; + _target.color = to; } - enterValue = target.color; + + enterValue = _target.color; } public override void OnUpdate(float dt) { - target.color = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); + _target.color = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); } public override bool Valid() { - return target != null; + return _target != null; } public override float Duration() @@ -62,7 +56,7 @@ namespace AlicizaX.AnimationFlow.Runtime public override string SubTitle() { - return target != null ? target.name : null; + return _target != null ? _target.name : null; } } } diff --git a/Runtime/Core/Animation/RotateTo.cs b/Runtime/Core/Animation/RotateTo.cs index 85d2690..651cec4 100644 --- a/Runtime/Core/Animation/RotateTo.cs +++ b/Runtime/Core/Animation/RotateTo.cs @@ -1,53 +1,56 @@ using UnityEngine; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class RotateTo : ActionNode { - public float duration = 1f; - public EaseType easyType; + public class RotateTo : AnimationBaseNode + { public Transform target; - public bool setFrom; - public Vector3 from; - public Vector3 to; - protected Vector3 orgValue; - protected Vector3 enterValue; - - public override void OnInit() { + public override void OnInit() + { orgValue = target.localEulerAngles; } - - public override void OnReset() { + + public override void OnReset() + { target.localEulerAngles = orgValue; } - public override void OnEnter() { - if (setFrom) { + public override void OnEnter() + { + if (setFrom) + { target.localEulerAngles = from; } + enterValue = target.localEulerAngles; } - public override void OnUpdate(float dt) { + public override void OnUpdate(float dt) + { target.localEulerAngles = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); } - public override bool Valid() { + public override bool Valid() + { return target != null && duration > 0; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { + public override string SubTitle() + { return target != null ? target.name : null; } } } - diff --git a/Runtime/Core/Animation/ScaleTo.cs b/Runtime/Core/Animation/ScaleTo.cs index 235f2a5..0939998 100644 --- a/Runtime/Core/Animation/ScaleTo.cs +++ b/Runtime/Core/Animation/ScaleTo.cs @@ -1,52 +1,55 @@ using UnityEngine; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class ScaleTo : ActionNode { - public float duration = 1f; - public EaseType easyType; + public class ScaleTo : AnimationBaseNode + { public Transform target; - public bool setFrom; - public Vector3 from; - public Vector3 to = Vector3.one; - protected Vector3 orgValue; - protected Vector3 enterValue; - - public override void OnInit() { + public override void OnInit() + { orgValue = target.localScale; } - - public override void OnReset() { + public override void OnReset() + { target.localScale = orgValue; } - public override void OnEnter() { - if (setFrom) { + public override void OnEnter() + { + if (setFrom) + { target.localScale = from; } + enterValue = target.localScale; } - public override void OnUpdate(float dt) { + public override void OnUpdate(float dt) + { target.localScale = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); } - public override bool Valid() { + public override bool Valid() + { return target != null && duration > 0; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { + public override string SubTitle() + { return target != null ? target.name : null; } } diff --git a/Runtime/Core/Animation/SpriteRendererAlphaTo.cs b/Runtime/Core/Animation/SpriteRendererAlphaTo.cs index e13c5f1..f7f7038 100644 --- a/Runtime/Core/Animation/SpriteRendererAlphaTo.cs +++ b/Runtime/Core/Animation/SpriteRendererAlphaTo.cs @@ -1,54 +1,58 @@ using UnityEngine; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class SpriteRendererAlphaTo : ActionNode { - public float duration = 1f; - public EaseType easyType; + public class SpriteRendererAlphaTo : AnimationBaseNode + { public SpriteRenderer target; - public bool setFrom; - public float from; - public float to; - protected float orgValue; - protected float enterValue; - public override void OnInit() { + public override void OnInit() + { orgValue = target.color.a; } - - public override void OnReset() { + + public override void OnReset() + { target.color = new Color(target.color.r, target.color.g, target.color.b, orgValue); } - public override void OnEnter() { - if (setFrom) { + public override void OnEnter() + { + if (setFrom) + { target.color = target.color = new Color(target.color.r, target.color.g, target.color.b, from); } + enterValue = target.color.a; } - public override void OnUpdate(float dt) { + public override void OnUpdate(float dt) + { float a = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); target.color = new Color(target.color.r, target.color.g, target.color.b, a); } - public override bool Valid() { + public override bool Valid() + { return target != null && duration > 0; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { + public override string SubTitle() + { return target != null ? target.name : null; } } } - diff --git a/Runtime/Core/Animation/SpriteRendererColorTo.cs b/Runtime/Core/Animation/SpriteRendererColorTo.cs index 52023db..90d383c 100644 --- a/Runtime/Core/Animation/SpriteRendererColorTo.cs +++ b/Runtime/Core/Animation/SpriteRendererColorTo.cs @@ -1,54 +1,57 @@ using UnityEngine; -namespace AlicizaX.AnimationFlow.Runtime { +namespace AlicizaX.AnimationFlow.Runtime +{ [Category("Animation")] - public class SpriteRendererColorTo : ActionNode { - public float duration = 1f; - public EaseType easyType; + public class SpriteRendererColorTo : AnimationBaseNode + { public SpriteRenderer target; - public bool setFrom; - public Color from = Color.white; - public Color to = Color.white; - protected Color orgValue; - protected Color enterValue; - - public override void OnInit() { + public override void OnInit() + { orgValue = target.color; } - - public override void OnReset() { + + public override void OnReset() + { target.color = orgValue; } - public override void OnEnter() { - if (setFrom) { + public override void OnEnter() + { + if (setFrom) + { target.color = from; } + enterValue = target.color; } - public override void OnUpdate(float dt) { + public override void OnUpdate(float dt) + { target.color = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); } - public override bool Valid() { + public override bool Valid() + { return target != null && duration > 0; } - public override float Duration() { + public override float Duration() + { return duration; } - public override bool HasSubTitle() { + public override bool HasSubTitle() + { return true; } - public override string SubTitle() { + public override string SubTitle() + { return target != null ? target.name : null; } } } - diff --git a/Runtime/Core/Animation/TranslateTo.cs b/Runtime/Core/Animation/TranslateTo.cs index 8cd1005..e61d4fd 100644 --- a/Runtime/Core/Animation/TranslateTo.cs +++ b/Runtime/Core/Animation/TranslateTo.cs @@ -1,28 +1,13 @@ -using Sirenix.OdinInspector; using UnityEngine; namespace AlicizaX.AnimationFlow.Runtime { [Category("Animation")] [System.Serializable] - public class TranslateTo : ActionNode + public class TranslateTo : AnimationBaseNode { - [LabelText("持续时间")] public float duration = 1f; - [LabelText("过渡类型")] public EaseType easyType; - - [ChildGameObjectsOnly] [LabelText("对象")] public Transform target; - [LabelText("设置起点")] public bool setFrom; - - [LabelText("开始")] [ShowIf("setFrom", true)] - public Vector3 from; - - [LabelText("结束")] public Vector3 to; - - protected Vector3 orgValue; - protected Vector3 enterValue; - public override void OnInit() { orgValue = target.localPosition; diff --git a/Runtime/Core/Animation/UISizeDelta.cs b/Runtime/Core/Animation/UISizeDelta.cs index ab87327..2002404 100644 --- a/Runtime/Core/Animation/UISizeDelta.cs +++ b/Runtime/Core/Animation/UISizeDelta.cs @@ -3,16 +3,9 @@ using UnityEngine; namespace AlicizaX.AnimationFlow.Runtime { [Category("RectTransform")] - public class UISizeDelta : ActionNode + public class UISizeDelta : AnimationBaseNode { - public float duration = 1f; - public EaseType easyType; public RectTransform target; - public bool setFrom; - public Vector2 from; - public Vector2 to; - protected Vector2 orgValue; - protected Vector2 enterValue; public override void OnInit() { diff --git a/Runtime/Core/Base.meta b/Runtime/Core/Base.meta new file mode 100644 index 0000000..04b2a25 --- /dev/null +++ b/Runtime/Core/Base.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b61695d4d191450e9a298bb9e925771a +timeCreated: 1763435401 \ No newline at end of file diff --git a/Runtime/Core/Base/AnimationBaseNode.cs b/Runtime/Core/Base/AnimationBaseNode.cs new file mode 100644 index 0000000..65fe421 --- /dev/null +++ b/Runtime/Core/Base/AnimationBaseNode.cs @@ -0,0 +1,18 @@ +using UnityEngine; + +namespace AlicizaX.AnimationFlow.Runtime +{ + public abstract class AnimationBaseNode : ActionNode where T : unmanaged + { + [Header("持续事件")] public float duration = 1f; + [Header("动画类型")] public EaseType easyType; + + [Header("设置起始")] public bool setFrom; + + [Header("起始值")] public T from; + + [Header("目标值")] public T to; + protected T orgValue; + protected T enterValue; + } +} diff --git a/Runtime/Core/Base/AnimationBaseNode.cs.meta b/Runtime/Core/Base/AnimationBaseNode.cs.meta new file mode 100644 index 0000000..da2ce6b --- /dev/null +++ b/Runtime/Core/Base/AnimationBaseNode.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 954800fde7334242b74b7a36262bdae6 +timeCreated: 1763435457 \ No newline at end of file diff --git a/Runtime/Core/Node/ActionNode.cs b/Runtime/Core/Node/ActionNode.cs index f50e587..4f38a24 100644 --- a/Runtime/Core/Node/ActionNode.cs +++ b/Runtime/Core/Node/ActionNode.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Numerics; -using Sirenix.OdinInspector; using UnityEngine; namespace AlicizaX.AnimationFlow.Runtime @@ -18,8 +16,8 @@ namespace AlicizaX.AnimationFlow.Runtime [System.Serializable] public class EntryNode : ActionNode { - [LabelText("循环次数")] public int LoopCount = 1; // 控制流程循环的次数 - [LabelText("入口名称")] public string Name; // 节点名称(可以是技能名称、关卡名称等) + [Header("循环次数")] public int LoopCount = 1; // 控制流程循环的次数 + [Header("入口名称")] public string Name; // 节点名称(可以是技能名称、关卡名称等) } [System.Serializable] @@ -138,4 +136,4 @@ namespace AlicizaX.AnimationFlow.Runtime State = EState.None; } } -} \ No newline at end of file +}