Пример #1
0
        public void Show(Boolean viewOnly)
        {
            if (Model.GetFlavorText().Count() > 0)
            {
                Console.WriteLine();
                foreach (String str in Model.GetFlavorText())
                {
                    Console.WriteLine(str);
                }
            }

            Console.WriteLine("--------------");
            Console.WriteLine("Dealer's Hand : {0}", Model.GetDealerHand());
            Console.WriteLine("Player's Hand : {0}", Model.GetPlayerHand());
            Console.WriteLine("Current Wager : {0}", Model.GetWager().ToString("C"));
            Console.WriteLine("-----");
            Console.WriteLine("Cash Available: {0}", Model.GetCashAvailable().ToString("C"));
            Console.WriteLine("--------------");


            if (Model.GetResultText().Count() > 0)
            {
                Console.WriteLine();
                foreach (String str in Model.GetResultText())
                {
                    Console.WriteLine("    {0}", str);
                }
            }

            Console.WriteLine();
            if (!viewOnly)
            {
                GetCommand();
            }
        }
Пример #2
0
        private void UpdatePlayerScore()
        {
            //  >>>>>[  Depending on the game's state (actively playing the hand, hand has
            //          concluded, etc...) the dominant color used to display data should
            //          should be able to switch. Modification is in progress.
            //          -----
            ConsoleColor BRIGHT = ConsoleColor.White;
            ConsoleColor DIM    = ConsoleColor.DarkGray;

            ConsoleColor DOMINANT = BRIGHT;

            //  >>>>>[  Draw the "crossbars" bounding the various sections of the screen.
            //          -----
            OverWrite(SCORE_LEFT, SCORE_TOP, new string('-', WIDTH), ConsoleColor.Gray);
            OverWrite(SCORE_LEFT, SCORE_TOP + 6, new string('-', WIDTH), ConsoleColor.Gray);

            //  >>>>>[  Display the Dealer's hand. Nothing really special
            //          needs to be done...
            //          -----
            OverWrite(SCORE_LEFT, SCORE_TOP + 2, "Dealer's Hand : " + Model.GetDealerHand(), DOMINANT, 47);

            //  >>>>>[  Display the Player's hand. The player has the ability
            //          to split their hand, so each individual hand must be
            //          displayed.
            //
            //          Split hands not currently being played will be gray
            //          in color. The active hand will be White.
            //          -----
            OverWrite(SCORE_LEFT + 48, SCORE_TOP + 2, "Player's Hand : ", DOMINANT, 47);
            if (!Model.GetPlayerHand().Equals("EMPTY"))
            {
                int y = 2;
                foreach (string hand in Model.GetPlayerHand().Split('|'))
                {
                    OverWrite(SCORE_LEFT + 64, SCORE_TOP + (y++), hand.Trim().Substring(0, 2).Equals(">>") ? hand.Trim().Substring(3) : hand.Trim(),
                              hand.Trim().Substring(0, 2).Equals(">>") ? DOMINANT : Model.GetPlayerHand().Split('|').Count() > 1 ? DIM : DOMINANT, 31);
                }
            }
            else
            {
                for (int y = 2; y < 6; y++)
                {
                    OverWrite(SCORE_LEFT + 64, SCORE_TOP + y, "", DOMINANT, 31);
                }

                OverWrite(SCORE_LEFT + 64, SCORE_TOP + 2, Model.GetPlayerHand(), DOMINANT, 31);
            }

            //  >>>>>[  Display the current wager.
            //          -----
            OverWrite(SCORE_LEFT + 48, SCORE_TOP + 1, "Current Wager : " + Model.GetWager().ToString("C"), DOMINANT, ("Current Wager : " + Model.GetWager().ToString("C")).Length + 4);

            //  >>>>>[  Display available cash.
            //          If cash available = 0 then color should be red.
            //          -----
            OverWrite(SCORE_LEFT + 88, SCORE_TOP + 1, "Cash Available: ", DOMINANT, ("Cash Available: ").Length);
            OverWrite(SCORE_LEFT + 105, SCORE_TOP + 1, Model.GetCashAvailable().ToString("C"), Model.GetCashAvailable() == 0 ? ConsoleColor.Red : DOMINANT, 14);
        }