Start working on those top left buttons in the UI draft.
This commit is contained in:
@@ -133,6 +133,7 @@ namespace Content.Client
|
|||||||
factory.RegisterIgnore("AiController");
|
factory.RegisterIgnore("AiController");
|
||||||
factory.RegisterIgnore("PlayerInputMover");
|
factory.RegisterIgnore("PlayerInputMover");
|
||||||
|
|
||||||
|
IoCManager.Register<IGameHud, GameHud>();
|
||||||
IoCManager.Register<IClientNotifyManager, ClientNotifyManager>();
|
IoCManager.Register<IClientNotifyManager, ClientNotifyManager>();
|
||||||
IoCManager.Register<ISharedNotifyManager, ClientNotifyManager>();
|
IoCManager.Register<ISharedNotifyManager, ClientNotifyManager>();
|
||||||
IoCManager.Register<IClientGameTicker, ClientGameTicker>();
|
IoCManager.Register<IClientGameTicker, ClientGameTicker>();
|
||||||
@@ -198,6 +199,7 @@ namespace Content.Client
|
|||||||
IoCManager.Resolve<IClientGameTicker>().Initialize();
|
IoCManager.Resolve<IClientGameTicker>().Initialize();
|
||||||
IoCManager.Resolve<IOverlayManager>().AddOverlay(new ParallaxOverlay());
|
IoCManager.Resolve<IOverlayManager>().AddOverlay(new ParallaxOverlay());
|
||||||
IoCManager.Resolve<IChatManager>().Initialize();
|
IoCManager.Resolve<IChatManager>().Initialize();
|
||||||
|
IoCManager.Resolve<IGameHud>().Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(ModUpdateLevel level, float frameTime)
|
public override void Update(ModUpdateLevel level, float frameTime)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Robust.Shared.Input;
|
|||||||
using Robust.Shared.Interfaces.Configuration;
|
using Robust.Shared.Interfaces.Configuration;
|
||||||
using Robust.Shared.Interfaces.Map;
|
using Robust.Shared.Interfaces.Map;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client
|
namespace Content.Client
|
||||||
@@ -16,14 +17,15 @@ namespace Content.Client
|
|||||||
internal sealed class EscapeMenuOwner : IEscapeMenuOwner
|
internal sealed class EscapeMenuOwner : IEscapeMenuOwner
|
||||||
{
|
{
|
||||||
#pragma warning disable 649
|
#pragma warning disable 649
|
||||||
[Dependency] private readonly IStateManager _stateManager;
|
|
||||||
[Dependency] private readonly IClientConsole _clientConsole;
|
[Dependency] private readonly IClientConsole _clientConsole;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
[Dependency] private readonly IConfigurationManager _configurationManager;
|
||||||
|
[Dependency] private readonly IInputManager _inputManager;
|
||||||
[Dependency] private readonly IPlacementManager _placementManager;
|
[Dependency] private readonly IPlacementManager _placementManager;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||||
[Dependency] private readonly IResourceCache _resourceCache;
|
[Dependency] private readonly IResourceCache _resourceCache;
|
||||||
[Dependency] private readonly IConfigurationManager _configurationManager;
|
[Dependency] private readonly IStateManager _stateManager;
|
||||||
[Dependency] private readonly IInputManager _inputManager;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||||
|
[Dependency] private readonly IGameHud _gameHud;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
private EscapeMenu _escapeMenu;
|
private EscapeMenu _escapeMenu;
|
||||||
@@ -31,6 +33,8 @@ namespace Content.Client
|
|||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
_stateManager.OnStateChanged += StateManagerOnOnStateChanged;
|
_stateManager.OnStateChanged += StateManagerOnOnStateChanged;
|
||||||
|
|
||||||
|
_gameHud.EscapeButtonToggled += _setOpenValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
|
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
|
||||||
@@ -44,26 +48,11 @@ namespace Content.Client
|
|||||||
Visible = false
|
Visible = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_escapeMenu.OnClose += () => _gameHud.EscapeButtonDown = false;
|
||||||
|
|
||||||
_escapeMenu.AddToScreen();
|
_escapeMenu.AddToScreen();
|
||||||
|
|
||||||
var escapeMenuCommand = InputCmdHandler.FromDelegate(session =>
|
var escapeMenuCommand = InputCmdHandler.FromDelegate(Enabled);
|
||||||
{
|
|
||||||
if (_escapeMenu.Visible)
|
|
||||||
{
|
|
||||||
if (_escapeMenu.IsAtFront())
|
|
||||||
{
|
|
||||||
_escapeMenu.Visible = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_escapeMenu.MoveToFront();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_escapeMenu.OpenCentered();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
|
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
|
||||||
}
|
}
|
||||||
@@ -76,6 +65,39 @@ namespace Content.Client
|
|||||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
|
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Enabled(ICommonSession session)
|
||||||
|
{
|
||||||
|
if (_escapeMenu.Visible)
|
||||||
|
{
|
||||||
|
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.Visible = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IEscapeMenuOwner
|
public interface IEscapeMenuOwner
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ namespace Content.Client.GameTicking
|
|||||||
[Dependency] private ILocalizationManager _localization;
|
[Dependency] private ILocalizationManager _localization;
|
||||||
[Dependency] private IResourceCache _resourceCache;
|
[Dependency] private IResourceCache _resourceCache;
|
||||||
[Dependency] private IPlayerManager _playerManager;
|
[Dependency] private IPlayerManager _playerManager;
|
||||||
|
[Dependency] private IGameHud _gameHud;
|
||||||
#pragma warning restore 649
|
#pragma warning restore 649
|
||||||
|
|
||||||
[ViewVariables] private bool _areWeReady;
|
[ViewVariables] private bool _areWeReady;
|
||||||
@@ -177,6 +178,8 @@ namespace Content.Client.GameTicking
|
|||||||
_tutorialButton = null;
|
_tutorialButton = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_gameHud.RootControl?.Parent.RemoveChild(_gameHud.RootControl);
|
||||||
|
|
||||||
_tickerState = TickerState.InLobby;
|
_tickerState = TickerState.InLobby;
|
||||||
|
|
||||||
_lobby = new LobbyGui(_localization, _resourceCache);
|
_lobby = new LobbyGui(_localization, _resourceCache);
|
||||||
@@ -248,6 +251,7 @@ namespace Content.Client.GameTicking
|
|||||||
|
|
||||||
_gameChat = new ChatBox();
|
_gameChat = new ChatBox();
|
||||||
_userInterfaceManager.StateRoot.AddChild(_gameChat);
|
_userInterfaceManager.StateRoot.AddChild(_gameChat);
|
||||||
|
_userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
|
||||||
_chatManager.SetChatBox(_gameChat);
|
_chatManager.SetChatBox(_gameChat);
|
||||||
_tutorialButton = new TutorialButton();
|
_tutorialButton = new TutorialButton();
|
||||||
_userInterfaceManager.StateRoot.AddChild(_tutorialButton);
|
_userInterfaceManager.StateRoot.AddChild(_tutorialButton);
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Client.UserInterface;
|
||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
|
|
||||||
namespace Content.Client.Interfaces
|
namespace Content.Client.Interfaces
|
||||||
|
|||||||
65
Content.Client/UserInterface/GameHud.cs
Normal file
65
Content.Client/UserInterface/GameHud.cs
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
using System;
|
||||||
|
using Content.Client.Utility;
|
||||||
|
using Robust.Client.Interfaces.ResourceManagement;
|
||||||
|
using Robust.Client.UserInterface;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Shared.IoC;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
|
||||||
|
namespace Content.Client.UserInterface
|
||||||
|
{
|
||||||
|
public interface IGameHud
|
||||||
|
{
|
||||||
|
Control RootControl { get; }
|
||||||
|
|
||||||
|
bool EscapeButtonDown { get; set; }
|
||||||
|
Action<bool> EscapeButtonToggled { get; set; }
|
||||||
|
void Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Responsible for laying out the default game HUD.
|
||||||
|
/// </summary>
|
||||||
|
internal sealed class GameHud : IGameHud
|
||||||
|
{
|
||||||
|
public const string StyleClassTopMenuButton = "topMenuButton";
|
||||||
|
|
||||||
|
private TextureButton _buttonEscapeMenu;
|
||||||
|
|
||||||
|
#pragma warning disable 649
|
||||||
|
[Dependency] private readonly IResourceCache _resourceCache;
|
||||||
|
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||||
|
#pragma warning restore 649
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
RootControl = new Control();
|
||||||
|
|
||||||
|
RootControl.SetAnchorPreset(Control.LayoutPreset.Wide);
|
||||||
|
|
||||||
|
_buttonEscapeMenu = new TextureButton
|
||||||
|
{
|
||||||
|
TextureNormal = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png"),
|
||||||
|
ToggleMode = true,
|
||||||
|
ToolTip = _localizationManager.GetString("Open escape menu.")
|
||||||
|
};
|
||||||
|
|
||||||
|
_buttonEscapeMenu.OnToggled += args => { EscapeButtonToggled?.Invoke(args.Pressed); };
|
||||||
|
|
||||||
|
_buttonEscapeMenu.AddStyleClass(StyleClassTopMenuButton);
|
||||||
|
|
||||||
|
RootControl.AddChild(_buttonEscapeMenu);
|
||||||
|
_buttonEscapeMenu.SetAnchorAndMarginPreset(Control.LayoutPreset.TopLeft, margin: 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Control RootControl { get; private set; }
|
||||||
|
|
||||||
|
public bool EscapeButtonDown
|
||||||
|
{
|
||||||
|
get => _buttonEscapeMenu.Pressed;
|
||||||
|
set => _buttonEscapeMenu.Pressed = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Action<bool> EscapeButtonToggled { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -441,6 +441,22 @@ namespace Content.Client.UserInterface
|
|||||||
{
|
{
|
||||||
new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f))
|
new StyleProperty(Label.StylePropertyFontColor, new Color(0.024f, 0.8f, 0.0f))
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
// Those buttons on the top left.
|
||||||
|
new StyleRule(new SelectorElement(typeof(TextureButton), new []{GameHud.StyleClassTopMenuButton}, null, TextureButton.StylePseudoClassNormal), new []
|
||||||
|
{
|
||||||
|
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#7b7e9e"))
|
||||||
|
}),
|
||||||
|
|
||||||
|
new StyleRule(new SelectorElement(typeof(TextureButton), new []{GameHud.StyleClassTopMenuButton}, null, TextureButton.StylePseudoClassHover), new []
|
||||||
|
{
|
||||||
|
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#8285a3"))
|
||||||
|
}),
|
||||||
|
|
||||||
|
new StyleRule(new SelectorElement(typeof(TextureButton), new []{GameHud.StyleClassTopMenuButton}, null, TextureButton.StylePseudoClassPressed), new []
|
||||||
|
{
|
||||||
|
new StyleProperty(Control.StylePropertyModulateSelf, Color.FromHex("#00b061"))
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
85
Resources/Textures/UserInterface/hamburger.svg
Normal file
85
Resources/Textures/UserInterface/hamburger.svg
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="7.9563375mm"
|
||||||
|
height="7.1438789mm"
|
||||||
|
viewBox="0 0 7.9563375 7.1438789"
|
||||||
|
version="1.1"
|
||||||
|
id="svg4593"
|
||||||
|
sodipodi:docname="hamburger.svg"
|
||||||
|
inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Textures/UserInterface/hamburger.svg.96dpi.png"
|
||||||
|
inkscape:export-xdpi="95.998207"
|
||||||
|
inkscape:export-ydpi="95.998207"
|
||||||
|
inkscape:version="0.92.4 5da689c313, 2019-01-14">
|
||||||
|
<defs
|
||||||
|
id="defs4587" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="5.6"
|
||||||
|
inkscape:cx="35.456574"
|
||||||
|
inkscape:cy="-4.4711292"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1043"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="0"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
units="px" />
|
||||||
|
<metadata
|
||||||
|
id="metadata4590">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-97.319452,-120.31497)">
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="stroke:#ffffff;stroke-width:1.32291663;stroke-linecap:round;stroke-opacity:1"
|
||||||
|
d="m 97.990331,120.97649 h 6.614579"
|
||||||
|
id="path4"
|
||||||
|
inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Textures/UserInterface/hamburger.png"
|
||||||
|
inkscape:export-xdpi="95.998207"
|
||||||
|
inkscape:export-ydpi="95.998207" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="stroke:#ffffff;stroke-width:1.32291663;stroke-linecap:round;stroke-opacity:1"
|
||||||
|
d="m 97.990331,123.8869 h 6.614579"
|
||||||
|
id="path6"
|
||||||
|
inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Textures/UserInterface/hamburger.png"
|
||||||
|
inkscape:export-xdpi="95.998207"
|
||||||
|
inkscape:export-ydpi="95.998207" />
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="stroke:#ffffff;stroke-width:1.32291663;stroke-linecap:round;stroke-opacity:1"
|
||||||
|
d="m 97.990331,126.79732 h 6.614579"
|
||||||
|
id="path8"
|
||||||
|
inkscape:export-filename="/home/pj/Projects/space-station-14-content/Resources/Textures/UserInterface/hamburger.png"
|
||||||
|
inkscape:export-xdpi="95.998207"
|
||||||
|
inkscape:export-ydpi="95.998207" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 3.1 KiB |
BIN
Resources/Textures/UserInterface/hamburger.svg.96dpi.png
Normal file
BIN
Resources/Textures/UserInterface/hamburger.svg.96dpi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 224 B |
Reference in New Issue
Block a user