49 lines
1.1 KiB
Lua
49 lines
1.1 KiB
Lua
---@class WB_Disables_C:UUserWidget
|
|
---@field HorizontalBox_EnemyDisable UHorizontalBox
|
|
--Edit Below--
|
|
---@type WB_Disables_C
|
|
local WB_Disables = { bInitDoOnce = false }
|
|
|
|
WB_Disables.DisableItems = {};
|
|
|
|
function WB_Disables:Construct()
|
|
self:LuaInit();
|
|
end
|
|
|
|
function WB_Disables:LuaInit()
|
|
if self.bInitDoOnce then return ; end
|
|
self.bInitDoOnce = true;
|
|
|
|
local Table = {};
|
|
for i = 1, EDisableType.Max - 1 do
|
|
if DisableInfo[i] and DisableInfo[i].Enable then
|
|
table.insert(Table, i);
|
|
end
|
|
end
|
|
--- 初始化一下,默认方式
|
|
UITool.ForeachAllChildren(self.HorizontalBox_EnemyDisable, function(index, Widget)
|
|
Widget:LuaInit();
|
|
Widget:SetDisableType(Table[index]);
|
|
if Table[index] then
|
|
self.DisableItems[Table[index]] = Widget;
|
|
end
|
|
end);
|
|
end
|
|
|
|
function WB_Disables:OnPlayerDisable(Disables)
|
|
for Type, Enable in pairs(Disables) do
|
|
if self.DisableItems[Type] then
|
|
self.DisableItems[Type]:SetInitDisable(Enable);
|
|
end
|
|
end
|
|
end
|
|
|
|
-- function WB_Disables:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
function WB_Disables:Destruct()
|
|
self.HorizontalBox_EnemyDisable:ClearChildren();
|
|
end
|
|
|
|
return WB_Disables |