/// <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); }
/// <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; } } }