刷新礼包修改

dev_chengFeng
jiaoyangna 2020-12-26 11:47:16 +08:00
parent 6945cbcacf
commit d5d30fd6a8
4 changed files with 24 additions and 3 deletions

View File

@ -390,7 +390,8 @@ GameEvent = {
RefreshMainPanel="Expedition.RefreshMainPanel"
},
GrowGift={
GetAllGift="GrowGift.GetAllGift"
GetAllGift="GrowGift.GetAllGift",
RechargeGift = "GrowGift.RechargeGift"
},
TreasureOfHeaven={
RechargeSuccess="TreasureOfHeaven.RechargeSuccess",

View File

@ -292,6 +292,8 @@ function this.RefreshGiftGoods(buffer)
local msg = PlayerInfoProto_pb.AllGiftGoodsIndication()
msg:ParseFromString(data)
OperatingManager.SetBasicValues(msg.GiftGoodsInfo)
Game.GlobalEvent:DispatchEvent(GameEvent.GrowGift.RechargeGift)
LogYellow("发送了GameEvent.GrowGift.RechargeGift")
end
-- 接收服务器好友申请,添加

View File

@ -30,7 +30,6 @@ function this.Initialize()
Game.GlobalEvent:AddEvent(GameEvent.PatFace.PatFaceHaveGrowGift, this.NewHeroGift)
end
---------------------------局限性----------------------------
function this.SetBasicValues(giftGoodsList)
giftGoodsInfo = giftGoodsList

View File

@ -24,6 +24,18 @@ function GiftView:ctor(mainPanel, gameObject)
self.ItemList = {}
end
--添加事件监听(用于子类重写)
function GiftView:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh)
end
--移除事件监听(用于子类重写)
function GiftView:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.GrowGift.RechargeGift, GiftView.refresh)
end
function GiftView:InitComponent(gameObject)
self.itemPre = Util.GetGameObject(gameObject, "rzyBg/ItemPre")
self.itemPre2 = Util.GetGameObject(gameObject, "rzyBg/ItemPre2")
@ -83,9 +95,10 @@ function GiftView:BindEvent()
end)
end)
end
local curBuyType = 0
function GiftView:OnShow(_sortingOrder, buyType)
rechargeNum= VipManager.GetChargedNum()--已经充值的金额
curBuyType = buyType
self:RefreshData(buyType)
end
@ -96,6 +109,12 @@ function GiftView:OnSortingOrderChange(cursortingOrder)
end
end
end
GiftView.refresh = function()
LogYellow("收到了GameEvent.GrowGift.RechargeGift")
GiftView:RefreshData(curBuyType)
end
------日周月礼包------
-- 根据选择的页签刷新数据
function GiftView:RefreshData(buyType)