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:
@@ -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);
|
||||
|
||||
25
Content.Client/Guidebook/Richtext/KeyBindTag.cs
Normal file
25
Content.Client/Guidebook/Richtext/KeyBindTag.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user