blob: 4efd1f9305dba6d427d3d279abf0dabfdd162a25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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<SceneView>();
}
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();
}
}
}
}
|