【修行】提交

dev_chengFeng
ZhangBiao 2021-05-14 14:54:57 +08:00
parent 410262cee8
commit b3e40bac95
3 changed files with 48 additions and 18 deletions

View File

@ -68,7 +68,7 @@ function this:Refresh(isTop,isAni)
for i = 1, #self.itemList do for i = 1, #self.itemList do
self.itemList[i].gameObject:SetActive(false) self.itemList[i].gameObject:SetActive(false)
end end
LogRed("#self.heroList:"..tostring(#self.heroList)) -- LogRed("#self.heroList:"..tostring(#self.heroList))
self.scrollView:SetData(self.heroList, function (index, item) self.scrollView:SetData(self.heroList, function (index, item)
this:ShowSingleData(item, self.heroList[index],index) this:ShowSingleData(item, self.heroList[index],index)
end,not isTop,not isAni) end,not isTop,not isAni)
@ -92,12 +92,12 @@ function this:ShowSingleData(go,heroData,index)
local starGrid = Util.GetGameObject(go, "star") local starGrid = Util.GetGameObject(go, "star")
local starPre = Util.GetGameObject(go, "starPre") local starPre = Util.GetGameObject(go, "starPre")
self.maskList[index] = Util.GetGameObject(go, "choosed") self.maskList[index] = Util.GetGameObject(go, "choosed")
LogGreen("data.UnlockId:"..tostring(data.UnlockId)) -- LogGreen("data.UnlockId:"..tostring(data.UnlockId))
self.maskList[index]:SetActive(tostring(PracticeManager.ImprintServerData[data.Id].subId) == tostring(heroData.dynamicId)) self.maskList[index]:SetActive(tostring(PracticeManager.ImprintServerData[data.Id].subId) == tostring(heroData.dynamicId))
SetHeroStars(starGrid, heroData.star) SetHeroStars(starGrid, heroData.star)
Util.AddOnceClick(go, function() Util.AddOnceClick(go, function()
LogGreen("subId:"..tostring(PracticeManager.ImprintServerData[data.Id].subId).." did:"..tostring(heroData.dynamicId)) -- LogGreen("subId:"..tostring(PracticeManager.ImprintServerData[data.Id].subId).." did:"..tostring(heroData.dynamicId))
for i = 1, #self.maskList do for i = 1, #self.maskList do
self.maskList[i]:SetActive(false) self.maskList[i]:SetActive(false)
end end

View File

@ -54,11 +54,18 @@ function PracticeImprint:OnSortingOrderChange()
end end
function PracticeImprint:OnShow() function PracticeImprint:OnShow()
self:Refresh(true,false)
end
function PracticeImprint:Refresh(isTop,isAni,func)
self.allImprintData = PracticeManager.GetAllImprintData() self.allImprintData = PracticeManager.GetAllImprintData()
self.ImprintInfo:SetActive(false) self.ImprintInfo:SetActive(false)
self.ScrollView:SetData(self.allImprintData, function(index, go) self.ScrollView:SetData(self.allImprintData, function(index, go)
self:SetPre(index,go,self.allImprintData[index]) self:SetPre(index,go,self.allImprintData[index])
end) end,isTop,isAni)
if func then
func()
end
end end
--设置每一期的三个神印 --设置每一期的三个神印
@ -87,11 +94,17 @@ function PracticeImprint:SetSingleImprint(_go,_imprintId)
-- LogGreen(" _imprintId:"..tostring(_imprintId).." serverData.state:"..tostring(serverData.state)) -- LogGreen(" _imprintId:"..tostring(_imprintId).." serverData.state:"..tostring(serverData.state))
if serverData.state == 0 then--未使用 if serverData.state == 0 then--未使用
stateImg.gameObject:SetActive(false) stateImg.gameObject:SetActive(false)
heroImg.gameObject:SetActive(false) -- heroImg.gameObject:SetActive(false)
elseif serverData.state == 1 then--已使用 elseif serverData.state == 1 then--已使用
stateImg.gameObject:SetActive(true) stateImg.gameObject:SetActive(true)
stateImg.sprite = Util.LoadSprite("t_tianshumijuan_yijihuo_zh") stateImg.sprite = Util.LoadSprite("t_tianshumijuan_yijihuo_zh")
heroImg.gameObject:SetActive(serverData.subId ~= "") end
heroImg.gameObject:SetActive(serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil")
-- LogYellow(_imprintId.." :"..serverData.subId..": s")
if serverData.subId ~= nil and serverData.subId ~= "" and serverData.subId ~= "nil" then
-- LogRed("serverData.subId:"..tostring(serverData.subId))
-- LogGreen(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id)
heroImg.sprite = Util.LoadSprite(GetSpriteNameByItemId(HeroManager.GetSingleHeroData(tostring(serverData.subId)).id))
end end
end end
icon.sprite = Util.LoadSprite(GetResourcePath(configData.Icon)) icon.sprite = Util.LoadSprite(GetResourcePath(configData.Icon))
@ -115,12 +128,12 @@ function PracticeImprint:ShowSingleImprintInfoLayout(_serverData,_configData)
if not _serverData then if not _serverData then
self.rightInfo:SetActive(false) self.rightInfo:SetActive(false)
self.doBtnText.text = string.format("%s解锁",_configData.Unlock) self.doBtnText.text = string.format("%s解锁",_configData.Unlock)
self.curHeroId = PracticeManager.ImprintServerData[_configData.UnlockId].subId
else else
if _configData.Type == 0 then if _configData.Type == 0 then
self.rightInfo:SetActive(false) self.rightInfo:SetActive(false)
elseif _configData.Type == 1 then elseif _configData.Type == 1 then
self.rightInfo:SetActive(true) self.rightInfo:SetActive(true)
self.curHeroId = PracticeManager.ImprintServerData[_configData.Id].subId
end end
if _serverData.state == 0 then if _serverData.state == 0 then
self.doBtnText.text = "选择神印" self.doBtnText.text = "选择神印"
@ -136,9 +149,17 @@ function PracticeImprint:ShowSingleImprintInfoLayout(_serverData,_configData)
local old,new,sub = 0,0,"" local old,new,sub = 0,0,""
old = PracticeManager.BigLevelImprintList[_configData.UnlockId] old = PracticeManager.BigLevelImprintList[_configData.UnlockId]
new = _configData.Id new = _configData.Id
if _configData.Type == 0 then
sub = ""
elseif _configData.Type == 1 then
sub = self.curHeroId sub = self.curHeroId
end
-- LogRed("old:"..tostring(old).." new:"..tostring(new).." sub:"..tostring(sub))
NetManager.PracticeImprintRequest(old,new,tostring(sub),function () NetManager.PracticeImprintRequest(old,new,tostring(sub),function ()
self:OnShow() self:Refresh(true,true,function ()
self.ImprintInfo:SetActive(true)
self:ShowSingleImprintInfoLayout(PracticeManager.GetSingleImprintData(new))
end)
end) end)
end end
end) end)
@ -156,13 +177,16 @@ function PracticeImprint:ShowSingleImprintInfoLayout(_serverData,_configData)
if _serverData and _configData.Type == 1 then if _serverData and _configData.Type == 1 then
self.Add:SetActive(true) self.Add:SetActive(true)
self.Hero:SetActive(false) self.Hero:SetActive(false)
LogRed("Id:"..tostring(_serverData.id).." _serverData.subId:"..tostring(_serverData.subId)) -- LogRed("Id:"..tostring(_serverData.id).." _serverData.subId:"..tostring(_serverData.subId))
if tostring(_serverData.subId) ~= nil and tostring(_serverData.subId) ~= "" then -- LogRed(tostring(not _serverData.subId))
-- LogRed(tostring(_serverData.subId ~= nil))
-- LogRed(tostring(tostring(_serverData.subId) ~= ""))
if _serverData.subId ~= nil and _serverData.subId ~= "" and _serverData.subId ~= "nil" then
self.Add:SetActive(false) self.Add:SetActive(false)
self.Hero:SetActive(true) self.Hero:SetActive(true)
--英雄图标 --英雄图标
heroData = HeroManager.GetSingleHeroData(_serverData.subId) heroData = HeroManager.GetSingleHeroData(tostring(_serverData.subId))
LogGreen("heroData:"..tostring(heroData)) -- LogGreen("heroData:"..tostring(heroData))
frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star)) frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
icon.sprite = Util.LoadSprite(heroData.icon) icon.sprite = Util.LoadSprite(heroData.icon)
lv.text = heroData.lv lv.text = heroData.lv
@ -178,6 +202,12 @@ function PracticeImprint:ShowSingleImprintInfoLayout(_serverData,_configData)
proIcon.sprite = Util.LoadSprite(GetProStrImageByProNum(_heroData.heroConfig.PropertyName)) proIcon.sprite = Util.LoadSprite(GetProStrImageByProNum(_heroData.heroConfig.PropertyName))
SetHeroStars(starGrid, _heroData.star) SetHeroStars(starGrid, _heroData.star)
self.curHeroId = tostring(_heroData.dynamicId) self.curHeroId = tostring(_heroData.dynamicId)
--刷新
self:Refresh(true,true,function ()
self.ImprintInfo:SetActive(true)
self:ShowSingleImprintInfoLayout(PracticeManager.GetSingleImprintData(_configData.Id))
end)
end) end)
end) end)
end) end)

