Adds character menu, crafting menu and tutorial to the top left.
This commit is contained in:
@@ -1,70 +0,0 @@
|
||||
using Content.Client.GameObjects.Components.Construction;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Construction
|
||||
{
|
||||
public class ConstructionButton : Button
|
||||
{
|
||||
public ConstructorComponent Owner
|
||||
{
|
||||
get => Menu.Owner;
|
||||
set => Menu.Owner = value;
|
||||
}
|
||||
ConstructionMenu Menu;
|
||||
|
||||
public ConstructionButton()
|
||||
{
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
protected override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SetAnchorPreset(LayoutPreset.BottomRight);
|
||||
MarginLeft = -110.0f;
|
||||
MarginTop = -70.0f;
|
||||
MarginRight = -50.0f;
|
||||
MarginBottom = -50.0f;
|
||||
Text = "Crafting";
|
||||
OnPressed += IWasPressed;
|
||||
}
|
||||
|
||||
private void PerformLayout()
|
||||
{
|
||||
Menu = new ConstructionMenu();
|
||||
Menu.AddToScreen();
|
||||
}
|
||||
|
||||
void IWasPressed(ButtonEventArgs args)
|
||||
{
|
||||
Menu.Open();
|
||||
}
|
||||
|
||||
public void AddToScreen()
|
||||
{
|
||||
UserInterfaceManager.StateRoot.AddChild(this);
|
||||
}
|
||||
|
||||
public void RemoveFromScreen()
|
||||
{
|
||||
if (Parent != null)
|
||||
{
|
||||
Parent.RemoveChild(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
Menu.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace Content.Client
|
||||
else
|
||||
{
|
||||
_gameHud.EscapeButtonDown = false;
|
||||
_escapeMenu.Visible = false;
|
||||
_escapeMenu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using Content.Client.GameObjects.Components.Mobs;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.GameObjects.Components.Mobs;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.Actor
|
||||
{
|
||||
@@ -21,15 +22,15 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
{
|
||||
public override string Name => "Character Interface Component";
|
||||
|
||||
/// <summary>
|
||||
/// Stored keybind to open the menu on keypress
|
||||
/// </summary>
|
||||
private InputCmdHandler _openMenuCmdHandler;
|
||||
[Dependency]
|
||||
#pragma warning disable 649
|
||||
private readonly IGameHud _gameHud;
|
||||
#pragma warning restore 649
|
||||
|
||||
/// <summary>
|
||||
/// Window to hold each of the character interfaces
|
||||
/// </summary>
|
||||
private SS14Window _window;
|
||||
public SS14Window Window { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create the window with all character UIs and bind it to a keypress
|
||||
@@ -39,26 +40,11 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
base.Initialize();
|
||||
|
||||
//Use all the character ui interfaced components to create the character window
|
||||
var UIcomponents = Owner.GetAllComponents<ICharacterUI>();
|
||||
_window = new CharacterWindow(UIcomponents);
|
||||
var uiComponents = Owner.GetAllComponents<ICharacterUI>();
|
||||
Window = new CharacterWindow(uiComponents);
|
||||
Window.OnClose += () => _gameHud.CharacterButtonDown = false;
|
||||
|
||||
_window.AddToScreen();
|
||||
|
||||
//Toggle window visible/invisible on keypress
|
||||
_openMenuCmdHandler = InputCmdHandler.FromDelegate(session => {
|
||||
if (_window.Visible)
|
||||
{
|
||||
_window.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
_window.Open();
|
||||
}
|
||||
});
|
||||
|
||||
//Set keybind to open character menu
|
||||
var inputMgr = IoCManager.Resolve<IInputManager>();
|
||||
inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, _openMenuCmdHandler);
|
||||
Window.AddToScreen();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,13 +54,40 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
{
|
||||
base.OnRemove();
|
||||
|
||||
_window.Dispose();
|
||||
_window = null;
|
||||
Window.Dispose();
|
||||
Window = null;
|
||||
|
||||
var inputMgr = IoCManager.Resolve<IInputManager>();
|
||||
inputMgr.SetInputCommand(ContentKeyFunctions.OpenCharacterMenu, null);
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
|
||||
{
|
||||
base.HandleMessage(message, netChannel, component);
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg playerAttachedMsg:
|
||||
_gameHud.CharacterButtonVisible = true;
|
||||
_gameHud.CharacterButtonToggled = b =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
Window.Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
Window.Close();
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
||||
case PlayerDetachedMsg playerDetachedMsg:
|
||||
_gameHud.CharacterButtonVisible = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A window that collects and shows all the individual character user interfaces
|
||||
/// </summary>
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Client.Construction;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Construction;
|
||||
using Content.Shared.GameObjects.Components.Construction;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.GameObjects;
|
||||
using Robust.Client.Interfaces.Graphics;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
|
||||
@@ -18,17 +17,19 @@ namespace Content.Client.GameObjects.Components.Construction
|
||||
{
|
||||
public class ConstructorComponent : SharedConstructorComponent
|
||||
{
|
||||
int nextId;
|
||||
readonly Dictionary<int, ConstructionGhostComponent> Ghosts = new Dictionary<int, ConstructionGhostComponent>();
|
||||
ConstructionButton Button;
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IGameHud _gameHud;
|
||||
#pragma warning restore 649
|
||||
|
||||
ITransformComponent Transform;
|
||||
private int nextId;
|
||||
private readonly Dictionary<int, ConstructionGhostComponent> Ghosts = new Dictionary<int, ConstructionGhostComponent>();
|
||||
public ConstructionMenu ConstructionMenu { get; private set; }
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
Transform = Owner.GetComponent<ITransformComponent>();
|
||||
Owner.GetComponent<ITransformComponent>();
|
||||
}
|
||||
|
||||
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
|
||||
@@ -38,15 +39,30 @@ namespace Content.Client.GameObjects.Components.Construction
|
||||
switch (message)
|
||||
{
|
||||
case PlayerAttachedMsg _:
|
||||
if (Button == null)
|
||||
if (ConstructionMenu == null)
|
||||
{
|
||||
Button = new ConstructionButton {Owner = this};
|
||||
ConstructionMenu = new ConstructionMenu {Owner = this};
|
||||
ConstructionMenu.OnClose += () => _gameHud.CraftingButtonDown = false;
|
||||
}
|
||||
Button.AddToScreen();
|
||||
ConstructionMenu.AddToScreen();
|
||||
|
||||
_gameHud.CraftingButtonVisible = true;
|
||||
_gameHud.CraftingButtonToggled = b =>
|
||||
{
|
||||
if (b)
|
||||
{
|
||||
ConstructionMenu.Open();
|
||||
}
|
||||
else
|
||||
{
|
||||
ConstructionMenu.Close();
|
||||
}
|
||||
};
|
||||
break;
|
||||
|
||||
case PlayerDetachedMsg _:
|
||||
Button.RemoveFromScreen();
|
||||
ConstructionMenu.Parent.RemoveChild(ConstructionMenu);
|
||||
_gameHud.CraftingButtonVisible = false;
|
||||
break;
|
||||
|
||||
case AckStructureConstructionMessage ackMsg:
|
||||
@@ -57,7 +73,7 @@ namespace Content.Client.GameObjects.Components.Construction
|
||||
|
||||
public override void OnRemove()
|
||||
{
|
||||
Button?.Dispose();
|
||||
ConstructionMenu?.Dispose();
|
||||
}
|
||||
|
||||
public void SpawnGhost(ConstructionPrototype prototype, GridCoordinates loc, Direction dir)
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using Content.Client.GameObjects.Components.Actor;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
public sealed class CharacterInterfaceSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IGameHud _gameHud;
|
||||
[Dependency] private readonly IPlayerManager _playerManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var inputSys = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.OpenCharacterMenu,
|
||||
new PointerInputCmdHandler(HandleOpenCharacterMenu));
|
||||
}
|
||||
|
||||
private void HandleOpenCharacterMenu(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
{
|
||||
if (_playerManager.LocalPlayer.ControlledEntity == null
|
||||
|| !_playerManager.LocalPlayer.ControlledEntity.TryGetComponent(out CharacterInterface characterInterface))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var menu = characterInterface.Window;
|
||||
|
||||
if (menu.Visible)
|
||||
{
|
||||
if (menu.IsAtFront())
|
||||
{
|
||||
_setOpenValue(menu, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.MoveToFront();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_setOpenValue(menu, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void _setOpenValue(SS14Window menu, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_gameHud.CharacterButtonDown = true;
|
||||
menu.OpenCentered();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameHud.CharacterButtonDown = false;
|
||||
menu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using Content.Client.Construction;
|
||||
using Content.Client.GameObjects.Components.Construction;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Input;
|
||||
using Robust.Client.GameObjects.EntitySystems;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Content.Client.GameObjects.EntitySystems
|
||||
{
|
||||
public sealed class ConstructorSystem : EntitySystem
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IGameHud _gameHud;
|
||||
[Dependency] private readonly IPlayerManager _playerManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
var inputSys = EntitySystemManager.GetEntitySystem<InputSystem>();
|
||||
inputSys.BindMap.BindFunction(ContentKeyFunctions.OpenCraftingMenu,
|
||||
new PointerInputCmdHandler(HandleOpenCraftingMenu));
|
||||
}
|
||||
|
||||
private void HandleOpenCraftingMenu(in PointerInputCmdHandler.PointerInputCmdArgs args)
|
||||
{
|
||||
if (_playerManager.LocalPlayer.ControlledEntity == null
|
||||
|| !_playerManager.LocalPlayer.ControlledEntity.TryGetComponent(out ConstructorComponent constructor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var menu = constructor.ConstructionMenu;
|
||||
|
||||
if (menu.Visible)
|
||||
{
|
||||
if (menu.IsAtFront())
|
||||
{
|
||||
_setOpenValue(menu, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
menu.MoveToFront();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_setOpenValue(menu, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void _setOpenValue(ConstructionMenu menu, bool value)
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_gameHud.CraftingButtonDown = true;
|
||||
menu.OpenCentered();
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameHud.CraftingButtonDown = false;
|
||||
menu.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,6 @@ namespace Content.Client.GameTicking
|
||||
[ViewVariables] private LobbyGui _lobby;
|
||||
[ViewVariables] private bool _gameStarted;
|
||||
[ViewVariables] private DateTime _startTime;
|
||||
[ViewVariables] private TutorialButton _tutorialButton;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
@@ -172,12 +171,6 @@ namespace Content.Client.GameTicking
|
||||
_gameChat = null;
|
||||
}
|
||||
|
||||
if (_tutorialButton != null)
|
||||
{
|
||||
_tutorialButton.Dispose();
|
||||
_tutorialButton = null;
|
||||
}
|
||||
|
||||
_gameHud.RootControl.Parent?.RemoveChild(_gameHud.RootControl);
|
||||
|
||||
_tickerState = TickerState.InLobby;
|
||||
@@ -253,9 +246,6 @@ namespace Content.Client.GameTicking
|
||||
_userInterfaceManager.StateRoot.AddChild(_gameChat);
|
||||
_userInterfaceManager.StateRoot.AddChild(_gameHud.RootControl);
|
||||
_chatManager.SetChatBox(_gameChat);
|
||||
_tutorialButton = new TutorialButton();
|
||||
_userInterfaceManager.StateRoot.AddChild(_tutorialButton);
|
||||
_tutorialButton.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomLeft, Control.LayoutPresetMode.MinSize, 50);
|
||||
_gameChat.DefaultChatFormat = "say \"{0}\"";
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Content.Client.Input
|
||||
human.AddFunction(ContentKeyFunctions.ActivateItemInWorld);
|
||||
human.AddFunction(ContentKeyFunctions.ThrowItemInHand);
|
||||
human.AddFunction(ContentKeyFunctions.OpenContextMenu);
|
||||
human.AddFunction(ContentKeyFunctions.OpenCraftingMenu);
|
||||
// Disabled until there is feedback, so hitting tab doesn't suddenly break interaction.
|
||||
// human.AddFunction(ContentKeyFunctions.ToggleCombatMode);
|
||||
|
||||
|
||||
@@ -18,8 +18,21 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
Control RootControl { get; }
|
||||
|
||||
// Escape top button.
|
||||
bool EscapeButtonDown { get; set; }
|
||||
Action<bool> EscapeButtonToggled { get; set; }
|
||||
|
||||
// Character top button.
|
||||
bool CharacterButtonDown { get; set; }
|
||||
bool CharacterButtonVisible { get; set; }
|
||||
Action<bool> CharacterButtonToggled { get; set; }
|
||||
|
||||
// Crafting top button.
|
||||
bool CraftingButtonDown { get; set; }
|
||||
bool CraftingButtonVisible { get; set; }
|
||||
Action<bool> CraftingButtonToggled { get; set; }
|
||||
|
||||
// Init logic.
|
||||
void Initialize();
|
||||
}
|
||||
|
||||
@@ -27,8 +40,10 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
private HBoxContainer _topButtonsContainer;
|
||||
private TopButton _buttonEscapeMenu;
|
||||
private TopButton _buttonInventoryMenu;
|
||||
private TopButton _buttonTutorial;
|
||||
private TopButton _buttonCharacterMenu;
|
||||
private TopButton _buttonCraftingMenu;
|
||||
private TutorialWindow _tutorialWindow;
|
||||
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IResourceCache _resourceCache;
|
||||
@@ -42,6 +57,9 @@ namespace Content.Client.UserInterface
|
||||
RootControl.SetAnchorPreset(Control.LayoutPreset.Wide);
|
||||
|
||||
var escapeTexture = _resourceCache.GetTexture("/Textures/UserInterface/hamburger.svg.96dpi.png");
|
||||
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/tutorial.svg.96dpi.png");
|
||||
|
||||
_topButtonsContainer = new HBoxContainer
|
||||
{
|
||||
@@ -53,30 +71,71 @@ namespace Content.Client.UserInterface
|
||||
|
||||
// TODO: Pull key names here from the actual key binding config.
|
||||
// Escape
|
||||
_buttonEscapeMenu = new TopButton(escapeTexture, "esc")
|
||||
_buttonEscapeMenu = new TopButton(escapeTexture, "ESC")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open escape menu.")
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonEscapeMenu);
|
||||
|
||||
// Inventory
|
||||
_buttonInventoryMenu = new TopButton(escapeTexture, "i")
|
||||
_buttonEscapeMenu.OnToggled += args => EscapeButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
// Tutorial
|
||||
_buttonTutorial = new TopButton(tutorialTexture, " ")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open inventory menu.")
|
||||
ToolTip = _localizationManager.GetString("Open tutorial.")
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonInventoryMenu);
|
||||
_topButtonsContainer.AddChild(_buttonTutorial);
|
||||
|
||||
_buttonTutorial.OnToggled += ButtonTutorialOnOnToggled;
|
||||
|
||||
// Inventory
|
||||
_buttonCharacterMenu = new TopButton(characterTexture, "C")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open character menu."),
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonCharacterMenu);
|
||||
|
||||
_buttonCharacterMenu.OnToggled += args => CharacterButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
// Crafting
|
||||
_buttonCraftingMenu = new TopButton(escapeTexture, "g")
|
||||
_buttonCraftingMenu = new TopButton(craftingTexture, "G")
|
||||
{
|
||||
ToolTip = _localizationManager.GetString("Open crafting menu.")
|
||||
ToolTip = _localizationManager.GetString("Open crafting menu."),
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_topButtonsContainer.AddChild(_buttonCraftingMenu);
|
||||
|
||||
_buttonEscapeMenu.OnToggled += args => EscapeButtonToggled?.Invoke(args.Pressed);
|
||||
_buttonCraftingMenu.OnToggled += args => CraftingButtonToggled?.Invoke(args.Pressed);
|
||||
|
||||
_tutorialWindow = new TutorialWindow();
|
||||
_tutorialWindow.AddToScreen();
|
||||
|
||||
_tutorialWindow.OnClose += () => _buttonTutorial.Pressed = false;
|
||||
}
|
||||
|
||||
private void ButtonTutorialOnOnToggled(BaseButton.ButtonToggledEventArgs obj)
|
||||
{
|
||||
if (_tutorialWindow.Visible)
|
||||
{
|
||||
if (!_tutorialWindow.IsAtFront())
|
||||
{
|
||||
_tutorialWindow.MoveToFront();
|
||||
}
|
||||
else
|
||||
{
|
||||
_tutorialWindow.Close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tutorialWindow.OpenCentered();
|
||||
_buttonTutorial.Pressed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public Control RootControl { get; private set; }
|
||||
@@ -89,6 +148,33 @@ namespace Content.Client.UserInterface
|
||||
|
||||
public Action<bool> EscapeButtonToggled { get; set; }
|
||||
|
||||
public bool CharacterButtonDown
|
||||
{
|
||||
get => _buttonCharacterMenu.Pressed;
|
||||
set => _buttonCharacterMenu.Pressed = value;
|
||||
}
|
||||
|
||||
public bool CharacterButtonVisible
|
||||
{
|
||||
get => _buttonCharacterMenu.Visible;
|
||||
set => _buttonCharacterMenu.Visible = value;
|
||||
}
|
||||
|
||||
public Action<bool> CharacterButtonToggled { get; set; }
|
||||
|
||||
public bool CraftingButtonDown
|
||||
{
|
||||
get => _buttonCraftingMenu.Pressed;
|
||||
set => _buttonCraftingMenu.Pressed = value;
|
||||
}
|
||||
|
||||
public bool CraftingButtonVisible
|
||||
{
|
||||
get => _buttonCraftingMenu.Visible;
|
||||
set => _buttonCraftingMenu.Visible = value;
|
||||
}
|
||||
|
||||
public Action<bool> CraftingButtonToggled { get; set; }
|
||||
|
||||
public sealed class TopButton : BaseButton
|
||||
{
|
||||
@@ -110,8 +196,10 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
Texture = texture,
|
||||
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
|
||||
SizeFlagsVertical = SizeFlags.Expand | SizeFlags.ShrinkCenter,
|
||||
MouseFilter = MouseFilterMode.Ignore,
|
||||
ModulateSelfOverride = ColorNormal
|
||||
ModulateSelfOverride = ColorNormal,
|
||||
CustomMinimumSize = (0, 32)
|
||||
});
|
||||
|
||||
_container.AddChild(_label = new Label
|
||||
|
||||
@@ -4,7 +4,7 @@ using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface
|
||||
{
|
||||
internal sealed class TutorialButton : Button
|
||||
public sealed class TutorialWindow : SS14Window
|
||||
{
|
||||
private const string TutorialContents = @"Hi and welcome to Space Station 14!
|
||||
|
||||
@@ -21,32 +21,19 @@ New to SS14: You can press ""E"" to activate objects. This functions similarly t
|
||||
|
||||
You can talk in OOC by prefixing the message with [ or /ooc.
|
||||
|
||||
If you are not on a QWERTY keyboard, the keys mentioned above are bound to the physical location on your keyboard,
|
||||
not what letter they correspond to. For example on AZERTY movement is ZQSD, drop is A, W is activate in hand.
|
||||
If you are not on a QWERTY keyboard, the keys mentioned above are bound to the physical location on your keyboard, not what letter they correspond to.
|
||||
For example on AZERTY movement is ZQSD, drop is A, W is activate in hand.
|
||||
|
||||
If you have any feedback, questions, bug reports, etc..., do not be afraid to tell us!
|
||||
You can ask on Discord or heck, just write it in OOC, we'll catch it.
|
||||
";
|
||||
You can ask on Discord or heck, just write it in OOC! We'll catch it.";
|
||||
|
||||
|
||||
public TutorialButton()
|
||||
public TutorialWindow()
|
||||
{
|
||||
OnPressed += OnOnPressed;
|
||||
|
||||
Text = "Tutorial";
|
||||
}
|
||||
|
||||
private void OnOnPressed(ButtonEventArgs obj)
|
||||
{
|
||||
_openTutorialWindow();
|
||||
}
|
||||
|
||||
private void _openTutorialWindow()
|
||||
{
|
||||
var window = new SS14Window {Title = "Tutorial"};
|
||||
HideOnClose = true;
|
||||
Visible = false;
|
||||
|
||||
var scrollContainer = new ScrollContainer();
|
||||
window.Contents.AddChild(scrollContainer);
|
||||
Contents.AddChild(scrollContainer);
|
||||
|
||||
var label = new RichTextLabel();
|
||||
scrollContainer.AddChild(label);
|
||||
@@ -54,8 +41,6 @@ You can ask on Discord or heck, just write it in OOC, we'll catch it.
|
||||
var message = new FormattedMessage();
|
||||
message.AddText(TutorialContents);
|
||||
label.SetMessage(message);
|
||||
|
||||
window.AddToScreen();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user