mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-15 03:31:44 +01:00
Improve sandbox window toggle buttons state handling (#42281)
This commit is contained in:
@@ -1,16 +1,12 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Markers;
|
||||
using Content.Client.Sandbox;
|
||||
using Content.Client.SubFloor;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.UserInterface.Systems.DecalPlacer;
|
||||
using Content.Client.UserInterface.Systems.Sandbox.Windows;
|
||||
using Content.Shared.Input;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Debugging;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Input;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface;
|
||||
@@ -30,14 +26,10 @@ namespace Content.Client.UserInterface.Systems.Sandbox;
|
||||
public sealed class SandboxUIController : UIController, IOnStateChanged<GameplayState>, IOnSystemChanged<SandboxSystem>
|
||||
{
|
||||
[Dependency] private readonly IConsoleHost _console = default!;
|
||||
[Dependency] private readonly IEyeManager _eye = default!;
|
||||
[Dependency] private readonly IInputManager _input = default!;
|
||||
[Dependency] private readonly ILightManager _light = default!;
|
||||
[Dependency] private readonly IClientAdminManager _admin = default!;
|
||||
[Dependency] private readonly IPlayerManager _player = default!;
|
||||
|
||||
[UISystemDependency] private readonly DebugPhysicsSystem _debugPhysics = default!;
|
||||
[UISystemDependency] private readonly MarkerSystem _marker = default!;
|
||||
[UISystemDependency] private readonly SandboxSystem _sandbox = default!;
|
||||
|
||||
private SandboxWindow? _window;
|
||||
@@ -117,13 +109,6 @@ public sealed class SandboxUIController : UIController, IOnStateChanged<Gameplay
|
||||
_window.OnOpen += () => { SandboxButton!.Pressed = true; };
|
||||
_window.OnClose += () => { SandboxButton!.Pressed = false; };
|
||||
|
||||
// TODO: These need moving to opened so at least if they're not synced properly on open they work.
|
||||
_window.ToggleLightButton.Pressed = !_light.Enabled;
|
||||
_window.ToggleFovButton.Pressed = !_eye.CurrentEye.DrawFov;
|
||||
_window.ToggleShadowsButton.Pressed = !_light.DrawShadows;
|
||||
_window.ShowMarkersButton.Pressed = _marker.MarkersVisible;
|
||||
_window.ShowBbButton.Pressed = (_debugPhysics.Flags & PhysicsDebugFlags.Shapes) != 0x0;
|
||||
|
||||
_window.AiOverlayButton.OnPressed += args =>
|
||||
{
|
||||
var player = _player.LocalEntity;
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
using Content.Client.SubFloor;
|
||||
using Content.Client.Markers;
|
||||
using Content.Client.SubFloor;
|
||||
using Content.Client.Stylesheets;
|
||||
using Content.Shared.Silicons.StationAi;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Debugging;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
@@ -10,17 +15,33 @@ namespace Content.Client.UserInterface.Systems.Sandbox.Windows;
|
||||
public sealed partial class SandboxWindow : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = null!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = null!;
|
||||
[Dependency] private readonly ILightManager _lightManager = null!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = null!;
|
||||
private readonly DebugPhysicsSystem _debugPhysicsSystem;
|
||||
private readonly MarkerSystem _markerSystem;
|
||||
private readonly SubFloorHideSystem _subFloorSystem;
|
||||
|
||||
public SandboxWindow()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_debugPhysicsSystem = _entManager.System<DebugPhysicsSystem>();
|
||||
_markerSystem = _entManager.System<MarkerSystem>();
|
||||
_subFloorSystem = _entManager.System<SubFloorHideSystem>();
|
||||
}
|
||||
|
||||
protected override void Opened()
|
||||
{
|
||||
base.Opened();
|
||||
// Make sure state is up to date.
|
||||
ToggleSubfloorButton.Pressed = _entManager.System<SubFloorHideSystem>().ShowAll;
|
||||
|
||||
ToggleSubfloorButton.Pressed = _subFloorSystem.ShowAll;
|
||||
ToggleLightButton.Pressed = !_lightManager.Enabled;
|
||||
ToggleFovButton.Pressed = !_eyeManager.CurrentEye.DrawFov;
|
||||
ToggleShadowsButton.Pressed = !_lightManager.DrawShadows;
|
||||
ShowMarkersButton.Pressed = _markerSystem.MarkersVisible;
|
||||
ShowBbButton.Pressed = (_debugPhysicsSystem.Flags & PhysicsDebugFlags.Shapes) != 0x0;
|
||||
AiOverlayButton.Pressed = _playerManager.LocalEntity is { } player && _entManager.HasComponent<StationAiOverlayComponent>(player);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user