Beispiel #1
0
        protected override void LoadContent()
        {
            GameDatas.GameFocus = true;
            IsMouseVisible = true;

            _spriteBatch = new SpriteBatch(GraphicsDevice);

            _gameStates = new Stack<GameState>();

            //////////////////////////////////////////////////////////

            GameDatas.Theme = new Theme("PinkTheme", 10, 40, 17, 3, 28, 33, 5, 50, 48);

            GameDatas.Theme.Load(Content);

            //////////////////////////////////////////////////////////

            _graphics.PreferredBackBufferWidth = GameDatas.Theme.GridTexture.Width*2 + 50;
            _graphics.PreferredBackBufferHeight = GameDatas.Theme.GridTexture.Height +
                                                  GameDatas.Theme.LogoTexture.Height + 50;
            _graphics.ApplyChanges();

            GameDatas.WindowWidth = Window.ClientBounds.Width;
            GameDatas.WindowHeight = Window.ClientBounds.Height;

            //////////////////////////////////////////////////////////

            var logo = new MenuPassive(GameDatas.Theme.LogoTexture);
            var comeBackButton = new MenuButton("Come Back :D");

            // CREATION MENU CREATE GAME

            var createNameTextBox = new MenuTextBox("What's your name?");
            var submitCreateGame = new MenuButton("Go !") {Click = CreateGame};

            var createGameMenuItems = new List<MenuItem> {logo, createNameTextBox, submitCreateGame, comeBackButton};
            var createGameMenuState = new MenuState(createGameMenuItems, true);
            createGameMenuState.SetPositions();
            submitCreateGame.subMenu = createGameMenuState;

            // CREATION MENU JOIN GAME

            var joinNameTextBox = new MenuTextBox("What's your name?");
            var serverIpTextBox = new MenuTextBox("IP Server :D");
            var submitJoinGame = new MenuButton("Go !");

            var joinGameMenuItems = new List<MenuItem> {logo, joinNameTextBox, serverIpTextBox, submitJoinGame, comeBackButton};
            var joinGameMenuState = new MenuState(joinGameMenuItems, true);
            joinGameMenuState.SetPositions();
            submitJoinGame.subMenu = joinGameMenuState;
            submitJoinGame.Click = JoinGame;
            comeBackButton.Click = _comeBack;

            // CREATION MENU ACCUEIL

            var createGameButton = new MenuButton("Create a Game");
            var joinGameButton = new MenuButton("Join a Game");

            createGameButton.subMenu = createGameMenuState;
            createGameButton.Click = _launchMenu;
            joinGameButton.subMenu = joinGameMenuState;
            joinGameButton.Click = _launchMenu;

            var homeMenuItems = new List<MenuItem> {logo, createGameButton, joinGameButton};
            var homeMenuState = new MenuState(homeMenuItems, true);
            homeMenuState.SetPositions();

            // FIN CREATION MENUS

            _gameStates.Push(homeMenuState);
            _gameStates.Peek().Initialize();
            _gameStates.Peek().LoadContent(Content);
        }
Beispiel #2
0
        public override void LoadContent(ContentManager content)
        {
            var gameOverPassive = new MenuPassive(GameDatas.Theme.GameOverTexture);
            var gameOverItems = new List<MenuItem> {gameOverPassive};

            _gameOverMenuState = new MenuState(gameOverItems, true);
            _gameOverMenuState.SetPositions();
        }