Beispiel #1
0
        public void OnManualRefresh()
        {
            if (this._storeDataItem.manualRefreshTimes < this._storeDataItem.maxManualRefreshTimes)
            {
                GeneralDialogContext context;
                string text = LocalizationGeneralLogic.GetText("Menu_Hcoin", new object[0]);
                if (this._storeDataItem.refreshItemID == 0)
                {
                    if (this._storeDataItem.nextRefreshCost > Singleton <PlayerModule> .Instance.playerData.hcoin)
                    {
                        object[] replaceParams = new object[] { text };
                        Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopManualRefreshLackHCoin", replaceParams), 2f), UIType.Any);
                    }
                    else
                    {
                        context = new GeneralDialogContext {
                            type  = GeneralDialogContext.ButtonType.DoubleButton,
                            title = LocalizationGeneralLogic.GetText("Menu_Title_Tips", new object[0])
                        };
                        object[] objArray2 = new object[] { this._storeDataItem.nextRefreshCost, text };
                        context.desc           = LocalizationGeneralLogic.GetText("Menu_Desc_RefreshShopHint", objArray2);
                        context.buttonCallBack = new Action <bool>(this.DoRequestToRefresh);
                        Singleton <MainUIManager> .Instance.ShowDialog(context, UIType.Any);
                    }
                }
                else
                {
                    int number = 0;
                    StorageDataItemBase base2 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(this._storeDataItem.refreshItemID);

                    StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(this._storeDataItem.refreshItemID, 1);

                    if (base2 != null)
                    {
                        number = base2.number;
                    }
                    if (this._storeDataItem.nextRefreshCost > number)
                    {
                        object[] objArray3 = new object[] { dummyStorageDataItem.GetDisplayTitle() };
                        Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_ShopManualRefreshLackHCoin", objArray3), 2f), UIType.Any);
                    }
                    else
                    {
                        context = new GeneralDialogContext {
                            type  = GeneralDialogContext.ButtonType.DoubleButton,
                            title = LocalizationGeneralLogic.GetText("Menu_Title_Tips", new object[0])
                        };
                        object[] objArray4 = new object[] { this._storeDataItem.nextRefreshCost, dummyStorageDataItem.GetDisplayTitle() };
                        context.desc           = LocalizationGeneralLogic.GetText("Menu_Desc_RefreshShopHint", objArray4);
                        context.buttonCallBack = new Action <bool>(this.DoRequestToRefresh);
                        Singleton <MainUIManager> .Instance.ShowDialog(context, UIType.Any);
                    }
                }
            }
        }
        public bool OnBuyGachaTicketRsp(BuyGachaTicketRsp rsp)
        {
            if (rsp.get_retcode() == null)
            {
                StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(this._ticketID, 1);

                object[] replaceParams = new object[] { this._lackTicketNum, dummyStorageDataItem.GetDisplayTitle() };
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_Desc_BuyGachaTicketSuccess", replaceParams), 2f), UIType.Any);
            }
            this.Destroy();
            return(false);
        }
Beispiel #3
0
        private bool OnBuyGachaTicket(BuyGachaTicketRsp rsp)
        {
            if (rsp.get_retcode() == null)
            {
                StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem((int)rsp.get_material_id(), 1);

                object[] replaceParams = new object[] { dummyStorageDataItem.GetDisplayTitle(), (int)rsp.get_num() };
                Singleton <MainUIManager> .Instance.ShowDialog(new GeneralHintDialogContext(LocalizationGeneralLogic.GetText("Menu_Desc_BuyGachaTicketSuccess", replaceParams), 2f), UIType.Any);

                Singleton <NetworkManager> .Instance.RequestHasGotItemIdList();

                return(this.SetupView());
            }
            return(false);
        }
