コード例 #1
0
        /// <summary>
        /// Set up our label for deck count
        /// </summary>
        public override void LoadContent()
        {
            CheckShouldLoad();

            DeckCountLabel        = AddChild(new Label(cardsLeftString + Player.CardsLeftInDeck.ToString(), Vector2.Zero));
            DeckCountLabel.Colour = Color.White;
            DeckCountLabel.Hide();

            base.LoadContent();
        }
コード例 #2
0
        /// <summary>
        /// For the active objects we do some simple animation to show they are being drawn
        /// </summary>
        /// <param name="elapsedGameTime"></param>
        public override void Update(float elapsedGameTime)
        {
            base.Update(elapsedGameTime);

            CardImagesList.RemoveAll(x => !x.IsAlive);

            foreach (UIObject uiObject in CardImagesList)
            {
                uiObject.LocalPosition -= new Vector2(2f, 0);
            }

            // Update the visibility of our label count based on whether the mouse is over the collider
            // Would normally do this in the HandleInput, but our DeckUI can be disabled if it's an opponent
            DebugUtils.AssertNotNull(Collider);
            if (Collider.IsMouseOver)
            {
                DeckCountLabel.Show();
            }
            else
            {
                DeckCountLabel.Hide();
            }
        }