Example #1
0
        /// <summary>
        /// Updates the component.
        /// </summary>
        /// <param name="gameTime">The game time.</param>
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);


            CurrentFrame = IsFaceDown ? CardGame.cardsAssets["CardBack_" + CardGame.Theme] :
                           CardGame.cardsAssets[UIUtilty.GetCardAssetName(Card)];
        }
        /// <summary>
        /// Load the basic contents for a card game (the card assets)
        /// </summary>
        public void LoadContent()
        {
            SpriteBatch = new SpriteBatch(Game.GraphicsDevice);
            // Initialize a full deck
            CardPacket fullDeck = new CardPacket(1, 2, CardSuit.AllSuits,
                                                 CardsFramework.CardValue.NonJokers | CardsFramework.CardValue.Jokers);
            string assetName;

            // Load all card assets
            for (int cardIndex = 0; cardIndex < 54; cardIndex++)
            {
                assetName = UIUtilty.GetCardAssetName(fullDeck[cardIndex]);
                LoadUITexture("Cards", assetName);
            }
            // Load card back picture
            LoadUITexture("Cards", "CardBack_" + Theme);

            // Load the game's font
            Font = Game.Content.Load <SpriteFont>(string.Format(@"Fonts\Regular"));

            GameTable.Initialize();
        }