// 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:");

        // Clamp our current "From" transition selection:
        curFromTrans = Mathf.Clamp(curFromTrans, 0, transitions.list.Length - 1);

        // Draw our "From" transition selection
        // as well as our clone button:
        curFromTrans = EditorGUILayout.Popup(curFromTrans, transitions.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");
                transitions.CloneAll(curFromTrans);
                isDirty = true;
            }
        }

        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 = transitions.list[curFromTrans].Add();
            isDirty         = true;
        }
        if (transitions.list[curFromTrans].animationTypes.Length > 0)
        {
            if (GUILayout.Button("-", "toolbarButton"))
            {
                Undo.RegisterUndo(this, "Delete transition element");
                transitions.list[curFromTrans].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, transitions.list[curFromTrans].animationTypes.Length - 1);

        // See if we have more to draw:
        if (transitions.list[curFromTrans].animationTypes.Length > 0)
        {
            // Let the user select the transition element:
            curTransElement = EditorGUILayout.Popup(curTransElement, transitions.list[curFromTrans].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);
            transitions.list[curFromTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.EnumPopup("Type:", transitions.list[curFromTrans].animationTypes[curTransElement]));

            // Draw the input fields for the selected
            // type's parameters:
            transitions.list[curFromTrans].animParams[curTransElement].DrawGUI(transitions.list[curFromTrans].animationTypes[curTransElement], ((MonoBehaviour)control).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:
        transitions.CloneAsNeeded(curFromTrans);
    }
Exemple #2
0
    // Draws all 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);

#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));
        EditorGUIUtility.UseControlStyles();
#else
        GUILayout.BeginVertical("Toolbar");
#endif
        GUI.backgroundColor = backgroundColor;

        GUILayout.BeginHorizontal();
        GUILayout.Space(10.0f);

        GUILayout.Label("Transitions: ");

        // Clamp our current "From" transition selection:
        curFromTrans = Mathf.Clamp(curFromTrans, 0, transitions.list.Length - 1);

        // 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;
        curFromTrans     = EditorGUILayout.Popup(curFromTrans, transitions.GetTransitionNames(), GUILayout.MaxWidth(90f));

        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"))
            {
                transitions.CloneAll(curFromTrans);
                isDirty = true;
            }
        }

        GUI.contentColor = oldColor;
#else
        curFromTrans = EditorGUILayout.Popup(curFromTrans, transitions.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"))
            {
                transitions.CloneAll(curFromTrans);
                isDirty = true;
            }
        }
#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 = transitions.list[curFromTrans].Add();
            isDirty         = true;
        }
        if (transitions.list[curFromTrans].animationTypes.Length > 0)
        {
            if (GUILayout.Button("-"))
            {
                transitions.list[curFromTrans].Remove(curTransElement);
                isDirty = true;
            }
        }
#else
        if (GUILayout.Button("+", "toolbarButton"))
        {
            curTransElement = transitions.list[curFromTrans].Add();
            isDirty         = true;
        }
        if (transitions.list[curFromTrans].animationTypes.Length > 0)
        {
            if (GUILayout.Button("-", "toolbarButton"))
            {
                transitions.list[curFromTrans].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, transitions.list[curFromTrans].animationTypes.Length - 1);

        // See if we have more to draw:
        if (transitions.list[curFromTrans].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, transitions.list[curFromTrans].GetNames(), GUILayout.MaxWidth(110f));
#else
            curTransElement = EditorGUILayout.Popup(curTransElement, transitions.list[curFromTrans].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();


            // Start watching for changes:
            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);
            GUILayout.Label("Type:");
            transitions.list[curFromTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.Popup((int)transitions.list[curFromTrans].animationTypes[curTransElement], System.Enum.GetNames(typeof(EZAnimation.ANIM_TYPE)), GUILayout.Width(150f)));
            GUILayout.Space(20f);
#else
            GUILayout.Space(0);
            transitions.list[curFromTrans].SetElementType(curTransElement, (EZAnimation.ANIM_TYPE)EditorGUILayout.EnumPopup("Type:", transitions.list[curFromTrans].animationTypes[curTransElement], GUILayout.Width(220f)));
#endif
            // Draw the input fields for the selected
            // type's parameters:
            transitions.list[curFromTrans].animParams[curTransElement].DrawGUI(transitions.list[curFromTrans].animationTypes[curTransElement], ((MonoBehaviour)control).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();
        }

        // Clone this transition as needed:
        transitions.CloneAsNeeded(curFromTrans);
    }