public void init(XsollaPricepoint pItem, XsollaUtils pUtils) { mItem = pItem; mUtils = pUtils; // Загружаем картинку if (pItem.image != "null") { mImgLoader.LoadImage(mItemImg, pItem.GetImageUrl()); } else if (pUtils.GetProject().virtualCurrencyIconUrl != "null") { mImgLoader.LoadImage(mItemImg, pUtils.GetProject().virtualCurrencyIconUrl); } else { mItemImg.color = new Color(255, 255, 255, 0); } // Задаем короткое описание mShortDesc.text = pItem.GetDescription(); // Задаем название mItemName.text = pUtils.GetProject().isDiscrete ? pItem.outAmount.ToString("N2") : pItem.outAmount.ToString("##.00"); mVcCurr.text = mUtils.GetProject().virtualCurrencyName; // Рекламный блок SetAdBlock(pItem); // Ценовой блок SetAmountBlock(pItem.sum, pItem.sumWithoutDiscount, pItem.currency); }
public override GameObject GetView(int position) { int type = GetElementType(position); GameObject shopItemInstance; switch (type) { case NORMAL: shopItemInstance = Instantiate(shopItemPrefab) as GameObject; break; case RECOMMENDED: shopItemInstance = Instantiate(shopItemPrefabRecomended) as GameObject; break; case BEST_DEAL: shopItemInstance = Instantiate(shopItemPrefabBest) as GameObject; break; case SPECIAL_OFFER: shopItemInstance = Instantiate(shopItemPrefabOffer) as GameObject; break; default: shopItemInstance = Instantiate(shopItemPrefab) as GameObject; break; } XsollaPricepoint pricepoint = GetItem(position); ShopItemViewAdapter itemAdapter = shopItemInstance.GetComponent <ShopItemViewAdapter>(); itemAdapter.SetRealPrice(pricepoint.GetPriceString()); itemAdapter.SetSpecial(pricepoint.desc); if ("".Equals(pricepoint.label) || "null".Equals(pricepoint.label)) { itemAdapter.SetCoins(textValue); } else { itemAdapter.SetCoins(pricepoint.label); } itemAdapter.SetCoinsAmount(pricepoint.outAmount.ToString()); itemAdapter.SetImage(pricepoint.GetImageUrl()); itemAdapter.SetOnClickListener(() => OnClickBuy(pricepoint.outAmount)); // ImageLoader imageLoader = GetComponent<ImageLoader> (); // imageLoader.LoadImage (shopItemInstance.GetComponent<Image>(), url); return(shopItemInstance); }
public override GameObject GetView(int position) { GameObject shopItemInstance = Instantiate(shopItemPrefab) as GameObject; XsollaPricepoint pricepoint = GetItem(position); ShopItemViewAdapter itemAdapter = shopItemInstance.GetComponent <ShopItemViewAdapter>(); itemAdapter.SetImage(pricepoint.GetImageUrl()); itemAdapter.SetName(pricepoint.GetOutString()); itemAdapter.SetDesc(_virtualCurrencyName); itemAdapter.SetBuyText(_buyBtnText); itemAdapter.SetSpecial(pricepoint.GetDescription()); itemAdapter.SetPrice(pricepoint.GetPriceString()); itemAdapter.SetLabel(pricepoint.GetAdvertisementType(), pricepoint.GetLabel()); itemAdapter.SetOnClickListener(() => OnClickBuy(pricepoint.outAmount)); return(shopItemInstance); }