parent
41831fad79
commit
615aaa0d88
File diff suppressed because it is too large
Load Diff
|
@ -32,6 +32,7 @@ function this:InitComponent(gameObject)
|
|||
this.scrollView.moveTween.Strength = 2
|
||||
this.preList={}
|
||||
this.currHeroIds={}
|
||||
this.itemList = {}
|
||||
end
|
||||
|
||||
function this:BindEvent()
|
||||
|
@ -77,17 +78,20 @@ function this:OnShow(_parent,...)
|
|||
end
|
||||
end
|
||||
|
||||
for i = 1, math.max(#this.preList,#heroDatas) do
|
||||
local item=this.preList[i]
|
||||
if not item then
|
||||
item=newObject(this.prefab)
|
||||
item.transform:SetParent(this.root.transform)
|
||||
item.transform.localScale=Vector3.one
|
||||
item.transform.localPosition=Vector3.zero
|
||||
this.preList[i]=item
|
||||
end
|
||||
item.gameObject:SetActive(false)
|
||||
end
|
||||
-- for i = 1, math.max(#this.preList,#heroDatas) do
|
||||
-- local item=this.preList[i]
|
||||
-- if not item then
|
||||
-- item=newObject(this.prefab)
|
||||
-- item.transform:SetParent(this.root.transform)
|
||||
-- item.transform.localScale=Vector3.one
|
||||
-- item.transform.localPosition=Vector3.zero
|
||||
-- this.preList[i]=item
|
||||
-- end
|
||||
-- item.gameObject:SetActive(false)
|
||||
-- end
|
||||
this.scrollView:ForeachItemGO(function(index, go)
|
||||
go.gameObject:SetActive(false)
|
||||
end)
|
||||
this.scrollView:SetData(heroDatas,function(index,root)
|
||||
this.SingleHeroDataShow(root,heroDatas[index])
|
||||
end)
|
||||
|
@ -98,16 +102,20 @@ end
|
|||
function this.SingleHeroDataShow(go,_heroData)
|
||||
local heroData = _heroData
|
||||
local _go = go
|
||||
Util.SetParticleSortLayer(go, sortingOrder+1)
|
||||
_go.gameObject:SetActive(true)
|
||||
Util.GetGameObject(_go.transform, "frame"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.Quantity))
|
||||
Util.GetGameObject(_go.transform, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(artResourcesConfig[_heroData.ResourceID].Name)
|
||||
local pos = Util.GetGameObject(_go.transform, "pos")
|
||||
local btn = Util.GetGameObject(_go.transform, "btn")
|
||||
if not this.itemList[go] then
|
||||
this.itemList[go] = SubUIManager.Open(SubUIConfig.ItemView,pos.transform)
|
||||
end
|
||||
this.itemList[go].gameObject:SetActive(true)
|
||||
this.itemList[go]:OnOpen(false,{heroData.Id,0},1,true,false,false,sortingOrder+1)
|
||||
|
||||
local selectObj=Util.GetGameObject(_go.transform, "choosed"):GetComponent("Image")
|
||||
selectObj.sprite=this.spLoader:LoadSprite("r_chouka_yixuanding")
|
||||
local cardclickBtn = Util.GetGameObject(_go.transform, "icon")
|
||||
local isHave=BattleUtil.ChecklistIsContainValue(this.currHeroIds,heroData.Id)
|
||||
selectObj.gameObject:SetActive(isHave)
|
||||
Util.AddOnceClick(cardclickBtn, function()
|
||||
Util.AddOnceClick(btn, function()
|
||||
if #this.currHeroIds==3 and not isHave then
|
||||
PopupTipPanel.ShowTip("只可选择3枚心愿魂印")
|
||||
return
|
||||
|
@ -123,7 +131,7 @@ function this.SingleHeroDataShow(go,_heroData)
|
|||
selectObj.gameObject:SetActive(isHave)
|
||||
end)
|
||||
|
||||
Util.AddLongPressClick(cardclickBtn, function()
|
||||
Util.AddLongPressClick(btn, function()
|
||||
UIManager.OpenPanel(UIName.SoulPrintPopUp,nil,nil,heroData.Id,nil,nil)
|
||||
end, 0.5)
|
||||
end
|
||||
|
@ -137,6 +145,10 @@ end
|
|||
function this:OnDestroy()
|
||||
this.spLoader:Destroy()
|
||||
this.scrollView=nil
|
||||
for k,v in pairs(this.itemList) do
|
||||
SubUIManager.Close(v)
|
||||
end
|
||||
this.itemList = {}
|
||||
end
|
||||
|
||||
return this
|
Loading…
Reference in New Issue