Ejemplo n.º 1
0
        private void MenuItemSelected(object sender, MenuItemType e)
        {
            switch (e)
            {
            case MenuItemType.NewGane:
                _world.WorldState = WorldState.NewGame;
                _gameState        = SpacetrisGameState.Game;
                break;

            case MenuItemType.Continue:
                _world.WorldState = WorldState.Continue;
                _gameState        = SpacetrisGameState.Game;
                break;

            case MenuItemType.Scores:
                break;

            case MenuItemType.Quit:
                Window.Close();
                break;

            case MenuItemType.Sound:
                break;

            case MenuItemType.Music:
                break;
            }
        }
Ejemplo n.º 2
0
        protected override void Initialize()
        {
            _gameState = SpacetrisGameState.Menu;

            _menu = new Menu();
            _menu.MenuItemSelected += MenuItemSelected;
            _menu.Initialize(Window);

            _world = new World01();
            _world.WorldStateChanged += PlayFieldStateChanged;
            _world.Initialize(Window);

            _world.CreateNewTetromino();
        }
Ejemplo n.º 3
0
        private void PlayFieldStateChanged(object sender, WorldState e)
        {
            switch (e)
            {
            case WorldState.Quit:
#if DEBUG
                "Game Over".Log();
#endif
                _menu.EnableMenuItem(MenuItemType.Continue, false, false);
                _gameState = SpacetrisGameState.Menu;
                break;

            case WorldState.Pause:
#if DEBUG
                "Pause".Log();
#endif
                _menu.EnableMenuItem(MenuItemType.Continue, true);
                _gameState = SpacetrisGameState.Menu;
                break;
            }
        }