Merge more UI refactor stuff (#11277)

* Changelog+options ui controller
* Sandbox UI controller
* Escape menu UI controller
This commit is contained in:
wrexbe
2022-09-14 14:34:48 -07:00
committed by GitHub
parent 8871c445b8
commit 018a96ee88
23 changed files with 591 additions and 573 deletions

View File

@@ -1,9 +1,11 @@
using System.IO;
using Content.Client.Administration.Managers;
using Content.Client.Sandbox;
using Content.Client.UserInterface.Systems.DecalPlacer;
using Content.Shared.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers.Implementations;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
@@ -46,17 +48,17 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
private void SpawnEntitiesButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
EntitySystem.Get<SandboxSystem>().ToggleEntitySpawnWindow();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<EntitySpawningUIController>().ToggleWindow();
}
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
{
EntitySystem.Get<SandboxSystem>().ToggleTilesWindow();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<TileSpawningUIController>().ToggleWindow();
}
private void SpawnDecalsButtonOnPressed(BaseButton.ButtonEventArgs obj)
{
EntitySystem.Get<SandboxSystem>().ToggleDecalsWindow();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<DecalPlacerUIController>().ToggleWindow();
}
}
}

View File

@@ -1,7 +1,7 @@
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Changelog
{
@@ -13,7 +13,7 @@ namespace Content.Client.Changelog
{
IoCManager.InjectDependencies(this);
OnPressed += OnOnPressed;
OnPressed += OnChangelogPressed;
// So that measuring before opening returns a correct height,
// and the window has the correct size when opened.
@@ -35,9 +35,9 @@ namespace Content.Client.Changelog
_changelogManager.NewChangelogEntriesChanged -= UpdateStuff;
}
private void OnOnPressed(ButtonEventArgs obj)
private void OnChangelogPressed(ButtonEventArgs obj)
{
new ChangelogWindow().OpenCentered();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<ChangelogUIController>().ToggleWindow();
}
private void UpdateStuff()

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Client.Resources;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Shared.Administration;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
@@ -204,7 +205,7 @@ namespace Content.Client.Changelog
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
new ChangelogWindow().OpenCentered();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<ChangelogUIController>().ToggleWindow();
}
}
}

View File

