Esempio n. 1
0
        private void SetupManualRefreshInfo()
        {
            base.transform.Find("RefreshTab").gameObject.SetActive((this._shopType == UIShopType.SHOP_NORMAL) || (this._shopType == UIShopType.SHOP_ACTIVITY));
            if ((this._shopType != UIShopType.SHOP_GACHATICKET) && (this._shopType != UIShopType.SHOP_ENDLESS))
            {
                if (this._shopType == UIShopType.SHOP_ACTIVITY)
                {
                    base.transform.Find("RefreshTab").gameObject.SetActive(this._storeDataItem.isOpen);
                    if (!this._storeDataItem.isOpen)
                    {
                        return;
                    }
                }
                base.transform.Find("RefreshTab/RefreshTime/Num").GetComponent <Text>().text = (this._storeDataItem.maxManualRefreshTimes - this._storeDataItem.manualRefreshTimes).ToString();
                base.transform.Find("RefreshTab/MetalNum/Num").GetComponent <Text>().text    = this._storeDataItem.nextRefreshCost.ToString();
                base.transform.Find("RefreshTab/MetalNum/Num").GetComponent <Text>().color   = MiscData.GetColor("TotalWhite");
                base.transform.Find("RefreshTab/MetalNum/x").GetComponent <Text>().color     = MiscData.GetColor("TotalWhite");
                if (this._storeDataItem.refreshItemID == 0)
                {
                    base.transform.Find("RefreshTab/MetalNum/ImgMetal").GetComponent <Image>().sprite = UIUtil.GetResourceSprite(ResourceType.Hcoin, null);
                    if (Singleton <PlayerModule> .Instance.playerData.hcoin < this._storeDataItem.nextRefreshCost)
                    {
                        base.transform.Find("RefreshTab/MetalNum/Num").GetComponent <Text>().color = MiscData.GetColor("WarningRed");
                        base.transform.Find("RefreshTab/MetalNum/x").GetComponent <Text>().color   = MiscData.GetColor("WarningRed");
                    }
                }
                else
                {
                    string iconPath = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(this._storeDataItem.refreshItemID, 1).GetIconPath();

                    if (MiscData.GetCurrencyIconPath(this._storeDataItem.refreshItemID) != null)
                    {
                        iconPath = MiscData.GetCurrencyIconPath(this._storeDataItem.refreshItemID);
                    }
                    base.transform.Find("RefreshTab/MetalNum/ImgMetal").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(iconPath);
                    int number = 0;
                    StorageDataItemBase base3 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(this._storeDataItem.refreshItemID);

                    if (base3 != null)
                    {
                        number = base3.number;
                    }
                    if (number < this._storeDataItem.nextRefreshCost)
                    {
                        base.transform.Find("RefreshTab/MetalNum/Num").GetComponent <Text>().color = MiscData.GetColor("WarningRed");
                        base.transform.Find("RefreshTab/MetalNum/x").GetComponent <Text>().color   = MiscData.GetColor("WarningRed");
                    }
                }
                if (this._storeDataItem.manualRefreshTimes >= this._storeDataItem.maxManualRefreshTimes)
                {
                    base.transform.Find("RefreshTab/RefreshBtn").GetComponent <Button>().interactable = false;
                }
                else
                {
                    base.transform.Find("RefreshTab/RefreshBtn").GetComponent <Button>().interactable = true;
                }
            }
        }
