2021-11-12 19:46:05 +01:00
|
|
|
using Content.Client.Administration.Managers;
|
2025-04-16 19:04:48 +02:00
|
|
|
using Content.Shared.Roles;
|
2021-12-10 16:55:01 +11:00
|
|
|
using Robust.Client.Graphics;
|
2022-09-14 20:42:35 -07:00
|
|
|
using Robust.Client.ResourceManagement;
|
2024-08-27 15:43:47 +01:00
|
|
|
using Robust.Client.UserInterface;
|
|
|
|
|
using Robust.Shared.Configuration;
|
2025-06-27 01:27:23 +02:00
|
|
|
using Robust.Shared.Prototypes;
|
2021-11-10 13:26:25 +01:00
|
|
|
|
2022-07-21 17:30:00 -05:00
|
|
|
namespace Content.Client.Administration.Systems
|
2021-11-10 13:26:25 +01:00
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed partial class AdminSystem
|
2021-11-10 13:26:25 +01:00
|
|
|
{
|
2022-09-14 20:42:35 -07:00
|
|
|
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
2023-10-29 15:29:30 +11:00
|
|
|
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
2021-11-12 19:46:05 +01:00
|
|
|
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
2021-12-10 16:55:01 +11:00
|
|
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
2022-09-14 20:42:35 -07:00
|
|
|
[Dependency] private readonly EntityLookupSystem _entityLookup = default!;
|
2024-08-27 15:43:47 +01:00
|
|
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
2025-03-25 17:03:59 +01:00
|
|
|
[Dependency] private readonly IConfigurationManager _configurationManager = default!;
|
2025-04-16 19:04:48 +02:00
|
|
|
[Dependency] private readonly SharedRoleSystem _roles = default!;
|
2025-06-27 01:27:23 +02:00
|
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
2022-03-24 17:08:08 +01:00
|
|
|
|
2021-11-10 13:26:25 +01:00
|
|
|
private AdminNameOverlay _adminNameOverlay = default!;
|
|
|
|
|
|
2022-03-24 17:08:08 +01:00
|
|
|
public event Action? OverlayEnabled;
|
|
|
|
|
public event Action? OverlayDisabled;
|
|
|
|
|
|
2021-11-10 13:26:25 +01:00
|
|
|
private void InitializeOverlay()
|
|
|
|
|
{
|
2025-03-25 17:03:59 +01:00
|
|
|
_adminNameOverlay = new AdminNameOverlay(
|
|
|
|
|
this,
|
|
|
|
|
EntityManager,
|
|
|
|
|
_eyeManager,
|
|
|
|
|
_resourceCache,
|
|
|
|
|
_entityLookup,
|
|
|
|
|
_userInterfaceManager,
|
2025-04-16 19:04:48 +02:00
|
|
|
_configurationManager,
|
2025-06-27 01:27:23 +02:00
|
|
|
_roles,
|
|
|
|
|
_proto);
|
2021-11-12 19:46:05 +01:00
|
|
|
_adminManager.AdminStatusUpdated += OnAdminStatusUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ShutdownOverlay()
|
|
|
|
|
{
|
|
|
|
|
_adminManager.AdminStatusUpdated -= OnAdminStatusUpdated;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnAdminStatusUpdated()
|
|
|
|
|
{
|
|
|
|
|
AdminOverlayOff();
|
2021-11-10 13:26:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-24 17:08:08 +01:00
|
|
|
public void AdminOverlayOn()
|
2021-11-10 13:26:25 +01:00
|
|
|
{
|
2025-04-16 19:04:48 +02:00
|
|
|
if (_overlayManager.HasOverlay<AdminNameOverlay>())
|
|
|
|
|
return;
|
2022-03-24 17:08:08 +01:00
|
|
|
_overlayManager.AddOverlay(_adminNameOverlay);
|
|
|
|
|
OverlayEnabled?.Invoke();
|
2021-11-10 13:26:25 +01:00
|
|
|
}
|
|
|
|
|
|
2022-03-24 17:08:08 +01:00
|
|
|
public void AdminOverlayOff()
|
2021-11-10 13:26:25 +01:00
|
|
|
{
|
|
|
|
|
_overlayManager.RemoveOverlay<AdminNameOverlay>();
|
2022-03-24 17:08:08 +01:00
|
|
|
OverlayDisabled?.Invoke();
|
2021-11-10 13:26:25 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|