示例#1
0
        public void doTask()
        {
            if (task != Task.TYPE)
            {
                frame.setIsTyping(false);
            }
            switch (task)
            {
            case Task.UNPAUSE:
                main.unpause();
                break;

            case Task.SET_MODE:
                Mode mode;
                Enum.TryParse(set, out mode);
                main.setMode(mode);
                break;

            case Task.CLOSE:
                main.Close();
                break;

            case Task.SET_PAUSE:
                if (main.getMode() != Mode.PAUSE)
                {
                    main.setMode(Mode.PAUSE);
                }
                main.setPauseFrame(set);
                break;

            case Task.SET_MENU:
                if (main.getMode() != Mode.MENU)
                {
                    main.setMode(Mode.MENU);
                }
                main.setMenuFrame(set);
                break;

            case Task.SWITCH_CONTROLS:
                main.getSettings().switchControlMode();
                List <Player> players = main.getLevel().getPlayers();
                players[0].setControls(
                    main.getSettings().getControlMode());

                if (players.Count > 1)
                {
                    players[1].setControls(1 -
                                           main.getSettings().getControlMode());
                }

                main.refreshPauseFrame();
                break;

            case Task.SWITCH_FOLLOW:
                main.getSettings().switchFollowMode(Int32.Parse(set));
                main.getLevel().setCamera(
                    main.getSettings().getFollowMode());
                main.refreshPauseFrame();
                break;

            case Task.SWITCH_PERIOD:
                main.getSettings().switchPeriod(Int32.Parse(set));
                main.applySettings();
                main.refreshPauseFrame();
                break;

            case Task.SWITCH_WINDOW:
                main.getSettings().switchWindowMode();
                main.applySettings();
                main.refreshPauseFrame();
                break;

            case Task.SWITCH_HUD:
                main.getSettings().switchHUDStatus();
                main.applySettings();
                main.refreshPauseFrame();
                break;

            case Task.TYPE:
                frame.setIsTyping(!frame.getIsTyping());
                break;

            case Task.SAVE_EDITOR:
                main.launchSaveEditor();
                break;
            }
        }