PGRData/Script/matrix/xui/xuicharacterv2p6/XUiSkillDetailsParentV2P6.lua
2024-09-01 22:49:41 +02:00

60 lines
2.1 KiB
Lua

local XUiSkillDetailsParentV2P6 = XLuaUiManager.Register(XLuaUi, "UiSkillDetailsParentV2P6")
function XUiSkillDetailsParentV2P6:OnAwake()
---@type XCharacterAgency
local ag = XMVCA:GetAgency(ModuleId.XCharacter)
self.CharacterAgency = ag
self.SkillGridIndex = 1
end
function XUiSkillDetailsParentV2P6:SetSkillPos(pos)
if not self.CharacterAgency:CheckIsShowEnhanceSkill(self.CharacterId) then
return
end
if self.SkillGridIndex > XCharacterConfigs.MAX_SHOW_SKILL_POS and pos <= XCharacterConfigs.MAX_SHOW_SKILL_POS then
-- 从跃升/独域技能切到普通技能
local skills = XCharacterConfigs.GetCharacterSkills(self.CharacterId)
if self.ChildUiSkillDetails then
self.ChildUiSkillDetails:RefreshDataByChangePage(self.CharacterId, skills, pos)
end
self:OpenChildUi("UiSkillDetails", self.CharacterId, skills, pos)
elseif self.SkillGridIndex <= XCharacterConfigs.MAX_SHOW_SKILL_POS and pos > XCharacterConfigs.MAX_SHOW_SKILL_POS then
self:OpenChildUi("UiSkillDetailsForEnhanceV2P6", self.CharacterId)
-- 从普通技能切到跃升/独域技能
end
self.SkillGridIndex = pos
end
function XUiSkillDetailsParentV2P6:OpenChildUi(uiName, ...)
if uiName == self.CurChildUiName then
return
end
self:OpenOneChildUi(uiName, ...)
self.CurChildUiName = uiName
end
function XUiSkillDetailsParentV2P6:OnStart(characterId, type, pos, gridIndex)
self.CharacterId = characterId
if not type then
return
end
if type == XCharacterConfigs.SkillDetailsType.Normal then
local skills = XCharacterConfigs.GetCharacterSkills(characterId)
self:OpenChildUi("UiSkillDetails", self.CharacterId, skills, pos, gridIndex)
self:SetSkillPos(pos)
else
self:OpenChildUi("UiSkillDetailsForEnhanceV2P6", self.CharacterId)
self:SetSkillPos(XCharacterConfigs.MAX_SHOW_SKILL_POS + 1)
end
end
function XUiSkillDetailsParentV2P6:OnDisable()
XDataCenter.FavorabilityManager.StopCv()
end
return XUiSkillDetailsParentV2P6