Esempio n. 1
0
        private void ChangeVolumeMenu()
        {
            MenuIcon musicVolumeUp   = new MenuIcon(Language.Instance.GetString("MusicVolumeUp"));
            MenuIcon musicVolumeDown = new MenuIcon(Language.Instance.GetString("MusicVolumeDown"));
            MenuIcon sfxVolumeUp     = new MenuIcon(Language.Instance.GetString("EffectsVolumeUp"));
            MenuIcon sfxVolumeDown   = new MenuIcon(Language.Instance.GetString("EffectsVolumeDown"));
            MenuIcon empty           = new MenuIcon("");
            MenuIcon done            = new MenuIcon(Language.Instance.GetString("Cancel"), Recellection.textureMap.GetTexture(Globals.TextureTypes.No));

            List <MenuIcon> iconList = new List <MenuIcon>();;

            iconList.Add(musicVolumeUp);
            iconList.Add(empty);
            iconList.Add(musicVolumeDown);
            iconList.Add(sfxVolumeUp);
            iconList.Add(sfxVolumeDown);
            iconList.Add(done);

            Menu volumeMenu = new Menu(Globals.MenuLayout.NineMatrix, iconList, "");

            MenuController.LoadMenu(volumeMenu);

            bool notFinished = true;

            while (notFinished)
            {
                MenuIcon response = MenuController.GetInput();

                if (response == musicVolumeUp)
                {
                    if (GameOptions.Instance.musicVolume <= 1.0f)
                    {
                        SoundsController.changeMusicVolume(GameOptions.Instance.musicVolume + 0.1f);
                    }
                }
                else if (response == musicVolumeDown)
                {
                    SoundsController.changeMusicVolume(GameOptions.Instance.musicVolume - 0.1f);
                }
                else if (response == sfxVolumeUp)
                {
                    if (GameOptions.Instance.sfxVolume <= 1.0f)
                    {
                        SoundsController.changeEffectsVolume(GameOptions.Instance.sfxVolume + 0.1f);
                    }
                }
                else if (response == sfxVolumeDown)
                {
                    SoundsController.changeEffectsVolume(GameOptions.Instance.sfxVolume - 0.1f);
                }
                else if (response == done)
                {
                    notFinished = false;
                }
            }
            MenuController.UnloadMenu();
        }
Esempio n. 2
0
        public void ChangeOptions()
        {
            Menu optionsMenu = BuildMenu();

            MenuController.LoadMenu(optionsMenu);

            Recellection.CurrentState = MenuView.Instance;
            bool notFinished = true;

            while (notFinished)
            {
                MenuIcon response = MenuController.GetInput();

                if (response == mute)
                {
                    if (GameOptions.Instance.musicMuted)
                    {
                        GameOptions.Instance.musicMuted = false;
                        SoundsController.changeEffectsVolume(GameOptions.Instance.sfxVolume);
                        SoundsController.changeMusicVolume(GameOptions.Instance.musicVolume);
                    }
                    else
                    {
                        GameOptions.Instance.musicMuted = true;
                        SoundsController.changeEffectsVolume(0.0f);
                        SoundsController.changeMusicVolume(0.0f);
                    }
                }
                else if (response == volume)
                {
                    ChangeVolumeMenu();
                }
                else if (response == language)
                {
                    ChangeLanguageMenu();
                }
                else if (response == difficulty)
                {
                    ChangeDifficultyMenu();
                }
                else if (response == back)
                {
                    notFinished = false;
                }
                else if (response == credits)
                {
                    PlayCredits();
                }
            }
            MenuController.UnloadMenu();
        }