Ejemplo n.º 1
0
        public void Init(GameManager gameManager, IapGoodItem iapItem, NewShopView shop)
        {
            base.Init(gameManager);

            base.Init(gameManager);

            IapItem = iapItem;
            _item   = BaseObjectFactory.GetItem(IapItem.RewardItemName);
            _shop   = shop;

            NameLabel.text        = Localization.Get(IapItem.LocalizedTitle);
            IconSprite.spriteName = _item.IconName;
            PriceLabel.text       = IapItem.Price.ToString();
            AmountLabel.text      = "x" + IapItem.RewardAmount;

            UIEventListener.Get(BuyButton).onClick += OnBuyClick;
        }
Ejemplo n.º 2
0
        public void Init(GameManager gameManager, NewShopView shop, string iapItemId, bool isOffer, string firstIapItemId = null, bool isFirst = false, int maxPerLineItems = 4)
        {
            base.Init(gameManager);

            ID              = iapItemId;
            IsOffer         = isOffer;
            _shop           = shop;
            MaxPerLineItems = maxPerLineItems;
            if (ID != IapStoreManager.FREE_GOLD)
            {
                IapItem = IapStoreManager.StoreController.products.WithID(iapItemId);
            }

            if (!string.IsNullOrEmpty(firstIapItemId))
            {
                _firstIapItem = IapStoreManager.StoreController.products.WithID(firstIapItemId);
            }

            Definition = GameManager.IapManager.IapItemDefinitions[iapItemId];
            if (isOffer)
            {
                DescriptionLabel.text = Localization.Get(Definition.Description);
                Icon.spriteName       = Definition.IconName;
            }
            else
            {
                DescriptionLabel.text = Definition.Currency.ToString();
                Icon.spriteName       = "gold_icon";
            }

            Free.enabled = ID == IapStoreManager.FREE_GOLD;

            SelectedBack.enabled = false;
            HotDeal.enabled      = Definition.HotDeal;
            MostPopular.enabled  = Definition.MostPopular;
            OfferObject.SetActive(Definition.OfferPercent > 0);
            OfferPercentLabel.text = "-" + Definition.OfferPercent + "%";

            UIEventListener.Get(Button).onClick += OnButtonClick;
        }