Exemple #1
0
    private void UpdateControlsInner()
    {
        cursor2Display.SetRightVisibility();
        cursor3.SetVisibility(true);
        cursor.SetVisibility(false);
        bool isP1 = cursor3.getX() == 0;

        if (controlsPos == 4)
        {
            if (controlsScreen.HasReturnedToNormal())
            {
                controlsPos = 3;
            }
        }
        else if (controlsPos == 3)
        {
            if (Input.GetKeyDown(KeyCode.Escape) || controlsScreen.ClickingCancelButton(clicker))
            {
                SignalFailure();
                controlsPos = 1;
                controlsScreen.UndoQuestion(cursor2.getY(), isP1);
            }
            else
            {
                int key = controlsScreen.DetectKeyInput();
                int cy  = cursor2.getY();
                if (key >= 0 && (KeyCode)key != KeyCode.Mouse0)
                {
                    controlsScreen.ChangeKey(cursor2.getY(), key, isP1);
                    if (cy == 0)
                    {
                        controlsPos = 1;
                    }
                    else
                    {
                        cursor2.setY(cy - 1);
                        cursor2Display.UpdatePosition(cy - 1);
                        controlsScreen.SetToQuestion(cy - 1, isP1);
                    }
                    return;
                }
                string axis = controlsScreen.DetectAxisInput();
                if (!string.IsNullOrEmpty(axis))
                {
                    controlsScreen.ChangeAxis(cursor2.getY(), axis, isP1);
                    if (cy == 0)
                    {
                        controlsPos = 1;
                    }
                    else
                    {
                        cursor2.setY(cy - 1);
                        cursor2Display.UpdatePosition(cy - 1);
                        controlsScreen.SetToQuestion(cy - 1, isP1);
                        controlsPos = 4;
                    }
                    return;
                }
            }
        }
        else if (controlsPos == 2)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                SignalFailure();
                controlsPos = 1;
                controlsScreen.UndoQuestion(cursor2.getY(), isP1);
            }
            else
            {
                int key = controlsScreen.DetectKeyInput();
                if (key >= 0 && (KeyCode)key != KeyCode.Mouse0)
                {
                    controlsScreen.ChangeKey(cursor2.getY(), key, isP1);
                    controlsPos = 1;
                    cursor2.FreezyPop(PD.KEY_DELAY * 2);
                    return;
                }
                string axis = controlsScreen.DetectAxisInput();
                if (!string.IsNullOrEmpty(axis))
                {
                    controlsScreen.ChangeAxis(cursor2.getY(), axis, isP1);
                    controlsPos = 1;
                    cursor2.FreezyPop(PD.KEY_DELAY * 2);
                    return;
                }
            }
        }
        else if (controlsPos == 1)
        {
            cursor2.DoUpdate();
            int cy = cursor2.getY();
            cursor2Display.UpdatePosition(cy);
            if (cursor2.launchOrPause())
            {
                SelectControlChange();
            }
            else if (cursor2.back())
            {
                controlsPos = 0;
                SignalFailure();
            }
        }
    }