miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleGodSoulLayout.lua

458 lines
24 KiB
Lua
Raw Normal View History

2021-10-18 10:36:32 +08:00
require("Base/BasePanel")
2021-10-20 18:02:09 +08:00
RoleGodSoulLayout = Inherit(BasePanel)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
2021-11-03 10:13:44 +08:00
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
2021-10-18 10:36:32 +08:00
--初始化组件(用于子类重写)
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:InitComponent()
self.spLoader = SpriteLoader.New()
2021-11-01 19:11:59 +08:00
self.closeBtn = Util.GetGameObject(self.gameObject,"mask")
self.help = Util.GetGameObject(self.gameObject,"bgdi/topLayout/help")
2021-10-20 18:02:09 +08:00
self.helpPosition = self.help:GetComponent("RectTransform").localPosition
2021-11-01 19:11:59 +08:00
self.curHeroName = Util.GetGameObject(self.gameObject,"bgdi/topLayout/name"):GetComponent("Text")
self.curHeroGo = Util.GetGameObject(self.gameObject,"bgdi/topLayout/itemPre/HeroPre")
2021-10-18 10:36:32 +08:00
2021-11-03 10:32:55 +08:00
self.godPre = Util.GetGameObject(self.gameObject,"godPre")
self.costPre = Util.GetGameObject(self.gameObject,"costPre")
self.heroPre = Util.GetGameObject(self.gameObject,"HeroPre")
self.singlePre = Util.GetGameObject(self.gameObject,"singlePre")
2021-11-05 10:18:10 +08:00
2021-11-03 11:18:37 +08:00
self.scroll = Util.GetGameObject(self.gameObject,"bgdi/scroll")
self.scrollPos = self.scroll:GetComponent("RectTransform").sizeDelta
2021-11-05 10:18:10 +08:00
self.effectMask = self.scroll:GetComponent("Image")
2021-11-03 11:18:37 +08:00
self.bgdi = Util.GetGameObject(self.gameObject,"bgdi")
self.bgdiPos = self.bgdi:GetComponent("RectTransform").sizeDelta
2021-10-20 18:02:09 +08:00
self.grid = Util.GetGameObject(self.gameObject,"bgdi/scroll/grid")
self.gridPos = self.grid:GetComponent("RectTransform").anchoredPosition
2021-10-20 18:02:09 +08:00
self.gridList = {}
2021-11-08 13:02:00 +08:00
self.effectbaijin = Util.GetGameObject(self.gameObject,"bgdi/topLayout/fx_zhuangbeijiemian2")
2021-10-18 10:36:32 +08:00
end
2021-11-01 19:11:59 +08:00
function RoleGodSoulLayout:OnSortingOrderChange()
2021-11-04 09:27:56 +08:00
Util.SetParticleSortLayer(self.bgdi,self.sortingOrder + 1)
2021-11-01 19:11:59 +08:00
end
2021-10-18 10:36:32 +08:00
--绑定事件(用于子类重写)
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:BindEvent()
Util.AddClick(self.help, function()
2021-10-26 16:00:31 +08:00
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.shenhun,self.helpPosition.x,self.helpPosition.y - 500)
2021-10-18 10:36:32 +08:00
end)
2021-11-01 19:11:59 +08:00
Util.AddClick(self.closeBtn, function()
self:ClosePanel()
end)
2021-10-18 10:36:32 +08:00
end
--添加事件监听(用于子类重写)
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:AddListener()
2021-11-01 19:11:59 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSodSoulLayout, self.SetData,self)
2021-11-05 10:18:10 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Role.RefreshSodSoulLayoutEffectMask,self.RefreshSodSoulLayoutEffectMaskCallBack,self)
2021-10-18 10:36:32 +08:00
end
--移除事件监听(用于子类重写)
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:RemoveListener()
2021-11-01 19:11:59 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSodSoulLayout, self.SetData,self)
2021-11-05 10:18:10 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Role.RefreshSodSoulLayoutEffectMask,self.RefreshSodSoulLayoutEffectMaskCallBack,self)
end
function RoleGodSoulLayout:RefreshSodSoulLayoutEffectMaskCallBack()
self:SetMaskActive(true)
2021-11-01 19:11:59 +08:00
end
--界面打开时调用(用于子类重写)
2021-11-03 18:11:08 +08:00
function RoleGodSoulLayout:OnOpen(_curHerodata,_star)
2021-11-01 19:11:59 +08:00
self.curHeroData = _curHerodata
if self.curHeroData.dynamicId then
2021-11-03 10:13:44 +08:00
self.level = self.curHeroData.lv
self.star = self.curHeroData.star
2021-11-01 19:11:59 +08:00
self.addShow = true
self.heroConfig = self.curHeroData.heroConfig
else
2021-11-03 10:13:44 +08:00
if _star == 6 then
self.level = 145
elseif _star == 10 then
self.level = 255
elseif _star == 11 then
self.level = 330
else
self.level = 1
end
self.star = _star
2021-11-01 19:11:59 +08:00
self.lv = 0
self.addShow = false
self.heroConfig = self.curHeroData
end
2021-10-18 10:36:32 +08:00
end
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:OnShow()
2021-10-18 10:36:32 +08:00
self.gameObject:SetActive(true)
2021-11-01 19:11:59 +08:00
self:SetData()
2021-11-04 09:27:56 +08:00
Util.SetParticleSortLayer(self.bgdi,self.sortingOrder + 1)
2021-11-08 13:02:00 +08:00
Util.SetParticleSortLayer(self.effectbaijin,self.sortingOrder + 1)
2021-10-18 10:36:32 +08:00
end
2021-11-01 19:11:59 +08:00
function RoleGodSoulLayout:SetData()
2021-10-20 18:02:09 +08:00
self:UpdateGodList()
2021-11-01 19:11:59 +08:00
self:SetHeroData(self.curHeroGo,self.curHeroData,true)
self.curHeroName.text = self.heroConfig.ReadingName
2021-11-03 11:18:37 +08:00
local scrollPos1 = 0
local bgdiPos1 = 175
for i = 1,#self.gridList do
scrollPos1 = scrollPos1 + GetPreferredHeight(self.gridList[i].go.transform)
end
bgdiPos1 = bgdiPos1 + scrollPos1
if bgdiPos1 > 1334 then
self.bgdiPos.y = 1334
self.scrollPos.y = 1334 - 180
else
self.bgdiPos.y = bgdiPos1
self.scrollPos.y = bgdiPos1 - 180
end
self.bgdi:GetComponent("RectTransform").sizeDelta = self.bgdiPos
self.scroll:GetComponent("RectTransform").sizeDelta = self.scrollPos
local pos = Vector3.New(self.gridPos.x,self.gridPos.y,self.gridPos.z)
2021-10-28 10:38:19 +08:00
for i = 1,self.lv - 1 do
pos.y = pos.y + GetPreferredHeight(self.gridList[i].go.transform)
end
local pos1 = self.grid:GetComponent("RectTransform").anchoredPosition
if pos1.y ~= pos.y then
self.grid:GetComponent("RectTransform").anchoredPosition = pos
end
2021-10-18 10:36:32 +08:00
end
2021-11-01 19:11:59 +08:00
function RoleGodSoulLayout:SetHeroData(heroGo,heroData,isCur)
local frame = Util.GetGameObject(heroGo,"frame"):GetComponent("Image")
local icon = Util.GetGameObject(heroGo,"icon"):GetComponent("Image")
local proIcon = Util.GetGameObject(heroGo,"proIcon"):GetComponent("Image")
local starGrid = Util.GetGameObject(heroGo,"star")
if self.addShow then
2021-11-03 10:13:44 +08:00
local star,starType = heroData.GetStar(1)
local starSize = Vector2.New(19.69,19.69)
local starScale = -8
2021-11-01 19:11:59 +08:00
if isCur then
local lv = Util.GetGameObject(heroGo,"lv/Text"):GetComponent("Text")
lv.text = heroData.lv
2021-11-03 10:13:44 +08:00
if starType == 3 then
2021-11-04 09:27:56 +08:00
starSize = Vector2.New(1,-16.28)
2021-11-03 10:13:44 +08:00
starScale = -13.77
elseif starType == 2 then
2021-11-03 18:11:08 +08:00
starSize = Vector2.New(60,60)
2021-11-15 16:58:49 +08:00
end
frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,self.star))
2021-11-03 10:13:44 +08:00
else
if starType == 3 then
2021-11-04 09:27:56 +08:00
starSize = Vector2.New(0.65,-29.2)
starScale = -24.72
2021-11-03 10:13:44 +08:00
elseif starType == 2 then
2021-11-05 10:18:10 +08:00
starSize = Vector2.New(34.492,32.767)
2021-11-03 10:13:44 +08:00
end
2021-11-15 16:58:49 +08:00
frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star))
2021-11-01 19:11:59 +08:00
end
proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetHeroIcon(self.spLoader,heroData,icon,heroData.heroConfig)
SetHeroStars(self.spLoader, starGrid, star,starType,starSize,starScale)
2021-10-27 12:50:15 +08:00
else
2021-11-01 19:11:59 +08:00
local lv = Util.GetGameObject(heroGo,"lv/Text"):GetComponent("Text")
2021-11-03 18:11:08 +08:00
lv.text = self.level
frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(heroData.Quality,self.star))
2021-11-01 19:11:59 +08:00
proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.PropertyName))
SetHeroIcon(self.spLoader,heroData,icon,heroData)
2021-11-03 10:13:44 +08:00
SetHeroStars(self.spLoader, starGrid, self.star,1)
2021-10-27 12:50:15 +08:00
end
2021-11-05 10:18:10 +08:00
if not isCur then
local posIcon = Util.GetGameObject(heroGo,"posIcon"):GetComponent("Image")
posIcon.sprite = self.spLoader:LoadSprite(heroData.professionIcon)
end
2021-11-01 19:11:59 +08:00
end
function RoleGodSoulLayout:UpdateGodList()
2021-11-03 10:13:44 +08:00
if self.curHeroData.dynamicId then
self.lv = GodSoulManager.GetGodSoulLv(self.curHeroData.dynamicId)
else
self.lv = 0
end
2021-10-27 12:50:15 +08:00
self.godDatas = GodSoulManager.GetGodSoulDataByLv(self.heroConfig.Id,0)
2021-10-22 15:47:59 +08:00
if not self.gridList then
self.gridList = {}
end
for i = 1,math.max(#self.gridList,#self.godDatas) do
2021-10-20 18:02:09 +08:00
if not self.godDatas[i] then
self.gridList[i].go.gameObject:SetActive(false)
2021-10-26 16:00:31 +08:00
else
if not self.gridList[i] then
self.gridList[i] = {}
self.gridList[i].go = newObjToParent(self.singlePre,self.grid)
2021-11-05 10:18:10 +08:00
self.gridList[i].middle = Util.GetGameObject(self.gridList[i].go,"middle")
2021-10-26 16:00:31 +08:00
self.gridList[i].tip = Util.GetGameObject(self.gridList[i].go,"middle/Text"):GetComponent("Text")
2021-11-05 10:18:10 +08:00
self.gridList[i].godGrid = Util.GetGameObject(self.gridList[i].go,"bottom/godGrid")
2021-10-26 16:00:31 +08:00
self.gridList[i].godLvList = {}
self.gridList[i].costGrid = Util.GetGameObject(self.gridList[i].go,"middle/costGrid")
self.gridList[i].costList = {}
self.gridList[i].add = Util.GetGameObject(self.gridList[i].go,"add")
2021-11-03 10:13:44 +08:00
self.gridList[i].addImage = Util.GetGameObject(self.gridList[i].go,"icon")
self.gridList[i].red = Util.GetGameObject(self.gridList[i].add,"icon/red")
2021-10-27 17:04:33 +08:00
self.gridList[i].red.gameObject:SetActive(false)
2021-11-05 10:18:10 +08:00
self.gridList[i].bottom = Util.GetGameObject(self.gridList[i].go,"bottom")
2021-10-26 16:00:31 +08:00
self.gridList[i].des = Util.GetGameObject(self.gridList[i].go,"bottom/des"):GetComponent("Text")
2021-11-01 19:11:59 +08:00
self.gridList[i].upHero = Util.GetGameObject(self.gridList[i].go,"upHero")
self.gridList[i].upHeroList = {}
end
if self.addShow then
self.gridList[i].upHeroDataList = GodSoulManager.GetBindHeroDatasByLevel(self.curHeroData.dynamicId,i)
else
self.gridList[i].upHeroDataList = {}
2021-10-26 16:00:31 +08:00
end
self.gridList[i].go.gameObject:SetActive(true)
2021-11-05 10:18:10 +08:00
self:UpdataSingleGod2(i)
2021-10-26 16:00:31 +08:00
end
2021-10-18 10:36:32 +08:00
end
end
2021-11-05 10:18:10 +08:00
--index 等级
function RoleGodSoulLayout:UpdataSingleGod2(index)
self.gridList[index].middle.gameObject:SetActive(false)
for i = 1,math.max(#self.gridList[index].godLvList,index) do
if index < i then
self.gridList[index].godLvList[i].gameObject:SetActive(false)
else
if not self.gridList[index].godLvList[i] then
self.gridList[index].godLvList[i] = newObjToParent(self.godPre,self.gridList[index].godGrid)
end
self.gridList[index].godLvList[i].gameObject:SetActive(true)
2021-11-08 11:24:10 +08:00
local shenhun = Util.GetGameObject(self.gridList[index].godLvList[i],"fx_shenhun")
local shenhunImage = Util.GetGameObject(self.gridList[index].godLvList[i],"godItem")
if index <= self.lv then
shenhun.gameObject:SetActive(true)
shenhunImage.gameObject:SetActive(false)
else
shenhun.gameObject:SetActive(false)
shenhunImage.gameObject:SetActive(true)
end
2021-11-05 10:18:10 +08:00
end
end
2021-11-08 11:24:10 +08:00
2021-11-05 10:18:10 +08:00
self.gridList[index].add.gameObject:SetActive(true)
self.gridList[index].addImage.gameObject:SetActive(true)
Util.SetGray(self.gridList[index].addImage,false)
if not self.addShow then
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
self.gridList[index].add.gameObject:SetActive(false)
elseif index <= self.lv + 1 then
if index == self.lv + 1 then
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
else
self.gridList[index].addImage.gameObject:SetActive(false)
self.gridList[index].des.text = string.format("<color=#00FF00>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
end
else
Util.SetGray(self.gridList[index].addImage,true)
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
end
for i = 1,math.max(#self.gridList[index].upHeroList,#self.godDatas[index]) do
if not self.godDatas[index][i] then
self.gridList[index].upHeroList[i].go.gameObject:SetActive(false)
else
if not self.gridList[index].upHeroList[i] then
self.gridList[index].upHeroList[i] = {}
self.gridList[index].upHeroList[i].go = newObjToParent(self.heroPre,self.gridList[index].upHero)
self.gridList[index].upHeroList[i].frame = Util.GetGameObject(self.gridList[index].upHeroList[i].go,"frame"):GetComponent("Image")
self.gridList[index].upHeroList[i].icon = Util.GetGameObject(self.gridList[index].upHeroList[i].go,"icon"):GetComponent("Image")
self.gridList[index].upHeroList[i].proIcon = Util.GetGameObject(self.gridList[index].upHeroList[i].go,"proIcon"):GetComponent("Image")
self.gridList[index].upHeroList[i].star = Util.GetGameObject(self.gridList[index].upHeroList[i].go,"star")
self.gridList[index].upHeroList[i].posIcon = Util.GetGameObject(self.gridList[index].upHeroList[i].go,"posIcon"):GetComponent("Image")
end
self.gridList[index].upHeroList[i].go.gameObject:SetActive(true)
if self.gridList[index].upHeroDataList[i] then
self.gridList[index].upHeroList[i].posIcon.gameObject:SetActive(true)
self.gridList[index].upHeroList[i].proIcon.gameObject:SetActive(true)
local tempHeroData = HeroManager.GetSingleHeroData(self.gridList[index].upHeroDataList[i])
self:SetHeroData(self.gridList[index].upHeroList[i].go,tempHeroData,false)
Util.SetGray(self.gridList[index].upHeroList[i].icon.gameObject,false)
else
self.gridList[index].upHeroList[i].frame.sprite = self.spLoader:LoadSprite(GetHeroQuantityImageByquality(self.godDatas[index][i].star,self.godDatas[index][i].star))
SetHeroStars(self.spLoader,self.gridList[index].upHeroList[i].star,self.godDatas[index][i].star,1,Vector2.New(43.081,40.927))
self.gridList[index].upHeroList[i].posIcon.gameObject:SetActive(false)
self.gridList[index].upHeroList[i].proIcon.gameObject:SetActive(false)
if self.godDatas[index][i].id > 0 then
self.gridList[index].upHeroList[i].icon.sprite = self.spLoader:LoadSprite(GetResourcePath(heroConfig[self.godDatas[index][i].id].Icon))
Util.SetGray(self.gridList[index].upHeroList[i].icon.gameObject,true)
else
self.gridList[index].upHeroList[i].icon.sprite = self.spLoader:LoadSprite("r_hero_jinjie-touxiang2")
if self.godDatas[index][i].property > 0 then
self.gridList[index].upHeroList[i].proIcon.gameObject:SetActive(true)
self.gridList[index].upHeroList[i].proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(self.godDatas[index][i].property))
elseif self.godDatas[index][i].profession > 0 then
self.gridList[index].upHeroList[i].posIcon.gameObject:SetActive(true)
self.gridList[index].upHeroList[i].posIcon.sprite = self.spLoader:LoadSprite(GetHeroPosStr(self.godDatas[index][i].profession))
else
end
Util.SetGray(self.gridList[index].upHeroList[i].icon.gameObject,false)
end
end
Util.AddOnceClick(self.gridList[index].upHeroList[i].go,function()
if self.addShow then
self:SetMaskActive(false)
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHun,self.godDatas[index],self.curHeroData,index,i)
end
end)
end
end
Util.AddOnceClick(self.gridList[index].add,function()
if self.addShow then
self:SetMaskActive(false)
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHun,self.godDatas[index],self.curHeroData,index,1)
end
end)
end
2021-11-02 10:20:17 +08:00
--index 等级
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:UpdataSingleGod(index)
for i = 1,math.max(#self.gridList[index].godLvList,index) do
if index < i then
self.gridList[index].godLvList[i].gameObject:SetActive(false)
2021-10-18 10:36:32 +08:00
else
2021-10-20 18:02:09 +08:00
if not self.gridList[index].godLvList[i] then
2021-10-22 15:47:59 +08:00
self.gridList[index].godLvList[i] = newObjToParent(self.godPre,self.gridList[index].godGrid)
2021-10-18 10:36:32 +08:00
end
2021-10-20 18:02:09 +08:00
self.gridList[index].godLvList[i].gameObject:SetActive(true)
2021-10-18 10:36:32 +08:00
end
end
2021-11-05 10:18:10 +08:00
2021-10-26 16:00:31 +08:00
--绿色
2021-11-01 19:11:59 +08:00
self.gridList[index].tip.text = string.format("<color=#B5AA95>需要:</color>")
2021-11-02 10:20:17 +08:00
local godDatasByLv = GodSoulManager.MergeGodSoulDataByLv(self.heroConfig.Id,index)
for i = 1,math.max(#self.gridList[index].costList,#godDatasByLv) do
if not godDatasByLv[i] then
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].go.gameObject:SetActive(false)
else
if not self.gridList[index].costList[i] then
self.gridList[index].costList[i] = {}
self.gridList[index].costList[i].go = newObjToParent(self.costPre,self.gridList[index].costGrid)
self.gridList[index].costList[i].frame = Util.GetGameObject(self.gridList[index].costList[i].go,"frame"):GetComponent("Image")
self.gridList[index].costList[i].icon = Util.GetGameObject(self.gridList[index].costList[i].frame.transform,"icon"):GetComponent("Image")
self.gridList[index].costList[i].num = Util.GetGameObject(self.gridList[index].costList[i].go,"num"):GetComponent("Text")
end
self.gridList[index].costList[i].go.gameObject:SetActive(true)
2021-10-26 16:00:31 +08:00
2021-11-02 10:20:17 +08:00
if godDatasByLv[i].id > 0 then
if godDatasByLv[i].star > 10 then
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].frame.sprite = self.spLoader:LoadSprite("s_shenhunxitong_zuanshitouxiangkuang")
2021-10-22 15:47:59 +08:00
else
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].frame.sprite = self.spLoader:LoadSprite("s_shenhunxitong_hong")
2021-10-22 15:47:59 +08:00
end
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].icon.gameObject:SetActive(true)
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].icon.sprite = self.spLoader:LoadSprite(GetResourcePath(heroConfig[godDatasByLv[i].id].Icon))
elseif godDatasByLv[i].property > 0 then
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].icon.gameObject:SetActive(false)
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].frame.sprite = self.spLoader:LoadSprite(PropertySmallIcon[godDatasByLv[i].star][godDatasByLv[i].property])
elseif godDatasByLv[i].profession > 0 then
2021-10-27 12:50:15 +08:00
self.gridList[index].costList[i].icon.gameObject:SetActive(false)
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].frame.sprite = self.spLoader:LoadSprite(GodSoulProfession[godDatasByLv[i].star][godDatasByLv[i].profession])
2021-10-27 12:50:15 +08:00
else
self.gridList[index].costList[i].icon.gameObject:SetActive(false)
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].frame.sprite = self.spLoader:LoadSprite(StarImage[godDatasByLv[i].star])
2021-10-27 12:50:15 +08:00
end
if not self.addShow then
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].num.text = string.format("<color=#B5AA95>×%s</color>",godDatasByLv[i].num)
2021-10-27 12:50:15 +08:00
Util.SetGray(self.gridList[index].costList[i].frame.gameObject,false)
2021-11-01 19:11:59 +08:00
elseif index >= self.lv + 1 then --未激活时红色,图标置灰
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].num.text = string.format("<color=#FF0000>×%s</color>",godDatasByLv[i].num)
2021-10-27 12:50:15 +08:00
Util.SetGray(self.gridList[index].costList[i].frame.gameObject,true)
else --激活时绿色,图标不置灰
2021-11-02 10:20:17 +08:00
self.gridList[index].costList[i].num.text = string.format("<color=#00FF00>×%s</color>",godDatasByLv[i].num)
2021-10-27 12:50:15 +08:00
Util.SetGray(self.gridList[index].costList[i].frame.gameObject,false)
2021-10-18 10:36:32 +08:00
end
end
2021-10-27 12:50:15 +08:00
end
2021-11-01 19:11:59 +08:00
if self.addShow then
if #self.gridList[index].upHeroDataList < 1 then
self.gridList[index].upHero.gameObject:SetActive(false)
else
self.gridList[index].upHero.gameObject:SetActive(true)
for i = 1,math.max(#self.gridList[index].upHeroList,#self.gridList[index].upHeroDataList) do
if not self.gridList[index].upHeroDataList[i] then
self.gridList[index].upHeroList[i].gameObject:SetActive(false)
else
if not self.gridList[index].upHeroList[i] then
self.gridList[index].upHeroList[i] = newObjToParent(self.heroPre,self.gridList[index].upHero)
end
self.gridList[index].upHeroList[i].gameObject:SetActive(true)
local tempHeroData = HeroManager.GetSingleHeroData(self.gridList[index].upHeroDataList[i])
self:SetHeroData(self.gridList[index].upHeroList[i],tempHeroData,false)
Util.AddOnceClick(self.gridList[index].upHeroList[i],function()
2021-11-05 10:18:10 +08:00
self:SetMaskActive(false)
2021-11-01 19:11:59 +08:00
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHun,self.godDatas[index],self.curHeroData,index,i)
end)
end
end
end
else
self.gridList[index].upHero.gameObject:SetActive(false)
end
2021-10-27 18:03:09 +08:00
self.gridList[index].red.gameObject:SetActive(false)
2021-10-27 12:50:15 +08:00
if not self.addShow then
self.gridList[index].add.gameObject:SetActive(false)
Util.SetGray(self.gridList[index].godGrid,false)
2021-10-27 15:24:46 +08:00
--Util.SetGray(self.gridList[index].des.gameObject,false)
2021-10-27 12:50:15 +08:00
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
elseif index <= self.lv + 1 then
2021-10-22 15:47:59 +08:00
if index == self.lv + 1 then
2021-11-03 10:13:44 +08:00
self.gridList[index].add.gameObject:SetActive(true)
self.gridList[index].addImage.gameObject:SetActive(true)
2021-10-26 16:00:31 +08:00
Util.SetGray(self.gridList[index].godGrid,true) --勾魂图标 未激活时置灰
2021-10-27 15:24:46 +08:00
--Util.SetGray(self.gridList[index].des.gameObject,true)
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
2021-10-27 18:03:09 +08:00
local isShow = GodSoulManager.CheckRedPointGodSoul(self.curHeroData) or false
2021-10-27 17:04:33 +08:00
self.gridList[index].red.gameObject:SetActive(isShow)
2021-10-22 15:47:59 +08:00
else
2021-11-03 10:13:44 +08:00
self.gridList[index].add.gameObject:SetActive(true)
self.gridList[index].addImage.gameObject:SetActive(false)
2021-10-22 15:47:59 +08:00
Util.SetGray(self.gridList[index].godGrid,false)
2021-10-27 15:24:46 +08:00
--Util.SetGray(self.gridList[index].des.gameObject,false)
self.gridList[index].des.text = string.format("<color=#00FF00>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
2021-10-22 15:47:59 +08:00
end
2021-10-28 16:19:59 +08:00
Util.SetGray(self.gridList[index].add,false)
2021-10-22 15:47:59 +08:00
else
self.gridList[index].add.gameObject:SetActive(true)
2021-11-03 10:13:44 +08:00
self.gridList[index].addImage.gameObject:SetActive(true)
2021-10-22 15:47:59 +08:00
--红色
Util.SetGray(self.gridList[index].godGrid,true)
2021-10-27 15:24:46 +08:00
--Util.SetGray(self.gridList[index].des.gameObject,true)
self.gridList[index].des.text = string.format("<color=#B5AA95>%s</color>",self.godDatas[index].skill) --神魂效果 绿色 未激活时置灰
2021-10-28 16:19:59 +08:00
Util.SetGray(self.gridList[index].add,true)
2021-10-18 10:36:32 +08:00
end
2021-11-05 10:18:10 +08:00
self.gridList[index].middle.gameObject:SetActive(false)
2021-10-22 15:47:59 +08:00
Util.AddOnceClick(self.gridList[index].add,function()
if index <= self.lv + 1 then
2021-11-05 10:18:10 +08:00
self:SetMaskActive(false)
2021-10-22 15:47:59 +08:00
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.ShenHun,self.godDatas[index],self.curHeroData,index)
2021-10-26 16:00:31 +08:00
else
2021-11-01 19:11:59 +08:00
PopupTipPanel.ShowTip("需要激活上一个神魂才可解锁!")
2021-10-22 15:47:59 +08:00
end
end)
2021-11-05 10:18:10 +08:00
2021-10-18 10:36:32 +08:00
end
2021-10-20 18:02:09 +08:00
function RoleGodSoulLayout:OnHide()
2021-10-18 10:36:32 +08:00
self.gameObject:SetActive(false)
end
2021-11-01 19:11:59 +08:00
function RoleGodSoulLayout:OnDestroy()
2021-10-20 18:02:09 +08:00
self.gridList = {}
2021-10-18 10:36:32 +08:00
end
2021-10-20 18:02:09 +08:00
2021-11-01 19:11:59 +08:00
function RoleGodSoulLayout:OnClose()
self.gameObject:SetActive(false)
end
2021-11-05 10:18:10 +08:00
function RoleGodSoulLayout:SetMaskActive(isShow)
self.effectMask.enabled = isShow
end
2021-10-20 18:02:09 +08:00
return RoleGodSoulLayout