From b64643ecd67ae8c7914c823a5ab34c50e4a68900 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 16 May 2019 16:25:06 +0200 Subject: [PATCH] Adds tutorial, remap some buttons to be more in line with SS13. --- Content.Client/Content.Client.csproj | 1 + .../GameTicking/ClientGameTicker.cs | 10 +++ .../UserInterface/TutorialButton.cs | 61 +++++++++++++++++++ Resources/keybinds.yml | 4 +- 4 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 Content.Client/UserInterface/TutorialButton.cs diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 71024b6d7d..d7632f5255 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -127,6 +127,7 @@ + diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index 72a9b3d42d..1ae9c5d814 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -44,6 +44,7 @@ namespace Content.Client.GameTicking [ViewVariables] private LobbyGui _lobby; [ViewVariables] private bool _gameStarted; [ViewVariables] private DateTime _startTime; + [ViewVariables] private TutorialButton _tutorialButton; public void Initialize() { @@ -170,6 +171,12 @@ namespace Content.Client.GameTicking _gameChat = null; } + if (_tutorialButton != null) + { + _tutorialButton.Dispose(); + _tutorialButton = null; + } + _tickerState = TickerState.InLobby; _lobby = new LobbyGui(_localization, _resourceCache); @@ -242,6 +249,9 @@ namespace Content.Client.GameTicking _gameChat = new ChatBox(); _userInterfaceManager.StateRoot.AddChild(_gameChat); _chatManager.SetChatBox(_gameChat); + _tutorialButton = new TutorialButton(); + _userInterfaceManager.StateRoot.AddChild(_tutorialButton); + _tutorialButton.SetAnchorAndMarginPreset(Control.LayoutPreset.BottomLeft, Control.LayoutPresetMode.MinSize, 50); _gameChat.DefaultChatFormat = "say \"{0}\""; } diff --git a/Content.Client/UserInterface/TutorialButton.cs b/Content.Client/UserInterface/TutorialButton.cs new file mode 100644 index 0000000000..1e72981a6c --- /dev/null +++ b/Content.Client/UserInterface/TutorialButton.cs @@ -0,0 +1,61 @@ +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.CustomControls; +using Robust.Shared.Utility; + +namespace Content.Client.UserInterface +{ + internal sealed class TutorialButton : Button + { + private const string TutorialContents = @"Hi and welcome to Space Station 14! + +This tutorial will assume that you know a bit about how SS13 plays. +It's mostly intended to lay out the controls and their differences from SS13. + +Just like in any game, WASD is movement. If that does not work, the server probably broke. + +Clicking on things ""interacts"" in some object-defined sense with it, with your active hand. + +X switches hands. Z uses the item in your hand. Q drops items. T focuses chat. C opens your inventory. + +New to SS14: You can press ""E"" to activate objects. This functions similarly to clicking with an empty hand most of the time: opens interfaces, etc. The difference is that it works even without an empty hand. No longer do you need to drop your tools to use a computer! + +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 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. +"; + + + public TutorialButton() + { + OnPressed += OnOnPressed; + + Text = "Tutorial"; + } + + private void OnOnPressed(ButtonEventArgs obj) + { + _openTutorialWindow(); + } + + private void _openTutorialWindow() + { + var window = new SS14Window {Title = "Tutorial"}; + + var scrollContainer = new ScrollContainer(); + window.Contents.AddChild(scrollContainer); + + var label = new RichTextLabel(); + scrollContainer.AddChild(label); + + var message = new FormattedMessage(); + message.AddText(TutorialContents); + label.SetMessage(message); + + window.AddToScreen(); + } + } +} diff --git a/Resources/keybinds.yml b/Resources/keybinds.yml index 6dce1d0f63..b0b87c8a81 100644 --- a/Resources/keybinds.yml +++ b/Resources/keybinds.yml @@ -45,13 +45,13 @@ binds: key: MouseMiddle type: State - function: SwapHands - key: Tab + key: X type: State - function: Drop key: Q type: State - function: ActivateItemInHand - key: F + key: Z type: State - function: OpenCharacterMenu key: C