@@ -7,7 +7,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.Decals.UI;
@@ -15,7 +14,6 @@ namespace Content.Client.Decals.UI;
[GenerateTypedNameReferences]
public sealed partial class DecalPlacerWindow : DefaultWindow
{
private readonly IPrototypeManager _prototypeManager;
private readonly DecalPlacementSystem _decalPlacementSystem;
public FloatSpinBox RotationSpinBox;
@@ -31,11 +29,10 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
private bool _cleanable;
private int _zIndex;
public DecalPlacerWindow(IPrototypeManager prototypeManager)
public DecalPlacerWindow()
{
RobustXamlLoader.Load(this);
_prototypeManager = prototypeManager;
_decalPlacementSystem = EntitySystem.Get<DecalPlacementSystem>();
// This needs to be done in C# so we can have custom stuff passed in the constructor
@@ -98,8 +95,6 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
};
// i have to make this a member method for some reason and i have no idea why its only for spinboxes
ZIndexSpinBox.ValueChanged += ZIndexSpinboxChanged;
Populate();
}
private void OnColorPicked(Color color)
@@ -173,9 +168,8 @@ public sealed partial class DecalPlacerWindow : DefaultWindow
RefreshList();
}
public void Populate()
public void Populate(IEnumerable<DecalPrototype> prototypes)
{
var prototypes = _prototypeManager.EnumeratePrototypes<DecalPrototype>();
_decals = new Dictionary<string, Texture>();
foreach (var decalPrototype in prototypes)
{

View File

@@ -49,7 +49,6 @@ namespace Content.Client.Entry
{
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IBaseClient _baseClient = default!;
[Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner = default!;
[Dependency] private readonly IGameController _gameController = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
@@ -130,8 +129,6 @@ namespace Content.Client.Entry
IoCManager.Resolve<IConfigurationManager>().OverrideDefault(CVars.NetBufferSize, NetBufferSizeOverride);
#endif
_escapeMenuOwner.Initialize();
_baseClient.PlayerJoinedServer += (_, _) =>
{
IoCManager.Resolve<IMapManager>().CreateNewMapEntity(MapId.Nullspace);

View File

@@ -1,4 +1,5 @@
using Content.Client.Options.UI;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -15,13 +16,10 @@ namespace Content.Client.Info
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly RulesManager _rules = default!;
private OptionsMenu optionsMenu;
public RulesAndInfoWindow()
{
IoCManager.InjectDependencies(this);
optionsMenu = new OptionsMenu();
Title = Loc.GetString("ui-info-title");
@@ -52,7 +50,12 @@ namespace Content.Client.Info
AddSection(tutorialList, Loc.GetString("ui-info-header-gameplay"), "Gameplay.txt", true);
AddSection(tutorialList, Loc.GetString("ui-info-header-sandbox"), "Sandbox.txt", true);
infoControlSection.ControlsButton.OnPressed += _ => optionsMenu.OpenCentered();
infoControlSection.ControlsButton.OnPressed += OnOptionsPressed;
}
private void OnOptionsPressed(BaseButton.ButtonEventArgs obj)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<OptionsUIController>().ToggleWindow();
}
private static void AddSection(Info info, Control control)

View File

@@ -30,7 +30,6 @@ namespace Content.Client.IoC
IoCManager.Register<IGameHud, GameHud>();
IoCManager.Register<IParallaxManager, ParallaxManager>();
IoCManager.Register<IChatManager, ChatManager>();
IoCManager.Register<IEscapeMenuOwner, EscapeMenuOwner>();
IoCManager.Register<IModuleManager, ClientModuleManager>();
IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>();
IoCManager.Register<IItemSlotManager, ItemSlotManager>();

View File

@@ -9,6 +9,7 @@ using Content.Client.Lobby.UI;
using Content.Client.Preferences;
using Content.Client.Preferences.UI;
using Content.Client.Resources;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Content.Client.Voting;
using Content.Shared.GameTicking;
using Robust.Client;
@@ -106,7 +107,7 @@ namespace Content.Client.Lobby
};
_lobby.LeaveButton.OnPressed += _ => _consoleHost.ExecuteCommand("disconnect");
_lobby.OptionsButton.OnPressed += _ => new OptionsMenu().Open();
_lobby.OptionsButton.OnPressed += OnOptionsPressed;
_gameTicker.InfoBlobUpdated += UpdateLobbyUi;
@@ -114,6 +115,11 @@ namespace Content.Client.Lobby
_gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated;
}
private void OnOptionsPressed(BaseButton.ButtonEventArgs obj)
{
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<OptionsUIController>().ToggleWindow();
}
protected override void Shutdown()
{
_gameTicker.InfoBlobUpdated -= UpdateLobbyUi;

View File

@@ -2,6 +2,7 @@ using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Content.Client.Options.UI;
using Content.Client.MainMenu.UI;
using Content.Client.UserInterface.Systems.EscapeMenu;
using Robust.Client;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
@@ -28,7 +29,6 @@ namespace Content.Client.MainMenu
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
private MainMenuControl _mainMenuControl = default!;
private OptionsMenu _optionsMenu = default!;
private bool _isConnecting;
// ReSharper disable once InconsistentNaming
@@ -46,8 +46,6 @@ namespace Content.Client.MainMenu
_mainMenuControl.AddressBox.OnTextEntered += AddressBoxEntered;
_client.RunLevelChanged += RunLevelChanged;
_optionsMenu = new OptionsMenu();
}
/// <inheritdoc />
@@ -57,7 +55,6 @@ namespace Content.Client.MainMenu
_netManager.ConnectFailed -= _onConnectFailed;
_mainMenuControl.Dispose();
_optionsMenu.Dispose();
}
private void QuitButtonPressed(BaseButton.ButtonEventArgs args)
@@ -67,7 +64,7 @@ namespace Content.Client.MainMenu
private void OptionsButtonPressed(BaseButton.ButtonEventArgs args)
{
_optionsMenu.OpenCentered();
IoCManager.Resolve<IUserInterfaceManager>().GetUIController<OptionsUIController>().ToggleWindow();
}
private void DirectConnectButtonPressed(BaseButton.ButtonEventArgs args)

View File

@@ -1,89 +0,0 @@
using Content.Client.Gameplay;
using Content.Client.HUD;
using Content.Client.Viewport;
using Robust.Client.Console;
using Robust.Client.Input;
using Robust.Client.State;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.IoC;
namespace Content.Client.Options
{
internal sealed class EscapeMenuOwner : IEscapeMenuOwner
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
private UI.EscapeMenu? _escapeMenu;
public void Initialize()
{
_stateManager.OnStateChanged += StateManagerOnOnStateChanged;
_gameHud.EscapeButtonToggled += _setOpenValue;
}
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
{
if (obj.NewState is GameplayStateBase)
{
// Switched TO GameScreen.
_escapeMenu = new UI.EscapeMenu(_consoleHost);
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
InputCmdHandler.FromDelegate(_ => Enabled()));
}
else if (obj.OldState is GameplayStateBase)
{
// Switched FROM GameScreen.
_escapeMenu?.Dispose();
_escapeMenu = null;
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
}
}
private void Enabled()
{
if (_escapeMenu != null && _escapeMenu.IsOpen)
{
if (_escapeMenu.IsAtFront())
{
_setOpenValue(false);
}
else
{
_escapeMenu.MoveToFront();
}
}
else
{
_setOpenValue(true);
}
}
private void _setOpenValue(bool value)
{
if (value)
{
_gameHud.EscapeButtonDown = true;
_escapeMenu?.OpenCentered();
}
else
{
_gameHud.EscapeButtonDown = false;
_escapeMenu?.Close();
}
}
}
public interface IEscapeMenuOwner
{
void Initialize();
}
}

View File

@@ -1,16 +1,17 @@
<DefaultWindow xmlns="https://spacestation14.io"
<ui1:EscapeMenu xmlns="https://spacestation14.io"
xmlns:changelog="clr-namespace:Content.Client.Changelog"
xmlns:ui="clr-namespace:Content.Client.Voting.UI"
xmlns:ui1="clr-namespace:Content.Client.Options.UI"
Title="{Loc 'ui-escape-title'}"
Resizable="False">
<BoxContainer Orientation="Vertical" SeparationOverride="4" MinWidth="150">
<changelog:ChangelogButton />
<changelog:ChangelogButton Access="Public" Name="ChangelogButton"/>
<ui:VoteCallMenuButton />
<Button Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
<Button Name="RulesButton" Text="{Loc 'ui-escape-rules'}" />
<Button Name="WikiButton" Text="{Loc 'ui-escape-wiki'}" />
<Button Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
<Button Name="QuitButton" Text="{Loc 'ui-escape-quit'}" />
<Button Access="Public" Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
<Button Access="Public" Name="RulesButton" Text="{Loc 'ui-escape-rules'}" />
<Button Access="Public" Name="WikiButton" Text="{Loc 'ui-escape-wiki'}" />
<Button Access="Public" Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
<Button Access="Public" Name="QuitButton" Text="{Loc 'ui-escape-quit'}" />
</BoxContainer>
</DefaultWindow>
</ui1:EscapeMenu>

