diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs
index 2060c1e4e9..8e756d59ad 100644
--- a/Content.Client/Chat/ChatBox.cs
+++ b/Content.Client/Chat/ChatBox.cs
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Content.Shared.Chat;
-using Robust.Client.Console;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Input;
using Robust.Client.UserInterface;
diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj
index 68385e7420..71024b6d7d 100644
--- a/Content.Client/Content.Client.csproj
+++ b/Content.Client/Content.Client.csproj
@@ -9,7 +9,7 @@
Properties
Content.Client
Content.Client
- v4.7.1
+ v4.7.2
512
..\RobustToolbox\bin\Client\Resources\Assemblies\
7.2
@@ -75,6 +75,7 @@
+
@@ -120,10 +121,12 @@
+
+
diff --git a/Content.Client/EntryPoint.cs b/Content.Client/EntryPoint.cs
index 2ac904e533..aeae753655 100644
--- a/Content.Client/EntryPoint.cs
+++ b/Content.Client/EntryPoint.cs
@@ -12,14 +12,12 @@ using Content.Client.Interfaces;
using Content.Client.Interfaces.GameObjects;
using Content.Client.Interfaces.Parallax;
using Content.Client.Parallax;
-using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.Interfaces;
using Robust.Client;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.Input;
using Robust.Client.Player;
-using Robust.Client.Utility;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -31,14 +29,14 @@ using Content.Client.GameObjects.Components.Mobs;
using Content.Client.GameObjects.Components.Research;
using Content.Client.GameObjects.Components.Sound;
using Content.Client.Interfaces.Chat;
-using Content.Client.Research;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Research;
+using Robust.Client.Interfaces.State;
using Robust.Client.Interfaces.UserInterface;
-using Robust.Shared.Log;
+using Robust.Client.State.States;
namespace Content.Client
{
@@ -46,6 +44,7 @@ namespace Content.Client
{
#pragma warning disable 649
[Dependency] private readonly IPlayerManager _playerManager;
+ [Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner;
#pragma warning restore 649
public override void Init()
@@ -139,6 +138,7 @@ namespace Content.Client
IoCManager.Register();
IoCManager.Register();
IoCManager.Register();
+ IoCManager.Register();
IoCManager.BuildGraph();
IoCManager.Resolve().LoadParallax();
@@ -146,11 +146,13 @@ namespace Content.Client
var stylesheet = new NanoStyle();
+ IoCManager.Resolve().Stylesheet = stylesheet.Stylesheet;
IoCManager.Resolve().Stylesheet = stylesheet.Stylesheet;
IoCManager.InjectDependencies(this);
- }
+ _escapeMenuOwner.Initialize();
+ }
///
/// Subscribe events to the player manager after the player manager is set up
///
diff --git a/Content.Client/EscapeMenuOwner.cs b/Content.Client/EscapeMenuOwner.cs
new file mode 100644
index 0000000000..667026cd53
--- /dev/null
+++ b/Content.Client/EscapeMenuOwner.cs
@@ -0,0 +1,88 @@
+using Content.Client.UserInterface;
+using Robust.Client.Console;
+using Robust.Client.Interfaces.Graphics;
+using Robust.Client.Interfaces.Input;
+using Robust.Client.Interfaces.Placement;
+using Robust.Client.Interfaces.ResourceManagement;
+using Robust.Client.Interfaces.State;
+using Robust.Client.State.States;
+using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Input;
+using Robust.Shared.Interfaces.Configuration;
+using Robust.Shared.Interfaces.Map;
+using Robust.Shared.IoC;
+using Robust.Shared.Prototypes;
+
+namespace Content.Client
+{
+ internal sealed class EscapeMenuOwner : IEscapeMenuOwner
+ {
+#pragma warning disable 649
+ [Dependency] private readonly IStateManager _stateManager;
+ [Dependency] private readonly IDisplayManager _displayManager;
+ [Dependency] private readonly IClientConsole _clientConsole;
+ [Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
+ [Dependency] private readonly IPlacementManager _placementManager;
+ [Dependency] private readonly IPrototypeManager _prototypeManager;
+ [Dependency] private readonly IResourceCache _resourceCache;
+ [Dependency] private readonly IConfigurationManager _configurationManager;
+ [Dependency] private readonly IInputManager _inputManager;
+#pragma warning restore 649
+
+ private EscapeMenu _escapeMenu;
+
+ public void Initialize()
+ {
+ _stateManager.OnStateChanged += StateManagerOnOnStateChanged;
+ }
+
+ private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
+ {
+ if (obj.NewState is GameScreen)
+ {
+ // Switched TO GameScreen.
+ _escapeMenu = new EscapeMenu(_displayManager, _clientConsole, _tileDefinitionManager, _placementManager,
+ _prototypeManager, _resourceCache, _configurationManager)
+ {
+ Visible = false
+ };
+
+ _escapeMenu.AddToScreen();
+
+ var escapeMenuCommand = InputCmdHandler.FromDelegate(session =>
+ {
+ if (_escapeMenu.Visible)
+ {
+ if (_escapeMenu.IsAtFront())
+ {
+ _escapeMenu.Visible = false;
+ }
+ else
+ {
+ _escapeMenu.MoveToFront();
+ }
+ }
+ else
+ {
+ _escapeMenu.OpenCentered();
+ }
+ });
+
+ _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
+ }
+ else if (obj.OldState is GameScreen)
+ {
+ // Switched FROM GameScreen.
+ _escapeMenu.Dispose();
+ _escapeMenu = null;
+
+ _inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
+ }
+ }
+ }
+
+ public interface IEscapeMenuOwner
+ {
+ void Initialize();
+ }
+}
diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs
index c0fa89cbd0..e92e565fcc 100644
--- a/Content.Client/GameTicking/ClientGameTicker.cs
+++ b/Content.Client/GameTicking/ClientGameTicker.cs
@@ -1,4 +1,5 @@
using System;
+using System.Linq;
using Content.Client.Chat;
using Content.Client.Interfaces;
using Content.Client.Interfaces.Chat;
@@ -9,10 +10,14 @@ using Robust.Client;
using Robust.Client.Console;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Input;
+using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
+using Robust.Client.Player;
+using Robust.Client.UserInterface;
using Robust.Shared.Input;
using Robust.Shared.Interfaces.Network;
using Robust.Shared.IoC;
+using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
@@ -27,6 +32,9 @@ namespace Content.Client.GameTicking
[Dependency] private IBaseClient _baseClient;
[Dependency] private IChatManager _chatManager;
[Dependency] private IClientConsole _console;
+ [Dependency] private ILocalizationManager _localization;
+ [Dependency] private IResourceCache _resourceCache;
+ [Dependency] private IPlayerManager _playerManager;
#pragma warning restore 649
[ViewVariables] private bool _areWeReady;
@@ -46,10 +54,25 @@ namespace Content.Client.GameTicking
_netManager.RegisterNetMessage(nameof(MsgTickerLobbyStatus), _lobbyStatus);
_baseClient.RunLevelChanged += BaseClientOnRunLevelChanged;
+ _playerManager.PlayerListUpdated += PlayerManagerOnPlayerListUpdated;
_initialized = true;
}
+ private void PlayerManagerOnPlayerListUpdated(object sender, EventArgs e)
+ {
+ if (_lobby == null)
+ {
+ return;
+ }
+
+ _lobby.OnlinePlayerItemList.Clear();
+ foreach (var session in _playerManager.Sessions.OrderBy(s => s.Name))
+ {
+ _lobby.OnlinePlayerItemList.AddItem(session.Name);
+ }
+ }
+
private void BaseClientOnRunLevelChanged(object sender, RunLevelChangedEventArgs e)
{
if (e.NewLevel != ClientRunLevel.Initialize)
@@ -83,11 +106,11 @@ namespace Content.Client.GameTicking
{
if (difference.TotalSeconds < -5)
{
- text = "Right Now?";
+ text = _localization.GetString("Right Now?");
}
else
{
- text = "Right Now";
+ text = _localization.GetString("Right Now");
}
}
else
@@ -95,7 +118,7 @@ namespace Content.Client.GameTicking
text = $"{(int) Math.Floor(difference.TotalMinutes)}:{difference.Seconds:D2}";
}
- _lobby.StartTime.Text = "Round Starts In: " + text;
+ _lobby.StartTime.Text = _localization.GetString("Round Starts In: {0}", text);
}
private void _lobbyStatus(MsgTickerLobbyStatus message)
@@ -116,14 +139,14 @@ namespace Content.Client.GameTicking
if (_gameStarted)
{
- _lobby.ReadyButton.Text = "Join";
+ _lobby.ReadyButton.Text = _localization.GetString("Join");
_lobby.ReadyButton.ToggleMode = false;
_lobby.ReadyButton.Pressed = false;
}
else
{
_lobby.StartTime.Text = "";
- _lobby.ReadyButton.Text = "Ready Up";
+ _lobby.ReadyButton.Text = _localization.GetString("Ready Up");
_lobby.ReadyButton.ToggleMode = true;
_lobby.ReadyButton.Pressed = _areWeReady;
}
@@ -144,9 +167,11 @@ namespace Content.Client.GameTicking
_tickerState = TickerState.InLobby;
- _lobby = new LobbyGui();
+ _lobby = new LobbyGui(_localization, _resourceCache);
_userInterfaceManager.StateRoot.AddChild(_lobby);
+ _lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20);
+
_chatManager.SetChatBox(_lobby.Chat);
_lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";
diff --git a/Content.Client/UserInterface/EscapeMenu.cs b/Content.Client/UserInterface/EscapeMenu.cs
new file mode 100644
index 0000000000..324d9590da
--- /dev/null
+++ b/Content.Client/UserInterface/EscapeMenu.cs
@@ -0,0 +1,121 @@
+using Robust.Client.Console;
+using Robust.Client.Interfaces.Graphics;
+using Robust.Client.Interfaces.Placement;
+using Robust.Client.Interfaces.ResourceManagement;
+using Robust.Client.UserInterface;
+using Robust.Client.UserInterface.Controls;
+using Robust.Client.UserInterface.CustomControls;
+using Robust.Shared.Interfaces.Configuration;
+using Robust.Shared.Interfaces.Map;
+using Robust.Shared.Prototypes;
+
+namespace Content.Client.UserInterface
+{
+ internal sealed class EscapeMenu : SS14Window
+ {
+ private readonly IClientConsole _console;
+ private readonly ITileDefinitionManager __tileDefinitionManager;
+ private readonly IPlacementManager _placementManager;
+ private readonly IPrototypeManager _prototypeManager;
+ private readonly IResourceCache _resourceCache;
+ private readonly IDisplayManager _displayManager;
+ private readonly IConfigurationManager _configSystem;
+
+ private BaseButton QuitButton;
+ private BaseButton OptionsButton;
+ private BaseButton SpawnEntitiesButton;
+ private BaseButton SpawnTilesButton;
+ private OptionsMenu optionsMenu;
+
+ public EscapeMenu(IDisplayManager displayManager,
+ IClientConsole console,
+ ITileDefinitionManager tileDefinitionManager,
+ IPlacementManager placementManager,
+ IPrototypeManager prototypeManager,
+ IResourceCache resourceCache,
+ IConfigurationManager configSystem) : base(displayManager)
+ {
+ _configSystem = configSystem;
+ _displayManager = displayManager;
+ _console = console;
+ __tileDefinitionManager = tileDefinitionManager;
+ _placementManager = placementManager;
+ _prototypeManager = prototypeManager;
+ _resourceCache = resourceCache;
+
+ PerformLayout();
+ }
+
+ private void PerformLayout()
+ {
+ optionsMenu = new OptionsMenu(_displayManager, _configSystem)
+ {
+ Visible = false
+ };
+ optionsMenu.AddToScreen();
+
+ Resizable = false;
+ HideOnClose = true;
+
+ Title = "Menu";
+
+ var vBox = new VBoxContainer {SeparationOverride = 2};
+ Contents.AddChild(vBox);
+
+ SpawnEntitiesButton = new Button {Text = "Spawn Entities"};
+ SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
+ vBox.AddChild(SpawnEntitiesButton);
+
+ SpawnTilesButton = new Button {Text = "Spawn Tiles"};
+ SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
+ vBox.AddChild(SpawnTilesButton);
+
+ // Add a spacer.
+ vBox.AddChild(new Control { CustomMinimumSize = (0, 5)});
+
+ OptionsButton = new Button {Text = "Options"};
+ OptionsButton.OnPressed += OnOptionsButtonClicked;
+ vBox.AddChild(OptionsButton);
+
+ QuitButton = new Button {Text = "Quit"};
+ QuitButton.OnPressed += OnQuitButtonClicked;
+ vBox.AddChild(QuitButton);
+
+ Size = CombinedMinimumSize;
+ }
+
+ private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
+ {
+ _console.ProcessCommand("disconnect");
+ Dispose();
+ }
+
+ private void OnOptionsButtonClicked(BaseButton.ButtonEventArgs args)
+ {
+ optionsMenu.OpenCentered();
+ }
+
+ private void OnSpawnEntitiesButtonClicked(BaseButton.ButtonEventArgs args)
+ {
+ var window = new EntitySpawnWindow(_displayManager, _placementManager, _prototypeManager, _resourceCache);
+ window.AddToScreen();
+ window.OpenToLeft();
+ }
+
+ private void OnSpawnTilesButtonClicked(BaseButton.ButtonEventArgs args)
+ {
+ var window = new TileSpawnWindow(__tileDefinitionManager, _placementManager, _displayManager, _resourceCache);
+ window.AddToScreen();
+ window.OpenToLeft();
+ }
+
+ protected override void Dispose(bool disposing)
+ {
+ base.Dispose(disposing);
+ if (disposing)
+ {
+ optionsMenu.Dispose();
+ }
+ }
+ }
+}
diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs
index fd0dc3371b..779e74c744 100644
--- a/Content.Client/UserInterface/HandsGui.cs
+++ b/Content.Client/UserInterface/HandsGui.cs
@@ -36,8 +36,8 @@ namespace Content.Client.UserInterface
private IEntity LeftHand;
private IEntity RightHand;
- private UIBox2i handL;
- private UIBox2i handR;
+ private UIBox2i _handL;
+ private UIBox2i _handR;
private SpriteView LeftSpriteView;
private SpriteView RightSpriteView;
@@ -60,24 +60,24 @@ namespace Content.Client.UserInterface
SetMarginsPreset(LayoutPreset.CenterBottom);
SetAnchorPreset(LayoutPreset.CenterBottom);
- handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE);
- handR = handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0));
+ _handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE);
+ _handR = _handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0));
MouseFilter = MouseFilterMode.Stop;
LeftSpriteView = new SpriteView {MouseFilter = MouseFilterMode.Ignore};
AddChild(LeftSpriteView);
- LeftSpriteView.Size = handL.Size;
- LeftSpriteView.Position = handL.TopLeft;
+ LeftSpriteView.Size = _handL.Size;
+ LeftSpriteView.Position = _handL.TopLeft;
RightSpriteView = new SpriteView {MouseFilter = MouseFilterMode.Ignore};
AddChild(RightSpriteView);
- RightSpriteView.Size = handR.Size;
- RightSpriteView.Position = handR.TopLeft;
+ RightSpriteView.Size = _handR.Size;
+ RightSpriteView.Position = _handR.TopLeft;
}
protected override Vector2 CalculateMinimumSize()
{
- return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE);
+ return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE) * UIScale;
}
protected override void Draw(DrawingHandleScreen handle)
@@ -87,6 +87,9 @@ namespace Content.Client.UserInterface
var leftActive = hands.ActiveIndex == "left";
+ var handL = new UIBox2(_handL.TopLeft * UIScale, _handL.BottomRight * UIScale);
+ var handR = new UIBox2(_handR.TopLeft * UIScale, _handR.BottomRight * UIScale);
+
handle.DrawStyleBox(handBox, leftActive ? handL : handR);
handle.DrawStyleBox(inactiveHandBox, leftActive ? handR : handL);
}
@@ -187,15 +190,15 @@ namespace Content.Client.UserInterface
protected override bool HasPoint(Vector2 point)
{
- return handL.Contains((Vector2i) point) || handR.Contains((Vector2i) point);
+ return _handL.Contains((Vector2i) point) || _handR.Contains((Vector2i) point);
}
protected override void MouseDown(GUIMouseButtonEventArgs args)
{
base.MouseDown(args);
- var leftHandContains = handL.Contains((Vector2i) args.RelativePosition);
- var rightHandContains = handR.Contains((Vector2i) args.RelativePosition);
+ var leftHandContains = _handL.Contains((Vector2i) args.RelativePosition);
+ var rightHandContains = _handR.Contains((Vector2i) args.RelativePosition);
string handIndex;
if (leftHandContains)
diff --git a/Content.Client/UserInterface/LobbyGui.cs b/Content.Client/UserInterface/LobbyGui.cs
index 64f6e65402..1e0890398b 100644
--- a/Content.Client/UserInterface/LobbyGui.cs
+++ b/Content.Client/UserInterface/LobbyGui.cs
@@ -1,36 +1,114 @@
using Content.Client.Chat;
-using Robust.Client.UserInterface;
+using Robust.Client.Graphics.Drawing;
+using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface.Controls;
-using Robust.Client.UserInterface.CustomControls;
-using Robust.Shared.Utility;
+using Robust.Shared.Localization;
+using Robust.Shared.Maths;
namespace Content.Client.UserInterface
{
- public class LobbyGui : Control
+ internal sealed class LobbyGui : PanelContainer
{
- protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Lobby/Lobby.tscn");
+ public Label ServerName { get; }
+ public Label StartTime { get; }
+ public Button ReadyButton { get; }
+ public Button ObserveButton { get; }
+ public Button LeaveButton { get; }
+ public ChatBox Chat { get; }
+ public ItemList OnlinePlayerItemList { get; }
- public Label ServerName => GetChild