Beispiel #1
0
        /// <summary>
        /// displays the right code and win/loose message at the end of the game
        /// also controls the LED
        /// </summary>
        /// <param name="rightCode">the right (secret) code</param>
        /// <param name="gameWon">true if the game was won, false if the player lost</param>
        public void gameFinished(ColorCode rightCode, bool gameWon)
        {
            display.SimpleGraphics.DisplayText("The right code was:", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Blue, FINAL_CODE_X_POS, FINAL_CODE_Y_POS + TEXT_SIZE);
            ColorCodeView rightCodeView = new ColorCodeView(FINAL_CODE_X_POS+10, FINAL_CODE_Y_POS + CODE_SIZE*2 + TEXT_SIZE*2, CODE_SIZE, display, rightCode);
            rightCodeView.drawColorCode();

            if (gameWon)
            {
                display.SimpleGraphics.DisplayText("You won!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Green, FINAL_CODE_X_POS, FINAL_CODE_Y_POS);
                led.FadeRepeatedly(GT.Color.Green);
            }
            else
            {
                display.SimpleGraphics.DisplayText("You lost!", Resources.GetFont(Resources.FontResources.NinaB), GT.Color.Red, FINAL_CODE_X_POS, FINAL_CODE_Y_POS);
                led.FadeRepeatedly(GT.Color.Red);
            }
        }
Beispiel #2
0
 /// <summary>
 /// initializes and draws everything (new input field, last result code) for a new round
 /// </summary>
 /// <param name="lastResultCode">result code (correct colors, correct positions) of the last round</param>
 public void nextRound(ColorCode lastResultCode)
 {
     int round = masterMind.getCurrentRound();
     ColorCodeView resultView = new ColorCodeView(RESULT_X_POS, (round + 2) * CODE_SIZE_SPACING * 2, CODE_SIZE, display, lastResultCode);
     resultView.drawColorCode();
     createColorCodeInput(round);
 }