Example #1
0
    private void _viewMaterialTab()
    {
        SetActive(gemTab, false);
        SetActive(bundleTab, false);
        SetActive(materialTab, true);
        CheckOpenedMaterialTab();
        int j = 0;

        SetTable(materialTab, UI.TBL_LIST, "CrystalShopListItemMaterial", _purchaseMaterialList.Count, false, delegate(int i, Transform t, bool b)
        {
            ProductData productData = _purchaseMaterialList[j];
            string text             = string.Format(base.sectionData.GetText("PRICE"), productData.priceIncludeTax);
            UITexture spro          = FindCtrl(t, UI.SPR_THUMB).GetComponent <UITexture>();
            ResourceLoad.LoadShopImageMaterialTexture(spro, productData.iconImg, delegate(Texture tex)
            {
                if (spro != null)
                {
                    spro.mainTexture = tex;
                }
            });
            SetLabelText(t, UI.LBL_NAME, productData.name);
            SetLabelText(t, UI.LBL_PRICE, text);
            SetLabelText(t, UI.LBL_PRICE_OLD, (!(productData.oldPrice > 0.0)) ? string.Empty : string.Format(base.sectionData.GetText("PRICE_STRETCH"), productData.oldPrice));
            SetSupportEncoding(t, UI.LBL_PRICE_OLD, true);
            SetSupportEncoding(t, UI.LBL_PROMO, true);
            SetLabelText(t, UI.LBL_PROMO, productData.promo.Replace("\\n", "\n"));
            if (productData.remainingDay > 0)
            {
                string empty      = string.Empty;
                TimeSpan timeSpan = TimeSpan.FromSeconds((double)productData.remainingDay);
                empty             = ((timeSpan.Days <= 1) ? string.Format(base.sectionData.GetText("TIME_REMAIN"), $"{timeSpan.Hours:d2}:{timeSpan.Minutes:d2}:{timeSpan.Seconds:d2}") : string.Format(base.sectionData.GetText("DAY_REMAIN"), timeSpan.Days));
                SetLabelText(t, UI.LBL_REMAIN, empty);
            }
            else
            {
                SetActive(t, UI.LBL_REMAIN, false);
            }
            SetActive(GetChildSafe(t, UI.OBJ_OFFER, productData.offerType - 1), true);
            if (_nativeStoreList != null)
            {
                StoreData product = _nativeStoreList.getProduct(productData.productId);
                if (product != null)
                {
                    text = product.price.ToString();
                    SetLabelText(t, UI.LBL_PRICE, text);
                }
                product = _nativeStoreList.getProduct(productData.skipId);
                if (product != null)
                {
                    SetLabelText(t, UI.LBL_PRICE_OLD, product.price.ToString());
                }
            }
            SetEvent(t, "MATERIAL_DETAIL", new object[3]
            {
                productData,
                text,
                j
            });
            j++;
        });
    }