예제 #1
0
        public StartState(BaseGame grid, IComponent parent)
            : base(grid, parent)
        {
            var g = 0;

            for (int index = 0; index < grid.GameData.Data.GameGridsVsMode.Count; index++)
            {
                if (grid.GameData.Data.GameGridsVsMode[index].Locked)
                {
                    g = index - 1;
                    break;
                }
            }
            GameType = new GameType {
                Players = 2, Difficulty = grid.GameData.Data.Difficulty, Grid = g
            };
            // _nextComponent = this;
            _nextItem = new MenuItem(grid,
                                     grid.Font.MeasureString(
                                         new Vector2(10, 100),
                                         Strings.Next), Strings.Next);
            _playerItem = new PlayersMenuItem(grid,
                                              grid.Font.MeasureString(
                                                  new Vector2(10, _nextItem.Bounds.Y + _nextItem.Bounds.Height),
                                                  Strings.PlayersMStr), () => GameType.Players, p => { GameType.Players = p; }, "PLAYERS");
            _gameGridItem = new GridMenuItem(grid, grid.Font.MeasureString(new Vector2(10, _playerItem.Bounds.Y + _playerItem.Bounds.Height), "GRID 00x00"),
                                             () => GameType.Grid,
                                             p => { GameType.Grid = p; }, Strings.Grid);
            _difficultyItem = new DifficultyMenuItem(grid,
                                                     grid.Font.MeasureString(
                                                         new Vector2(10, _gameGridItem.Bounds.Y + _gameGridItem.Bounds.Height), "NORMAL"), () => GameType.Difficulty, p =>
            {
                GameType.Difficulty           = p;
                grid.GameData.Data.Difficulty = p;
            },
                                                     Strings.Difficulty);
            _backItem = new MenuItem(grid,
                                     grid.Font.MeasureString(
                                         new Vector2(10, _difficultyItem.Bounds.Y + _difficultyItem.Bounds.Height),
                                         Strings.Back), Strings.Back);
            _menu = new Menu(grid, HandleMenuSelect,
                             _nextItem,
                             _playerItem,
                             _gameGridItem,
                             _difficultyItem,
                             _backItem
                             );
            _stageLocked = new Tween(new TimeSpan(0, 0, 0, 1), 1, 0);
            _stageLocked.Finish();
        }
        public PlayerSelectArena(Golf game, BaseArena previousArena, List <Player> players) : base(game, previousArena)
        {
            Players = players;

            var nextItem = new MenuItem(game, Fonts.GameFont.MeasureString(
                                            new Vector2(10, 100),
                                            Strings.Next), Strings.Next);
            var playerItem = new PlayersMenuItem(game,
                                                 Fonts.GameFont.MeasureString(
                                                     new Vector2(10, nextItem.Bounds.Y + nextItem.Bounds.Height),
                                                     Strings.PlayersMStr), () => Game.GameSettings.Players, p => { Game.GameSettings.Players = p; }, Strings.Players);

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

            Maps = new List <SMap>(game.CustomGameStorage.LoadMaps().Maps);
            if (!Maps.Any())
            {
                Game.CustomGameStorage.AddMap(new TestMap().ToSMap());
                Maps = new List <SMap>(game.CustomGameStorage.LoadMaps().Maps);
            }
            CustomLevelSelector = new CustomLevelSelector(Maps);
            NormalLevelSelector = new NormalLevelSelector();
            MapChooser          = new MapChooser(game, new Rectangle((int)Game.Center.X - ((Textures.MapBorder.Width + (Textures.Back.Width * 2)) / 2), 100, Textures.MapBorder.Width, Textures.MapBorder.Height), string.Empty, gameType.GameType == GameType.Normal?NormalLevelSelector:CustomLevelSelector, this);
            _menu = Maps.Any()? new Menu(Game, HandleMenuSelect,
                                         nextItem,
                                         playerItem,
                                         gameType,
                                         backItem
                                         ): new Menu(Game, HandleMenuSelect,
                                                     nextItem,
                                                     playerItem,
                                                     backItem
                                                     );
        }