Beispiel #1
0
        public void SetupView(Goods goods, bool isSelected, int ticketID, bool isMultiCurrency = false)
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey;

            this._goods           = goods;
            this._ticketID        = ticketID;
            this._isMultiCurrency = isMultiCurrency;
            this.SetItemDefaultColor();
            base.transform.Find("BG/Selected").gameObject.SetActive(isSelected);
            base.transform.Find("BG/Unselected").gameObject.SetActive(!isSelected);
            if (this._ticketID > 0)
            {
                int hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[this._ticketID];
                shopGoodsMetaDataByKey = new ShopGoodsMetaData(this._ticketID, this._ticketID, 1, 1, hCoinCost, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                if (Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict.ContainsKey(this._ticketID / 10))
                {
                    hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[this._ticketID / 10];
                    shopGoodsMetaDataByKey = new ShopGoodsMetaData(this._ticketID, this._ticketID / 10, 1, 10, hCoinCost * 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                }
            }
            else
            {
                shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
            }
            StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(shopGoodsMetaDataByKey.ItemID, shopGoodsMetaDataByKey.ItemLevel);

            dummyStorageDataItem.number = shopGoodsMetaDataByKey.ItemNum;
            this.SetupSaleLabel(shopGoodsMetaDataByKey);
            base.transform.Find("FragmentIcon").gameObject.SetActive(dummyStorageDataItem is AvatarFragmentDataItem);
            Sprite spriteByPrefab = Miscs.GetSpriteByPrefab(dummyStorageDataItem.GetIconPath());

            base.transform.Find("ItemIcon/Icon").GetComponent <Image>().sprite       = spriteByPrefab;
            base.transform.Find("ItemIcon/FrameBg").GetComponent <Image>().sprite    = Miscs.GetSpriteByPrefab(MiscData.Config.ItemRarityBGImgPath[dummyStorageDataItem.rarity]);
            base.transform.Find("ItemIcon/FrameLight").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(MiscData.Config.ItemRarityLightImgPath[dummyStorageDataItem.rarity]);
            base.transform.Find("ItemIcon/FrameBg").gameObject.SetActive(true);
            base.transform.Find("ItemIcon/FrameLight").gameObject.SetActive(true);
            this.SetupDesc(dummyStorageDataItem);
            this.SetupRarityView(dummyStorageDataItem);
            this.SetupStigmataTypeIcon(dummyStorageDataItem);
            this.SetupPrice(shopGoodsMetaDataByKey);
            if (goods.get_buy_times() >= shopGoodsMetaDataByKey.MaxBuyTimes)
            {
                this.SetItemGrey();
            }
            else
            {
                base.transform.Find("BG/Unselected/NowPrize").gameObject.SetActive(true);
                base.transform.Find("BG/Unselected/Empty").gameObject.SetActive(false);
                Color color = base.transform.Find("BG/Unselected/Image").GetComponent <Image>().color;
                color.a = 1f;
                base.transform.Find("BG/Unselected/Image").GetComponent <Image>().color = color;
                base.transform.Find("BG/Selected/NowPrize").gameObject.SetActive(true);
                base.transform.Find("BG/Selected/Empty").gameObject.SetActive(false);
                color   = base.transform.Find("BG/Unselected/Image").GetComponent <Image>().color;
                color.a = 1f;
                base.transform.Find("BG/Unselected/Image").GetComponent <Image>().color = color;
                base.transform.Find("ItemIcon/SellOut").gameObject.SetActive(false);
            }
        }
Beispiel #2
0
        public static List <int> GetGoodsRealPrice(Goods goods)
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
            List <int>        goodsOriginPrice       = GetGoodsOriginPrice(goods);

            for (int i = 0; i < goodsOriginPrice.Count; i++)
            {
                goodsOriginPrice[i] = (int)Mathf.Floor((((float)goodsOriginPrice[i]) * shopGoodsMetaDataByKey.Discount) / 10000f);
            }
            return(goodsOriginPrice);
        }
