/// <summary>
        /// Init the specified pItem, pUtils, pGroupId, pActionResetCacheGroup and pList.
        /// </summary>
        /// <param name="pItem">P item.</param>
        /// <param name="pUtils">P utils.</param>
        /// <param name="pGroupId">P group identifier.</param>
        /// <param name="pActionResetCacheGroup">P action reset cache group.</param>
        /// <param name="pList">If set to <c>true</c> p list.</param>
        public void init(XsollaShopItem pItem, XsollaUtils pUtils, int pGroupId, Action <int, bool> pActionResetCacheGroup, bool pList)
        {
            mItem    = pItem;
            mUtils   = pUtils;
            mGroupId = pGroupId;
            mActionResetCacheGroup = pActionResetCacheGroup;
            mIsListLayoutItem      = pList;

            // Загружаем картинку
            mImgLoader.LoadImage(mItemImg, pItem.GetImageUrl());

            // Задаем название
            mItemName.text = pItem.GetName();

            // Задаем короткое описание
            mShortDesc.text = pItem.GetDescription();

            // Дефолтное состояние прогресс бара
            ProgressBarBuyBtn(false);

            // Задаем полное описание
            if (mLongCanvas != null)
            {
                Resizer.ResizeToParrentRe(mLongCanvas.gameObject);
            }
            // Если полное описание пустое, то скрываем ссылку
            if (pItem.GetLongDescription() != "")
            {
                mLongDesc.text = pItem.GetLongDescription();
            }
            else
            {
                mLongDescLink.gameObject.SetActive(false);
            }

            // Задаем иконку любимого товара
            SetFavoriteState();
            mFav.gameObject.GetComponent <Button>().onClick.AddListener(delegate { ChangeFavState(); });

            // Задаем состояние длинного описания
            LongDescState = false;
            mLongDescLink.GetComponent <Button>().onClick.AddListener(delegate { SetStateLongState(!mLongDescState); });

            // Блокируем минус
            if (mQuantityMinus != null)
            {
                mQuantityMinus.interactable = false;
            }

            // Задаем поля для лэндинга list
            SetListLandingItem(pItem);
            // Рекламный блок
            SetAdBlock(pItem);
            // Ценовой блок
            SetAmountBlock(pItem.vcAmount, pItem.vcAmountWithoutDiscount, pItem.amount, pItem.amountWithoutDiscount, pItem.currency);
        }
Exemplo n.º 2
0
        public override GameObject GetView(int position)
        {
            GameObject          shopItemInstance = Instantiate(shopItemPrefab) as GameObject;
            XsollaShopItem      item             = manager.GetItemByPosition(position);//manager.GetItemByPosition (position);
            ShopItemViewAdapter itemAdapter      = shopItemInstance.GetComponent <ShopItemViewAdapter>();

            itemAdapter.SetRealPrice(item.GetPriceString());
            itemAdapter.SetSpecial(item.GetBounusString());
            itemAdapter.SetCoins(item.GetDescription());
            itemAdapter.SetCoinsAmount(item.GetName());
            itemAdapter.SetImage(item.GetImageUrl());
            itemAdapter.SetOnClickListener(() => OnClickBuy("sku[" + item.GetKey() + "]"));
            return(shopItemInstance);
        }
Exemplo n.º 3
0
        public override GameObject GetView(int position)
        {
            GameObject shopItemInstance = Instantiate(shopItemPrefab) as GameObject;

            shopItemInstance.name = "ShopItemGood " + position;
            XsollaShopItem      item        = manager.GetItemByPosition(position); //manager.GetItemByPosition (position);
            ShopItemViewAdapter itemAdapter = shopItemInstance.GetComponent <ShopItemViewAdapter>();

            itemAdapter.SetPrice(item.GetPriceString());
            itemAdapter.SetSpecial(item.GetBounusString());
            itemAdapter.SetDesc(item.GetDescription());
            itemAdapter.SetName(item.GetName());
            itemAdapter.SetFullDesc(item.GetLongDescription());
            itemAdapter.SetBuyText("Buy");
            itemAdapter.SetImage(item.GetImageUrl());
            itemAdapter.SetFavorite(item.IsFavorite());
            itemAdapter.SetOnClickListener(() => OnClickBuy("sku[" + item.GetKey() + "]", item.IsVirtualPayment()));
            itemAdapter.SetOnFavoriteChanged((b) => OnClickFavorite(b, "sku[" + item.GetKey() + "]", item.GetId()));
            itemAdapter.SetLabel(item.GetAdvertisementType(), item.GetLabel());
            return(shopItemInstance);
        }