diff --git a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/TimeLimitUpHero.lua b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/TimeLimitUpHero.lua index 7fc31ebd3a..89d0d862d2 100644 --- a/Assets/ManagedResources/~Lua/Modules/DynamicActivity/TimeLimitUpHero.lua +++ b/Assets/ManagedResources/~Lua/Modules/DynamicActivity/TimeLimitUpHero.lua @@ -84,7 +84,23 @@ function TimeLimitUpHero:BindEvent() -- JumpManager.GoJump(40014) -- end) Util.AddClick(self.btn_hero.gameObject, function() - UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ChooseUpHero,self.actId,curHeroId) + -- 制作数据 + local upConfig=ConfigManager.GetConfigDataByKey(ConfigName.WishActivityUp,"ActivityId", self.actId) + if not upConfig then + return + end + local str=upConfig.UpList + local heros={} + for i = 1, #str do + table.insert(heros,str[i][1]) + end + -- 打开选择界面 + UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ChooseUpHero,heros, curHeroId, function(chooseId) + NetManager.ChoiceHeroRewardRequest(self.actId,chooseId,function() + ActivityGiftManager.SetActivityInfoRewardId(self.actId,chooseId) + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.TimeLimitUpHeroChange,chooseId) + end) + end) end) Util.AddClick(self.dragView.gameObject, function() local SkeletonGraphic = heroLiveObj:GetComponent("SkeletonGraphic") diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ChooseUpHero.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ChooseUpHero.lua index a47216cddb..adf439e482 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ChooseUpHero.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ChooseUpHero.lua @@ -4,7 +4,8 @@ local this = {} local parent --传入特效层级 local sortingOrder=0 -local args=nil +local heros=nil +local confirmFunc=nil local currHeroId=0 local curPage = 1 local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) @@ -47,11 +48,10 @@ function this:BindEvent() parent:ClosePanel() end) Util.AddClick(this.confirmBtn,function() - NetManager.ChoiceHeroRewardRequest(args[1],currHeroId,function() - ActivityGiftManager.SetActivityInfoRewardId(args[1],currHeroId) - Game.GlobalEvent:DispatchEvent(GameEvent.Activity.TimeLimitUpHeroChange,currHeroId) - parent:ClosePanel() - end) + if confirmFunc then + confirmFunc(currHeroId) + end + parent:ClosePanel() end) for i = 1, 4 do Util.AddClick(this.btnList[i],function() @@ -69,26 +69,24 @@ function this:RemoveListener() end function this:OnShow(_parent,_args) - args = _args + heros = _args[1] + currHeroId=_args[2] + confirmFunc=_args[3] + parent=_parent sortingOrder =_parent.sortingOrder - this:Refresh(heroConfig[args[2]].PropertyName) + local default = 1 + if currHeroId and currHeroId ~= 0 then + default = heroConfig[currHeroId].PropertyName + end + this:Refresh(default) end function this:Refresh(_page) curPage = _page this.light.transform:SetParent(this.btnList[_page].transform) this.light.transform.localPosition = Vector3.zero - local upConfig=ConfigManager.GetConfigDataByKey(ConfigName.WishActivityUp,"ActivityId",args[1]) - if not upConfig then - return - end - local str=upConfig.UpList - local heros={} - for i = 1, #str do - table.insert(heros,str[i][1]) - end + local heroDatas={} - currHeroId=args[2] for i = 1, #heros do if _page == heroConfig[heros[i]].PropertyName then table.insert(heroDatas,heroConfig[heros[i]]) @@ -130,7 +128,7 @@ end function this:OnClose() currHeroId=0 - args=nil + heros=nil end function this:OnDestroy()