dev_chengFeng
ZhangBiao 2020-08-13 16:38:40 +08:00
parent fbf7c3b41d
commit e397fa88e7
1 changed files with 32 additions and 14 deletions

View File

@ -58,6 +58,8 @@ function this:BindEvent()
this.text:SetActive(false)
this.cost:SetActive(false)
this.ShowCostInfo()
local value = this.RebuildData(msg.heroTempId,curSelectHero)
this.SetHero(this.replaceHero,value)
end)
@ -80,6 +82,8 @@ function this:BindEvent()
this.text:SetActive(false)
this.cost:SetActive(true)
this.ShowCostInfo()
end)
end)
--保存置换
@ -93,6 +97,8 @@ function this:BindEvent()
this.text:SetActive(true)
this.cost:SetActive(false)
this.ShowCostInfo()
HeroManager.DeleteHeroDatas({curSelectHero.dynamicId})
for i = 1, #msg.drop.Hero do
@ -100,11 +106,13 @@ function this:BindEvent()
end
curSelectHero = HeroManager.GetSingleHeroData(msg.drop.Hero[1].id)
this.ShowCurrPosHeroReplace(curIndex)
for i = 1, #heroDatas do
if heroSelectBtn[i] and heroDatas[i] then
heroSelectBtn[i]:SetActive(heroDatas[i].dynamicId == curSelectHero.dynamicId)
end
end
-- for i = 1, #heroDatas do
-- if heroSelectBtn[i] and heroDatas[i] then
-- heroSelectBtn[i]:SetActive(heroDatas[i].dynamicId == curSelectHero.dynamicId)
-- end
-- end
end)
end)
@ -168,7 +176,10 @@ function this.ShowCurrPosHeroReplace(_curIndex)
this.needHero:SetActive(false)
heroDatas = this.GetHeroDataByPosition(_curIndex)
this.ScrollView:SetData(heroDatas, function (index, go)
heroSelectBtn[index] = Util.GetGameObject(go.transform, "choosed")
-- heroSelectBtn[index] = Util.GetGameObject(go.transform, "choosed")
-- if not heroSelectBtn[heroDatas[index].dynamicId] then
-- heroSelectBtn[heroDatas[index].dynamicId] = Util.GetGameObject(go.transform, "choosed")
-- end
this.SingleHeroDataShow(go, heroDatas[index])
end)
end
@ -185,7 +196,7 @@ function this.GetHeroDataByPosition(_position)
end
return heros
end
local oldChoose
--数据显示
function this.SingleHeroDataShow(_go,_heroData)
local go = _go
@ -215,7 +226,10 @@ function this.SingleHeroDataShow(_go,_heroData)
local cardBtn = Util.GetGameObject(go.transform, "icon")
local choosed = Util.GetGameObject(go.transform, "choosed")
choosed:SetActive(false)
if curSelectHero.dynamicId == heroData.dynamicId then
choosed:SetActive(true)
oldChoose = choosed
end
this.replaceBtn:SetActive(true)
this.cancelBtn:SetActive(false)
this.saveBtn:SetActive(false)
@ -226,7 +240,6 @@ function this.SingleHeroDataShow(_go,_heroData)
if curSelectHero.id then
this.SetHero(this.needHero,curSelectHero)
choosed:SetActive(true)
this.ShowCostInfo()
this.needHero:SetActive(true)
this.replaceHero:SetActive(false)
@ -239,6 +252,7 @@ function this.SingleHeroDataShow(_go,_heroData)
Util.AddOnceClick(cardBtn, function()
if heroData.dynamicId == curSelectHero.dynamicId then
choosed:SetActive(false)
oldChoose = nil
curSelectHero = {}
this.needHero:SetActive(false)
@ -253,6 +267,10 @@ function this.SingleHeroDataShow(_go,_heroData)
else
choosed:SetActive(true)
if oldChoose then
oldChoose:SetActive(false)
end
oldChoose = choosed
curSelectHero = heroData
this.ShowCostInfo()
this.needHero:SetActive(true)
@ -291,11 +309,11 @@ function this.SingleHeroDataShow(_go,_heroData)
end
end
for i = 1, #heroDatas do
if heroSelectBtn[i] and heroDatas[i] then
heroSelectBtn[i]:SetActive(heroDatas[i].dynamicId == curSelectHero.dynamicId)
end
end
-- for i = 1, #heroDatas do
-- if heroSelectBtn[i] and heroDatas[i] then
-- heroSelectBtn[i]:SetActive(heroDatas[i].dynamicId == curSelectHero.dynamicId)
-- end
-- end
end)