Ejemplo n.º 1
0
        public GameSettings(BaseGame grid, IComponent parent)
            : base(grid, parent)
        {
            _enableEffects = new CheckedMenuItem(grid,
                                                 grid.Font.MeasureString(new Vector2(10, 100), Strings.EffectsUc), () => Game.Audio.EnableAudio,
                                                 p => { Game.Audio.EnableAudio = p; },
                                                 Strings.EffectsUc);
            _effectVolume = new ScaleMenuItem(grid,
                                              grid.Font.MeasureString(new Vector2(10, _enableEffects.Bounds.Y + _enableEffects.Bounds.Height), Strings.EffectVolume + MaxPercent), () => Game.Audio.EffectVolume,
                                              p => { Game.Audio.EffectVolume = p; }, Strings.EffectVolume);
            _musicVolume = new ScaleMenuItem(grid,
                                             grid.Font.MeasureString(new Vector2(10, _effectVolume.Bounds.Y + _effectVolume.Bounds.Height), Strings.MusicVolume + MaxPercent), () => Game.Audio.MusicVolume,
                                             p => { Game.Audio.MusicVolume = p; }, Strings.MusicVolume);

            MenuItem backItem = new MenuItem(grid,
                                             grid.Font.MeasureString(new Vector2(10, _musicVolume.Bounds.Y + _musicVolume.Bounds.Height), Strings.Back),
                                             Strings.Back);

            _menu = new Menu(grid, HandleMenuSelect,
                             _enableEffects,
                             _effectVolume,
                             _musicVolume,
                             backItem
                             );
        }
Ejemplo n.º 2
0
        public SettingsArena(Golf game, BaseArena previousArena) : base(game, previousArena)
        {
            var effectVolume = new ScaleMenuItem(game,
                                                 Fonts.GameFont.MeasureString(new Vector2(10, 100), Strings.EffectVolume + MaxPercent), () => Game.Sounds.EffectVolume,
                                                 p => { Game.Sounds.SetEffectVolume(p); }, Strings.EffectVolume);
            var musicVolume = new ScaleMenuItem(game,
                                                Fonts.GameFont.MeasureString(new Vector2(10, effectVolume.Bounds.Y + effectVolume.Bounds.Height), Strings.MusicVolume + MaxPercent), () => Game.Sounds.MusicVolume,
                                                p => { Game.Sounds.SetMusicVolume(p); }, Strings.MusicVolume);

            var tileSets = new TileSetMenuItem(game,
                                               Fonts.GameFont.MeasureString(new Vector2(10, musicVolume.Bounds.Y + musicVolume.Bounds.Height), Strings.RoadBlock), () => Array.IndexOf(Game.TileSets, Game.TileSet),
                                               p => { Game.TileSet = Game.TileSets[p]; }, Strings.TileSet, new List <int> {
                0, 1, 2, 3
            });

            var backItem = new MenuItem(game,
                                        Fonts.GameFont.MeasureString(new Vector2(10, tileSets.Bounds.Y + tileSets.Bounds.Height), Strings.Back),
                                        Strings.Back);

            _menu = new Menu(Game, HandleMenuSelect,
                             effectVolume,
                             musicVolume,
                             tileSets,
                             backItem
                             );
        }