【周卡】停留在周卡界面跨天时刷新界面显示

dev_chengFeng
gaoxin 2021-10-29 18:27:23 +08:00
parent 487a2c0a6f
commit 0c81ddfefe
4 changed files with 13 additions and 2 deletions

View File

@ -397,6 +397,9 @@ GameEvent = {
MonthCard={ MonthCard={
OnMonthCardUpdate = "MonthCard.OnMonthCardUpdate", OnMonthCardUpdate = "MonthCard.OnMonthCardUpdate",
}, },
WeekCard={
OnWeekCardUpdate = "WeekCard.OnWeekCardUpdate",
},
BugCoin={ --点金 BugCoin={ --点金
OnBuyCoinUpdate="BugCoin.OnBuyCoinUpdate" OnBuyCoinUpdate="BugCoin.OnBuyCoinUpdate"
}, },

View File

@ -149,7 +149,6 @@ function this.RegisterMessage(network)
socket:RegistNetMessage(MessageTypeProto_pb.EQUIP_BOOK_INDICATION, this.EquipBookInfoIndication) socket:RegistNetMessage(MessageTypeProto_pb.EQUIP_BOOK_INDICATION, this.EquipBookInfoIndication)
-- 周卡推送 -- 周卡推送
socket:RegistNetMessage(MessageTypeProto_pb.WeekCardIndicationInfoResponse, this.WeekCardIndication) socket:RegistNetMessage(MessageTypeProto_pb.WeekCardIndicationInfoResponse, this.WeekCardIndication)
end end
function this.EquipBookInfoIndication(buff) function this.EquipBookInfoIndication(buff)
@ -1046,6 +1045,7 @@ function this.SevenWorldInfoIndication(buffer)
end) end)
end end
-- 周卡推送
function this.WeekCardIndication(buffer) function this.WeekCardIndication(buffer)
local data = buffer:DataByte() local data = buffer:DataByte()
local msg = ActivityProto_pb.WeekCardIndicationInfoResponse() local msg = ActivityProto_pb.WeekCardIndicationInfoResponse()

View File

@ -15,6 +15,8 @@ function this.UpdateAllWeekCard(msg)
for i, data in ipairs(msg.allWeekCardInfo) do for i, data in ipairs(msg.allWeekCardInfo) do
this.UpdateWeekCardData(data) this.UpdateWeekCardData(data)
end end
-- 发送事件
Game.GlobalEvent:DispatchEvent(GameEvent.WeekCard.OnWeekCardUpdate)
end end
-- 更新月卡数据 -- 更新月卡数据
function this.UpdateWeekCardData(data) function this.UpdateWeekCardData(data)

View File

@ -40,10 +40,12 @@ end
--绑定事件(用于子类重写) --绑定事件(用于子类重写)
function WeekCardPage:BindEvent() function WeekCardPage:BindEvent()
Game.GlobalEvent:AddEvent(GameEvent.WeekCard.OnWeekCardUpdate, self.RefreshShow, self)
end end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
function WeekCardPage:AddListener() function WeekCardPage:AddListener()
Game.GlobalEvent:RemoveEvent(GameEvent.WeekCard.OnWeekCardUpdate, self.RefreshShow, self)
end end
--移除事件监听(用于子类重写) --移除事件监听(用于子类重写)
@ -64,6 +66,8 @@ end
function WeekCardPage:OnShow(_sortingOrder) function WeekCardPage:OnShow(_sortingOrder)
self.gameObject:SetActive(true) self.gameObject:SetActive(true)
sortingOrder = _sortingOrder sortingOrder = _sortingOrder
-- 刷新显示
self:RefreshShow() self:RefreshShow()
-- 查看周卡界面刷新红点 -- 查看周卡界面刷新红点
@ -73,7 +77,7 @@ function WeekCardPage:OnShow(_sortingOrder)
end end
-- 妖晶数量显示 -- 妖晶数量显示
function WeekCardPage:RefreshShow(index) function WeekCardPage:RefreshShow()
local allData = WeekCardManager.GetWeekCardDataArray() local allData = WeekCardManager.GetWeekCardDataArray()
--月卡 --月卡
for i = 1, #self.cardPres do for i = 1, #self.cardPres do
@ -133,6 +137,7 @@ function WeekCardPage:SetCardShow(index, data)
Util.SetGray(pre.btn, false) Util.SetGray(pre.btn, false)
Util.AddOnceClick(pre.btn, function() Util.AddOnceClick(pre.btn, function()
WeekCardManager.RequestGetWeekCardReward(data.id, function() WeekCardManager.RequestGetWeekCardReward(data.id, function()
-- 刷新显示
self:RefreshShow() self:RefreshShow()
end) end)
end) end)
@ -155,6 +160,7 @@ function WeekCardPage:SetCardShow(index, data)
-- 前端修改购买状态 -- 前端修改购买状态
data.isBuy = true data.isBuy = true
WeekCardManager.UpdateWeekCardData(data) WeekCardManager.UpdateWeekCardData(data)
-- 刷新显示
self:RefreshShow() self:RefreshShow()
end) end)
end) end)