Files
BusyRabbit/Content/Lua/Utils/UI/WidgetUtils.lua

23 lines
533 B
Lua
Raw Normal View History

2025-07-13 15:47:08 +08:00
local GameplayStatics = import("GameplayStatics")
local WidgetUtils = {}
local function GetHud(wco)
local pc = GameplayStatics.GetPlayerController(wco, 0)
if pc == nil then return end
return pc:GetHud()
end
function WidgetUtils.Show(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:ShowWidget(widget_name)
end
function WidgetUtils.Hide(wco, widget_name)
local hud = GetHud(wco)
if not hud then return end
return hud:PopWidget(widget_name)
end
return WidgetUtils