public Tag(Emotion emotion, int idA, int idB) { this.type = Type.Emotion; this.emotion = emotion; this.color = emotion.Color(); start = Mathf.Min(idA, idB); end = Mathf.Max(idA, idB); }
void OnGUI() { GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "", GUI.skin.window); Rect rect = GUILayoutUtility.GetRect(Screen.width, 16).Offset(2, 2, -4, -4); switch (tag.type) { case Tag.Type.Wait: GUI.Label(rect, "Break", EditorStyles.toolbar); GUILayout.Space(8); GUILayout.BeginHorizontal(); GUILayout.Label("Duration :"); tag.duration = EditorGUILayout.FloatField(tag.duration); GUILayout.EndHorizontal(); float temp = GUILayout.HorizontalSlider(tag.duration, 0.01f, 5.0f); if (temp != tag.duration) { tag.duration = temp; GUI.FocusControl("None"); } tag.duration = Mathf.Clamp(tag.duration, 0.01f, 5.0f); GUILayout.Space(16); if (GUILayout.Button("Close")) { Close(); } break; case Tag.Type.Emotion: GUI.Label(rect, "Emotion", EditorStyles.toolbar); GUILayout.Space(8); for (int i = 1; i < btns.Length; i++) { Emotion em = (Emotion)i; if (GUILayout.Button(em.ToString())) { tag.emotion = em; tag.color = em.Color(); Close(); } } break; } Repaint(); }