diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index a6e6e8f693..0446d97fcc 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -153,6 +153,7 @@ GameEvent = { OnBagItemNumChange = "Bag.OnBagItemNumChange", GetNewItem = "Bag.GetNewItem",--得一个新item OnRefreshSoulPanelData="Bag.OnRefreshSoulPanelData", + OnBagShowWarPowerChange="Bag.OnBagShowWarPowerChange", }, Adventure = { OnAreaStateChange = "Adventure.OnAreaStateChange", diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua index 258562e13a..d2b5c8da26 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua @@ -493,6 +493,7 @@ function BagPanel:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn) Game.GlobalEvent:AddEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData) Game.GlobalEvent:AddEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo) + Game.GlobalEvent:AddEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange) end --移除事件监听(用于子类重写) @@ -502,6 +503,7 @@ function BagPanel:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.BagGoldChangeCallBackOnClickTabBtn) Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnRefreshSoulPanelData, this.OnRefreshSoulPanelBagData) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnChangeName, this.FreshPlayerInfo) + Game.GlobalEvent:RemoveEvent(GameEvent.Bag.OnBagShowWarPowerChange, this.ShowWarPowerChange) end --界面打开时调用(用于子类重写) function BagPanel:OnOpen(_sortIndex) @@ -806,5 +808,11 @@ function this.ShowGuideGo() JumpManager.ShowGuide(UIName.BagPanel, item1Btn) end end - +function this.ShowWarPowerChange() + Timer.New(function() + MsgPanel.ShowTwo("是否前往坐骑界面?",nil,function() + UIManager.OpenPanel(UIName.SettingPanel,2) + end) + end, 1):Start() +end return BagPanel \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua index ee5bf5592c..ec0bbfc163 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua @@ -158,12 +158,14 @@ function RewardItemSingleShowPopup:BindEvent() end) end elseif itemConfigData.ItemType == ItemType.Ride then + local oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) if PlayerManager.userMountList[itemConfigData.Id] then MsgPanel.ShowTwo("当前已激活该坐骑,是否要重复使用?",nil,function() NetManager.ActiveUserMountRequest(itemSid,function (msg) PlayerManager.SetPlayerMountTime(itemSid,msg.validTime) self:ClosePanel() PopupTipPanel.ShowTip("成功激活坐骑!") + this.WarPowerChange(oldPowerNum) end) end) else @@ -171,6 +173,7 @@ function RewardItemSingleShowPopup:BindEvent() PlayerManager.SetPlayerMountTime(itemSid,msg.validTime) self:ClosePanel() PopupTipPanel.ShowTip("成功激活坐骑!") + this.WarPowerChange(oldPowerNum) end) end elseif itemConfigData then @@ -378,5 +381,11 @@ end function RewardItemSingleShowPopup:OnDestroy() end - +function this.WarPowerChange(oldPowerNum) + Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnBagShowWarPowerChange,oldPowerNum) + local newPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) + if oldPowerNum ~= newPowerNum then + UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum}) + end +end return RewardItemSingleShowPopup \ No newline at end of file