From 42a2496ef7061104e34bd2845e52134700f78b93 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 20 Jul 2020 19:57:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dsdk=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=97=B6=E7=95=8C=E9=9D=A2=E4=B8=8D=E5=88=B7=E6=96=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManagedResources/~Lua/Logic/GameEvent.lua | 1 + .../~Lua/Modules/Login/LoginManager.lua | 2 ++ .../~Lua/Modules/Login/LoginPanel.lua | 33 +++++++++++++++++++ .../~Lua/Modules/Net/IndicationManager.lua | 5 ++- .../~Lua/Modules/Pay/PayManager.lua | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index 79e42f74cd..7ccf230fe4 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -303,6 +303,7 @@ GameEvent = { }, LoginSuccess = { OnLoginSuccess = "LoginSuccess.OnLoginSuccess", + OnLogout = "LoginSuccess.OnLogout", }, HeroGrade = { OnHeroGradeChange = "HeroGrade.OnHeroGradeChange", diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua index bd57deea58..f5f5e5fcf3 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginManager.lua @@ -45,6 +45,8 @@ function this.Initialize() ThinkingAnalyticsManager.Track("quit_account") Framework.Dispose() App.Instance:ReStart() + -- 发送登出事件 + Game.GlobalEvent:DispatchEvent(GameEvent.LoginSuccess.OnLogout) end end end diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index b4d38e6240..621e958a3c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -116,6 +116,7 @@ function this:AddListener() Game.GlobalEvent:AddEvent(Protocal.Connect, this.OnConnect) Game.GlobalEvent:AddEvent(Protocal.Disconnect, this.OnDisconnect) Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus) + Game.GlobalEvent:AddEvent(GameEvent.LoginSuccess.OnLogout, this.RefreshLoginStatus) end --移除事件监听(用于子类重写) @@ -124,6 +125,38 @@ function this:RemoveListener() Game.GlobalEvent:RemoveEvent(Protocal.Connect, this.OnConnect) Game.GlobalEvent:RemoveEvent(Protocal.Disconnect, this.OnDisconnect) Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLoginSuccess, this.RefreshLoginStatus) + Game.GlobalEvent:RemoveEvent(GameEvent.LoginSuccess.OnLogout, this.RefreshLoginStatus) +end + +function this:OnLogout() + if IsSDKLogin then + this.sdkLoginBtn:SetActive(false) + this.inputField.gameObject:SetActive(false) + this.UserBtn:SetActive(false) + this.btnUser:SetActive(false) + this.btnNotice.transform.position = this.btnUser.transform.position + this.SDKLogin() + else + this.sdkLoginBtn:SetActive(false) + + local userId = PlayerPrefs.GetString(openIdkey, defaultOpenIdkey) + if IsDevelopLogin then + this.UserBtn:SetActive(false) + this.btnUser:SetActive(false) + this.inputField.gameObject:SetActive(true) + this.inputField.text = userId + else + this.UserBtn:SetActive(true) + this.btnUser:SetActive(true) + this.inputField.gameObject:SetActive(false) + this.UserBtnText.text = userId + end + + RequestPanel.Show(Language[11121]) + this.SetLoginPart(true) + networkMgr:SendGetHttp(string.format("%sjl_loginserver/getServerList?openId=%s&channel=%s&plat=android&sub_channel=%s", LoginRoot_Url, userId, LoginRoot_Channel, LoginRoot_SubChannel), + this.OnReceiveServerList, nil, nil, nil) + end end function this:OnSortingOrderChange() diff --git a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua index 32dc825738..5ed97dc4c6 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua @@ -525,7 +525,10 @@ function this.PaySuccess(buffer) local tip = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, msg.goodsId).Tip PopupTipPanel.ShowTip(tip) --FirstRechargeManager.RefreshAccumRechargeValue(msg.goodsId) - Game.GlobalEvent:DispatchEvent(GameEvent.MoneyPay.OnPayResultSuccess, msg.goodsId) + -- 延时0.5秒刷新。避免sdk支付时商店次数未刷新,界面刷新的问题 + Timer.New(function() + Game.GlobalEvent:DispatchEvent(GameEvent.MoneyPay.OnPayResultSuccess, msg.goodsId) + end, 0.5):Start() --end end diff --git a/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua b/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua index e19f902a3f..e20614abf8 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pay/PayManager.lua @@ -62,7 +62,7 @@ function this.RequestPay(context) params.productId = context.Id params.productName = context.Name or "" params.productDesc = context.Desc or "" - params.price = context.Price + params.price = context.Price * 100 -- 以分为单位 params.ratio = 1 params.buyNum = context.BuyNum or 1 params.coinNum = BagManager.GetItemCountById(16)