PGRData/Script/matrix/xui/xuitransfinite/main/XUiTransfiniteBattlePrepareGridHead.lua

31 lines
1.1 KiB
Lua
Raw Normal View History

2024-09-01 22:49:41 +02:00
---@class XUiTransfiniteBattlePrepareGridHead
local XUiTransfiniteBattlePrepareGridHead = XClass(nil, "XUiTransfiniteBattlePrepareGridHead")
function XUiTransfiniteBattlePrepareGridHead:Ctor(ui)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
end
---@param data XViewModelTransfiniteRoomMember
function XUiTransfiniteBattlePrepareGridHead:Update(data)
if data then
self.Head.gameObject:SetActiveEx(true)
if self.BtnEmpty then
self.BtnEmpty.gameObject:SetActiveEx(false)
end
self.ImgHpBar.fillAmount = data.Hp
self.ImgSpBar.fillAmount = data.Sp
self.StandIcon:SetRawImage(data.Icon)
self.ImgFirstBg.gameObject:SetActiveEx(data.IsFirst)
self.TxtCaptain.transform.parent.gameObject:SetActiveEx(data.IsCaptain)
self.ImgDead.gameObject:SetActiveEx(data.IsDead)
else
self.Head.gameObject:SetActiveEx(false)
if self.BtnEmpty then
self.BtnEmpty.gameObject:SetActiveEx(true)
end
end
end
return XUiTransfiniteBattlePrepareGridHead