From d5d30fd6a818386b0d0838abcd1c99886f429752 Mon Sep 17 00:00:00 2001 From: jiaoyangna <3046463818@qq.com> Date: Sat, 26 Dec 2020 11:47:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=B7=E6=96=B0=E7=A4=BC=E5=8C=85=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManagedResources/~Lua/Logic/GameEvent.lua | 3 ++- .../~Lua/Modules/Net/IndicationManager.lua | 2 ++ .../Modules/Operating/OperatingManager.lua | 1 - .../~Lua/Modules/Recharge/View/GiftView.lua | 21 ++++++++++++++++++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index cd9bbc01bf..638746d1ff 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -390,7 +390,8 @@ GameEvent = { RefreshMainPanel="Expedition.RefreshMainPanel" }, GrowGift={ - GetAllGift="GrowGift.GetAllGift" + GetAllGift="GrowGift.GetAllGift", + RechargeGift = "GrowGift.RechargeGift" }, TreasureOfHeaven={ RechargeSuccess="TreasureOfHeaven.RechargeSuccess", diff --git a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua index 975f6016c4..0a17cde15d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua @@ -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 -- 接收服务器好友申请,添加 diff --git a/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua b/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua index e2753991c7..6174604981 100644 --- a/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Operating/OperatingManager.lua @@ -30,7 +30,6 @@ function this.Initialize() Game.GlobalEvent:AddEvent(GameEvent.PatFace.PatFaceHaveGrowGift, this.NewHeroGift) end - ---------------------------局限性---------------------------- function this.SetBasicValues(giftGoodsList) giftGoodsInfo = giftGoodsList diff --git a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua index 89cf8e3caf..15df8ad5da 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recharge/View/GiftView.lua @@ -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)