View File

@@ -1,69 +1,15 @@
using Content.Client.Info;
using Content.Client.Administration;
using Robust.Client.AutoGenerated;
using Robust.Client.Console;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Client.UserInterface;
using Content.Client.Links;
using Robust.Shared.GameObjects;
namespace Content.Client.Options.UI
{
[GenerateTypedNameReferences]
internal sealed partial class EscapeMenu : DefaultWindow
public sealed partial class EscapeMenu : DefaultWindow
{
private readonly IClientConsoleHost _consoleHost;
private readonly OptionsMenu _optionsMenu;
public EscapeMenu(IClientConsoleHost consoleHost)
public EscapeMenu()
{
_consoleHost = consoleHost;
RobustXamlLoader.Load(this);
_optionsMenu = new OptionsMenu();
OptionsButton.OnPressed += OnOptionsButtonClicked;
QuitButton.OnPressed += OnQuitButtonClicked;
RulesButton.OnPressed += _ => new RulesAndInfoWindow().Open();
DisconnectButton.OnPressed += OnDisconnectButtonClicked;
WikiButton.OnPressed += OnWikiButtonClicked;
}
private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
{
_consoleHost.ExecuteCommand("quit");
Dispose();
}
private void OnDisconnectButtonClicked(BaseButton.ButtonEventArgs args)
{
_consoleHost.ExecuteCommand("disconnect");
Dispose();
}
private void OnOptionsButtonClicked(BaseButton.ButtonEventArgs args)
{
_optionsMenu.OpenCentered();
}
private void OnWikiButtonClicked(BaseButton.ButtonEventArgs args)
{
var uriOpener = IoCManager.Resolve<IUriOpener>();
uriOpener.OpenUri(UILinks.Wiki);
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
_optionsMenu.Dispose();
}
}
}
}

View File

