diff options
Diffstat (limited to 'Assets/ActionTool/Editor/ActionEventEditor.cs')
-rw-r--r-- | Assets/ActionTool/Editor/ActionEventEditor.cs | 72 |
1 files changed, 68 insertions, 4 deletions
diff --git a/Assets/ActionTool/Editor/ActionEventEditor.cs b/Assets/ActionTool/Editor/ActionEventEditor.cs index fc5d248d..a2aefbf6 100644 --- a/Assets/ActionTool/Editor/ActionEventEditor.cs +++ b/Assets/ActionTool/Editor/ActionEventEditor.cs @@ -92,7 +92,8 @@ namespace ActionTool FieldInfo field = fields[i];
string name = field.Name + " (" + field.FieldType.Name + ")";
string tooltip = "";
- foreach(var attr in field.GetCustomAttributes())
+ bool skip = false;
+ foreach (var attr in field.GetCustomAttributes())
{
if(attr.GetType() == typeof(TooltipAttribute))
{
@@ -100,10 +101,73 @@ namespace ActionTool if(tooltip != null)
{
tooltip = tooltipattr.tooltip;
- }
- }
+ }
+ else if (attr.GetType() == typeof(DisallowModifiyInGUI))
+ {
+ GUI.enabled = false;
+ }
+ 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))
+ {
+ WhenNotAttribute when = attr as WhenNotAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if ((int)condition.GetValue(animEvent) == when.value)
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(IfAttribute))
+ {
+ IfAttribute when = attr as IfAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if (!(bool)condition.GetValue(animEvent))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(IfNotAttribute))
+ {
+ IfNotAttribute when = attr as IfNotAttribute;
+ string conditionName = when.conditionName;
+ FieldInfo condition = type.GetField(conditionName);
+ if ((bool)condition.GetValue(animEvent))
+ {
+ skip = true;
+ break;
+ }
+ }
+ else if (attr.GetType() == typeof(SpaceAttribute))
+ {
+ SpaceAttribute space = attr as SpaceAttribute;
+ GUILayout.Space(space.height);
+ }
+ else if (attr.GetType() == typeof(CommentAttribute))
+ {
+ CommentAttribute comment = attr as CommentAttribute;
+ EditorGUILayout.LabelField(comment.comment);
+ }
+ }
}
- EditorGUILayout.LabelField(new GUIContent(name, tooltip), styles.textBold);
+ if (skip)
+ {
+ GUI.enabled = true;
+ continue;
+ }
+ EditorGUILayout.LabelField(new GUIContent(name, tooltip), styles.textBold);
if (field.FieldType == typeof(Vector3))
{
field.SetValue(animEvent, GUI_Vector3((Vector3)field.GetValue(animEvent)));
|