コード例 #1
0
        /// <summary>
        /// Handles the hand's ReceivedCard event be adding a corresponding
        /// animated card.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The
        /// <see cref="CardsFramework.CardEventArgs"/>
        /// instance containing the event data.</param>
        void Hand_ReceivedCard(object sender, CardEventArgs e)
        {
            // Add the card to the screen
            AnimatedCardsGameComponent animatedCardGameComponent =
                new AnimatedCardsGameComponent(e.Card, CardGame)
            {
                Visible = false
            };

            heldAnimatedCards.Add(animatedCardGameComponent);
            Game.Components.Add(animatedCardGameComponent);
        }
コード例 #2
0
 /// <summary>
 /// Handles the hand's LostCard event be removing the corresponding animated
 /// card.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The
 /// <see cref="CardsFramework.CardEventArgs"/>
 /// instance containing the event data.</param>
 void Hand_LostCard(object sender, CardEventArgs e)
 {
     // Remove the card from screen
     for (int animationIndex = 0; animationIndex < heldAnimatedCards.Count; animationIndex++)
     {
         if (heldAnimatedCards[animationIndex].Card == e.Card)
         {
             Game.Components.Remove(heldAnimatedCards[animationIndex]);
             heldAnimatedCards.RemoveAt(animationIndex);
             return;
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Handles the hand's ReceivedCard event be adding a corresponding 
        /// animated card.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The 
        /// <see cref="CardsFramework.CardEventArgs"/> 
        /// instance containing the event data.</param>
        void Hand_ReceivedCard(object sender, CardEventArgs e)
        {
            // Add the card to the screen
            AnimatedCardsGameComponent animatedCardGameComponent =
                new AnimatedCardsGameComponent(e.Card, CardGame) { Visible = false };

            heldAnimatedCards.Add(animatedCardGameComponent);
            Game.Components.Add(animatedCardGameComponent);
        }
コード例 #4
0
 /// <summary>
 /// Handles the hand's LostCard event be removing the corresponding animated
 /// card.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The 
 /// <see cref="CardsFramework.CardEventArgs"/> 
 /// instance containing the event data.</param>
 void Hand_LostCard(object sender, CardEventArgs e)
 {
     // Remove the card from screen
     for (int animationIndex = 0; animationIndex < heldAnimatedCards.Count; animationIndex++)
     {
         if (heldAnimatedCards[animationIndex].Card == e.Card)
         {
             Game.Components.Remove(heldAnimatedCards[animationIndex]);
             heldAnimatedCards.RemoveAt(animationIndex);
             return;
         }
     }
 }