コード例 #1
0
        public void StartNewGame()
        {
            MainWindow.Close();

            MainWindow                 = new MainWindow();
            this.GS                    = new GameState();
            GS.PlayerNames             = NewGameOptions.PlayerNames;
            GS.AI                      = NewGameOptions.PlayerAI;
            VM_MainWindow              = new VM_MainWindow(GS, this);
            VM_MainWindow.PlayerColors = NewGameOptions.PlayerColors;
            MainWindow.DataContext     = VM_MainWindow;
            MainWindow.Show();
            NewGameWindow.Close();
        }
コード例 #2
0
        private void CreateGame()
        {
            try
            {
                if (Player1 == null || Player2 == null)
                {
                    throw new Exception("Both players must be selected.");
                }

                Player p1 = Player1.CreatePlayer(PlayerToken.O);
                Player p2 = Player2.CreatePlayer(PlayerToken.X);

                MainWindow gameWindow = new MainWindow(p1, p2);
                gameWindow.Show();

                window.Close();
            }
            catch (Exception e)
            {
                MessageBoxFactory.ShowError(e);
            }
        }