Beispiel #1
0
        public DurakGame(frmGameGUI guiSubscriber = null)
        {
            // Assign form passed in constructor to class-scope variable
            if (guiSubscriber is frmGameGUI)
            {
                gui = guiSubscriber;
            }

            // Set PlayingCard values and shuffle deck
            InitializeDeck();
            // Add players to player list
            InitializePlayers();
            // Deal cards from the deck to the player hands,
            // sorting them once by rank before sending to the GUI
            DealCards();
            // TODO - add hand sorting by Durak rank, syncing with the GUI

            // Reveal and assign the trump card
            RevealTrump();
            // Set first attacker to the player with the lowest trump card
            // (Defaults to Player 1 if no player has a trump card)
            SetFirstAttacker();

            // Log
            Console.WriteLine("DURAK INITIALIZATION COMPLETE");
            Console.WriteLine(" Deck Contents:");
            PrintListOfCards(deck, "    ");
            Console.WriteLine(" " + Players[0].Name + "'s Hand:");
            PrintListOfCards(Players[0].Cards, "    ");
            Console.WriteLine(" " + Players[1].Name + "'s Hand:");
            PrintListOfCards(Players[1].Cards, "    ");
        }
Beispiel #2
0
 /// <summary>
 /// btnPlay_Click - Hides menu and opens the Durak game UI
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnPlay_Click(object sender, EventArgs e)
 {
     this.Hide();
     gameForm = new frmGameGUI(this);
 }