Beispiel #3
0
        public override string ToString()
        {
            object[] args = new object[] { this.shopID, this.isOpen, this.shopNameTextID, this.nextAutoRefreshTime, this.manualRefreshTimes, this.nextRefreshCost, this.maxManualRefreshTimes };
            string   str  = string.Format("<StoreDataItem>\nID: {0}\nisOpen: {1}\nnameID: {2}\nnextAutoRefreshTime: {3}\nmanualRefreshTimes: {4}\nnextRefreshHCoinCost: {5}\nmaxManualRefreshTimes: {6}", args) + "\ngoodsList: " + this.goodsList.Count.ToString() + "\n";

            foreach (Goods goods in this.goodsList)
            {
                ShopGoodsMetaData   shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
                StorageDataItemBase dummyStorageDataItem   = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(shopGoodsMetaDataByKey.ItemID, shopGoodsMetaDataByKey.ItemLevel);

                dummyStorageDataItem.number = shopGoodsMetaDataByKey.ItemNum;
                string   str2      = str;
                object[] objArray2 = new object[] {
                    str2, "ID: ", goods.get_goods_id(), " name: ", dummyStorageDataItem.GetDisplayTitle(), " level: ", shopGoodsMetaDataByKey.ItemLevel.ToString(), " number: ", shopGoodsMetaDataByKey.ItemNum.ToString(), " hcoinCost: ", shopGoodsMetaDataByKey.HCoinCost.ToString(), " scoinCost: ", shopGoodsMetaDataByKey.SCoinCost.ToString(), " maxBuyTimes: ", shopGoodsMetaDataByKey.MaxBuyTimes.ToString(), " buyTimes: ",
                    goods.get_buy_times().ToString(), "\n"
                };
                str = string.Concat(objArray2);
            }
            return(str);
        }
Beispiel #4
0
        public void OnIconClick()
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey;

            if (this._ticketID > 0)
            {
                int hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[this._ticketID];
                shopGoodsMetaDataByKey = new ShopGoodsMetaData(this._ticketID, this._ticketID, 1, 1, hCoinCost, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                if (Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict.ContainsKey(this._ticketID / 10))
                {
                    hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[this._ticketID / 10];
                    shopGoodsMetaDataByKey = new ShopGoodsMetaData(this._ticketID, this._ticketID / 10, 1, 10, hCoinCost * 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                }
            }
            else
            {
                shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)this._goods.get_goods_id());
            }
            StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(shopGoodsMetaDataByKey.ItemID, shopGoodsMetaDataByKey.ItemLevel);

            dummyStorageDataItem.number = shopGoodsMetaDataByKey.ItemNum;
            UIUtil.ShowItemDetail(dummyStorageDataItem, true, true);
            this.OnClick();
        }
