summaryrefslogtreecommitdiff
path: root/Assets/ActionTool/Editor/ActionEventEditor.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-09-02 09:59:31 +0800
committerchai <chaifix@163.com>2021-09-02 09:59:31 +0800
commit3ad68338dff5229d3fd8ec9f3ee994d7e37fb0ed (patch)
treeb5fbf74148147019f75dd4c078fd76f4804330ec /Assets/ActionTool/Editor/ActionEventEditor.cs
parentf7e60ab9a52e557aa2250477d018b2768bccc028 (diff)
*override rootmotion
Diffstat (limited to 'Assets/ActionTool/Editor/ActionEventEditor.cs')
-rw-r--r--Assets/ActionTool/Editor/ActionEventEditor.cs87
1 files changed, 68 insertions, 19 deletions
diff --git a/Assets/ActionTool/Editor/ActionEventEditor.cs b/Assets/ActionTool/Editor/ActionEventEditor.cs
index 50b697e4..0fd9ea22 100644
--- a/Assets/ActionTool/Editor/ActionEventEditor.cs
+++ b/Assets/ActionTool/Editor/ActionEventEditor.cs
@@ -93,6 +93,7 @@ namespace ActionTool
string name = field.Name + " (" + field.FieldType.Name + ")";
string tooltip = "";
bool skip = false;
+ bool isHDR = false;
foreach (var attr in field.GetCustomAttributes())
{
if(attr.GetType() == typeof(TooltipAttribute))
@@ -109,16 +110,27 @@ namespace ActionTool
}
else if (attr.GetType() == typeof(WhenAttribute))
{
- WhenAttribute when = attr as WhenAttribute;
- string conditionName = when.conditionName;
- FieldInfo condition = type.GetField(conditionName);
- if ((int)condition.GetValue(animEvent) != when.value)
- {
- skip = true;
- break;
- }
- }
- else if (attr.GetType() == typeof(WhenNotAttribute))
+ WhenAttribute when = attr as WhenAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if (!when.IsSatisfied((int)condition.GetValue(animEvent)))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(AndWhenAttribute))
+ {
+ AndWhenAttribute when = attr as AndWhenAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if (!when.IsSatisfied((int)condition.GetValue(animEvent)))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(WhenNotAttribute))
{
WhenNotAttribute when = attr as WhenNotAttribute;
string conditionName = when.conditionName;
@@ -156,12 +168,16 @@ namespace ActionTool
SpaceAttribute space = attr as SpaceAttribute;
GUILayout.Space(space.height);
}
- else if (attr.GetType() == typeof(CommentAttribute))
- {
- CommentAttribute comment = attr as CommentAttribute;
- EditorGUILayout.LabelField(comment.comment);
- }
- else if (attr.GetType() == typeof(WhenAttribute))
+ else if (attr.GetType() == typeof(CommentAttribute))
+ {
+ CommentAttribute comment = attr as CommentAttribute;
+ GUIStyle style = GUI.skin.GetStyle("Label");
+ TextAnchor preanchor = style.alignment;
+ style.alignment = comment.alignment;
+ GUI_Label(new GUIContent(comment.comment), style);
+ style.alignment = preanchor;
+ }
+ else if (attr.GetType() == typeof(WhenAttribute))
{
WhenAttribute when = attr as WhenAttribute;
string conditionName = when.conditionName;
@@ -205,6 +221,10 @@ namespace ActionTool
break;
}
}
+ else if(attr.GetType() == typeof(HDRAttribute))
+ {
+ isHDR = true;
+ }
}
if (skip)
{
@@ -244,14 +264,31 @@ namespace ActionTool
{
field.SetValue(animEvent, GUI_Int((int)field.GetValue(animEvent)));
}
- GUILayout.Space(5);
+ else if(field.FieldType == typeof(Color))
+ {
+ if(isHDR)
+ {
+ field.SetValue(animEvent, GUI_ColorHDR((Color)field.GetValue(animEvent)));
+ }
+ else
+ {
+ field.SetValue(animEvent, GUI_Color((Color)field.GetValue(animEvent)));
+ }
+ }
+ GUILayout.Space(5);
}
}
EditorGUILayout.EndScrollView();
}
- float GUI_Float(float value)
+ void GUI_Label(GUIContent label, GUIStyle style)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ EditorGUI.LabelField(rect, label, style);
+ }
+
+ float GUI_Float(float value)
{
Rect rect = EditorGUILayout.GetControlRect();
return EditorGUI.FloatField(rect, "", value);
@@ -299,5 +336,17 @@ namespace ActionTool
return GUI.Toggle(rect, value, "Check");
}
- }
+ Color GUI_Color(Color col)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ return EditorGUI.ColorField(rect, col);
+ }
+
+ Color GUI_ColorHDR(Color col)
+ {
+ Rect rect = EditorGUILayout.GetControlRect();
+ return EditorGUI.ColorField(rect, new GUIContent(""), col, true, true, true);
+ }
+
+ }
} \ No newline at end of file