private void NewGameButton_Click(object sender, RoutedEventArgs e)
        {
            var level = Levels.SelectedItem as GameLevel;

            LevelDefinition.CreateLevels();

            Game.NewGame(level);
            levelPresenter.SetLevel(level);

            Levels.SelectedItem = null;
        }
Exemplo n.º 2
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Game.Init(GameCanvas);
            Game.SetInformationControls(LifeLabel, MoneyLabel, ScoreLabel, TimeLabel, LengthLabel);

            Game.Timer.Tick += new GameTimer.TickEventHandler((o, a) => gameFPSPresenterControl.Tick());

            Game.TowerSelected        += new Game.TowerHandler(ShowTowerInfo);
            Game.MonsterDied          += new Game.MonsterHandler((a) => UpdateTowerUpgradePossibility());
            Game.MonsterSelected      += new Game.MonsterHandler(ShowMonsterInfo);
            Game.BlockDetected        += new Game.BlockDetectedHandler(BlockDetectedAlert);
            Game.GameOver             += new GameLevel.LevelHandler(GameOver);
            Game.GameStarted          += new Game.GameEventHandler(GameStarted);
            Game.CurrentLevelCompeted += new GameLevel.LevelHandler(LevelCompleted);

            ShowTowerInfo(new TowerArg(null));
            AddTowerBtn_MouseLeave(sender, null);

            LevelDefinition.CreateLevels();
            gameMenuControl.SetLevelSource(LevelDefinition.MainGameLevelList);
            gameMenuControl.SetLevelPresenter(gameLevelPresenterControl);
            ShowGameMenu("Новая игра", string.Format("Здравствуй, {0}!", Environment.UserName), 0.0, 2.0);
        }