Game HUD improvements:
Added sandbox button, needs implementation. Tutorial bound to F1. Improved color of buttons.
This commit is contained in:
@@ -14,6 +14,7 @@ namespace Content.Client.Input
|
||||
var common = contexts.GetContext("common");
|
||||
common.AddFunction(ContentKeyFunctions.FocusChat);
|
||||
common.AddFunction(ContentKeyFunctions.ExamineEntity);
|
||||
common.AddFunction(ContentKeyFunctions.OpenTutorial);
|
||||
|
||||
var human = contexts.GetContext("human");
|
||||
human.AddFunction(ContentKeyFunctions.SwapHands);
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using System;
|
||||
using Content.Client.Utility;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -31,6 +34,9 @@ namespace Content.Client.UserInterface
|
||||
bool CraftingButtonDown { get; set; }
|
||||
bool CraftingButtonVisible { get; set; }
|
||||
Action<bool> CraftingButtonToggled { get; set; }
|
||||
bool SandboxButtonDown { get; set; }
|
||||
bool SandboxButtonVisible { get; set; }
|
||||
Action<bool> SandboxButtonToggled { get; set; }
|
||||
|
||||
// Init logic.
|
||||
void Initialize();
|
||||
@@ -43,11 +49,13 @@ namespace Content.Client.UserInterface
|
||||
private TopButton _buttonTutorial;
|
||||
private TopButton _buttonCharacterMenu;
|
||||
private TopButton _buttonCraftingMenu;
|
||||
private TopButton _buttonSandboxMenu;
|
||||
private TutorialWindow _tutorialWindow;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IResourceCache _resourceCache;
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager;
|
||||
[Dependency] private readonly IInputManager _inputManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public void Initialize()
|
||||
@@ -60,6 +68,7 @@ namespace Content.Client.UserInterface
|
||||
var characterTexture = _resourceCache.GetTexture("/Textures/UserInterface/character.svg.96dpi.png");
|
||||
var craftingTexture = _resourceCache.GetTexture("/Textures/UserInterface/hammer.svg.96dpi.png");
|
||||
var tutorialTexture = _resourceCache.GetTexture("/Textures/UserInterface/students-cap.svg.96dpi.png");
|
||||
var sandboxTexture = _resourceCache.GetTexture("/Textures/UserInterface/sandbox.svg.96dpi.png");
|
||||
|
||||
_topButtonsContainer = new HBoxContainer
|
||||
{
|
||||
@@ -81,14 +90,14 @@ namespace Content.Client.UserInterface
|
||||
_buttonEscapeMenu.OnToggled += args => EscapeButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
// Tutorial
|
||||
_buttonTutorial = new TopButton(tutorialTexture, " ")
|
||||
_buttonTutorial = new TopButton(tutorialTexture, "F1")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open tutorial.")
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonTutorial);
|
||||
|
||||
_buttonTutorial.OnToggled += ButtonTutorialOnOnToggled;
|
||||
_buttonTutorial.OnToggled += a => ButtonTutorialOnOnToggled();
|
||||
|
||||
// Inventory
|
||||
_buttonCharacterMenu = new TopButton(characterTexture, "C")
|
||||
@@ -112,22 +121,37 @@ namespace Content.Client.UserInterface
|
||||
|
||||
_buttonCraftingMenu.OnToggled += args => CraftingButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
// Sandbox
|
||||
_buttonSandboxMenu = new TopButton(sandboxTexture, "B")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open sandbox menu."),
|
||||
Visible = true
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonSandboxMenu);
|
||||
|
||||
_buttonSandboxMenu.OnToggled += args => SandboxButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
_tutorialWindow = new TutorialWindow();
|
||||
|
||||
_tutorialWindow.OnClose += () => _buttonTutorial.Pressed = false;
|
||||
|
||||
_inputManager.SetInputCommand(ContentKeyFunctions.OpenTutorial, InputCmdHandler.FromDelegate(s => ButtonTutorialOnOnToggled()));
|
||||
}
|
||||
|
||||
private void ButtonTutorialOnOnToggled(BaseButton.ButtonToggledEventArgs obj)
|
||||
private void ButtonTutorialOnOnToggled()
|
||||
{
|
||||
if (_tutorialWindow.IsOpen)
|
||||
{
|
||||
if (!_tutorialWindow.IsAtFront())
|
||||
{
|
||||
_tutorialWindow.MoveToFront();
|
||||
_buttonTutorial.Pressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_tutorialWindow.Close();
|
||||
_buttonTutorial.Pressed = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -175,13 +199,27 @@ namespace Content.Client.UserInterface
|
||||
|
||||
public Action<bool> CraftingButtonToggled { get; set; }
|
||||
|
||||
public bool SandboxButtonDown
|
||||
{
|
||||
get => _buttonSandboxMenu.Pressed;
|
||||
set => _buttonSandboxMenu.Pressed = value;
|
||||
}
|
||||
|
||||
public bool SandboxButtonVisible
|
||||
{
|
||||
get => _buttonSandboxMenu.Visible;
|
||||
set => _buttonSandboxMenu.Visible = value;
|
||||
}
|
||||
|
||||
public Action<bool> SandboxButtonToggled { get; set; }
|
||||
|
||||
public sealed class TopButton : BaseButton
|
||||
{
|
||||
public const string StyleClassLabelTopButton = "topButtonLabel";
|
||||
|
||||
private static readonly Color ColorNormal = Color.FromHex("#7b7e9e");
|
||||
private static readonly Color ColorHovered = Color.FromHex("#9699bb");
|
||||
private static readonly Color ColorPressed = Color.FromHex("#00b061");
|
||||
private static readonly Color ColorPressed = Color.FromHex("#789B8C");
|
||||
|
||||
private readonly VBoxContainer _container;
|
||||
private readonly TextureRect _textureRect;
|
||||
|
||||
@@ -17,5 +17,6 @@ namespace Content.Shared.Input
|
||||
public static readonly BoundKeyFunction OpenContextMenu = "OpenContextMenu";
|
||||
public static readonly BoundKeyFunction FocusChat = "FocusChatWindow";
|
||||
public static readonly BoundKeyFunction ToggleCombatMode = "ToggleCombatMode";
|
||||
public static readonly BoundKeyFunction OpenTutorial = "OpenTutorial";
|
||||
}
|
||||
}
|
||||
|
||||
44
Resources/Textures/UserInterface/sandbox.svg
Normal file
44
Resources/Textures/UserInterface/sandbox.svg
Normal file
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<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"
|
||||
version="1.1"
|
||||
width="32"
|
||||
viewBox="0 0 32 31.999998"
|
||||
height="31.999998"
|
||||
enable-background="new 0 0 512 512"
|
||||
id="Capa_1">
|
||||
<metadata
|
||||
id="metadata15">
|
||||
<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>
|
||||
<defs
|
||||
id="defs13" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke-width:0.0625"
|
||||
id="path2"
|
||||
d="m 4.349375,17.178128 c 1.3010625,-1.55238 3.1984375,-2.39375 5.13,-2.39375 3.069,0 4.279688,1.93125 5.51875,1.82812 1.503625,-7.518 1.314375,-6.34006 1.314375,-7.175 0,-3.61875 -2.94375,-6.5625 -6.5625,-6.5625 -3.61875,0 -6.5625,2.94375 -6.5625,6.5625 0,0.82481 -0.1764375,-0.49862 1.161875,7.74063 z M 9.75,4.749998 c 2.440625,0 4.450625,1.875 4.666875,4.26 h -9.33375 c 0.21625,-2.385 2.22625,-4.26 4.666875,-4.26 z" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke-width:0.0625"
|
||||
id="path4"
|
||||
d="m 24.78625,16.311248 3.055,2.6925 0.663125,-2.94312 c 0.416875,-1.84875 -0.74875,-3.69188 -2.5975,-4.10875 l -1.219375,-0.275 2.075,-9.20625 0.914375,0.20562 c 0.504625,0.11369 1.006812,-0.20275 1.120625,-0.70812 0.11375,-0.505 -0.203125,-1.00687996 -0.70875,-1.12062996 l -3.658125,-0.82437 c -0.505,-0.11375 -1.006875,0.20312 -1.120625,0.70812 C 23.19625,1.236248 23.513125,1.738128 24.01875,1.851878 l 0.914375,0.20625 -2.075,9.20687 -1.219375,-0.275 c -1.850813,-0.41719 -3.690125,0.74031 -4.10875,2.5975 l -0.4275,1.89563 c 2.471937,-1.37675 5.55725,-1.04519 7.68375,0.82812 z" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke-width:0.0625"
|
||||
id="path6"
|
||||
d="m 23.54625,17.718128 c -1.63625,-1.4425 -4.046875,-1.605 -5.8625,-0.395 l -0.8725,0.58187 c -1.101875,0.73438 -2.50125,0.78313 -3.65125,0.12563 l -1.288125,-0.73563 c -2.078875,-1.1885 -4.7064375,-0.66712 -6.18,1.20313 l -3.2,4.06437 H 29.0425 Z" />
|
||||
<path
|
||||
style="fill:#ffffff;fill-opacity:1;stroke-width:0.0625"
|
||||
id="path8"
|
||||
d="m 0,24.437498 v 6.625 c 0,0.5175 0.42,0.9375 0.9375,0.9375 h 30.125 c 0.5175,0 0.9375,-0.42 0.9375,-0.9375 v -6.625 z" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
BIN
Resources/Textures/UserInterface/sandbox.svg.96dpi.png
Normal file
BIN
Resources/Textures/UserInterface/sandbox.svg.96dpi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 731 B |
@@ -79,3 +79,6 @@ binds:
|
||||
- function: OpenCraftingMenu
|
||||
type: state
|
||||
key: G
|
||||
- function: OpenTutorial
|
||||
type: state
|
||||
key: F1
|
||||
|
||||
Reference in New Issue
Block a user