From 98f31f197a126850a5878cd6e583ae6dbf64ab3d Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 15 Sep 2021 12:50:26 +0800 Subject: *rename --- .../ActionTool/Editor/ActionColliderFrameEditor.cs | 109 +++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 Assets/Tools/ActionTool/Editor/ActionColliderFrameEditor.cs (limited to 'Assets/Tools/ActionTool/Editor/ActionColliderFrameEditor.cs') diff --git a/Assets/Tools/ActionTool/Editor/ActionColliderFrameEditor.cs b/Assets/Tools/ActionTool/Editor/ActionColliderFrameEditor.cs new file mode 100644 index 00000000..4efd1f93 --- /dev/null +++ b/Assets/Tools/ActionTool/Editor/ActionColliderFrameEditor.cs @@ -0,0 +1,109 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace ActionTool +{ + + // 编辑collider帧 + public class ActionColliderFrameEditor : EditorWindow + { + EditorWindow sceneView; + + private void OnEnable() + { + titleContent = new GUIContent("Collider Frame Editor"); + maxSize = new Vector2(300, 180); + minSize = maxSize; + + if(!sceneView) + sceneView = EditorWindow.GetWindow(); + } + + private void OnDisable() + { + // sceneView = null; + ActionManager.OnSelectColliderFrame(null); + } + + private void Update() + { + } + + private void OnGUI() + { + var frame = ActionManager.editColliderFrame; + if (frame == null) + { + this.Close(); + return; + } + + GUI.changed = false; + + GUILayout.Space(5); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("frame: "); + EditorGUILayout.LabelField(frame.frame.ToString()); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("active: "); + frame.active = EditorGUILayout.Toggle(frame.active); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.LabelField("position: "); + frame.position = EditorGUILayout.Vector3Field("", frame.position); + + EditorGUILayout.LabelField("size: "); + frame.size = EditorGUILayout.Vector3Field("", frame.size); + + GUILayout.Space(10); + + GUILayout.BeginHorizontal(); + + if(GUILayout.Button("Left abit")) + { + ActionData action = ActionManager.actionData; + float normaltime = frame.frame / action.totalFrame; + action.curAnimTimeNormal = normaltime - 0.001f; + } + + if (GUILayout.Button("Right abit")) + { + ActionData action = ActionManager.actionData; + float normaltime = frame.frame / action.totalFrame; + action.curAnimTimeNormal = normaltime + 0.001f; + } + + if (GUILayout.Button("Current")) + { + ActionData action = ActionManager.actionData; + float normaltime = frame.frame / action.totalFrame; + action.curAnimTimeNormal = normaltime; + } + + GUILayout.EndHorizontal(); + + GUILayout.Space(10); + + Color prevColor = GUI.backgroundColor; + GUI.backgroundColor = Color.red; + if (GUILayout.Button("Delete")) + { + ActionManager.DeleteCurFrame(); + } + GUI.backgroundColor = prevColor; + + if (GUI.changed) + { + if (sceneView != null) + sceneView.Repaint(); + if (ActionManager.PreviewWindow != null) + ActionManager.PreviewWindow.Repaint(); + } + } + } +} \ No newline at end of file -- cgit v1.1-26-g67d0