View File

@ -161,10 +161,10 @@ function this.UpdataImprintDataFromServer(_imprintList)
this.ImprintServerData[value.id].type = value.type this.ImprintServerData[value.id].type = value.type
this.ImprintServerData[value.id].subId = value.subId this.ImprintServerData[value.id].subId = value.subId
this.ImprintServerData[value.id].state = value.state this.ImprintServerData[value.id].state = value.state
LogPink("value.id:"..tostring(value.id).." value.type:"..tostring(value.type).." value.subId:"..tostring(value.subId).." value.state:"..tostring(value.state)) LogBlue("value.id:"..tostring(value.id).." value.type:"..tostring(value.type).." value.subId:"..tostring(value.subId).." value.state:"..tostring(value.state))
if value.state == 1 then if value.state == 1 then
this.BigLevelImprintList[XiuXianSkillConfig[value.id].UnlockId] = value.id this.BigLevelImprintList[XiuXianSkillConfig[value.id].UnlockId] = value.id
LogBlue("大境界Id:"..tostring(XiuXianSkillConfig[value.id].UnlockId).."对应的神印:"..tostring(value.id)) -- LogBlue("大境界Id:"..tostring(XiuXianSkillConfig[value.id].UnlockId).."对应的神印:"..tostring(value.id))
end end
end end
end end
@ -174,9 +174,9 @@ end
function this.BigLevelWithImprint() function this.BigLevelWithImprint()
for i, v in ConfigPairs(XiuXianSkillConfig) do for i, v in ConfigPairs(XiuXianSkillConfig) do
if v.UnlockId > 0 then if v.UnlockId > 0 then
this.BigLevelImprintList[v.UnlockId] = {} this.BigLevelImprintList[v.UnlockId] = 0
this.BigLevelImprintList[v.UnlockId].id = 0 -- this.BigLevelImprintList[v.UnlockId].id = 0
this.BigLevelImprintList[v.UnlockId].subId = "" -- this.BigLevelImprintList[v.UnlockId].subId = ""
end end
end end
end end