Example #1
0
        private void SetCurrentCard(Card card)
        {
            if (card == null)
            {
                return;
            }

            CurrentCard = card;
            CurrentCardGo.SetCardData(CurrentCard.CardInfo);
            CurrentCardGo.LoadArtwork(ResourceCenter.CardArtworks[CurrentCard.CardInfo.Identifier]);
            CardInfo info = CurrentCard.CardInfo;

            InputIdentifier.text = info.Identifier.ToString().PadLeft(3, '0');
            InputName.text       = info.Name;
        }
Example #2
0
        // REQUESTS FROM GAME MANAGER TO UI

        /// <summary>
        /// Add a CardGameObject to the scene corresponding to a card in the player's hand.
        /// </summary>
        /// <param name="toAdd">The Card added to the hand for which we need to create a GameObject.</param>
        /// <param name="position">The position to add the card at.</param>
        public void AddCardToPlayerHand(Card toAdd, int position)
        {
            if (_duelUiCenter == null)
            {
                return;
            }
            GameObject         newCard = Instantiate(CardGameObjectPrefab);
            HandCardGameObject cardGo  = newCard.GetComponent <HandCardGameObject>();

            if (cardGo != null)
            {
                cardGo.SetCardData(toAdd.CardInfo);
                cardGo.RegisterBridge(this);
                cardGo.LoadArtwork(_resourceCenter.CardArtworks[toAdd.CardInfo.Identifier]);
            }

            toAdd.OnDataChanged += cardGo.DataChangedCardData;
            _playerHand.Add(cardGo);
            _duelUiCenter.AddCardToHand(newCard, position);
        }