@@ -1,8 +1,6 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
namespace Content.Client.Options.UI
{

View File

@@ -1,5 +1,6 @@
<Control xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls">
<tabs:GraphicsTab xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:tabs="clr-namespace:Content.Client.Options.UI.Tabs">
<BoxContainer Orientation="Vertical">
<BoxContainer Orientation="Vertical" Margin="8 8 8 8" VerticalExpand="True">
<CheckBox Name="VSyncCheckBox" Text="{Loc 'ui-options-vsync'}" />
@@ -45,4 +46,4 @@
HorizontalAlignment="Right" />
</controls:StripeBack>
</BoxContainer>
</Control>
</tabs:GraphicsTab>

View File

@@ -7,9 +7,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
namespace Content.Client.Options.UI.Tabs

View File

@@ -1,168 +1,93 @@
using Content.Client.Administration.Managers;
using Content.Client.Decals.UI;
using Content.Client.Eui;
using Content.Client.HUD;
using Content.Client.Markers;
using Content.Client.SubFloor;
using Content.Shared.Administration;
using Content.Shared.GameTicking;
using Content.Shared.Input;
using Content.Shared.Sandbox;
using Robust.Client.Console;
using Robust.Client.Debugging;
using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.Placement;
using Robust.Client.Placement.Modes;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers.Implementations;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Players;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Sandbox
{
// Layout for the SandboxWindow
public sealed class SandboxWindow : DefaultWindow
{
public readonly Button RespawnButton;
public readonly Button SpawnEntitiesButton;
public readonly Button SpawnTilesButton;
public readonly Button SpawnDecalsButton;
public readonly Button GiveFullAccessButton; //A button that just puts a captain's ID in your hands.
public readonly Button GiveAghostButton;
public readonly Button ToggleLightButton;
public readonly Button ToggleFovButton;
public readonly Button ToggleShadowsButton;
public readonly Button SuicideButton;
public readonly Button ToggleSubfloorButton;
public readonly Button ShowMarkersButton; //Shows spawn points
public readonly Button ShowBbButton; //Shows bounding boxes
public readonly Button MachineLinkingButton; // Enables/disables machine linking mode.
private readonly IGameHud _gameHud;
public SandboxWindow()
{
Resizable = false;
_gameHud = IoCManager.Resolve<IGameHud>();
Title = Loc.GetString("sandbox-window-title");
var vBox = new BoxContainer
{
Orientation = LayoutOrientation.Vertical,
SeparationOverride = 4
};
Contents.AddChild(vBox);
RespawnButton = new Button { Text = Loc.GetString("sandbox-window-respawn-button") };
vBox.AddChild(RespawnButton);
SpawnEntitiesButton = new Button { Text = Loc.GetString("sandbox-window-spawn-entities-button") };
vBox.AddChild(SpawnEntitiesButton);
SpawnTilesButton = new Button { Text = Loc.GetString("sandbox-window-spawn-tiles-button") };
vBox.AddChild(SpawnTilesButton);
SpawnDecalsButton = new Button { Text = Loc.GetString("sandbox-window-spawn-decals-button") };
vBox.AddChild(SpawnDecalsButton);
GiveFullAccessButton = new Button { Text = Loc.GetString("sandbox-window-grant-full-access-button") };
vBox.AddChild(GiveFullAccessButton);
GiveAghostButton = new Button { Text = Loc.GetString("sandbox-window-ghost-button") };
vBox.AddChild(GiveAghostButton);
ToggleLightButton = new Button { Text = Loc.GetString("sandbox-window-toggle-lights-button"), ToggleMode = true, Pressed = !IoCManager.Resolve<ILightManager>().Enabled };
vBox.AddChild(ToggleLightButton);
ToggleFovButton = new Button { Text = Loc.GetString("sandbox-window-toggle-fov-button"), ToggleMode = true, Pressed = !IoCManager.Resolve<IEyeManager>().CurrentEye.DrawFov };
vBox.AddChild(ToggleFovButton);
ToggleShadowsButton = new Button { Text = Loc.GetString("sandbox-window-toggle-shadows-button"), ToggleMode = true, Pressed = !IoCManager.Resolve<ILightManager>().DrawShadows };
vBox.AddChild(ToggleShadowsButton);
ToggleSubfloorButton = new Button { Text = Loc.GetString("sandbox-window-toggle-subfloor-button"), ToggleMode = true, Pressed = EntitySystem.Get<SubFloorHideSystem>().ShowAll };
vBox.AddChild(ToggleSubfloorButton);
SuicideButton = new Button { Text = Loc.GetString("sandbox-window-toggle-suicide-button") };
vBox.AddChild(SuicideButton);
ShowMarkersButton = new Button { Text = Loc.GetString("sandbox-window-show-spawns-button"), ToggleMode = true, Pressed = EntitySystem.Get<MarkerSystem>().MarkersVisible };
vBox.AddChild(ShowMarkersButton);
ShowBbButton = new Button { Text = Loc.GetString("sandbox-window-show-bb-button"), ToggleMode = true, Pressed = (EntitySystem.Get<DebugPhysicsSystem>().Flags & PhysicsDebugFlags.Shapes) != 0x0 };
vBox.AddChild(ShowBbButton);
MachineLinkingButton = new Button { Text = Loc.GetString("sandbox-window-link-machines-button"), ToggleMode = true };
vBox.AddChild(MachineLinkingButton);
}
protected override void EnteredTree()
{
base.EnteredTree();
_gameHud.SandboxButtonDown = true;
}
protected override void ExitedTree()
{
base.ExitedTree();
_gameHud.SandboxButtonDown = false;
}
}
public sealed class SandboxSystem : SharedSandboxSystem
{
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IPlacementManager _placementManager = default!;
[Dependency] private readonly IResourceCache _resourceCache = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IClientAdminManager _adminManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly IMapManager _map = default!;
[Dependency] private readonly IPlacementManager _placement = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
private bool _sandboxEnabled;
public bool SandboxAllowed { get; private set; }
private SandboxWindow? _sandboxWindow;
private EntitySpawnWindow? _spawnWindow;
private TileSpawnWindow? _tilesSpawnWindow;
private DecalPlacerWindow? _decalSpawnWindow;
public event Action? SandboxEnabled;
public event Action? SandboxDisabled;
public override void Initialize()
{
base.Initialize();
_adminManager.AdminStatusUpdated += CheckStatus;
SubscribeNetworkEvent<MsgSandboxStatus>(OnSandboxStatus);
SubscribeNetworkEvent<RoundRestartCleanupEvent>(OnRoundRestart);
_adminManager.AdminStatusUpdated += OnAdminStatus;
_gameHud.SandboxButtonToggled += SandboxButtonPressed;
// Do these need cleanup?
_inputManager.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
InputCmdHandler.FromDelegate(session => ToggleEntitySpawnWindow()));
_inputManager.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
InputCmdHandler.FromDelegate(session => ToggleSandboxWindow()));
_inputManager.SetInputCommand(ContentKeyFunctions.OpenTileSpawnWindow,
InputCmdHandler.FromDelegate(session => ToggleTilesWindow()));
_inputManager.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
InputCmdHandler.FromDelegate(session => ToggleDecalsWindow()));
CommandBinds.Builder
.Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(OnCopy))
.Register<SandboxSystem>();
}
private bool OnCopy(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
private void CheckStatus()
{
if (!CanSandbox())
var currentStatus = _sandboxEnabled || _adminManager.IsActive();
if (currentStatus == SandboxAllowed)
return;
SandboxAllowed = currentStatus;
if (SandboxAllowed)
{
SandboxEnabled?.Invoke();
_gameHud.SandboxButtonVisible = true;
}
else
{
SandboxDisabled?.Invoke();
_gameHud.SandboxButtonVisible = false;
}
}
public override void Shutdown()
{
_adminManager.AdminStatusUpdated -= CheckStatus;
base.Shutdown();
}
private void OnSandboxStatus(MsgSandboxStatus ev)
{
SetAllowed(ev.SandboxAllowed);
}
private void SetAllowed(bool sandboxEnabled)
{
_sandboxEnabled = sandboxEnabled;
CheckStatus();
}
public void Respawn()
{
RaiseNetworkEvent(new MsgSandboxRespawn());
}
public void GiveAdminAccess()
{
RaiseNetworkEvent(new MsgSandboxGiveAccess());
}
public void GiveAGhost()
{
RaiseNetworkEvent(new MsgSandboxGiveAghost());
}
public void Suicide()
{
RaiseNetworkEvent(new MsgSandboxSuicide());
}
public bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
if (!SandboxAllowed)
return false;
// Try copy entity.
@@ -173,10 +98,10 @@ namespace Content.Client.Sandbox
if (comp.EntityPrototype == null || comp.EntityPrototype.NoSpawn || comp.EntityPrototype.Abstract)
return false;
if (_placementManager.Eraser)
_placementManager.ToggleEraser();
if (_placement.Eraser)
_placement.ToggleEraser();
_placementManager.BeginPlacing(new()
_placement.BeginPlacing(new()
{
EntityType = comp.EntityPrototype.ID,
IsTile = false,
@@ -187,13 +112,13 @@ namespace Content.Client.Sandbox
}
// Try copy tile.
if (!_mapManager.TryFindGridAt(coords.ToMap(EntityManager), out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
if (!_map.TryFindGridAt(coords.ToMap(EntityManager), out var grid) || !grid.TryGetTileRef(coords, out var tileRef))
return false;
if (_placementManager.Eraser)
_placementManager.ToggleEraser();
if (_placement.Eraser)
_placement.ToggleEraser();
_placementManager.BeginPlacing(new()
_placement.BeginPlacing(new()
{
EntityType = null,
IsTile = true,
@@ -203,265 +128,38 @@ namespace Content.Client.Sandbox
return true;
}
private void OnAdminStatus()
{
if (CanSandbox())
Enable();
else
Disable();
}
private bool CanSandbox()
{
return SandboxAllowed || _adminManager.IsActive();
}
/// <summary>
/// Run when sandbox is disabled
/// </summary>
private void Disable()
{
_gameHud.SandboxButtonVisible = false;
_sandboxWindow?.Close();
_sandboxWindow = null;
_spawnWindow?.Close();
_tilesSpawnWindow?.Close();
_decalSpawnWindow?.Close();
}
private void Enable()
{
_gameHud.SandboxButtonVisible = true;
}
private void OnRoundRestart(RoundRestartCleanupEvent ev)
{
// Go through and cleanup windows (even if they remain adminned better to just shut them).
Disable();
if (CanSandbox())
Enable();
}
public override void Shutdown()
{
base.Shutdown();
// TODO: Gamehud moment
_gameHud.SandboxButtonToggled -= SandboxButtonPressed;
_adminManager.AdminStatusUpdated -= OnAdminStatus;
CommandBinds.Unregister<SandboxSystem>();
}
private void OnSandboxStatus(MsgSandboxStatus ev)
{
SetAllowed(ev.SandboxAllowed);
}
private void SandboxButtonPressed(bool newValue)
{
UpdateSandboxWindowVisibility();
}
private void ToggleSandboxWindow()
{
UpdateSandboxWindowVisibility();
}
private void UpdateSandboxWindowVisibility()
{
if (CanSandbox() && _sandboxWindow?.IsOpen != true)
OpenSandboxWindow();
else
_sandboxWindow?.Close();
}
private void SetAllowed(bool newAllowed)
{
if (newAllowed == SandboxAllowed)
return;
SandboxAllowed = newAllowed;
_gameHud.SandboxButtonVisible = CanSandbox();
if (!CanSandbox())
Disable();
}
private void OpenSandboxWindow()
{
if (_sandboxWindow != null)
{
if (!_sandboxWindow.IsOpen)
_sandboxWindow.Open();
return;
}
_sandboxWindow = new SandboxWindow();
_sandboxWindow.OnClose += SandboxWindowOnClose;
_sandboxWindow.RespawnButton.OnPressed += OnRespawnButtonOnOnPressed;
_sandboxWindow.SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
_sandboxWindow.SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
_sandboxWindow.SpawnDecalsButton.OnPressed += OnSpawnDecalsButtonClicked;
_sandboxWindow.GiveFullAccessButton.OnPressed += OnGiveAdminAccessButtonClicked;
_sandboxWindow.GiveAghostButton.OnPressed += OnGiveAghostButtonClicked;
_sandboxWindow.ToggleLightButton.OnToggled += OnToggleLightButtonClicked;
_sandboxWindow.ToggleFovButton.OnToggled += OnToggleFovButtonClicked;
_sandboxWindow.ToggleShadowsButton.OnToggled += OnToggleShadowsButtonClicked;
_sandboxWindow.SuicideButton.OnPressed += OnSuicideButtonClicked;
_sandboxWindow.ToggleSubfloorButton.OnPressed += OnToggleSubfloorButtonClicked;
_sandboxWindow.ShowMarkersButton.OnPressed += OnShowMarkersButtonClicked;
_sandboxWindow.ShowBbButton.OnPressed += OnShowBbButtonClicked;
_sandboxWindow.MachineLinkingButton.OnPressed += OnMachineLinkingButtonClicked;
_sandboxWindow.OpenCentered();
}
private void SandboxWindowOnClose()
{
_sandboxWindow = null;
}
private void OnRespawnButtonOnOnPressed(BaseButton.ButtonEventArgs args)
{
RaiseNetworkEvent(new MsgSandboxRespawn());
}
private void OnSpawnEntitiesButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleEntitySpawnWindow();
}
private void OnSpawnTilesButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleTilesWindow();
}
private void OnSpawnDecalsButtonClicked(BaseButton.ButtonEventArgs obj)
{
ToggleDecalsWindow();
}
private void OnToggleLightButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleLight();
}
private void OnToggleFovButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleFov();
}
private void OnToggleShadowsButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleShadows();
}
private void OnToggleSubfloorButtonClicked(BaseButton.ButtonEventArgs args)
{
ToggleSubFloor();
}
private void OnShowMarkersButtonClicked(BaseButton.ButtonEventArgs args)
{
ShowMarkers();
}
private void OnShowBbButtonClicked(BaseButton.ButtonEventArgs args)
{
ShowBb();
}
private void OnMachineLinkingButtonClicked(BaseButton.ButtonEventArgs args)
{
LinkMachines();
}
private void OnGiveAdminAccessButtonClicked(BaseButton.ButtonEventArgs args)
{
RaiseNetworkEvent(new MsgSandboxGiveAccess());
}
private void OnGiveAghostButtonClicked(BaseButton.ButtonEventArgs args)
{
RaiseNetworkEvent(new MsgSandboxGiveAghost());
}
private void OnSuicideButtonClicked(BaseButton.ButtonEventArgs args)
{
RaiseNetworkEvent(new MsgSandboxSuicide());
}
// TODO: These should check for command perms + be reset if the round is over.
public void ToggleEntitySpawnWindow()
{
if (!CanSandbox())
return;
_userInterfaceManager.GetUIController<EntitySpawningUIController>().ToggleWindow();
}
public void ToggleTilesWindow()
{
if (!CanSandbox())
return;
_userInterfaceManager.GetUIController<TileSpawningUIController>().ToggleWindow();
}
public void ToggleDecalsWindow()
{
if (_decalSpawnWindow == null)
{
if (!CanSandbox()) return;
_decalSpawnWindow = new DecalPlacerWindow(PrototypeManager);
_decalSpawnWindow.OpenToLeft();
return;
}
if (_decalSpawnWindow.IsOpen)
{
_decalSpawnWindow.Close();
}
else
{
_decalSpawnWindow.Open();
}
}
// TODO: need to cleanup these
private void ToggleLight()
public void ToggleLight()
{
_consoleHost.ExecuteCommand("togglelight");
}
private void ToggleFov()
public void ToggleFov()
{
_consoleHost.ExecuteCommand("togglefov");
}
private void ToggleShadows()
public void ToggleShadows()
{
_consoleHost.ExecuteCommand("toggleshadows");
}
private void ToggleSubFloor()
public void ToggleSubFloor()
{
_consoleHost.ExecuteCommand("showsubfloor");
}
private void ShowMarkers()
public void ShowMarkers()
{
_consoleHost.ExecuteCommand("showmarkers");
}
private void ShowBb()
public void ShowBb()
{
_consoleHost.ExecuteCommand("physics shapes");
}
private void LinkMachines()
public void MachineLinking()
{
_consoleHost.ExecuteCommand("signallink");
}

View File

@@ -0,0 +1,84 @@
using Content.Client.Decals.UI;
using Content.Client.Gameplay;
using Content.Client.Sandbox;
using Content.Shared.Decals;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.Systems.DecalPlacer;
public sealed class DecalPlacerUIController : UIController, IOnStateExited<GameplayState>, IOnSystemChanged<SandboxSystem>
{
[Dependency] private readonly IPrototypeManager _prototypes = default!;
[UISystemDependency] private readonly SandboxSystem _sandbox = default!;
private DecalPlacerWindow? _window;
public void ToggleWindow()
{
EnsureWindow();
if (_window!.IsOpen)
{
_window.Close();
}
else if(_sandbox.SandboxAllowed)
{
_window.Open();
}
}
public void OnStateExited(GameplayState state)
{
if (_window == null)
return;
_window.Dispose();
_window = null;
}
public void OnSystemLoaded(SandboxSystem system)
{
_sandbox.SandboxDisabled += CloseWindow;
_prototypes.PrototypesReloaded += OnPrototypesReloaded;
}
public void OnSystemUnloaded(SandboxSystem system)
{
_sandbox.SandboxDisabled -= CloseWindow;
_prototypes.PrototypesReloaded -= OnPrototypesReloaded;
}
private void OnPrototypesReloaded(PrototypesReloadedEventArgs obj)
{
ReloadPrototypes();
}
private void ReloadPrototypes()
{
if (_window == null || _window.Disposed)
return;
var prototypes = _prototypes.EnumeratePrototypes<DecalPrototype>();
_window.Populate(prototypes);
}
private void EnsureWindow()
{
if (_window is { Disposed: false })
return;
_window = UIManager.CreateWindow<DecalPlacerWindow>();
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterLeft);
ReloadPrototypes();
}
private void CloseWindow()
{
if (_window == null || _window.Disposed)
return;
_window.Close();
}
}

View File

@@ -0,0 +1,42 @@
using Content.Client.Changelog;
using JetBrains.Annotations;
using Robust.Client.State;
using Robust.Client.UserInterface.Controllers;
namespace Content.Client.UserInterface.Systems.EscapeMenu;
[UsedImplicitly]
public sealed class ChangelogUIController : UIController
{
private ChangelogWindow _changeLogWindow = default!;
public void OpenWindow()
{
EnsureWindow();
_changeLogWindow.OpenCentered();
_changeLogWindow.MoveToFront();
}
private void EnsureWindow()
{
if (_changeLogWindow is { Disposed: false })
return;
_changeLogWindow = UIManager.CreateWindow<ChangelogWindow>();
}
public void ToggleWindow()
{
EnsureWindow();
if (_changeLogWindow.IsOpen)
{
_changeLogWindow.Close();
}
else
{
OpenWindow();
}
}
}

View File

@@ -0,0 +1,114 @@
using Content.Client.Gameplay;
using Content.Client.HUD;
using Content.Client.Info;
using Content.Client.Links;
using Content.Client.UserInterface.Controls;
using JetBrains.Annotations;
using Robust.Client.Console;
using Robust.Client.Input;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Shared.Input;
using Robust.Shared.Input.Binding;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
namespace Content.Client.UserInterface.Systems.EscapeMenu;
[UsedImplicitly]
public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
{
[Dependency] private readonly IClientConsoleHost _console = default!;
[Dependency] private readonly IUriOpener _uri = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
private Options.UI.EscapeMenu? _escapeWindow;
public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_escapeWindow == null);
_gameHud.EscapeButtonToggled += GameHudOnEscapeButtonToggled;
_escapeWindow = UIManager.CreateWindow<Options.UI.EscapeMenu>();
_escapeWindow.OnClose += () => { _gameHud.EscapeButtonDown = false; };
_escapeWindow.OnOpen += () => { _gameHud.EscapeButtonDown = true; };
_escapeWindow.ChangelogButton.OnPressed += _ =>
{
CloseEscapeWindow();
UIManager.GetUIController<ChangelogUIController>().ToggleWindow();
};
_escapeWindow.RulesButton.OnPressed += _ =>
{
CloseEscapeWindow();
new RulesAndInfoWindow().Open();
};
_escapeWindow.DisconnectButton.OnPressed += _ =>
{
CloseEscapeWindow();
_console.ExecuteCommand("disconnect");
};
_escapeWindow.OptionsButton.OnPressed += _ =>
{
CloseEscapeWindow();
UIManager.GetUIController<OptionsUIController>().OpenWindow();
};
_escapeWindow.QuitButton.OnPressed += _ =>
{
CloseEscapeWindow();
_console.ExecuteCommand("quit");
};
_escapeWindow.WikiButton.OnPressed += _ =>
{
_uri.OpenUri(UILinks.Wiki);
};
CommandBinds.Builder
.Bind(EngineKeyFunctions.EscapeMenu,
InputCmdHandler.FromDelegate(_ => ToggleWindow()))
.Register<EscapeUIController>();
}
private void GameHudOnEscapeButtonToggled(bool obj)
{
ToggleWindow();
}
public void OnStateExited(GameplayState state)
{
if (_escapeWindow != null)
{
_escapeWindow.Dispose();
_escapeWindow = null;
}
_gameHud.EscapeButtonToggled -= GameHudOnEscapeButtonToggled;
_gameHud.EscapeButtonDown = false;
CommandBinds.Unregister<EscapeUIController>();
}
private void CloseEscapeWindow()
{
_escapeWindow?.Close();
}
private void ToggleWindow()
{
if (_escapeWindow == null)
return;
if (_escapeWindow.IsOpen)
{
CloseEscapeWindow();
}
else
{
_escapeWindow.OpenCentered();
}
}
}

