using UnityEditor; using UnityEngine; using VketCloudGUITools.Runtime; namespace VketCloudGUITools.Editor { [CustomEditor(typeof(SetShowGUIGUIAction))] public class SetShowGUIGUIActionInspector : GUIActionInspector { GUIActionEditorRectHelpder _helper = null; public override void OnSubInspectorGUI(Rect position) { var action = target as SetShowGUIGUIAction; _helper = new GUIActionEditorRectHelpder(position); Rect typeRect, checkRect, content1Rect, content2Rect; _helper.GetTypeRectAndCheckRect(out typeRect, out checkRect); content1Rect = _helper.ContentRect(1); content2Rect = _helper.ContentRect(1); using (new GUI.GroupScope(position, GUI.skin.box)) { // Action Name DrawActionNameTypeFieldDummy(checkRect, typeRect, action.ActionName); // GUI Name var oldGuiName = action.GuiName; var newGuiName = EditorGUI.TextField(content1Rect, "GUI Name", oldGuiName); if (newGuiName != oldGuiName) { Undo.RecordObject(action, "GUI Action"); action.GuiName = newGuiName; } // Show var oldShow = action.Show; var newShow = EditorGUI.Toggle(content2Rect, "Show", oldShow); if (newShow != oldShow) { Undo.RecordObject(action, "GUI Action"); action.Show = newShow; } } } public override float GetSubInspectorHeight() => EditorGUIUtility.singleLineHeight * 3; } }