【英雄选择】英雄选择界面通用化
parent
0a4c24520c
commit
ecaa9f1dbc
|
@ -84,7 +84,23 @@ function TimeLimitUpHero:BindEvent()
|
||||||
-- JumpManager.GoJump(40014)
|
-- JumpManager.GoJump(40014)
|
||||||
-- end)
|
-- end)
|
||||||
Util.AddClick(self.btn_hero.gameObject, function()
|
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)
|
end)
|
||||||
Util.AddClick(self.dragView.gameObject, function()
|
Util.AddClick(self.dragView.gameObject, function()
|
||||||
local SkeletonGraphic = heroLiveObj:GetComponent("SkeletonGraphic")
|
local SkeletonGraphic = heroLiveObj:GetComponent("SkeletonGraphic")
|
||||||
|
|
|
@ -4,7 +4,8 @@ local this = {}
|
||||||
local parent
|
local parent
|
||||||
--传入特效层级
|
--传入特效层级
|
||||||
local sortingOrder=0
|
local sortingOrder=0
|
||||||
local args=nil
|
local heros=nil
|
||||||
|
local confirmFunc=nil
|
||||||
local currHeroId=0
|
local currHeroId=0
|
||||||
local curPage = 1
|
local curPage = 1
|
||||||
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
|
local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig)
|
||||||
|
@ -47,11 +48,10 @@ function this:BindEvent()
|
||||||
parent:ClosePanel()
|
parent:ClosePanel()
|
||||||
end)
|
end)
|
||||||
Util.AddClick(this.confirmBtn,function()
|
Util.AddClick(this.confirmBtn,function()
|
||||||
NetManager.ChoiceHeroRewardRequest(args[1],currHeroId,function()
|
if confirmFunc then
|
||||||
ActivityGiftManager.SetActivityInfoRewardId(args[1],currHeroId)
|
confirmFunc(currHeroId)
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.Activity.TimeLimitUpHeroChange,currHeroId)
|
end
|
||||||
parent:ClosePanel()
|
parent:ClosePanel()
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
for i = 1, 4 do
|
for i = 1, 4 do
|
||||||
Util.AddClick(this.btnList[i],function()
|
Util.AddClick(this.btnList[i],function()
|
||||||
|
@ -69,26 +69,24 @@ function this:RemoveListener()
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnShow(_parent,_args)
|
function this:OnShow(_parent,_args)
|
||||||
args = _args
|
heros = _args[1]
|
||||||
|
currHeroId=_args[2]
|
||||||
|
confirmFunc=_args[3]
|
||||||
|
|
||||||
parent=_parent
|
parent=_parent
|
||||||
sortingOrder =_parent.sortingOrder
|
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
|
end
|
||||||
function this:Refresh(_page)
|
function this:Refresh(_page)
|
||||||
curPage = _page
|
curPage = _page
|
||||||
this.light.transform:SetParent(this.btnList[_page].transform)
|
this.light.transform:SetParent(this.btnList[_page].transform)
|
||||||
this.light.transform.localPosition = Vector3.zero
|
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={}
|
local heroDatas={}
|
||||||
currHeroId=args[2]
|
|
||||||
for i = 1, #heros do
|
for i = 1, #heros do
|
||||||
if _page == heroConfig[heros[i]].PropertyName then
|
if _page == heroConfig[heros[i]].PropertyName then
|
||||||
table.insert(heroDatas,heroConfig[heros[i]])
|
table.insert(heroDatas,heroConfig[heros[i]])
|
||||||
|
@ -130,7 +128,7 @@ end
|
||||||
|
|
||||||
function this:OnClose()
|
function this:OnClose()
|
||||||
currHeroId=0
|
currHeroId=0
|
||||||
args=nil
|
heros=nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnDestroy()
|
function this:OnDestroy()
|
||||||
|
|
Loading…
Reference in New Issue