コード例 #1
0
ファイル: Form1.cs プロジェクト: ogrish55/Mastermind
        private void UpdateUI()
        {
            Score score;

            switch (nodeController.Round)
            {
            case 1:
                for (int i = 0; i < roundOneLabels.Count; i++)
                {
                    roundOneLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox1.Visible = true;
                score             = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore1.Text  = ($"White points: {score.WhitePoint}");
                BlackScore1.Text  = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 2:
                for (int i = 0; i < roundTwoLabels.Count; i++)
                {
                    roundTwoLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox2.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore2.Text = ($"White points: {score.WhitePoint}");
                BlackScore2.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 3:
                for (int i = 0; i < roundThreeLabels.Count; i++)
                {
                    roundThreeLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox3.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore3.Text = ($"White points: {score.WhitePoint}");
                BlackScore3.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 4:
                for (int i = 0; i < roundFourLabels.Count; i++)
                {
                    roundFourLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox4.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore4.Text = ($"White points: {score.WhitePoint}");
                BlackScore4.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 5:
                for (int i = 0; i < roundFiveLabels.Count; i++)
                {
                    roundFiveLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox5.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore5.Text = ($"White points: {score.WhitePoint}");
                BlackScore5.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 6:
                for (int i = 0; i < roundSixLabels.Count; i++)
                {
                    roundSixLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox6.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore6.Text = ($"White points: {score.WhitePoint}");
                BlackScore6.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 7:
                for (int i = 0; i < roundSevenLabels.Count; i++)
                {
                    roundSevenLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox7.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore7.Text = ($"White points: {score.WhitePoint}");
                BlackScore7.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 8:
                for (int i = 0; i < roundEightLabels.Count; i++)
                {
                    roundEightLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox8.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore8.Text = ($"White points: {score.WhitePoint}");
                BlackScore8.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 9:
                for (int i = 0; i < roundNineLabels.Count; i++)
                {
                    roundNineLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox9.Visible = true;

                score            = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore9.Text = ($"White points: {score.WhitePoint}");
                BlackScore9.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;

            case 10:
                for (int i = 0; i < roundTenLabels.Count; i++)
                {
                    roundTenLabels[i].Text = nodeController.GuessList[i].NodeColor.ToString();
                }
                groupBox10.Visible = true;

                score             = nodeController.CompareGuess(aiController.ColorCombination);
                WhiteScore10.Text = ($"White points: {score.WhitePoint}");
                BlackScore10.Text = ($"Black points: {score.BlackPoint}");
                CheckForVictory(score);
                break;
            }
        }