View File

@@ -0,0 +1,42 @@
using Content.Client.Options.UI;
using JetBrains.Annotations;
using Robust.Client.State;
using Robust.Client.UserInterface.Controllers;
namespace Content.Client.UserInterface.Systems.EscapeMenu;
[UsedImplicitly]
public sealed class OptionsUIController : UIController
{
private OptionsMenu _optionsWindow = default!;
private void EnsureWindow()
{
if (_optionsWindow is { Disposed: false })
return;
_optionsWindow = UIManager.CreateWindow<OptionsMenu>();
}
public void OpenWindow()
{
EnsureWindow();
_optionsWindow.OpenCentered();
_optionsWindow.MoveToFront();
}
public void ToggleWindow()
{
EnsureWindow();
if (_optionsWindow.IsOpen)
{
_optionsWindow.Close();
}
else
{
OpenWindow();
}
}
}

View File

@@ -0,0 +1,149 @@
using Content.Client.Gameplay;
using Content.Client.HUD;
using Content.Client.Markers;
using Content.Client.Sandbox;
using Content.Client.SubFloor;
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.UserInterface;
using Robust.Client.UserInterface.Controllers;
using Robust.Client.UserInterface.Controllers.Implementations;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Input.Binding;
using Robust.Shared.Map;
using Robust.Shared.Players;
using Robust.Shared.Utility;
namespace Content.Client.UserInterface.Systems.Sandbox;
// TODO hud refactor should part of this be in engine?
[UsedImplicitly]
public sealed class SandboxUIController : UIController, IOnStateChanged<GameplayState>, IOnSystemChanged<SandboxSystem>
{
[Dependency] private readonly IEyeManager _eye = default!;
[Dependency] private readonly IInputManager _input = default!;
[Dependency] private readonly ILightManager _light = default!;
[Dependency] private readonly IGameHud _gameHud = default!;
[UISystemDependency] private readonly DebugPhysicsSystem _debugPhysics = default!;
[UISystemDependency] private readonly MarkerSystem _marker = default!;
[UISystemDependency] private readonly SandboxSystem _sandbox = default!;
[UISystemDependency] private readonly SubFloorHideSystem _subfloorHide = default!;
private SandboxWindow? _window;
// TODO hud refactor cache
private EntitySpawningUIController EntitySpawningController => UIManager.GetUIController<EntitySpawningUIController>();
private TileSpawningUIController TileSpawningController => UIManager.GetUIController<TileSpawningUIController>();
private DecalPlacerUIController DecalPlacerController => UIManager.GetUIController<DecalPlacerUIController>();
public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_window == null);
EnsureWindow();
_gameHud.SandboxButtonToggled += GameHudOnSandboxButtonToggled;
_input.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
InputCmdHandler.FromDelegate(_ => EntitySpawningController.ToggleWindow()));
_input.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
InputCmdHandler.FromDelegate(_ => ToggleWindow()));
_input.SetInputCommand(ContentKeyFunctions.OpenTileSpawnWindow,
InputCmdHandler.FromDelegate(_ => TileSpawningController.ToggleWindow()));
_input.SetInputCommand(ContentKeyFunctions.OpenDecalSpawnWindow,
InputCmdHandler.FromDelegate(_ => DecalPlacerController.ToggleWindow()));
CommandBinds.Builder
.Bind(ContentKeyFunctions.EditorCopyObject, new PointerInputCmdHandler(Copy))
.Register<SandboxSystem>();
}
private void EnsureWindow()
{
if(_window is { Disposed: false })
return;
_window = UIManager.CreateWindow<SandboxWindow>();
_window.OnClose += () => { _gameHud.SandboxButtonDown = false; };
_window.OnOpen += () => { _gameHud.SandboxButtonDown = true; };
_window.ToggleLightButton.Pressed = !_light.Enabled;
_window.ToggleFovButton.Pressed = !_eye.CurrentEye.DrawFov;
_window.ToggleShadowsButton.Pressed = !_light.DrawShadows;
_window.ToggleSubfloorButton.Pressed = _subfloorHide.ShowAll;
_window.ShowMarkersButton.Pressed = _marker.MarkersVisible;
_window.ShowBbButton.Pressed = (_debugPhysics.Flags & PhysicsDebugFlags.Shapes) != 0x0;
_window.RespawnButton.OnPressed += _ => _sandbox.Respawn();
_window.SpawnTilesButton.OnPressed += _ => TileSpawningController.ToggleWindow();
_window.SpawnEntitiesButton.OnPressed += _ => EntitySpawningController.ToggleWindow();
_window.SpawnDecalsButton.OnPressed += _ => DecalPlacerController.ToggleWindow();
_window.GiveFullAccessButton.OnPressed += _ => _sandbox.GiveAdminAccess();
_window.GiveAghostButton.OnPressed += _ => _sandbox.GiveAGhost();
_window.ToggleLightButton.OnToggled += _ => _sandbox.ToggleLight();
_window.ToggleFovButton.OnToggled += _ => _sandbox.ToggleFov();
_window.ToggleShadowsButton.OnToggled += _ => _sandbox.ToggleShadows();
_window.SuicideButton.OnPressed += _ => _sandbox.Suicide();
_window.ToggleSubfloorButton.OnPressed += _ => _sandbox.ToggleSubFloor();
_window.ShowMarkersButton.OnPressed += _ => _sandbox.ShowMarkers();
_window.ShowBbButton.OnPressed += _ => _sandbox.ShowBb();
_window.MachineLinkingButton.OnPressed += _ => _sandbox.MachineLinking();
}
private void GameHudOnSandboxButtonToggled(bool pressed)
{
ToggleWindow();
}
public void OnStateExited(GameplayState state)
{
if (_window != null)
{
_window.Dispose();
_window = null;
}
_gameHud.SandboxButtonToggled -= GameHudOnSandboxButtonToggled;
_gameHud.SandboxButtonDown = false;
CommandBinds.Unregister<SandboxSystem>();
}
public void OnSystemLoaded(SandboxSystem system)
{
system.SandboxDisabled += CloseAll;
}
public void OnSystemUnloaded(SandboxSystem system)
{
system.SandboxDisabled -= CloseAll;
}
private void CloseAll()
{
_window?.Close();
EntitySpawningController.CloseWindow();
TileSpawningController.CloseWindow();
}
private bool Copy(ICommonSession? session, EntityCoordinates coords, EntityUid uid)
{
return _sandbox.Copy(session, coords, uid);
}
private void ToggleWindow()
{
if (_window == null)
return;
if (_sandbox.SandboxAllowed && _window.IsOpen != true)
{
_window.OpenCentered();
}
else
{
_window.Close();
}
}
}

