using UnityEditor; using UnityEngine; using VketCloudGUITools.Runtime; namespace VketCloudGUITools.Editor { [CustomEditor(typeof(IndexGUIAction))] public class IndexGUIActionInsepctor : GUIActionInspector { GUIActionEditorRectHelpder _helper = null; public override void OnSubInspectorGUI(Rect position) { var action = target as IndexGUIAction; _helper = new GUIActionEditorRectHelpder(position); Rect typeRect, checkRect, content1Rect; _helper.GetTypeRectAndCheckRect(out typeRect, out checkRect); content1Rect = _helper.ContentRect(1); using (new GUI.GroupScope(position, GUI.skin.box)) { // Action Name var oldActionName = action.ActionName; var newActionName = DrawActionNameTypeField(checkRect, typeRect, action.ActionName, GUIActionTargetNames.IndexTargetNames); if (newActionName != oldActionName) { Undo.RecordObject(action, "GUI Action"); action.ActionName = newActionName; } // Value var oldValue = action.Value; var newValue = EditorGUI.IntField(content1Rect, "Value", action.Value); if (newValue != oldValue) { Undo.RecordObject(action, "GUI Action"); action.Value = newValue; } } } public override float GetSubInspectorHeight() => EditorGUIUtility.singleLineHeight * 2; } }