Bopycat.Form1.buttonRoll_Click C# (CSharp) Метод

buttonRoll_Click() приватный Метод

private buttonRoll_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Результат void
        private void buttonRoll_Click(object sender, EventArgs e)
        {
            watch.Stop();

            GameStateTurnAction gsta = new GameStateTurnAction(currentGameState.Clone(), watch.ElapsedMilliseconds, TurnAction.Roll);

            turns.Add(gsta);

            textBoxLog.Text += "Turn action added" + " " + watch.ElapsedMilliseconds + "ms." + Environment.NewLine;
            textBoxLog.SelectionStart = textBoxLog.Text.Length;
            textBoxLog.ScrollToCaret();

            buttonRoll.Enabled = false;
            buttonRoll.Visible = false;

            currentGameState.SetDice(random.Next(1, 7), random.Next(1, 7));
            originalGameState = currentGameState.Clone();

            legalPlays = currentGameState.Board.LegalPlays(currentGameState.PlayerOnRoll, currentGameState.Dice);

            if (legalPlays.Count == 0)
            {
                this.Render();
                this.Refresh();

                legalPlays.Clear();
                madeMoves.Clear();
                unusedDice.Clear();

                currentGameState.ChangeTurn();

                Thread.Sleep(1000);

                UpdateControls();

                return;
            }

            unusedDice.AddRange(currentGameState.Dice);

            if (currentGameState.Dice[0] == currentGameState.Dice[1])
                unusedDice.AddRange(currentGameState.Dice);

            UpdateControls();
        }