Beispiel #5
0
        public void OnSelectGoods(Goods goods)
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey;

            if (this._shopType == UIShopType.SHOP_GACHATICKET)
            {
                int iD        = (int)goods.get_goods_id();
                int hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[(int)goods.get_goods_id()];
                shopGoodsMetaDataByKey = new ShopGoodsMetaData((int)goods.get_goods_id(), (int)goods.get_goods_id(), 1, 1, hCoinCost, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                if (Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict.ContainsKey(iD / 10))
                {
                    hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[(int)(goods.get_goods_id() / 10)];
                    shopGoodsMetaDataByKey = new ShopGoodsMetaData(iD, iD / 10, 1, 10, hCoinCost * 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
                }
            }
            else
            {
                shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
            }
            if (shopGoodsMetaDataByKey != null)
            {
                this._currentSelectedGoodsID = (int)goods.get_goods_id();
                if (this._shopType == UIShopType.SHOP_ACTIVITY)
                {
                    this.RefreshActivityScroller();
                }
                else
                {
                    this._scrollViewTrans.GetComponent <MonoGridScroller>().RefreshCurrent();
                }
                base.transform.parent.Find("CartInfoPanel/Info").gameObject.SetActive(true);
                StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(shopGoodsMetaDataByKey.ItemID, shopGoodsMetaDataByKey.ItemLevel);

                string text = string.Empty;
                if (goods.get_buy_times() >= shopGoodsMetaDataByKey.MaxBuyTimes)
                {
                    text = LocalizationGeneralLogic.GetText("Menu_ShopStoreBuyCostLackMoney", new object[0]);
                    base.transform.parent.Find("CartInfoPanel/BuyBtn").GetComponent <Button>().interactable = false;
                }
                else
                {
                    base.transform.parent.Find("CartInfoPanel/BuyBtn").GetComponent <Button>().interactable = true;
                    if (shopGoodsMetaDataByKey.ItemNum > 1)
                    {
                        object[] replaceParams = new object[] { dummyStorageDataItem.GetDisplayTitle(), shopGoodsMetaDataByKey.ItemNum };
                        text = LocalizationGeneralLogic.GetText("Menu_ShopStoreBuyCostDescMulti", replaceParams);
                    }
                    else
                    {
                        object[] objArray2 = new object[] { dummyStorageDataItem.GetDisplayTitle() };
                        text = LocalizationGeneralLogic.GetText("Menu_ShopStoreBuyCostDescOne", objArray2);
                    }
                    if (this._shopType != UIShopType.SHOP_GACHATICKET)
                    {
                        int num3 = shopGoodsMetaDataByKey.MaxBuyTimes - ((int)goods.get_buy_times());
                        if (goods.get_can_be_refreshSpecified() && goods.get_can_be_refresh())
                        {
                            object[] objArray3 = new object[] { num3 };
                            text = text + LocalizationGeneralLogic.GetText("Menu_ShopStoreBuyCostRemainToday", objArray3);
                        }
                        else
                        {
                            object[] objArray4 = new object[] { num3 };
                            text = text + LocalizationGeneralLogic.GetText("Menu_ShopStoreBuyCostRemainTotal", objArray4);
                        }
                    }
                }
                base.transform.parent.Find("CartInfoPanel/Info/Desc").GetComponent <Text>().text = text;
            }
        }
Beispiel #6
0
        private bool CanBuyGoods()
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey;

            if (this._currentSelectedGoodsID == 0)
            {
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopNoSelect", new object[0]), 2f), UIType.Any);

                return(false);
            }
            Goods goodsByID = this.GetGoodsByID(this._currentSelectedGoodsID);

            if (goodsByID == null)
            {
                return(false);
            }
            if (this._shopType == UIShopType.SHOP_GACHATICKET)
            {
                int hCoinCost = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[(int)goodsByID.get_goods_id()];
                shopGoodsMetaDataByKey = new ShopGoodsMetaData((int)goodsByID.get_goods_id(), (int)goodsByID.get_goods_id(), 1, 1, hCoinCost, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7fffffff, 1, 0x2710, false);
            }
            else
            {
                shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goodsByID.get_goods_id());
            }
            if (goodsByID.get_buy_times() >= shopGoodsMetaDataByKey.MaxBuyTimes)
            {
                return(false);
            }
            List <int> list = (this._shopType != UIShopType.SHOP_GACHATICKET) ? UIUtil.GetGoodsRealPrice(goodsByID) : new List <int> {
                Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[(int)goodsByID.get_goods_id()]
            };
            int num2 = 0;

            if (shopGoodsMetaDataByKey.HCoinCost > 0)
            {
                if (list[num2] > Singleton <PlayerModule> .Instance.playerData.hcoin)
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackHCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.SCoinCost > 0)
            {
                if (list[num2] > Singleton <PlayerModule> .Instance.playerData.scoin)
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.CostItemNum > 0)
            {
                StorageDataItemBase storageItemByTypeAndID = Singleton <StorageModule> .Instance.GetStorageItemByTypeAndID(typeof(MaterialDataItem), shopGoodsMetaDataByKey.CostItemId);

                if ((storageItemByTypeAndID == null) || (list[num2] > storageItemByTypeAndID.number))
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.CostItemNum2 > 0)
            {
                StorageDataItemBase base3 = Singleton <StorageModule> .Instance.GetStorageItemByTypeAndID(typeof(MaterialDataItem), shopGoodsMetaDataByKey.CostItemId2);

                if ((base3 == null) || (list[num2] > base3.number))
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.CostItemNum3 > 0)
            {
                StorageDataItemBase base4 = Singleton <StorageModule> .Instance.GetStorageItemByTypeAndID(typeof(MaterialDataItem), shopGoodsMetaDataByKey.CostItemId3);

                if ((base4 == null) || (list[num2] > base4.number))
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.CostItemNum4 > 0)
            {
                StorageDataItemBase base5 = Singleton <StorageModule> .Instance.GetStorageItemByTypeAndID(typeof(MaterialDataItem), shopGoodsMetaDataByKey.CostItemId4);

                if ((base5 == null) || (list[num2] > base5.number))
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (shopGoodsMetaDataByKey.CostItemNum5 > 0)
            {
                StorageDataItemBase base6 = Singleton <StorageModule> .Instance.GetStorageItemByTypeAndID(typeof(MaterialDataItem), shopGoodsMetaDataByKey.CostItemId5);

                if ((base6 == null) || (list[num2] > base6.number))
                {
                    Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsLackSCoin", new object[0]), 2f), UIType.Any);

                    return(false);
                }
                num2++;
            }
            if (Singleton <StorageModule> .Instance.IsFull())
            {
                GeneralDialogContext dialogContext = new GeneralDialogContext {
                    type  = GeneralDialogContext.ButtonType.SingleButton,
                    title = LocalizationGeneralLogic.GetText("Menu_Title_Tips", new object[0]),
                    desc  = LocalizationGeneralLogic.GetText("Menu_ShopBuyGoodsBagFull", new object[0])
                };
                Singleton <MainUIManager> .Instance.ShowDialog(dialogContext, UIType.Any);

                return(false);
            }
            return(true);
        }
