修复sdk支付时界面不刷新的问题,

dev_chengFeng
gaoxin 2020-07-20 19:57:49 +08:00
parent ed0a54ab56
commit 42a2496ef7
5 changed files with 41 additions and 2 deletions

View File

@ -303,6 +303,7 @@ GameEvent = {
},
LoginSuccess = {
OnLoginSuccess = "LoginSuccess.OnLoginSuccess",
OnLogout = "LoginSuccess.OnLogout",
},
HeroGrade = {
OnHeroGradeChange = "HeroGrade.OnHeroGradeChange",

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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)