Esempio n. 2
0
        private void SetupMetalNum()
        {
            base.transform.Find("SpecialDesc").gameObject.SetActive(true);
            Transform transform = base.transform.Find("SystemInfoPanel/Currency");

            switch (this._shopType)
            {
            case UIShopType.SHOP_ACTIVITY:
                base.transform.Find("SpecialDesc").gameObject.SetActive(false);
                base.transform.Find("SystemInfoPanel/Currency").gameObject.SetActive(false);
                transform = base.transform.Find("SystemInfoPanel/ActivityCurrency");
                transform.gameObject.SetActive(true);
                break;

            case UIShopType.SHOP_GACHATICKET:
                base.transform.Find("SystemInfoPanel/Currency").gameObject.SetActive(false);
                base.transform.Find("SystemInfoPanel/ActivityCurrency").gameObject.SetActive(false);
                return;

            default:
                base.transform.Find("SystemInfoPanel/ActivityCurrency").gameObject.SetActive(false);
                transform.gameObject.SetActive(true);
                break;
            }
            transform.gameObject.SetActive(this._storeDataItem.currencyIDList.Count > 0);
            for (int i = 0; i < transform.childCount; i++)
            {
                Transform child = transform.GetChild(i);
                if (i >= this._storeDataItem.currencyIDList.Count)
                {
                    child.gameObject.SetActive(false);
                }
                else
                {
                    child.gameObject.SetActive(true);
                    StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(this._storeDataItem.currencyIDList[i], 1);

                    string currencyIconPath = MiscData.GetCurrencyIconPath(dummyStorageDataItem.ID);
                    if (string.IsNullOrEmpty(currencyIconPath))
                    {
                        currencyIconPath = dummyStorageDataItem.GetIconPath();
                    }
                    child.Find("ImgMetal").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(currencyIconPath);
                    List <StorageDataItemBase> list = Singleton <StorageModule> .Instance.TryGetStorageDataItemByMetaId(this._storeDataItem.currencyIDList[i], 1);

                    int number = 0;
                    if (list.Count > 0)
                    {
                        if (dummyStorageDataItem is MaterialDataItem)
                        {
                            number = list[0].number;
                        }
                        else
                        {
                            number = list.Count;
                        }
                    }
                    child.Find("Num").GetComponent <Text>().text = number.ToString();
                }
            }
        }
