예제 #1
0
 void options_DisplayModeChanged(Options options, GameManagement.DisplayMode mode)
 {
     tempDisplayMode = mode;
 }
예제 #2
0
        public override CurrentMenu Update(GameTime gametime, Inputhandler inputhandler)
        {
            CurrentMenu menu = CurrentMenu.Options;
            base.DoUpDownMovement(gametime, inputhandler);
            if (inputhandler.GetNewPressedMenuKeys.Contains(MenuKeys.Left) || inputhandler.GetNewPressedMenuKeys.Contains(MenuKeys.Right))
            {
                int relative = inputhandler.GetNewPressedMenuKeys.Contains(MenuKeys.Left) ? -1 : 1;
                switch (current_position)
                {
                    case (int)OptionsMenuPositions.Resolution:
                        tempRes = Resolution.GetAvailableResolutions.GetRelativeElement(currentResPos, relative);
                        try
                        {
                            currentResPos = Resolution.GetAvailableResolutions.IndexOf(tempRes);
                        }
                        catch (Exception)
                        {
                            currentResPos = 0;
                        }
                        break;
                    case (int)OptionsMenuPositions.Shader_Quality:
                        options.QualitySettings[OptionsID.ShaderQuality] = options.QualitySettings[OptionsID.ShaderQuality].GetRelativeElement(relative);
                        break;
                    case (int)OptionsMenuPositions.Post_Process_Quality:
                        options.QualitySettings[OptionsID.PostProcessQuality] = options.QualitySettings[OptionsID.PostProcessQuality].GetRelativeElement(relative);
                        break;
                    case (int)OptionsMenuPositions.Particle_Quality:
                        options.QualitySettings[OptionsID.ParticleQuality] = options.QualitySettings[OptionsID.ParticleQuality].GetRelativeElement(relative);
                        break;
                    case (int)OptionsMenuPositions.Controller:
                        options.Controller = options.Controller.GetRelativeElement(relative);
                        break;
                    case (int)OptionsMenuPositions.Display_Mode:
                        tempDisplayMode = options.DisplayMode.GetRelativeElement(relative);
                        break;
                    case (int)OptionsMenuPositions.Music_Volume:
                        options.MusicVolume = options.MusicVolume + relative * 5;
                        break;
                }
                RecreateStrings();
            }
            if (inputhandler.GetNewPressedMenuKeys.Contains(MenuKeys.Back))
                menu = CurrentMenu.MainMenu;
            if (inputhandler.GetNewPressedMenuKeys.Contains(MenuKeys.Enter))
            {
                switch (current_position)
                {
                    case (int)OptionsMenuPositions.Back:
                        menu = CurrentMenu.MainMenu;
                        break;
                    case (int)OptionsMenuPositions.Apply:
                        options.DisplayMode = tempDisplayMode;
                        options.Resolution = tempRes;
                        RecreateStrings();
                        break;
                }
            }

            return menu;
        }
예제 #3
0
 protected override void InitializeMenu()
 {
     OptionsMenuPositions[] optionsButtons = (OptionsMenuPositions[])Enum.GetValues(typeof(OptionsMenuPositions));
     string[] buttons = new string[optionsButtons.Length];
     lists = new MenuList[1];
     lists[0] = new MenuList("Options", buttons);
     lists[0].SetActiveButton(0);
     tempRes = options.Resolution;
     tempDisplayMode = options.DisplayMode;
     options.DisplayModeChanged += new DisplayModeChangedEventHandler(options_DisplayModeChanged);
     options.ResolutionChanged += new ResolutionChangedEventHandler(options_ResolutionChanged);
     RecreateStrings();
 }