mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
* Add window helper for BUIs Automatically does OnClose and just makes content slightly nicer. * more * Add prototype reload helper * Add Box2i Center * weh
39 lines
937 B
C#
39 lines
937 B
C#
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Robust.Client.GameObjects;
|
|
|
|
public sealed class UserInterfaceSystem : SharedUserInterfaceSystem
|
|
{
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
ProtoManager.PrototypesReloaded += OnProtoReload;
|
|
}
|
|
|
|
public override void Shutdown()
|
|
{
|
|
base.Shutdown();
|
|
ProtoManager.PrototypesReloaded -= OnProtoReload;
|
|
}
|
|
|
|
private void OnProtoReload(PrototypesReloadedEventArgs obj)
|
|
{
|
|
var player = Player.LocalEntity;
|
|
|
|
if (!UserQuery.TryComp(player, out var userComp))
|
|
return;
|
|
|
|
foreach (var uid in userComp.OpenInterfaces.Keys)
|
|
{
|
|
if (!UIQuery.TryComp(uid, out var uiComp))
|
|
continue;
|
|
|
|
foreach (var bui in uiComp.ClientOpenInterfaces.Values)
|
|
{
|
|
bui.OnProtoReload(obj);
|
|
}
|
|
}
|
|
}
|
|
}
|