【ID1010167】

【乾坤宝盒】许愿魂印弹窗中,魂印图标下方添加道具名称
dev_chengFeng
jiaoyangna 2021-09-01 19:59:37 +08:00
parent 41831fad79
commit 615aaa0d88
2 changed files with 148 additions and 9619 deletions

File diff suppressed because it is too large Load Diff

View File

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