Beispiel #4
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 #5
0
        public ChatMsgDataItem(SystemChatMsg sysChatMsg)
        {
            if (sysChatMsg.get_type() == 1)
            {
                StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem((int)sysChatMsg.get_item_id(), 1);

                Type     mSG           = Type.MSG;
                object[] replaceParams = new object[] { string.Format("[{0}]", dummyStorageDataItem.GetDisplayTitle()) };
                string   text          = LocalizationGeneralLogic.GetText("ChatMsg_GachaGetItem", replaceParams);
                if (dummyStorageDataItem.rarity >= 4)
                {
                    string   str2      = string.Format("{0}[{1}]{2}", "<color=#9b59b6>", dummyStorageDataItem.GetDisplayTitle(), "</color>");
                    string   str3      = string.Format("{0}{1}{2}", "<color=#88c700ff>", LocalizationGeneralLogic.GetText("Chat_Content_Source_Egg", new object[0]), "</color>");
                    object[] objArray2 = new object[] { str3, str2 };
                    text = LocalizationGeneralLogic.GetText("ChatMsg_GachaGetItemFrom", objArray2);
                    mSG  = Type.LUCK_GECHA;
                }
                DateTime dateTimeFromTimeStamp = Miscs.GetDateTimeFromTimeStamp(sysChatMsg.get_time());
                string   nickname = !string.IsNullOrEmpty(sysChatMsg.get_nickname()) ? sysChatMsg.get_nickname() : ("ID. " + sysChatMsg.get_uid());
                this.Init((int)sysChatMsg.get_uid(), nickname, dateTimeFromTimeStamp, text, mSG);
            }
        }
        protected override bool SetupView()
        {
            StorageDataItemBase dummyStorageDataItem = Singleton <StorageModule> .Instance.GetDummyStorageDataItem(this._ticketID, 1);

            StorageDataItemBase base3 = Singleton <StorageModule> .Instance.TryGetMaterialDataByID(this._ticketID);

            this._currentTicketNum = (base3 != null) ? base3.number : 0;
            this._ticketPrice      = Singleton <PlayerModule> .Instance.playerData.gachaTicketPriceDict[this._ticketID];
            this._lackTicketNum    = this._wantedNum - this._currentTicketNum;
            this._hcoinEnough      = Singleton <PlayerModule> .Instance.playerData.hcoin >= (this._lackTicketNum * this._ticketPrice);
            string str  = !this._hcoinEnough ? LocalizationGeneralLogic.GetText("Menu_GoToRecharge", new object[0]) : LocalizationGeneralLogic.GetText("Menu_Buy", new object[0]);
            string str2 = !this._hcoinEnough ? LocalizationGeneralLogic.GetText("Menu_GoToRechargeDesc", new object[0]) : LocalizationGeneralLogic.GetText("Menu_Desc_GachaTicketLack", new object[] { dummyStorageDataItem.GetDisplayTitle(), this._lackTicketNum *this._ticketPrice, this._lackTicketNum, dummyStorageDataItem.GetDisplayTitle() });

            base.view.transform.Find("Dialog/Content/DoubleButton/OKBtn/Text").GetComponent <Text>().text = str;
            base.view.transform.Find("Dialog/Content/Desc/DescText").GetComponent <Text>().text           = str2;
            string iconPath = dummyStorageDataItem.GetIconPath();

            base.view.transform.Find("Dialog/Content/TicketIcon/Image").GetComponent <Image>().sprite = Miscs.GetSpriteByPrefab(iconPath);
            base.view.transform.Find("Dialog/Content/CurretnTickets/Content/TicketLabel").GetComponent <Text>().text = dummyStorageDataItem.GetDisplayTitle();
            base.view.transform.Find("Dialog/Content/CurretnTickets/Content/Num").GetComponent <Text>().text         = this._currentTicketNum.ToString();
            object[] replaceParams = new object[] { dummyStorageDataItem.GetDisplayTitle() };
            base.view.transform.Find("Dialog/Title/Text").GetComponent <Text>().text = LocalizationGeneralLogic.GetText("Menu_Title_GachaTitcketLack", replaceParams);
            return(false);
        }
Beispiel #7
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;
            }
        }