コード例 #1
0
ファイル: frmGameGUI.cs プロジェクト: blakephillips/Durak
        /// <summary>
        /// Initializes game, draws cards
        /// </summary>
        public void InitiateGame()
        {
            pbTrump.Image = Image.FromFile(CardBox.GetImagePathFromCard(durakGame.TrumpCard));
            //Load card image
            pbDeck.Load(CardBox.GetImagePathFromCard());

            Refresh();
            //Initialize card deck count amount
            lblDeckCount.Text = durakGame.deck.Count.ToString();

            //Play super cool sound
            //source : https://freesound.org/people/mickmon/sounds/176862/
            SoundPlayer dealSound = new System.Media.SoundPlayer(RESOURCES_PATH + "deal.wav");

            dealSound.Play();

            //Deal cards
            gameStats.cardsDrawn = gameStats.cardsDrawn + DurakGame.STARTING_CARD_COUNT;
            for (int i = 0; i < DurakGame.STARTING_CARD_COUNT; i++)
            {
                DealCardToPanel(this.pnlPlayerBottom, durakGame.Players[0].Cards[i]);
                DealCardToPanel(this.pnlPlayerTop, durakGame.Players[1].Cards[i]);
                Wait(50);
            }
            this.txtMessages.Update();
            durakGame.TurnAttack();
        }
コード例 #2
0
ファイル: frmGameGUI.cs プロジェクト: blakephillips/Durak
 /// <summary>
 /// Discard the river
 /// </summary>
 public void DiscardCards()
 {
     lblStatus.Text = durakGame.GetAttacker().Name + " gives up attacking!";
     Wait(200);
     if (pbDiscard.Image == null)
     {
         pbDiscard.Load(CardBox.GetImagePathFromCard());
     }
     for (int slide = 0; slide < 80; slide += 2)
     {
         for (int i = 0; i < pnlPlayArea.Controls.Count; i++)
         {
             CardBox cb = (CardBox)pnlPlayArea.Controls[i];
             cb.Left += slide;
             cb.Top  -= cb.Location.Y / 10;
         }
         Wait(3);
     }
     for (int i = pnlPlayArea.Controls.Count - 1; i >= 0; i--)
     {
         CardBox cb = (CardBox)pnlPlayArea.Controls[i];
         pnlPlayArea.Controls.Remove(cb);
     }
 }