Beispiel #7
0
        public static List <int> GetGoodsOriginPrice(Goods goods)
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
            List <int>        list = new List <int>();

            if (shopGoodsMetaDataByKey.HCoinCost > 0)
            {
                list.Add(shopGoodsMetaDataByKey.HCoinCost);
            }
            if (shopGoodsMetaDataByKey.SCoinCost > 0)
            {
                list.Add(shopGoodsMetaDataByKey.SCoinCost);
            }
            if (shopGoodsMetaDataByKey.CostItemId > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum);
            }
            if (shopGoodsMetaDataByKey.CostItemId2 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum2);
            }
            if (shopGoodsMetaDataByKey.CostItemId3 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum3);
            }
            if (shopGoodsMetaDataByKey.CostItemId4 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum4);
            }
            if (shopGoodsMetaDataByKey.CostItemId5 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum5);
            }
            float num      = 1f;
            int   buyTimes = ((int)goods.get_buy_times()) + 1;
            ShopGoodsPriceRateMetaData shopGoodsPriceRateMetaDataByKey = ShopGoodsPriceRateMetaDataReader.GetShopGoodsPriceRateMetaDataByKey(buyTimes);

            if (shopGoodsMetaDataByKey.PriceRateID == 1)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType1;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 2)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType2;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 3)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType3;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 4)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType4;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 5)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType5;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 6)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType6;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 7)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType7;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 8)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType8;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 9)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType9;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 10)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType10;
            }
            num /= 100f;
            for (int i = 0; i < list.Count; i++)
            {
                list[i] = Mathf.FloorToInt(((float)list[i]) * num);
            }
            return(list);
        }