View File

@@ -0,0 +1,22 @@
<windows:SandboxWindow
xmlns="https://spacestation14.io"
xmlns:windows="clr-namespace:Content.Client.UserInterface.Systems.Sandbox.Windows"
Title="{Loc sandbox-window-title}"
Resizable="False">
<BoxContainer Orientation="Vertical" SeparationOverride="4">
<Button Name="RespawnButton" Access="Public" Text="{Loc sandbox-window-respawn-button}"/>
<Button Name="SpawnEntitiesButton" Access="Public" Text="{Loc sandbox-window-spawn-entities-button}"/>
<Button Name="SpawnTilesButton" Access="Public" Text="{Loc sandbox-window-spawn-tiles-button}"/>
<Button Name="SpawnDecalsButton" Access="Public" Text="{Loc sandbox-window-spawn-decals-button}"/>
<Button Name="GiveFullAccessButton" Access="Public" Text="{Loc sandbox-window-grant-full-access-button}"/>
<Button Name="GiveAghostButton" Access="Public" Text="{Loc sandbox-window-ghost-button}"/>
<Button Name="ToggleLightButton" Access="Public" Text="{Loc sandbox-window-toggle-lights-button}" ToggleMode="True"/>
<Button Name="ToggleFovButton" Access="Public" Text="{Loc sandbox-window-toggle-fov-button}" ToggleMode="True"/>
<Button Name="ToggleShadowsButton" Access="Public" Text="{Loc sandbox-window-toggle-shadows-button}" ToggleMode="True"/>
<Button Name="ToggleSubfloorButton" Access="Public" Text="{Loc sandbox-window-toggle-subfloor-button}" ToggleMode="True"/>
<Button Name="SuicideButton" Access="Public" Text="{Loc sandbox-window-toggle-suicide-button}" ToggleMode="True"/>
<Button Name="ShowMarkersButton" Access="Public" Text="{Loc sandbox-window-show-spawns-button}" ToggleMode="True"/>
<Button Name="ShowBbButton" Access="Public" Text="{Loc sandbox-window-show-bb-button}" ToggleMode="True"/>
<Button Name="MachineLinkingButton" Access="Public" Text="{Loc sandbox-window-link-machines-button}" ToggleMode="True"/>
</BoxContainer>
</windows:SandboxWindow>

View File

@@ -0,0 +1,14 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.UserInterface.Systems.Sandbox.Windows;
[GenerateTypedNameReferences]
public sealed partial class SandboxWindow : DefaultWindow
{
public SandboxWindow()
{
RobustXamlLoader.Load(this);
}
}