// Draws all our transition-related UI stuff: void DoTransitionStuff() { //------------------------------- // Draw a nice separator: //------------------------------- GUILayout.Space(5.0f); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f); GUILayout.BeginVertical("Toolbar"); GUI.backgroundColor = backgroundColor; GUILayout.BeginHorizontal(); GUILayout.Space(15.0f); GUILayout.Label("Trans:"); // Draw our "From" transition selection // as well as our clone button: curTrans = EditorGUILayout.Popup(curTrans, panel.GetTransitionNames(), "toolbarPopup", GUILayout.MaxWidth(90f)); if (GUILayout.Button("Clone", "toolbarButton")) { if (EditorUtility.DisplayDialog("Are you sure?", "Are you sure you wish to copy this transition to all others in this set?", "Yes", "No")) { Undo.RegisterUndo(this, "Clone transition"); panel.Transitions.CloneAll(curTrans); isDirty = true; } } BeginMonitorChanges(); if (curTrans < 4) { panel.blockInput[curTrans] = GUILayout.Toggle(panel.blockInput[curTrans], "Block Input", "toolbarButton"); } EndMonitorChanges(); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); backgroundColor = GUI.backgroundColor; GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f); GUILayout.BeginVertical("Toolbar"); GUILayout.BeginHorizontal(); GUI.backgroundColor = backgroundColor; GUILayout.Space(10f); GUILayout.Label("Elmnts:"); if (GUILayout.Button("+", "toolbarButton")) { Undo.RegisterUndo(this, "Add transition element"); curTransElement = panel.Transitions.list[curTrans].Add(); isDirty = true; } if (panel.Transitions.list[curTrans].animationTypes.Length > 0) { if (GUILayout.Button("-", "toolbarButton")) { Undo.RegisterUndo(this, "Delete transition element"); panel.Transitions.list[curTrans].Remove(curTransElement); isDirty = true; } } GUILayout.Space(20f); //------------------------------- // End separator (maybe, depending on if we have a drop-down selection) //------------------------------- // Make sure our selection is in a valid range: curTransElement = Mathf.Clamp(curTransElement, 0, panel.Transitions.list[curTrans].animationTypes.Length - 1); // See if we have more to draw: if (panel.Transitions.list[curTrans].animationTypes.Length > 0) { // Let the user select the transition element: curTransElement = EditorGUILayout.Popup(curTransElement, panel.Transitions.list[curTrans].GetNames(), "toolbarPopup", GUILayout.MaxWidth(110f)); GUILayout.FlexibleSpace(); // Cap off our toolbar-ish separator thingy GUILayout.EndHorizontal(); GUILayout.EndVertical(); BeginMonitorChanges(); // Draw the type selection: GUILayout.Space(0); panel.Transitions.list[curTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.EnumPopup("Type:", panel.Transitions.list[curTrans].animationTypes[curTransElement])); // Draw the input fields for the selected // type's parameters: panel.Transitions.list[curTrans].animParams[curTransElement].DrawGUI(panel.Transitions.list[curTrans].animationTypes[curTransElement], panel.gameObject, this, true); EndMonitorChanges(); } else { // Pad the right end of our separator bar: GUILayout.FlexibleSpace(); // Cap off our toolbar-ish separator thingy GUILayout.EndHorizontal(); GUILayout.EndVertical(); } // Clone this transition as needed: panel.Transitions.CloneAsNeeded(curTrans); }
// Draws all transition-related UI stuff: void DoTransitionStuff() { #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) // Box off our transition fields area: GUILayout.BeginArea(new Rect(0, 0, position.width, position.height)); GUILayout.FlexibleSpace(); #endif //------------------------------- // Draw a nice separator: //------------------------------- GUILayout.Space(5.0f); Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = new Color(0.8f, 0.8f, 0.8f); #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) GUILayout.BeginVertical(GUILayout.MaxWidth(200f)); #else GUILayout.BeginVertical("Toolbar"); #endif GUI.backgroundColor = backgroundColor; GUILayout.BeginHorizontal(); GUILayout.Space(10.0f); GUILayout.Label("Transitions: "); // Draw our "From" transition selection // as well as our clone button: #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) Color oldColor = GUI.contentColor; GUI.contentColor = Color.black; curTrans = EditorGUILayout.Popup(curTrans, panel.GetTransitionNames(), GUILayout.MaxWidth(100f)); if (GUILayout.Button("Clone")) { if (EditorUtility.DisplayDialog("Are you sure?", "Are you sure you wish to copy this transition to all others in this set?", "Yes", "No")) { panel.Transitions.CloneAll(curTrans); isDirty = true; } } BeginMonitorChanges(); if (curTrans < 4) { panel.blockInput[curTrans] = GUILayout.Toggle(panel.blockInput[curTrans], "Block Input"); } EndMonitorChanges(); GUI.contentColor = oldColor; #else curTrans = EditorGUILayout.Popup(curTrans, panel.GetTransitionNames(), "toolbarPopup", GUILayout.MaxWidth(100f)); if (GUILayout.Button("Clone", "toolbarButton")) { if (EditorUtility.DisplayDialog("Are you sure?", "Are you sure you wish to copy this transition to all others in this set?", "Yes", "No")) { panel.Transitions.CloneAll(curTrans); isDirty = true; } } BeginMonitorChanges(); if (curTrans < 4) { panel.blockInput[curTrans] = GUILayout.Toggle(panel.blockInput[curTrans], "Block Input", "toolbarButton"); } EndMonitorChanges(); #endif GUILayout.Space(53f); GUILayout.Label("Elements:"); #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) if (GUILayout.Button("+")) { curTransElement = panel.Transitions.list[curTrans].Add(); isDirty = true; } if (panel.Transitions.list[curTrans].animationTypes.Length > 0) { if (GUILayout.Button("-")) { panel.Transitions.list[curTrans].Remove(curTransElement); isDirty = true; } } #else if (GUILayout.Button("+", "toolbarButton")) { curTransElement = panel.Transitions.list[curTrans].Add(); isDirty = true; } if (panel.Transitions.list[curTrans].animationTypes.Length > 0) { if (GUILayout.Button("-", "toolbarButton")) { panel.Transitions.list[curTrans].Remove(curTransElement); isDirty = true; } } #endif GUILayout.Space(20f); //------------------------------- // End separator (maybe, depending on if we have a drop-down selection) //------------------------------- // Make sure our selection is in a valid range: curTransElement = Mathf.Clamp(curTransElement, 0, panel.Transitions.list[curTrans].animationTypes.Length - 1); // See if we have more to draw: if (panel.Transitions.list[curTrans].animationTypes.Length > 0) { // Let the user select the transition element: #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) oldColor = GUI.contentColor; GUI.contentColor = Color.black; curTransElement = EditorGUILayout.Popup(curTransElement, panel.Transitions.list[curTrans].GetNames(), GUILayout.MaxWidth(110f)); #else curTransElement = EditorGUILayout.Popup(curTransElement, panel.Transitions.list[curTrans].GetNames(), "toolbarPopup", GUILayout.MaxWidth(110f)); #endif #if !UNITY_IPHONE || (UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) GUILayout.FlexibleSpace(); #endif // Cap off our toolbar-ish separator thingy GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.BeginHorizontal(); BeginMonitorChanges(); // Draw the type selection: #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) GUILayout.Space(10f); panel.Transitions.list[curTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.Popup("Type:", (int)panel.Transitions.list[curTrans].animationTypes[curTransElement], System.Enum.GetNames(typeof(EZAnimation.ANIM_TYPE)), GUILayout.Width(150f))); GUILayout.Space(20f); #else GUILayout.Space(0); panel.Transitions.list[curTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.EnumPopup("Type:", panel.Transitions.list[curTrans].animationTypes[curTransElement], GUILayout.Width(220f))); #endif // Draw the input fields for the selected // type's parameters: panel.Transitions.list[curTrans].animParams[curTransElement].DrawGUI(panel.Transitions.list[curTrans].animationTypes[curTransElement], panel.gameObject, this, false); #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) GUI.contentColor = oldColor; #endif EndMonitorChanges(); } else { // Pad the right end of our separator bar: GUILayout.FlexibleSpace(); // Cap off our toolbar-ish separator thingy GUILayout.EndHorizontal(); GUILayout.EndVertical(); } #if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) GUILayout.EndArea(); #endif // Clone this transition as needed: panel.Transitions.CloneAsNeeded(curTrans); }