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

47 lines
No EOL
1.4 KiB
Lua

local XUiGridLikeRoleItem = require("XUi/XUiFavorability/XUiGridLikeRoleItem")
XUiGridLineCharacter = XClass(XUiGridLikeRoleItem, "XUiGridLineCharacter")
function XUiGridLineCharacter:Ctor(ui)
self.GameObject = ui.gameObject
self.Transform = ui.transform
XTool.InitUiObject(self)
end
function XUiGridLineCharacter:RefreshAssist(data, rootUi)
self.RootUi = rootUi
self:RefreshAddButton(data.IsAdd)
if data.IsAdd then
return
end
self.Super.OnRefresh(self, data)
self.ImgAssist.gameObject:SetActive(data.ChiefAssistant)
end
function XUiGridLineCharacter:RefreshAddButton(isAdd)
self.BtnAdd.CallBack = function () self.RootUi:OnBtnAddAssistListClick() end
if isAdd then
for i = 0, self.Transform.childCount - 1 do
local childGo = self.Transform:GetChild(i).gameObject
childGo:SetActiveEx(self.BtnAdd.gameObject.name == childGo.name)
end
else
for i = 0, self.Transform.childCount - 1 do
local childGo = self.Transform:GetChild(i).gameObject
childGo:SetActiveEx(self.BtnAdd.gameObject.name ~= childGo.name)
end
end
end
function XUiGridLineCharacter:OnBtnAddClick()
self.RootUi:OnBtnAddAssistListClick()
end
function XUiGridLineCharacter:IsRed()
return false
end
function XUiGridLineCharacter:OnSelect(flag)
self.ImgSelected.gameObject:SetActiveEx(flag)
end
return XUiGridLineCharacter