Beispiel #1
0
    void KeyAction(string key)
    {
        if (g.inputMode == inputModes.moving)
        {
            if (key == g.aButton)
            {
                gui.OpenOOCMenu();
                g.inputMode = inputModes.oocMenuRoot;
            }

            if (p.CheckCollision(key))
            {
                p.MoveThisSprite(key);
            }
        }
        else if (g.inputMode == inputModes.combatMove)
        {
            if (key == g.aButton)
            {
                c.EndPlayerMovement();
            }
            else if (key == g.bButton)
            {
                c.CancelPlayerMovement();
            }
            else
            {
                if (p.CheckCollision(key) && p.CheckMoveBoundary(key))
                {
                    if (!p.FleeingDirection(key))
                    {
                        p.MoveThisSprite(key);
                    }
                    else
                    {
                        gui.UpdateCombatFeedback("Can't escape yet!");
                    }
                }
            }
        }
        else if (g.inputMode == inputModes.combatCommand)
        {
            if (key == g.upButton ||
                key == g.downButton ||
                key == g.leftButton ||
                key == g.rightButton)
            {
                gui.MoveCombatSel(key);
            }

            if (key == g.aButton)
            {
                gui.ConfirmCombatSel();
            }
        }
        else if (g.inputMode == inputModes.oocMenuRoot)
        {
            if (key == g.aButton)
            {
                gui.ConfirmOOCSel();
            }
            else if (key == g.bButton)
            {
                gui.CloseOOCMenu();
                g.inputMode = inputModes.moving;
            }
        }
        else if (g.inputMode == inputModes.selectToTalk)
        {
            if (key == g.bButton)
            {
                gui.HideMapSelector();
                g.inputMode = inputModes.moving;
            }
            else if (key == g.aButton)
            {
                gui.StartConversation();
            }
            else if (key == g.rightButton || key == g.upButton)
            {
                gui.SelectNextOnMap(false);
            }
            else if (key == g.leftButton || key == g.downButton)
            {
                gui.SelectNextOnMap(true);
            }
        }
        else if (g.inputMode == inputModes.convoListen)
        {
            if (key == g.aButton || key == g.bButton)
            {
                gui.AdvanceConvo();
            }
        }
        else if (g.inputMode == inputModes.convoSpeak)
        {
            if (key == g.downButton || key == g.upButton || key == g.aButton || key == g.bButton)
            {
                gui.ConvoSel(key);
            }
        }
    }