PGRData/Script/matrix/xui/xuiguildboss/component/XUiGuildBossTeamList.lua

47 lines
1.8 KiB
Lua
Raw Normal View History

--工会boss队员头像组件
local XUiGuildBossTeamList = XClass(nil, "XUiGuildBossTeamList")
function XUiGuildBossTeamList:Ctor(ui)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
self.MaxHeadNum = 3
end
function XUiGuildBossTeamList:Init(data, characterHeadInfoList, needBigHead)
characterHeadInfoList = characterHeadInfoList or {}
2024-09-01 20:49:41 +00:00
local emptyNum = 0
for i = 1, self.MaxHeadNum do
2024-09-01 20:49:41 +00:00
self["TeamHeadObj" .. i].gameObject:SetActiveEx(false)
if data[i] and data[i] <= 0 then
emptyNum = emptyNum + 1 -- 靠左对齐
else
2024-09-01 20:49:41 +00:00
local index = i - emptyNum
self["TeamHeadObj" .. index].gameObject:SetActiveEx(true)
if i <= #data then
2024-09-01 20:49:41 +00:00
self["TryMarkObj" .. index].gameObject:SetActiveEx(data[i] < 1000000)
--Head
local characterId
if XRobotManager.CheckIsRobotId(data[i]) then
characterId = XRobotManager.GetCharacterId(data[i])
else
characterId = data[i]
end
local iconPath
local headInfo = characterHeadInfoList[i] or {}
if needBigHead then
iconPath = XDataCenter.CharacterManager.GetCharBigHeadIcon(characterId, true, headInfo.HeadFashionId, headInfo.HeadFashionType)
else
iconPath = XDataCenter.CharacterManager.GetCharSmallHeadIcon(characterId, true, headInfo.HeadFashionId, headInfo.HeadFashionType)
end
2024-09-01 20:49:41 +00:00
self["ImgHead" .. index]:SetRawImage(iconPath)
2024-09-01 20:49:41 +00:00
self["TeamHeadObj" .. index].gameObject:SetActiveEx(true)
else
2024-09-01 20:49:41 +00:00
self["TeamHeadObj" .. index].gameObject:SetActiveEx(false)
end
end
end
end
return XUiGuildBossTeamList