【英雄选择】英雄选择界面通用化
parent
0a4c24520c
commit
ecaa9f1dbc
|
@ -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")
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue