예제 #1
0
        public void ConfirmPlayer(int gameSize, Player p1, Player p2, bool confirmationRequired, int gameId)
        {
            gameOption = "player";
            DialogResult dialogResult = MessageBox.Show(p2.First_Name + ": " + p1.First_Name + " wants to play against you ", "Confirmation", MessageBoxButtons.YesNo);
            player2 = p1;
            if (dialogResult == DialogResult.Yes)
            {
                gameboard = new GameBoardWPF(gameId, size, "player", p2, p1, confirmationRequired);
                elementHost1.Child = gameboard;

                c.playerConfirmed(p1, p2);
                GameBoardPanel.Visible = true;
                GameInfoPanel.Visible = true;
            }
            else if (dialogResult == DialogResult.No)
            {
                //do something else
            }
        }
예제 #2
0
        private void StartGameBtn_Click(object sender, EventArgs e)
        {
            if(!recordGame.Text.Equals("")) // select recordGame id
            {
                gameId = Convert.ToInt32(recordGame.Text);
                GameMove[] moves = c.GetGameMoves(gameId);

                gameboard = new GameBoardWPF(gameId, moves, confirmation);
                elementHost1.Child = gameboard;
            }
            else
            {
                gameId = c.AddGame(champId, player1, player2, size);
                c.AddPlayerToChamp(player1, champId);
                if (gameOption == "computer") // vs computer
                {
                    gameboard = new GameBoardWPF(gameId, size, gameOption, player1, player2, confirmation);
                    elementHost1.Child = gameboard;
                }
                else                          // vs player
                {
                    gameboard = new GameBoardWPF(gameId, size, gameOption, player1, player2, confirmation,c);
                    elementHost1.Child = gameboard;
                }
                c.AddAdvisor(player1, advisors.ToArray(), gameId);
                c.GameInfo(size, gameOption);

            }
            GameBoardPanel.Visible = true;
            GameInfoPanel.Visible = true;
        }
예제 #3
0
 private void newGameBtn_Click(object sender, EventArgs e)
 {
     gameId = c.AddGame(champId, player1, player2, size);
     gameboard = new GameBoardWPF(gameId, size, gameOption, player1, player2, confirmation);
     elementHost1.Child = gameboard;
     c.AddAdvisor(player1, advisors.ToArray(), gameId);
     c.GameInfo(size, gameOption);
 }