【灵兽山】放生10只整灵兽后,可以同时选择整只灵兽和碎片,恭送后消耗是正确的,仅显示问题

dev_chengFeng
ZhangBiao 2021-10-19 11:20:11 +08:00
parent 48236ba797
commit db87d4925a
1 changed files with 38 additions and 25 deletions

View File

@ -41,7 +41,8 @@ function this:InitComponent(gameObject)
this.cardPre, this.scrollbar, Vector2.New(v21.width, v21.height), 1, 5, Vector2.New(43,15))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
maxSelectNum = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,54).Value)
maxSelectNum = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,54).Value)
this.chooseObjList = {}
end
function this:BindEvent()
@ -180,6 +181,7 @@ end
function this:OnShow(...)
local args={...}
sortingOrder =0
this.chooseObjList = {}
this.SortTypeClick(sortingOrder,args[3],args[4])
end
@ -263,15 +265,16 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
Util.GetGameObject(_go.transform, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(heroData.icon)
local chipImg=Util.GetGameObject(_go.transform, "chipImg"):GetComponent("Image")
local formationMask =Util.GetGameObject(_go.transform, "mask")
formationMask:SetActive(false)
Util.GetGameObject(_go.transform, "mask/formationImage"):SetActive(false)
Util.GetGameObject(_go.transform, "mask/formationImage"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-yishangzheng_zh")
if heroData.ischip==1 then
chipImg.gameObject:SetActive(true)
formationMask:SetActive(isGray)
-- formationMask:SetActive(isGray)
chipImg.sprite=this.spLoader:LoadSprite(GetHeroChipQuantityImageByquality(heroData.quality))
else
chipImg.gameObject:SetActive(false)
formationMask:SetActive(false)
-- formationMask:SetActive(false)
end
local starGrid = Util.GetGameObject(_go.transform, "star")
SetHeroStars(this.spLoader, starGrid, heroData.star,1,Vector2.New(32.5,32.5),-15)
@ -280,6 +283,7 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
choosed:SetActive(selectChipId==heroData.dynamicId)
else
choosed:SetActive(selectHeroData[heroData.dynamicId] ~= nil)
this.chooseObjList[heroData.dynamicId] = choosed
end
local cardclickBtn = Util.GetGameObject(_go.transform, "icon")
this.selectText.text = Language[11728]..LengthOfTable(selectHeroData).."/"..maxSelectNum
@ -303,26 +307,33 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
this.chipObj:SetActive(false)
return
else
oldChoosed:SetActive(false)
choosed:SetActive(true)
oldChoosed=choosed
end
end
selectChipId=heroData.dynamicId
Util.SetGray(this.btn_add,true)
selectChipNum=heroData.num
maxChipNum=heroData.num
this.chipNumTxt.text=selectChipNum
isPokemon=false
--点击的是灵兽
else
--如果灵兽是选中状态,取消选中
oldChoosed:SetActive(false)
choosed:SetActive(true)
oldChoosed=choosed
end
end
selectChipId=heroData.dynamicId
Util.SetGray(this.btn_add,true)
selectChipNum=heroData.num
maxChipNum=heroData.num
this.chipNumTxt.text=selectChipNum
isPokemon=false
--如果选中灵兽,则取消灵兽选择
if LengthOfTable(selectHeroData) > 0 then
for k,v in pairs(selectHeroData) do
selectHeroData[k] = nil
this.chooseObjList[k]:SetActive(false)
end
end
else--点击的是灵兽
--取消碎片选中
selectChipId=0
selectChipNum=0
if oldChoosed then
oldChoosed:SetActive(false)
oldChoosed=nil
end
end
--如果灵兽是选中状态,取消选中
if selectHeroData[heroData.dynamicId] then
choosed:SetActive(false)
selectHeroData[heroData.dynamicId] = nil
@ -342,14 +353,15 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
PopupTipPanel.ShowTip(string.format(Language[11747],maxSelectNum))
return
end
choosed:SetActive(true)
selectHeroData[heroData.dynamicId]=heroData
this.selectText.text = Language[11728]..LengthOfTable(selectHeroData).."/"..maxSelectNum
--否则就是正常选择
choosed:SetActive(true)
selectHeroData[heroData.dynamicId]=heroData
this.selectText.text = Language[11728]..LengthOfTable(selectHeroData).."/"..maxSelectNum
if isPokemon==false then
--todo 首次点击灵兽,置灰所有碎片
this.ScrollView:SetData(heroDatas, function (index, go)
this.SingleHeroDataShow(go, heroDatas[index],true)
end,true,true)
end,true,true)
this.selectText.gameObject:SetActive(true)
this.chipObj:SetActive(false)
isPokemon = true
@ -361,9 +373,9 @@ function this.SingleHeroDataShow(go,_heroData,isGray)
end)
--灰色遮罩点击
Util.AddOnceClick(formationMask, function()
PopupTipPanel.ShowTip(Language[11748])
end)
-- Util.AddOnceClick(formationMask, function()
-- PopupTipPanel.ShowTip(Language[11748])
-- end)
end
--英雄排序
function this.SortHeroDatas(_heroDatas)
@ -397,6 +409,7 @@ function this:OnClose()
selectHeroData={}
isPokemon=false
oldChoosed=nil
this.chooseObjList = {}
end
function this:OnDestroy()