From d373067ce7982c14040274f9eab8ad9a1c50c5f1 Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 10 Jul 2021 11:58:54 +0800 Subject: *misc --- Assets/ActionTool/Editor/ActionColliderEditor.cs | 40 +++++++++++++++++------- 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'Assets/ActionTool/Editor/ActionColliderEditor.cs') diff --git a/Assets/ActionTool/Editor/ActionColliderEditor.cs b/Assets/ActionTool/Editor/ActionColliderEditor.cs index 57c060fa..0c312806 100644 --- a/Assets/ActionTool/Editor/ActionColliderEditor.cs +++ b/Assets/ActionTool/Editor/ActionColliderEditor.cs @@ -9,18 +9,29 @@ namespace ActionTool // 编辑collider帧 public class ActionColliderEditor : EditorWindow { + EditorWindow sceneView; private void OnEnable() { - titleContent = new GUIContent("Collider Editor"); - } + titleContent = new GUIContent("Collider Editor"); + maxSize = new Vector2(300, 150); + minSize = maxSize; - private void OnDisable() + if(!sceneView) + sceneView = EditorWindow.GetWindow(); + } + + private void OnDisable() { - ActionManager.OnSelectColliderFrame(null); + // sceneView = null; + ActionManager.OnSelectColliderFrame(null); } - private void OnGUI() + private void Update() + { + } + + private void OnGUI() { var frame = ActionManager.editColliderFrame; if (frame == null) @@ -29,12 +40,11 @@ namespace ActionTool return; } - Rect pos = position; - pos.width = 300; - pos.height = 150; - position = pos; + GUI.changed = false; - EditorGUILayout.BeginHorizontal(); + GUILayout.Space(5); + + EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("frame: "); EditorGUILayout.LabelField(frame.frame.ToString()); EditorGUILayout.EndHorizontal(); @@ -59,6 +69,14 @@ namespace ActionTool ActionManager.DeleteCurFrame(); } GUI.color = prevColor; + + if (GUI.changed) + { + if (sceneView != null) + sceneView.Repaint(); + if (ActionManager.PreviewWindow != null) + ActionManager.PreviewWindow.Repaint(); + } } } -} \ No newline at end of file +} \ No newline at end of file -- cgit v1.1-26-g67d0