From dd6e15e23e96486f7be195589c6396e4977f6f25 Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 24 Aug 2021 20:54:33 +0800 Subject: *misc --- Assets/ActionTool/Editor/ActionColliderEditor.cs | 35 ++++++++++++++++-------- 1 file changed, 23 insertions(+), 12 deletions(-) (limited to 'Assets/ActionTool') diff --git a/Assets/ActionTool/Editor/ActionColliderEditor.cs b/Assets/ActionTool/Editor/ActionColliderEditor.cs index a446b61d..69f6a372 100644 --- a/Assets/ActionTool/Editor/ActionColliderEditor.cs +++ b/Assets/ActionTool/Editor/ActionColliderEditor.cs @@ -97,12 +97,23 @@ namespace ActionTool bool skip = false; foreach (var attr in field.GetCustomAttributes()) { - if(attr.GetType() == typeof(ColliderTypeAttribute)) + if (attr.GetType() == typeof(ColliderTypeAttribute)) { ColliderTypeAttribute t = attr as ColliderTypeAttribute; collliderType = (int)t.type; } - else if (attr.GetType() == typeof(WhenAttribute)) + } + if (collliderType != -1 && collliderType != (int)collider.type) + { + skip = true; + } + if (skip) + { + continue; + } + foreach (var attr in field.GetCustomAttributes()) + { + if (attr.GetType() == typeof(WhenAttribute)) { WhenAttribute when = attr as WhenAttribute; string conditionName = when.conditionName; @@ -158,10 +169,15 @@ namespace ActionTool indent = 13; } } - } - if (collliderType != -1 && collliderType != (int)collider.type) - { - skip = true; + 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; + } } if(foldout != null && (++foldoutElementCount) <= foldout.count) { @@ -198,12 +214,7 @@ 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); - } - } + } GUI_Label(new GUIContent(name, tooltip), styles.textBold); -- cgit v1.1-26-g67d0