Exemple #1
0
        public OptionsState(StateContext context) : base(context)
        {
            InputMap.AddMapping(Terminal.TK_UP, ActionType.MoveUp);
            InputMap.AddMapping(Terminal.TK_DOWN, ActionType.MoveDown);
            InputMap.AddMapping(Terminal.TK_LEFT, ActionType.MoveLeft);
            InputMap.AddMapping(Terminal.TK_RIGHT, ActionType.MoveRight);
            InputMap.AddMapping(Terminal.TK_ENTER, ActionType.Activate);

            var speedPicker = new Picker <GameSpeed>("Speed", HandleChangeSpeed);

            speedPicker.AddOption("Slow", GameSpeed.Slow);
            speedPicker.AddOption("Medium", GameSpeed.Medium);
            speedPicker.AddOption("Fast", GameSpeed.Fast);
            speedPicker.SelectOption(Context.Settings.Speed);

            var themePicker = new Picker <PaletteId>("Palette", HandleChangeTheme);

            themePicker.AddOption("Default", PaletteId.Default);
            themePicker.AddOption("Monochrome", PaletteId.Monochrome);
            themePicker.SelectOption(Context.Settings.PaletteId);

            Menu = new Menu();
            Menu.AddItem(themePicker);
            Menu.AddItem(speedPicker);
            Menu.AddItem(new Button("Return", () => RequestPopState()));
        }