コード例 #1
0
ファイル: Game.cs プロジェクト: Revenege/Durak
        /// <summary>
        /// Ends the Current turn, checks for winners
        /// </summary>
        private void EndTurn()
        {
            //Determine if the Player has lost
            int hasPlayerLost = 0;

            for (int i = 0; i < Players.PlayerCount; i++)
            {
                if (Players.GetPlayer(i).WinStatus == true)
                {
                    hasPlayerLost++;
                }
            }
            //If there is only one player remaining, the player has lost
            if (hasPlayerLost == Players.PlayerCount - 1)
            {
                MessageBox.Show("Too bad, you are the Durak!");
                this.Close();
            }
            game.Table.InPlay.Clear();
            pnlTable.Controls.Clear();
            //Begin the next Turn by advancing the turn
            attacker = Players.GetNextPlayer();
            defender = Players.PeakNextPlayer();
            //Drawing to the max number of cards possilbe
            game.DrawToMax();

            //Set the deck size
            lblDeckSize.Text = game.GetCardsRemaining().ToString();
            //If the next player is an AI, post which one
            if (attacker.IsAi == true)
            {
                //txtCardPlayed.Text += "\nIt is now "+Players.GetCurrentPlayer().Name +" Turn";
                DisplayOutput("It is now " + Players.GetCurrentPlayer().Name + " Turn");
                //Advance the turn
                AiTurn('A');
            }
            else
            {
                //Advance the turn ater setting the playState
                //btnAccept.Enabled = true;

                DisplayOutput("It is now your turn");

                //lblTempOutput.Text = game.ShowHand(attacker);
                playState = 'A';
            }
        }