PGRData/Resources/Scripts/XUi/XUiSet/XUiInstruction.lua
2022-12-26 14:06:01 +05:30

67 lines
No EOL
1.9 KiB
Lua

XUiInstruction = XClass(nil, "XUiInstruction")
function XUiInstruction:Ctor(ui)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
self.Npc = {self.Npc1, self.Npc2, self.Npc3}
self.TogPortrait = {self.TogPortrait1, self.TogPortrait2, self.TogPortrait3}
self.PanelNpc:Init(self.Npc, function(index) self:OnPanelNpc(index) end)
self.Core = {}
self.CoreDescription = {}
self:Init()
end
function XUiInstruction:Init()
local role = CS.XFight.GetActivateClientRole()
local firstIndex = role.Captain and (role.Captain.Index + 1) or 1
for i = 1, 3 do
local hasNpc, npc = role:GetNpc(i - 1)
if not hasNpc then
self.Npc[i].gameObject:SetActiveEx(false)
else
local characterId = math.floor(npc.TemplateId / 10)
self.Core[i] = XCharacterConfigs.GetCharTeachIconById(characterId)
self.CoreDescription[i] = XCharacterConfigs.GetCharTeachDescriptionById(characterId)
local iconPath = npc.Template.HeadImageName
if npc.FightNpcData ~= nil then
iconPath = XDataCenter.CharacterManager.GetFightCharHeadIcon(npc.FightNpcData.Character)
end
self.TogPortrait[i]:SetSprite(iconPath)
end
end
self.PanelNpc:SelectIndex(firstIndex)
end
function XUiInstruction:OnPanelNpc(index)
self.ImgCoreSkill:SetRawImage(self.Core[index])
self.TxtCoreDescription.text = self.CoreDescription[index]
end
function XUiInstruction:ShowPanel()
self.IsShow = true
self.GameObject:SetActive(true)
end
function XUiInstruction:HidePanel()
self.IsShow = false
self.GameObject:SetActive(false)
end
function XUiInstruction:CheckDataIsChange()
return false
end
function XUiInstruction:SaveChange()
end
function XUiInstruction:CancelChange()
end
function XUiInstruction:ResetToDefault()
end