Exemple #1
0
    private void InitDrakMarketFeatured(DarkMarketItem data, bool isReloadIcon = true)
    {
        //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d5: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ed: Unknown result type (might be due to invalid IL or missing references)
        //IL_0299: Unknown result type (might be due to invalid IL or missing references)
        //IL_0333: Unknown result type (might be due to invalid IL or missing references)
        SetActive((Enum)UI.BTN_FEATURED_OFFER, true);
        if (data.saleType == 1)
        {
            SetEvent((Enum)UI.BTN_FEATURED_OFFER, "BUY_NORMAL", data.id);
        }
        else if (data.saleType == 2)
        {
            SetEvent((Enum)UI.BTN_FEATURED_OFFER, "BUY_NORMAL", data.id);
        }
        else if (data.saleType == 200)
        {
            SetEvent((Enum)UI.BTN_FEATURED_OFFER, "BUY_IAP", data.id);
        }
        int num = 100 - Mathf.RoundToInt(data.saleNum / data.baseNum * 100f);

        if (num < 30)
        {
            SetColor((Enum)UI.LBL_OFFER_SALE_VALUE, normalSale);
        }
        else if (num < 70)
        {
            SetColor((Enum)UI.LBL_OFFER_SALE_VALUE, mediumSale);
        }
        else
        {
            SetColor((Enum)UI.LBL_OFFER_SALE_VALUE, hotSale);
        }
        if (num > 0)
        {
            SetLabelText((Enum)UI.LBL_OFFER_SALE_VALUE, $"-{num}%");
        }
        else
        {
            SetLabelText((Enum)UI.LBL_OFFER_SALE_VALUE, $"{num}%");
        }
        SetFontStyle((Enum)UI.LBL_OFFER_SALE_VALUE, 2);
        SetLabelText((Enum)UI.LBL_OFFER_NAME, data.name);
        if (!string.IsNullOrEmpty(data.refProductId))
        {
            SetActive((Enum)UI.LBL_OFFER_OLD_PRICE, true);
            SetLabelText((Enum)UI.LBL_OFFER_OLD_PRICE, $"[s]${data.baseNum}[/s]");
            SetSupportEncoding(UI.LBL_OFFER_OLD_PRICE, true);
        }
        else
        {
            SetActive((Enum)UI.LBL_OFFER_OLD_PRICE, false);
        }
        SetLabelText((Enum)UI.LBL_OFFER_SALE_PRICE, $"${data.saleNum}");
        if (_nativeStoreList != null)
        {
            StoreData product = _nativeStoreList.getProduct(data.saleoffProductId);
            if (product != null)
            {
                SetLabelText((Enum)UI.LBL_OFFER_SALE_PRICE, product.price.ToString());
            }
            StoreData product2 = _nativeStoreList.getProduct(data.refProductId);
            if (product2 != null)
            {
                SetLabelText((Enum)UI.LBL_OFFER_OLD_PRICE, $"[s]{product2.price}[/s]");
            }
        }
        if (data.usedCount >= data.limit)
        {
            SetSliderValue((Enum)UI.SLD_OFFER_BUY_PROGRESS, 0f);
            SetActive((Enum)UI.LBL_OFFER_SALE_PROGRESS, false);
            SetActive((Enum)UI.OBJ_OFFER_OUT_OFF_STOCK, true);
            SetColor((Enum)UI.FEATURED_OFFER_BANNER, disableTintColor);
            SetButtonEnabled((Enum)UI.BTN_FEATURED_OFFER, false);
        }
        else
        {
            float value = 1f - (float)data.usedCount / (float)data.limit;
            SetSliderValue((Enum)UI.SLD_OFFER_BUY_PROGRESS, value);
            SetActive((Enum)UI.LBL_OFFER_SALE_PROGRESS, true);
            SetLabelText((Enum)UI.LBL_OFFER_SALE_PROGRESS, $"{data.limit - data.usedCount}/{data.limit}");
            SetActive((Enum)UI.OBJ_OFFER_OUT_OFF_STOCK, false);
            SetColor((Enum)UI.FEATURED_OFFER_BANNER, Color.get_white());
            SetButtonEnabled((Enum)UI.BTN_FEATURED_OFFER, true);
        }
        if (isReloadIcon)
        {
            Transform ctrl = GetCtrl(UI.BTN_FEATURED_OFFER);
            UITexture spro = FindCtrl(ctrl, UI.FEATURED_OFFER_BANNER).GetComponent <UITexture>();
            ResourceLoad.LoadBlackMarketOfferTexture(spro, data.imgId, delegate(Texture tex)
            {
                if (spro != null)
                {
                    spro.mainTexture = tex;
                }
            });
        }
    }