Пример #1
0
    private void OnQuery_BUY_IAP()
    {
        int itemId = (int)GameSection.GetEventData();

        currentItemChoosed = MonoBehaviourSingleton <ShopManager> .I.GetDarkMarketItem(itemId);

        SendGoldCanPurchase();
    }
Пример #2
0
    private void OnQuery_BUY_NORMAL()
    {
        int itemId = (int)GameSection.GetEventData();

        currentItemChoosed = MonoBehaviourSingleton <ShopManager> .I.GetDarkMarketItem(itemId);

        string text = "Gems";

        if (currentItemChoosed.saleType == 2)
        {
            text = "Gold";
        }
        object[] eventData = new object[3]
        {
            currentItemChoosed.name,
            currentItemChoosed.saleNum,
            text
        };
        GameSection.SetEventData(eventData);
    }
Пример #3
0
 private void InitDrakMarketItem(int index, DarkMarketItem data, bool isReloadIcon = true)
 {
     //IL_014a: Unknown result type (might be due to invalid IL or missing references)
     //IL_016b: Unknown result type (might be due to invalid IL or missing references)
     //IL_0184: Unknown result type (might be due to invalid IL or missing references)
     if (data == null)
     {
         SetActive((Enum)(UI)index, false);
     }
     else
     {
         Transform ctrl = GetCtrl((UI)index);
         if (data.saleType == 1)
         {
             SetEvent((Enum)(UI)index, "BUY_NORMAL", data.id);
             SetActive(ctrl, UI.SPR_GOLD_ITEM_BG, false);
             SetActive(ctrl, UI.SPR_GEM_ITEM_BG, true);
             SetLabelText(ctrl, UI.LBL_GEM_SALE_PRICE, $"x{data.saleNum}");
         }
         else if (data.saleType == 2)
         {
             SetEvent((Enum)(UI)index, "BUY_NORMAL", data.id);
             SetActive(ctrl, UI.SPR_GOLD_ITEM_BG, true);
             SetLabelText(ctrl, UI.LBL_GOLD_SALE_PRICE, $"x{data.saleNum}");
             SetActive(ctrl, UI.SPR_GEM_ITEM_BG, false);
         }
         else if (data.saleType == 200)
         {
             SetEvent((Enum)(UI)index, "BUY_IAP", data.id);
         }
         int num = 100 - Mathf.RoundToInt(data.saleNum / data.baseNum * 100f);
         if (num < 30)
         {
             SetColor(ctrl, UI.LBL_SALE_PERCENT, normalSale);
         }
         else if (num < 70)
         {
             SetColor(ctrl, UI.LBL_SALE_PERCENT, mediumSale);
         }
         else
         {
             SetColor(ctrl, UI.LBL_SALE_PERCENT, hotSale);
         }
         if (num > 60)
         {
             SetActive(ctrl, UI.OBJ_HOT, true);
         }
         else
         {
             SetActive(ctrl, UI.OBJ_HOT, false);
         }
         if (num > 0)
         {
             SetLabelText(ctrl, UI.LBL_SALE_PERCENT, $"-{num}%");
         }
         else
         {
             SetLabelText(ctrl, UI.LBL_SALE_PERCENT, $"{num}%");
         }
         SetFontStyle(ctrl, UI.LBL_SALE_PERCENT, 2);
         SetLabelText(ctrl, UI.LBL_ITEM_NAME, data.name);
         if (data.rewards != null && data.rewards.Count > 0)
         {
             string empty = string.Empty;
             SetLabelText(text: (data.rewards[0].num > 1000000) ? $"x{(float)data.rewards[0].num / 1000000f}M" : ((data.rewards[0].num <= 1000) ? $"x{data.rewards[0].num}" : $"x{(float)data.rewards[0].num / 1000f}K"), root: ctrl, label_enum: UI.LBL_ITEM_SALE_NUM);
         }
         else
         {
             SetLabelText(ctrl, UI.LBL_ITEM_SALE_NUM, string.Empty);
         }
         if (data.usedCount >= data.limit)
         {
             SetSliderValue(ctrl, UI.SLD_BUY_PROGRESS, 0f);
             SetActive(ctrl, UI.LBL_SALE_PROGRESS, false);
             SetActive(ctrl, UI.OBJ_OUT_OFF_STOCK, true);
             SetButtonEnabled((Enum)(UI)index, false);
         }
         else
         {
             float value = 1f - (float)data.usedCount / (float)data.limit;
             SetSliderValue(ctrl, UI.SLD_BUY_PROGRESS, value);
             SetActive(ctrl, UI.LBL_SALE_PROGRESS, true);
             SetLabelText(ctrl, UI.LBL_SALE_PROGRESS, $"{data.limit - data.usedCount}/{data.limit}");
             SetActive(ctrl, UI.OBJ_OUT_OFF_STOCK, false);
             SetButtonEnabled((Enum)(UI)index, true);
         }
         if (isReloadIcon)
         {
             UITexture spro = FindCtrl(ctrl, UI.IMG_ICON).GetComponent <UITexture>();
             ResourceLoad.LoadBlackMarketIconTexture(spro, data.imgId, delegate(Texture tex)
             {
                 if (spro != null)
                 {
                     spro.mainTexture = tex;
                 }
             });
         }
     }
 }
Пример #4
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;
                }
            });
        }
    }