示例#1
0
        public void AddChipsIfLost()
        {
            if (this.currentForm.playerChips <= 0)
            {
                AddChipsWhenLost AchipsWhenLost = new AddChipsWhenLost();
                AchipsWhenLost.ShowDialog();

                if (AchipsWhenLost.AddChipsValue != 0)
                {
                    this.currentForm.playerChips = AchipsWhenLost.AddChipsValue;
                    this.currentForm.botOneChips += AchipsWhenLost.AddChipsValue;
                    this.currentForm.botTwoChips += AchipsWhenLost.AddChipsValue;
                    this.currentForm.botThreeChips += AchipsWhenLost.AddChipsValue;
                    this.currentForm.botFourChips += AchipsWhenLost.AddChipsValue;
                    this.currentForm.botFiveChips += AchipsWhenLost.AddChipsValue;
                    this.currentForm.hasPlayerBankrupted = false;
                    this.currentForm.playerTurn = true;
                    this.currentForm.playerRaiseButton.Enabled = true;
                    this.currentForm.playerFoldButton.Enabled = true;
                    this.currentForm.playerCheckButton.Enabled = true;
                    this.currentForm.playerRaiseButton.Text = "Raise";
                }
            }
        }
        async Task Finish(int n)
        {
            if (n == 2)
            {
                this.winner.FixWinners();
            }

            this.callChipsValue = this.bigBlind;
            this.Raise = 0;
            this.foldedPlayers = 5;
            this.type = 0;
            this.totalRounds = 0;
            this.botOnePower = 0;
            this.botTwoPower = 0;
            this.botThreePower = 0;
            this.botFourPower = 0;
            this.botFivePower = 0;
            this.playerPower = 0;
            this.playerType = -1;
            this.Raise = 0;

            this.botOneType = -1;
            this.botTwoType = -1;
            this.botThreeType = -1;
            this.botFourType = -1;
            this.botFiveType = -1;

            this.botOneTurn = false;
            this.botTwoTurn = false;
            this.botThreeTurn = false;
            this.botFourTurn = false;
            this.botFiveTurn = false;

            this.hasBotOneBankrupted = false;
            this.hasBotTwoBankrupted = false;
            this.hasBotThreeBankrupted = false;
            this.hasBotFourBankrupted = false;
            this.hasBotFiveBankrupted = false;

            this.hasPlayerFolded = false;
            this.botOneFolded = false;
            this.botTwoFolded = false;
            this.botThreeFolded = false;
            this.botFourFolded = false;
            this.botFiveFolded = false;

            this.hasPlayerBankrupted = false;
            this.playerTurn = true;
            this.shouldRestart = false;
            this.isRaising = false;

            this.playerCall = 0;
            this.botOneCall = 0;
            this.botTwoCall = 0;
            this.botThreeCall = 0;
            this.botFourCall = 0;
            this.botFiveCall = 0;

            this.playerRaise = 0;
            this.botOneRaise = 0;
            this.botTwoRaise = 0;
            this.botThreeRaise = 0;
            this.botFourRaise = 0;
            this.botFiveRaise = 0;

            this.height = 0;
            this.width = 0;
            this.winners = 0;

            this.maxLeft = 6;
            this.last = 0;
            this.raisedTurn = 1;

            this.bankruptPlayers.Clear();

            this.CheckWinners.Clear();

            this.totalAllInChips.Clear();

            this.winningingHands.Clear();

            this.sorted.Current = 0;
            this.sorted.Power = 0;
            this.potTextBox.Text = @"0";
            this.t = 60;
            this.turnCount = 0;

            this.playerStatus.Text = string.Empty;
            this.botOneStatus.Text = string.Empty;
            this.botTwoStatus.Text = string.Empty;
            this.botThreeStatus.Text = string.Empty;
            this.botFourStatus.Text = string.Empty;
            this.botFiveStatus.Text = string.Empty;

            if (this.playerChips <= 0)
            {
                AddChipsWhenLost addChipsWhenLost = new AddChipsWhenLost();
                addChipsWhenLost.ShowDialog();

                if (addChipsWhenLost.AddChipsValue != 0)
                {
                    this.playerChips = addChipsWhenLost.AddChipsValue;
                    this.botOneChips += addChipsWhenLost.AddChipsValue;
                    this.botTwoChips += addChipsWhenLost.AddChipsValue;
                    this.botThreeChips += addChipsWhenLost.AddChipsValue;
                    this.botFourChips += addChipsWhenLost.AddChipsValue;
                    this.botFiveChips += addChipsWhenLost.AddChipsValue;

                    this.hasPlayerBankrupted = false;
                    this.playerTurn = true;
                    this.playerRaiseButton.Enabled = true;
                    this.playerFoldButton.Enabled = true;
                    this.playerCheckButton.Enabled = true;
                    this.playerRaiseButton.Text = @"Raise";
                }
            }

            this.ImgLocation = Directory.GetFiles("Assets\\Cards", "*.png", SearchOption.TopDirectoryOnly);

            for (int cardNumber = 0; cardNumber < 17; cardNumber++)
            {
                this.cardsImages[cardNumber].Image = null;
                this.cardsImages[cardNumber].Invalidate();
                this.cardsImages[cardNumber].Visible = false;
            }

            await this.Shuffle();
        }