Example #1
0
        /// <summary>
        /// Change the selection in the menu.
        /// </summary>
        public static void changeSelection()
        {
            switch (Event.current.keyCode)
            {
            case KeyCode.DownArrow:
                gotoVariablesDown();
                break;

            case KeyCode.UpArrow:
                gotoVariablesUp();
                break;
            }

            // refresh the editor
            heroEditor.Repaint();
        }
Example #2
0
        // --------------------------------------------------------------
        // Methods (On Click)
        // --------------------------------------------------------------

        /// <summary>
        /// Change the selection in the menu.
        /// </summary>
        public static void changeSelection()
        {
            //// property menu
            //if (propertyFocus)
            //{
            //    switch (Event.current.keyCode)
            //    {
            //        case KeyCode.DownArrow:
            //            gotoStatesFromProperties();
            //            break;
            //    }
            //}

            // property menu
            if (propertyFocus)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:
                    if (heroObject.propertiesList.visible)
                    {
                        gotoPropertiesDown();
                    }
                    else
                    {
                        gotoStatesFromProperties();
                    }
                    break;

                case KeyCode.UpArrow:
                    if (propertyID > -1)
                    {
                        gotoPropertiesUp();
                    }
                    else
                    {
                        gotoPropertiesTitle();
                    }
                    break;

                case KeyCode.Return:
                    heroObject.propertiesList.visible = !heroObject.propertiesList.visible;
                    break;
                }
            }

            // state menu (states)
            else if (stateFocus && typeID == 1)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:

                    // states are expanded
                    if (heroObject.states.visible)
                    {
                        // move from States to first state
                        if (stateID == -1)
                        {
                            gotoStateDown();
                        }

                        // if selected state is expanded, go to first event in state
                        else if (heroObject.states.states[stateID].visible)
                        {
                            gotoEventsFromStateDown();
                        }

                        // go to the next state or to variables
                        else
                        {
                            gotoStateDown();
                        }
                    }

                    // states are collapsed
                    else
                    {
                        gotoVariablesFromStates();
                    }

                    break;

                case KeyCode.UpArrow:
                    // go to properties
                    if (stateID == -1)
                    {
                        gotoPropertiesFromStates();
                    }
                    // go to states
                    if (stateID == 0)
                    {
                        gotoStateUp();
                    }
                    // go to previous state
                    else if (stateID > 0 && !heroObject.states.states[stateID - 1].visible)
                    {
                        gotoStateUp();
                    }
                    // go to last event in previous state
                    else if (stateID > 0 && heroObject.states.states[stateID - 1].visible)
                    {
                        gotoEventsFromStateUp();
                    }
                    break;

                case KeyCode.Return:
                    if (stateID == -1)
                    {
                        heroObject.states.visible = !heroObject.states.visible;
                    }
                    else
                    {
                        heroObject.states.states[stateID].visible = !heroObject.states.states[stateID].visible;
                    }
                    break;
                }
            }

            // state menu (events)
            else if (stateFocus && typeID == 2)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:

                    // events are expanded
                    if (heroObject.states.states[stateID].visible)
                    {
                        // move from state to first event
                        if (eventID == -1)
                        {
                            gotoEventDown();
                        }

                        // if selected event is expanded, go to first action in event
                        else if (heroObject.states.states[stateID].heroEvent[eventID].visible &&
                                 heroObject.states.states[stateID].heroEvent[eventID].actions.Count > 0)
                        {
                            gotoActionsFromEventDown();
                        }

                        // go to the next event or to next state
                        else
                        {
                            gotoEventDown();
                        }
                    }

                    // events are collapsed
                    else
                    {
                        gotoStateFromEventDown();
                    }

                    break;

                case KeyCode.UpArrow:
                    if (eventID > 0)
                    {
                        gotoEventUp();
                    }
                    else
                    {
                        gotoStateFromEventUp();
                    }
                    break;

                case KeyCode.Return:
                    heroObject.states.states[stateID].heroEvent[eventID].visible = !heroObject.states.states[stateID].heroEvent[eventID].visible;
                    break;
                }
            }

            // state menu (actions)
            else if (stateFocus && typeID == 3)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:

                    // actions are expanded
                    if (heroObject.states.states[stateID].heroEvent[eventID].visible)
                    {
                        gotoActionDown();
                    }

                    // actions are collapsed
                    else
                    {
                        gotoEventFromActionDown();
                    }

                    break;

                case KeyCode.UpArrow:
                    if (actionID > 0)
                    {
                        gotoActionUp();
                    }
                    else
                    {
                        gotoEventFromActionUp();
                    }
                    break;

                case KeyCode.Return:
                    heroObject.states.states[stateID].heroEvent[eventID].actions[actionID].visible = !heroObject.states.states[stateID].heroEvent[eventID].actions[actionID].visible;
                    break;
                }
            }

            // variable menu
            else if (variableFocus)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:
                    if (heroObject.lists.visible)
                    {
                        gotoVariablesDown();
                    }
                    else
                    {
                        gotoGlobalsFromVariables();
                    }
                    break;

                case KeyCode.UpArrow:
                    if (variableID > -1)
                    {
                        gotoVariablesUp();
                    }
                    else
                    {
                        gotoStatesFromVariables();
                    }
                    break;

                case KeyCode.Return:
                    heroObject.lists.visible = !heroObject.lists.visible;
                    break;
                }
            }

            // globals menu
            else if (globalFocus)
            {
                switch (Event.current.keyCode)
                {
                case KeyCode.DownArrow:
                    if (heroObject.globalsVisible)
                    {
                        gotoGlobalsDown();
                    }
                    break;

                case KeyCode.UpArrow:
                    if (globalID > -1)
                    {
                        gotoGlobalsUp();
                    }
                    else
                    {
                        gotoVariablesFromGlobals();
                    }
                    break;

                case KeyCode.Return:
                    heroObject.globalsVisible = !heroObject.globalsVisible;
                    break;
                }
            }

            // refresh the editor
            heroEditor.Repaint();
        }