Esempio n. 3
0
        private void SetupPrice(ShopGoodsMetaData goodsItem)
        {
            List <int> list = (this._ticketID <= 0) ? UIUtil.GetGoodsRealPrice(this._goods) : new List <int> {
                goodsItem.HCoinCost
            };

            if (this._isMultiCurrency)
            {
                if (list.Count > 3)
                {
                    base.transform.GetComponent <LayoutElement>().preferredWidth = 320f;
                }
                else
                {
                    base.transform.GetComponent <LayoutElement>().preferredWidth = 220f;
                }
            }
            Transform transform  = base.transform.Find("BG/Unselected/NowPrize");
            Transform transform2 = base.transform.Find("BG/Selected/NowPrize");
            int       num        = 1;

            if (goodsItem.HCoinCost > 0)
            {
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Hcoin");
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Hcoin");
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                else
                {
                    transform.Find("Image").GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Hcoin");
                    transform2.Find("Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Hcoin");
                    transform.Find("Num").GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find("Num").GetComponent <Text>().text      = list[num - 1].ToString();
                }
                this.SetupCurrencyColor(list[num - 1] <= Singleton <PlayerModule> .Instance.playerData.hcoin, num);
                num++;
            }
            if (goodsItem.SCoinCost > 0)
            {
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Scoin");
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Scoin");
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                else
                {
                    transform.Find("Image").GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Scoin");
                    transform2.Find("Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab("SpriteOutput/RewardIcons/Scoin");
                    transform.Find("Num").GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find("Num").GetComponent <Text>().text      = list[num - 1].ToString();
                }
                this.SetupCurrencyColor(list[num - 1] <= Singleton <PlayerModule> .Instance.playerData.scoin, num);
                num++;
            }
            if (goodsItem.CostItemId > 0)
            {
                StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(goodsItem.CostItemId, 1);

                string currencyIconPath = MiscData.GetCurrencyIconPath(goodsItem.CostItemId);
                if (string.IsNullOrEmpty(currencyIconPath))
                {
                    currencyIconPath = dummyStorageDataItem.GetIconPath();
                }
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(currencyIconPath);
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(currencyIconPath);
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                else
                {
                    transform.Find("Image").GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(currencyIconPath);
                    transform2.Find("Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(currencyIconPath);
                    transform.Find("Num").GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find("Num").GetComponent <Text>().text      = list[num - 1].ToString();
                }
                int number = 0;
                StorageDataItemBase base3 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(goodsItem.CostItemId);

                if (base3 != null)
                {
                    number = base3.number;
                }
                this.SetupCurrencyColor(list[num - 1] <= number, num);
                num++;
            }
            if (goodsItem.CostItemId2 > 0)
            {
                StorageDataItemBase base4 = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(goodsItem.CostItemId2, 1);

                string iconPath = MiscData.GetCurrencyIconPath(goodsItem.CostItemId2);
                if (string.IsNullOrEmpty(iconPath))
                {
                    iconPath = base4.GetIconPath();
                }
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(iconPath);
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(iconPath);
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                int num3 = 0;
                StorageDataItemBase base5 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(goodsItem.CostItemId2);

                if (base5 != null)
                {
                    num3 = base5.number;
                }
                this.SetupCurrencyColor(list[num - 1] <= num3, num);
                num++;
            }
            if (goodsItem.CostItemId3 > 0)
            {
                StorageDataItemBase base6 = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(goodsItem.CostItemId3, 1);

                string str3 = MiscData.GetCurrencyIconPath(goodsItem.CostItemId3);
                if (string.IsNullOrEmpty(str3))
                {
                    str3 = base6.GetIconPath();
                }
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(str3);
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(str3);
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                int num4 = 0;
                StorageDataItemBase base7 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(goodsItem.CostItemId3);

                if (base7 != null)
                {
                    num4 = base7.number;
                }
                this.SetupCurrencyColor(list[num - 1] <= num4, num);
                num++;
            }
            if (goodsItem.CostItemId4 > 0)
            {
                StorageDataItemBase base8 = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(goodsItem.CostItemId4, 1);

                string str4 = MiscData.GetCurrencyIconPath(goodsItem.CostItemId4);
                if (string.IsNullOrEmpty(str4))
                {
                    str4 = base8.GetIconPath();
                }
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(str4);
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(str4);
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                int num5 = 0;
                StorageDataItemBase base9 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(goodsItem.CostItemId4);

                if (base9 != null)
                {
                    num5 = base9.number;
                }
                this.SetupCurrencyColor(list[num - 1] <= num5, num);
                num++;
            }
            if (goodsItem.CostItemId5 > 0)
            {
                StorageDataItemBase base10 = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(goodsItem.CostItemId5, 1);

                string str5 = MiscData.GetCurrencyIconPath(goodsItem.CostItemId5);
                if (string.IsNullOrEmpty(str5))
                {
                    str5 = base10.GetIconPath();
                }
                if (this._isMultiCurrency)
                {
                    transform.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite  = Miscs.GetSpriteByPrefab(str5);
                    transform2.Find(string.Format("{0}/Image", num)).GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(str5);
                    transform.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text       = list[num - 1].ToString();
                    transform2.Find(string.Format("{0}/Num", num)).GetComponent <Text>().text      = list[num - 1].ToString();
                }
                int num6 = 0;
                StorageDataItemBase base11 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(goodsItem.CostItemId5);

                if (base11 != null)
                {
                    num6 = base11.number;
                }
                this.SetupCurrencyColor(list[num - 1] <= num6, num);
                num++;
            }
            if (list.Count < transform.childCount)
            {
                for (int i = list.Count; i < transform.childCount; i++)
                {
                    transform.GetChild(i).gameObject.SetActive(false);
                    transform2.GetChild(i).gameObject.SetActive(false);
                }
            }
            if (goodsItem.Discount < 0x2710)
            {
                int num8 = UIUtil.GetGoodsOriginPrice(this._goods)[0];
                base.transform.Find("BG/Unselected/FakePrize").gameObject.SetActive(true);
                base.transform.Find("BG/Selected/FakePrize").gameObject.SetActive(true);
                base.transform.Find("BG/Unselected/FakePrize/Num").GetComponent <Text>().text = num8.ToString();
                base.transform.Find("BG/Selected/FakePrize/Num").GetComponent <Text>().text   = num8.ToString();
            }
            else
            {
                base.transform.Find("BG/Unselected/FakePrize").gameObject.SetActive(false);
                base.transform.Find("BG/Selected/FakePrize").gameObject.SetActive(false);
            }
            if (!this._isMultiCurrency)
            {
                base.transform.Find("BG/Unselected/NowPrize/Image").gameObject.SetActive(true);
                base.transform.Find("BG/Unselected/NowPrize/x").gameObject.SetActive(true);
                base.transform.Find("BG/Unselected/NowPrize/Num").gameObject.SetActive(true);
                base.transform.Find("BG/Selected/NowPrize/Image").gameObject.SetActive(true);
                base.transform.Find("BG/Selected/NowPrize/x").gameObject.SetActive(true);
                base.transform.Find("BG/Selected/NowPrize/Num").gameObject.SetActive(true);
            }
        }