private void OpenPendingShop() { if (GUIShopScene.PendingOpenShopType == EShopType.EShop_Max) { global::Debug.LogError(new object[] { "data error" }); GUIShopScene.PendingOpenShopType = EShopType.EShop_Common; } if (!GUIShopScene.IsShopOpen(GUIShopScene.PendingOpenShopType)) { global::Debug.LogError(new object[] { "data error" }); GameUIManager.mInstance.GobackSession(); return; } this.ShopType = GUIShopScene.PendingOpenShopType; this.Title.text = Singleton<StringManager>.Instance.GetString(string.Format("ShopN{0}", (int)this.ShopType)); TopGoods topGoods = GameUIManager.mInstance.GetTopGoods(); topGoods.BackLabelText = this.Title.text; this._RefreshShopStatus(); for (int i = 0; i < 4; i++) { this.tabEquip[i].gameObject.SetActive(this.ShopType == EShopType.EShop_Trial); } if (GUIShopScene.PendingOpenShopType == EShopType.EShop_Common2) { MC2S_GetShopData mC2S_GetShopData = new MC2S_GetShopData(); mC2S_GetShopData.ShopVersion = Globals.Instance.Player.PetShopVersion; mC2S_GetShopData.Refresh = false; mC2S_GetShopData.ShopType = 0; mC2S_GetShopData.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData); } else if (GUIShopScene.PendingOpenShopType == EShopType.EShop_Awaken) { MC2S_GetShopData mC2S_GetShopData2 = new MC2S_GetShopData(); mC2S_GetShopData2.ShopVersion = Globals.Instance.Player.AwakeShopVersion; mC2S_GetShopData2.Refresh = false; mC2S_GetShopData2.ShopType = 1; mC2S_GetShopData2.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData2); } else if (GUIShopScene.PendingOpenShopType == EShopType.EShop_Lopet) { MC2S_GetShopData mC2S_GetShopData3 = new MC2S_GetShopData(); mC2S_GetShopData3.ShopVersion = Globals.Instance.Player.AwakeShopVersion; mC2S_GetShopData3.Refresh = false; mC2S_GetShopData3.ShopType = 9; mC2S_GetShopData3.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData3); } else { this.OpenShopData(); } }
private void OnRefreshClick(GameObject go) { Globals.Instance.EffectSoundMgr.Play("ui/ui_001"); if (this.ShopType != EShopType.EShop_Common2 && this.ShopType != EShopType.EShop_Awaken && this.ShopType != EShopType.EShop_Lopet) { global::Debug.LogErrorFormat("shop can not refresh {0}", new object[] { this.ShopType }); return; } LocalPlayer player = Globals.Instance.Player; if (this.ShopType == EShopType.EShop_Common2) { int num = Tools.GetShopRefreshTimes(this.ShopType) - (int)player.Data.Common2ShopRefresh; if (num <= 0) { if (player.Data.VipLevel >= 15u) { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } else { VipLevelInfo vipLevelInfo = null; for (VipLevelInfo info = Globals.Instance.AttDB.VipLevelDict.GetInfo((int)(player.Data.VipLevel + 1u)); info != null; info = Globals.Instance.AttDB.VipLevelDict.GetInfo(info.ID + 1)) { if (info.ID > 15) { break; } if ((long)info.ShopCommon2Count > (long)((ulong)player.Data.Common2ShopRefresh)) { vipLevelInfo = info; break; } } if (vipLevelInfo != null) { GameMessageBox.ShowPrivilegeMessageBox(string.Format(Singleton<StringManager>.Instance.GetString("ShopT6"), vipLevelInfo.ID, Singleton<StringManager>.Instance.GetString("ShopN0"), vipLevelInfo.ShopCommon2Count)); } else { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } } } else { int itemCount = player.ItemSystem.GetItemCount(GameConst.GetInt32(82)); if (itemCount > 0) { MC2S_GetShopData mC2S_GetShopData = new MC2S_GetShopData(); mC2S_GetShopData.ShopVersion = Globals.Instance.Player.PetShopVersion; mC2S_GetShopData.Refresh = true; mC2S_GetShopData.ShopType = (int)this.ShopType; mC2S_GetShopData.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData); this.refreshBtn.isEnabled = false; return; } if (player.Data.Diamond < GameConst.GetInt32(51)) { GameMessageBox.ShowRechargeMessageBox(); } else { MC2S_GetShopData mC2S_GetShopData2 = new MC2S_GetShopData(); mC2S_GetShopData2.ShopVersion = Globals.Instance.Player.PetShopVersion; mC2S_GetShopData2.Refresh = true; mC2S_GetShopData2.ShopType = (int)this.ShopType; mC2S_GetShopData2.DiamondRefresh = true; Globals.Instance.CliSession.Send(512, mC2S_GetShopData2); this.refreshBtn.isEnabled = false; } } } else if (this.ShopType == EShopType.EShop_Awaken) { int num2 = Tools.GetShopRefreshTimes(this.ShopType) - (int)player.Data.AwakenShopRefresh; if (num2 <= 0) { if (player.Data.VipLevel >= 15u) { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } else { VipLevelInfo vipLevelInfo2 = null; for (VipLevelInfo info2 = Globals.Instance.AttDB.VipLevelDict.GetInfo((int)(player.Data.VipLevel + 1u)); info2 != null; info2 = Globals.Instance.AttDB.VipLevelDict.GetInfo(info2.ID + 1)) { if (info2.ID > 15) { break; } if ((long)info2.ShopAwakenCount > (long)((ulong)player.Data.AwakenShopRefresh)) { vipLevelInfo2 = info2; break; } } if (vipLevelInfo2 != null) { GameMessageBox.ShowPrivilegeMessageBox(string.Format(Singleton<StringManager>.Instance.GetString("ShopT6"), vipLevelInfo2.ID, Singleton<StringManager>.Instance.GetString("ShopN1"), vipLevelInfo2.ShopAwakenCount)); } else { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } } } else { int itemCount2 = player.ItemSystem.GetItemCount(GameConst.GetInt32(82)); if (itemCount2 > 0) { MC2S_GetShopData mC2S_GetShopData3 = new MC2S_GetShopData(); mC2S_GetShopData3.ShopVersion = Globals.Instance.Player.PetShopVersion; mC2S_GetShopData3.Refresh = true; mC2S_GetShopData3.ShopType = (int)this.ShopType; mC2S_GetShopData3.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData3); this.refreshBtn.isEnabled = false; return; } if (player.Data.Diamond < GameConst.GetInt32(51)) { GameMessageBox.ShowRechargeMessageBox(); } else { MC2S_GetShopData mC2S_GetShopData4 = new MC2S_GetShopData(); mC2S_GetShopData4.ShopVersion = Globals.Instance.Player.AwakeShopVersion; mC2S_GetShopData4.Refresh = true; mC2S_GetShopData4.ShopType = (int)this.ShopType; mC2S_GetShopData4.DiamondRefresh = true; Globals.Instance.CliSession.Send(512, mC2S_GetShopData4); this.refreshBtn.isEnabled = false; } } } else if (this.ShopType == EShopType.EShop_Lopet) { int num3 = Tools.GetShopRefreshTimes(this.ShopType) - player.Data.LopetShopRefresh; if (num3 <= 0) { if (player.Data.VipLevel >= 15u) { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } else { VipLevelInfo vipLevelInfo3 = null; for (VipLevelInfo info3 = Globals.Instance.AttDB.VipLevelDict.GetInfo((int)(player.Data.VipLevel + 1u)); info3 != null; info3 = Globals.Instance.AttDB.VipLevelDict.GetInfo(info3.ID + 1)) { if (info3.ID > 15) { break; } if (info3.ShopLopetCount > player.Data.LopetShopRefresh) { vipLevelInfo3 = info3; break; } } if (vipLevelInfo3 != null) { GameMessageBox.ShowPrivilegeMessageBox(string.Format(Singleton<StringManager>.Instance.GetString("ShopT6"), vipLevelInfo3.ID, Singleton<StringManager>.Instance.GetString("ShopN9"), vipLevelInfo3.ShopLopetCount)); } else { GameUIManager.mInstance.ShowMessageTipByKey("ShopT6_1", 0f, 0f); } } } else { int itemCount3 = player.ItemSystem.GetItemCount(GameConst.GetInt32(82)); if (itemCount3 > 0) { MC2S_GetShopData mC2S_GetShopData5 = new MC2S_GetShopData(); mC2S_GetShopData5.ShopVersion = Globals.Instance.Player.PetShopVersion; mC2S_GetShopData5.Refresh = true; mC2S_GetShopData5.ShopType = (int)this.ShopType; mC2S_GetShopData5.DiamondRefresh = false; Globals.Instance.CliSession.Send(512, mC2S_GetShopData5); this.refreshBtn.isEnabled = false; return; } if (player.Data.Diamond < GameConst.GetInt32(51)) { GameMessageBox.ShowRechargeMessageBox(); } else { MC2S_GetShopData mC2S_GetShopData6 = new MC2S_GetShopData(); mC2S_GetShopData6.ShopVersion = Globals.Instance.Player.AwakeShopVersion; mC2S_GetShopData6.Refresh = true; mC2S_GetShopData6.ShopType = (int)this.ShopType; mC2S_GetShopData6.DiamondRefresh = true; Globals.Instance.CliSession.Send(512, mC2S_GetShopData6); this.refreshBtn.isEnabled = false; } } } }