コード例 #1
0
        public CardSelectorView SetCardInSelector(CardInfo cardRow, Investigator investigator)
        {
            CardSelectorView selector = cardSelectorsManager.GetSelectorByCardIdOrEmpty(cardRow.Id);
            int quantity = investigator.GetAmountOfThisCardInDeck(cardRow);

            selector.SetQuantity(quantity);
            SetSelector();
            if (quantity <= 0)
            {
                DesactivateSelector(selector);
            }
            return(selector);

            void SetSelector()
            {
                if (!selector.IsEmpty)
                {
                    return;
                }
                selector.SetSelector(cardRow.Id, imageCards.GetSprite(cardRow.Id));
                selector.SetName(cardRow.Name);
                selector.SetTransform(placeHolderZone);
                LayoutRebuilder.ForceRebuildLayoutImmediate(placeHolderZone);
            }
        }