Content PR for RichText refactor (#13772)

* Fix examine system after formatted text refactor
Implement key bind markup tag

* Add font prototype definitions

* Update submodule.

---------

Co-authored-by: moonheart08 <moonheart08@users.noreply.github.com>
This commit is contained in:
Julian Giebel
2023-02-16 00:10:05 +01:00
committed by GitHub
parent c31af2e488
commit 5e8e848d52
6 changed files with 78 additions and 12 deletions

View File

@@ -244,9 +244,15 @@ namespace Content.Client.Examine
return;
}
foreach (var msg in message.Tags.OfType<FormattedMessage.TagText>())
foreach (var msg in message.Nodes)
{
if (string.IsNullOrWhiteSpace(msg.Text)) continue;
if (msg.Name != null)
continue;
var text = msg.Value.StringValue ?? "";
if (string.IsNullOrWhiteSpace(text))
continue;
var richLabel = new RichTextLabel() { Margin = new Thickness(4, 4, 0, 4)};
richLabel.SetMessage(message);

View File

@@ -0,0 +1,25 @@
using JetBrains.Annotations;
using Robust.Client.Input;
using Robust.Client.UserInterface.RichText;
using Robust.Shared.Utility;
namespace Content.Client.Guidebook.Richtext;
[UsedImplicitly]
public sealed class KeyBindTag : IMarkupTag
{
[Dependency] private readonly IInputManager _inputManager = default!;
public string Name => "keybind";
public string TextBefore(MarkupNode node)
{
if (!node.Value.TryGetString(out var keyBindName))
return "";
if (!_inputManager.TryGetKeyBinding(keyBindName, out var binding))
return keyBindName;
return binding.GetKeyString();
}
}

View File

@@ -319,7 +319,7 @@ namespace Content.Shared.Examine
/// <seealso cref="PushText"/>
public void PushMessage(FormattedMessage message)
{
if (message.Tags.Count == 0)
if (message.Nodes.Count == 0)
return;
if (_doNewLine)

View File

@@ -0,0 +1,35 @@
- type: font
id: Default
path: /Fonts/NotoSans/NotoSans-Regular.ttf
- type: font
id: DefaultItalic
path: /Fonts/NotoSans/NotoSans-Italic.ttf
- type: font
id: DefaultBold
path: /Fonts/NotoSans/NotoSans-Bold.ttf
- type: font
id: NotoSansDisplay
path: /Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf
- type: font
id: NotoSansDisplayItalic
path: /Fonts/NotoSansDisplay/NotoSansDisplay-Italic.ttf
- type: font
id: NotoSansDisplayBold
path: /Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf
- type: font
id: NotoSansDisplayBoldItalic
path: /Fonts/NotoSansDisplay/NotoSansDisplay-BoldItalic.ttf
- type: font
id: BoxRound
path: /Fonts/Boxfont-round/Boxfont Round.ttf
- type: font
id: AnimalSilence
path: /Fonts/Animal Silence.otf

View File

@@ -8,12 +8,12 @@
We shall politely assume you already know how WASD to walk works.
Beyond that, there's a handful primary interactions in SS14, ordered by importance:
- [color=#a4885c]Left click[/color] to pick up items and activate objects like buttons or computers, and [color=#a4885c]E[/color] to activate items. You can also press [color=#a4885c]alt[/color] while doing this to trigger alternate interactions for some objects.
- You can also quickly activate items you're holding by pressing [color=#a4885c]Z[/color] and [color=#a4885c]alt-Z[/color] respectively.
- [color=#a4885c]Right click[/color] to open the context menu. You can then either left click an entry just like you would in the world, or right click it again to open the verb menu, which gives you more complex ways to interact with an object.
- You can [color=#a4885c]shift-left click[/color] objects to examine them, and get their name and a detailed (though often humorous) description.
- [color=#a4885c][keybind="Use"/][/color] to pick up items and activate objects like buttons or computers, and [color=#a4885c][keybind="ActivateItemInWorld"/][/color] to activate items. You can also press [color=#a4885c]alt[/color] while doing this to trigger alternate interactions for some objects.
- You can also quickly activate items you're holding by pressing [color=#a4885c][keybind="ActivateItemInHand"/][/color] and [color=#a4885c][keybind="AltActivateItemInHand"/][/color] respectively.
- [color=#a4885c][keybind="UIRightClick"/][/color] to open the context menu. You can then either left click an entry just like you would in the world, or right click it again to open the verb menu, which gives you more complex ways to interact with an object.
- You can [color=#a4885c][keybind="ExamineEntity"/][/color] objects to examine them, and get their name and a detailed (though often humorous) description.
You can quickly try out these controls with the monkey below (note: clicking it only works in-game and not in the lobby), and at any point in this guidebook if you're shown an entity, [color=#a4885c]shift-left click to examine will always work[/color]:
You can quickly try out these controls with the monkey below (note: clicking it only works in-game and not in the lobby), and at any point in this guidebook if you're shown an entity, [color=#a4885c][keybind="ExamineEntity"/] to examine will always work[/color]:
<GuideEntityEmbed Entity="MobGuidebookMonkey" Interactive="True" Caption=""/>
@@ -21,14 +21,14 @@ You can quickly try out these controls with the monkey below (note: clicking it
## Inventory
In order to move items around in your inventory and between containers, you can click the item (or item name) to move it to your active hand, and then click the spot you want it to go (either a slot in your HUD, or the container).
The items in your hands are only active one at a time, in order to swap between what you're currently using, you can press [color=#a4885c]X[/color] on your keyboard to change active hands.
The items in your hands are only active one at a time, in order to swap between what you're currently using, you can press [color=#a4885c][keybind="SwapHands"/][/color] on your keyboard to change active hands.
Opening containers in your inventory is easy as well, either hover over the item and activate it with [color=#a4885c]E[/color] or [color=#a4885c]Z[/color], or click on the bag icon in the bottom right corner of the slot it is in.
Opening containers in your inventory is easy as well, either hover over the item and activate it with [color=#a4885c][keybind="ActivateItemInWorld"/][/color] or click on the bag icon in the bottom right corner of the slot it is in.
When you open a container a window will pop up showing the contents of the container and how much space it has available to hold things.
All items have an assigned size, some too large to fit into most or all containers.
To drop items, you can press [color=#a4885c]Q[/color], and to drop them more violently (also known as throwing), you can press [color=#a4885c]ctrl-Q[/color].
To drop items, you can press [color=#a4885c][keybind="Drop"/][/color], and to drop them more violently (also known as throwing), you can press [color=#a4885c][keybind="ThrowItemInHand"/][/color].
## Actions
To the left in your HUD there's a bar showing various actions you can take.