Revert Rich text (#5848)

This commit is contained in:
Paul Ritter
2021-12-20 12:42:42 +01:00
committed by GitHub
parent e3a1b2b37b
commit cc57d1380c
60 changed files with 212 additions and 302 deletions

View File

@@ -4,7 +4,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Actions.UI
@@ -69,7 +68,7 @@ namespace Content.Client.Actions.UI
MaxWidth = TooltipTextMaxWidth,
StyleClasses = {StyleNano.StyleClassTooltipActionRequirements}
};
requiresLabel.SetMessage(Basic.RenderMarkup("[color=#635c5c]" +
requiresLabel.SetMessage(FormattedMessage.FromMarkup("[color=#635c5c]" +
requires +
"[/color]"));
vbox.AddChild(requiresLabel);
@@ -89,7 +88,7 @@ namespace Content.Client.Actions.UI
if (timeLeft > TimeSpan.Zero)
{
var duration = Cooldown.Value.End - Cooldown.Value.Start;
_cooldownLabel.SetMessage(Basic.RenderMarkup(
_cooldownLabel.SetMessage(FormattedMessage.FromMarkup(
$"[color=#a10505]{duration.Seconds} sec cooldown ({timeLeft.Seconds + 1} sec remaining)[/color]"));
_cooldownLabel.Visible = true;
}

View File

@@ -16,7 +16,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.Actions.UI
@@ -479,10 +478,10 @@ namespace Content.Client.Actions.UI
private FormattedMessage SlotNumberLabel()
{
if (SlotNumber > 10) return FormattedMessage.Empty;
if (SlotNumber > 10) return FormattedMessage.FromMarkup("");
var number = Loc.GetString(SlotNumber == 10 ? "0" : SlotNumber.ToString());
var color = (ActionEnabled || !HasAssignment) ? EnabledColor : DisabledColor;
return Basic.RenderMarkup("[color=" + color + "]" + number + "[/color]");
return FormattedMessage.FromMarkup("[color=" + color + "]" + number + "[/color]");
}
private void UpdateIcons()

View File

@@ -18,7 +18,6 @@ using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Network;
using Robust.Shared.GameObjects;
using Robust.Shared.Utility.Markup;
using YamlDotNet.RepresentationModel;
namespace Content.Client.Administration.UI
@@ -59,7 +58,9 @@ namespace Content.Client.Administration.UI
public void ReceiveLine(string text)
{
TextOutput.AddMessage(Basic.RenderMarkup(text));
var formatted = new FormattedMessage(1);
formatted.AddMarkup(text);
TextOutput.AddMessage(formatted);
}
}
}

View File

@@ -14,7 +14,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Content.Client.Changelog.ChangelogManager;
using static Robust.Client.UserInterface.Controls.BoxContainer;
@@ -147,13 +146,13 @@ namespace Content.Client.Changelog
Margin = new Thickness(6, 0, 0, 0),
};
authorLabel.SetMessage(
Basic.RenderMarkup(Loc.GetString("changelog-author-changed", ("author", author))));
FormattedMessage.FromMarkup(Loc.GetString("changelog-author-changed", ("author", author))));
ChangelogBody.AddChild(authorLabel);
foreach (var change in groupedEntry.SelectMany(c => c.Changes))
{
var text = new RichTextLabel();
text.SetMessage(Basic.RenderMarkup(change.Message));
text.SetMessage(FormattedMessage.FromMarkup(change.Message));
ChangelogBody.AddChild(new BoxContainer
{
Orientation = LayoutOrientation.Horizontal,

View File

@@ -21,7 +21,6 @@ using Robust.Shared.Log;
using Robust.Shared.Network;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Chat.Managers
{
@@ -421,7 +420,7 @@ namespace Content.Client.Chat.Managers
return;
}
var messages = SplitMessage(Basic.RenderMarkup(msg.Message).ToString());
var messages = SplitMessage(FormattedMessage.RemoveMarkup(msg.Message));
foreach (var message in messages)
{

View File

@@ -18,7 +18,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Chat.UI
{
@@ -396,7 +395,7 @@ namespace Content.Client.Chat.UI
private void WriteChatMessage(StoredChatMessage message)
{
var messageText = Basic.EscapeText(message.Message);
var messageText = FormattedMessage.EscapeText(message.Message);
if (!string.IsNullOrEmpty(message.MessageWrap))
{
messageText = string.Format(message.MessageWrap, messageText);
@@ -503,7 +502,11 @@ namespace Content.Client.Chat.UI
{
DebugTools.Assert(!Disposed);
Contents.AddMessage(Basic.RenderMarkup(message, new Section{Color=color.ToArgb()}));
var formatted = new FormattedMessage(3);
formatted.PushColor(color);
formatted.AddMarkup(message);
formatted.Pop();
Contents.AddMessage(formatted);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)

View File

@@ -7,7 +7,6 @@ using Robust.Client.UserInterface.XAML;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.ContextMenu.UI
{
@@ -46,14 +45,7 @@ namespace Content.Client.ContextMenu.UI
/// <summary>
/// Convenience property to set label text.
/// </summary>
public string Text {
set
{
var b = new Basic();
b.AddMarkupPermissive(value.Trim());
Label.SetMessage(b.Render());
}
}
public string Text { set => Label.SetMessage(FormattedMessage.FromMarkupPermissive(value.Trim())); }
public ContextMenuElement(string? text = null)
{

View File

@@ -15,7 +15,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using YamlDotNet.RepresentationModel;
using static Robust.Client.UserInterface.Controls.BoxContainer;
@@ -144,7 +143,7 @@ namespace Content.Client.Credits
var text = _resourceManager.ContentFileReadAllText($"/Credits/{path}");
if (markup)
{
label.SetMessage(Basic.RenderMarkup(text.Trim()));
label.SetMessage(FormattedMessage.FromMarkup(text.Trim()));
}
else
{

View File

@@ -181,9 +181,9 @@ namespace Content.Client.Examine
message = response.Message;
}
foreach (var msg in message.Sections)
foreach (var msg in message.Tags.OfType<FormattedMessage.TagText>())
{
if (string.IsNullOrWhiteSpace(msg.Content)) continue;
if (string.IsNullOrWhiteSpace(msg.Text)) continue;
var richLabel = new RichTextLabel();
richLabel.SetMessage(message);

View File

@@ -7,7 +7,6 @@ using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Ghost.Roles.UI
{
@@ -18,9 +17,7 @@ namespace Content.Client.Ghost.Roles.UI
public GhostRoleRulesWindow(string rules, Action<BaseButton.ButtonEventArgs> requestAction)
{
RobustXamlLoader.Load(this);
var b = new Basic();
b.AddMarkupPermissive(rules + "\n" + Loc.GetString("ghost-roles-window-rules-footer"));
Title.SetMessage(b.Render());
Title.SetMessage(FormattedMessage.FromMarkupPermissive(rules + "\n" + Loc.GetString("ghost-roles-window-rules-footer")));
RequestButton.OnPressed += requestAction;
}

View File

@@ -24,7 +24,6 @@ using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Robust.Client.Input.Keyboard.Key;
using static Robust.Client.UserInterface.Controls.BoxContainer;
using Control = Robust.Client.UserInterface.Control;
@@ -728,7 +727,7 @@ namespace Content.Client.HUD
private string? DefaultShortKeyName(BoundKeyFunction keyFunction)
{
var name = Basic.EscapeText(_inputManager.GetKeyFunctionButtonString(keyFunction));
var name = FormattedMessage.EscapeText(_inputManager.GetKeyFunctionButtonString(keyFunction));
return name.Length > 3 ? null : name;
}

View File

@@ -2,7 +2,6 @@
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Info;
@@ -16,7 +15,7 @@ public partial class InfoSection : BoxContainer
TitleLabel.Text = title;
if (markup)
Content.SetMessage(Basic.RenderMarkup(text.Trim()));
Content.SetMessage(FormattedMessage.FromMarkup(text.Trim()));
else
Content.SetMessage(text);
}

View File

@@ -6,7 +6,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Info
{
@@ -63,7 +62,7 @@ namespace Content.Client.Info
public void SetInfoBlob(string markup)
{
_richTextLabel.SetMessage(Basic.RenderMarkup(markup));
_richTextLabel.SetMessage(FormattedMessage.FromMarkup(markup));
}
}
}

View File

@@ -1,6 +1,5 @@
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Message
{
@@ -8,7 +7,7 @@ namespace Content.Client.Message
{
public static void SetMarkup(this RichTextLabel label, string markup)
{
label.SetMessage(Basic.RenderMarkup(markup));
label.SetMessage(FormattedMessage.FromMarkup(markup));
}
}
}

View File

@@ -4,7 +4,6 @@ using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Client.Paper.UI
{
@@ -22,9 +21,9 @@ namespace Content.Client.Paper.UI
{
Input.Visible = true;
}
var msg = new Basic();
var msg = new FormattedMessage();
msg.AddMarkupPermissive(state.Text);
Label.SetMessage(msg.Render());
Label.SetMessage(msg);
}
}
}

View File

@@ -4,7 +4,6 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Utility;
using Robust.Shared.Maths;
namespace Content.Client.Stylesheets
@@ -40,57 +39,28 @@ namespace Content.Client.Stylesheets
protected StyleBoxTexture BaseAngleRect { get; }
protected IFontLibrary FontLib { get; }
protected StyleBase(IResourceCache resCache)
{
FontLib = new FontLibrary(
new FontClass(Id: "notosans", Style: default, Size: (FontSize) 12)
) as IFontLibrary;
FontLib.AddFont("notosans",
new FontVariant
(
FontStyle.Normal,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Italic,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Italic.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Bold,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-Bold.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Bold.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Bold | FontStyle.Italic,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSans-BoldItalic.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Bold.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
)
var notoSans12 = resCache.GetFont
(
new []
{
"/Fonts/NotoSans/NotoSans-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
},
12
);
var notoSans12Italic = resCache.GetFont
(
new []
{
"/Fonts/NotoSans/NotoSans-Italic.ttf",
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
},
12
);
var textureCloseButton = resCache.GetTexture("/Textures/Interface/Nano/cross.svg.png");
// Button styles.
@@ -181,8 +151,7 @@ namespace Content.Client.Stylesheets
new SelectorElement(null, null, null, null),
new[]
{
new StyleProperty("font-library", FontLib),
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 12)),
new StyleProperty("font", notoSans12),
}),
// Default font.
@@ -190,7 +159,7 @@ namespace Content.Client.Stylesheets
new SelectorElement(null, new[] {StyleClassItalic}, null, null),
new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Italic, (FontSize) 12)),
new StyleProperty("font", notoSans12Italic),
}),
// Window close button base texture.

View File

@@ -14,7 +14,6 @@ using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.StylesheetHelpers;
namespace Content.Client.Stylesheets
@@ -110,49 +109,19 @@ namespace Content.Client.Stylesheets
public StyleNano(IResourceCache resCache) : base(resCache)
{
FontLib.AddFont("notosansdisplay",
new FontVariant
(
FontStyle.Normal,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Bold,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Italic,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-Italic.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Regular.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
),
new FontVariant
(
FontStyle.Bold | FontStyle.Italic,
new []
{
resCache.GetResource<FontResource>("/Fonts/NotoSansDisplay/NotoSansDisplay-BoldItalic.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols-Bold.ttf"),
resCache.GetResource<FontResource>("/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf")
}
)
);
var notoSans10 = resCache.notoStack(size: 10);
var notoSansItalic10 = resCache.notoStack(variation: "Italic", size: 10);
var notoSans12 = resCache.notoStack(size: 12);
var notoSansItalic12 = resCache.notoStack(variation: "Italic", size: 12);
var notoSansBold12 = resCache.notoStack(variation: "Bold", size: 12);
var notoSansBoldItalic12 = resCache.notoStack(variation: "BoldItalic", size: 12);
var notoSansDisplayBold14 = resCache.notoStack(variation: "Bold", display: true, size: 14);
var notoSansDisplayBold16 = resCache.notoStack(variation: "Bold", display: true, size: 16);
var notoSans15 = resCache.notoStack(variation: "Regular", size: 15);
var notoSans16 = resCache.notoStack(variation: "Regular", size: 16);
var notoSansBold16 = resCache.notoStack(variation: "Bold", size: 16);
var notoSansBold18 = resCache.notoStack(variation: "Bold", size: 18);
var notoSansBold20 = resCache.notoStack(variation: "Bold", size: 20);
var windowHeaderTex = resCache.GetTexture("/Textures/Interface/Nano/window_header.png");
var windowHeader = new StyleBoxTexture
{
@@ -459,16 +428,7 @@ namespace Content.Client.Stylesheets
var sliderFillRed = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Red};
var sliderFillBlue = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Blue};
FontLib.AddFont("box",
new FontVariant
(
default,
new []
{
resCache.GetResource<FontResource>("/Fonts/Boxfont-round/Boxfont Round.ttf")
}
)
);
var boxFont13 = resCache.GetFont("/Fonts/Boxfont-round/Boxfont Round.ttf", 13);
var insetBack = new StyleBoxTexture
{
@@ -485,7 +445,7 @@ namespace Content.Client.Stylesheets
new[]
{
new StyleProperty(Label.StylePropertyFontColor, NanoGold),
new StyleProperty(Label.StylePropertyFont, new FontClass("notosansdisplay", FontStyle.Bold, (FontSize) 14)),
new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14),
}),
// Alert (white) window title.
new StyleRule(
@@ -493,7 +453,7 @@ namespace Content.Client.Stylesheets
new[]
{
new StyleProperty(Label.StylePropertyFontColor, Color.White),
new StyleProperty(Label.StylePropertyFont, new FontClass("notosansdisplay", FontStyle.Bold, (FontSize) 14)),
new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14),
}),
// Window background.
new StyleRule(
@@ -643,16 +603,16 @@ namespace Content.Client.Stylesheets
// Context Menu Labels
Element<RichTextLabel>().Class(VerbMenuElement.StyleClassVerbInteractionText)
.Prop(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold | FontStyle.Italic, (FontSize) 12)),
.Prop(Label.StylePropertyFont, notoSansBoldItalic12),
Element<RichTextLabel>().Class(VerbMenuElement.StyleClassVerbActivationText)
.Prop(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold, (FontSize) 12)),
.Prop(Label.StylePropertyFont, notoSansBold12),
Element<RichTextLabel>().Class(VerbMenuElement.StyleClassVerbAlternativeText)
.Prop(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Italic, (FontSize) 12)),
.Prop(Label.StylePropertyFont, notoSansItalic12),
Element<RichTextLabel>().Class(VerbMenuElement.StyleClassVerbOtherText)
.Prop(Label.StylePropertyFont, new FontClass("notosans", default, (FontSize) 12)),
.Prop(Label.StylePropertyFont, notoSans12),
// Thin buttons (No padding nor vertical margin)
Element<EntityContainerButton>().Class(StyleClassStorageButton)
@@ -717,7 +677,7 @@ namespace Content.Client.Stylesheets
new SelectorElement(typeof(Label), null, null, null)),
new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Bold, (FontSize) 16)),
new StyleProperty("font", notoSansBold16),
}),
// Main menu: also make those buttons slightly more separated.
@@ -823,52 +783,52 @@ namespace Content.Client.Stylesheets
new SelectorElement(typeof(RichTextLabel), null, null, null)),
new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Italic, (FontSize) 12)),
new StyleProperty("font", notoSansItalic12),
}),
// alert tooltip
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipAlertTitle}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Bold, (FontSize) 18))
new StyleProperty("font", notoSansBold18)
}),
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipAlertDescription}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 16))
new StyleProperty("font", notoSans16)
}),
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipAlertCooldown}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 16))
new StyleProperty("font", notoSans16)
}),
// action tooltip
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionTitle}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Bold, (FontSize) 16))
new StyleProperty("font", notoSansBold16)
}),
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionDescription}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 15))
new StyleProperty("font", notoSans15)
}),
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionCooldown}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 15))
new StyleProperty("font", notoSans15)
}),
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipActionRequirements}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 15))
new StyleProperty("font", notoSans15)
}),
// small number for the entity counter in the entity menu
new StyleRule(new SelectorElement(typeof(Label), new[] {EntityMenuElement.StyleClassEntityMenuCountText}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 10)),
new StyleProperty("font", notoSans10),
new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Right),
}),
// hotbar slot
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassHotbarSlotNumber}, null, null), new[]
{
new StyleProperty("font", new FontClass("notosansdisplay", FontStyle.Bold, (FontSize) 16))
new StyleProperty("font", notoSansDisplayBold16)
}),
// Entity tooltip
@@ -925,14 +885,14 @@ namespace Content.Client.Stylesheets
new StyleRule(
new SelectorElement(typeof(Label), new[] {Placeholder.StyleClassPlaceholderText}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", default, (FontSize) 16)),
new StyleProperty(Label.StylePropertyFont, notoSans16),
new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)),
}),
// Big Label
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelHeading}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold, (FontSize) 16)),
new StyleProperty(Label.StylePropertyFont, notoSansBold16),
new StyleProperty(Label.StylePropertyFontColor, NanoGold),
}),
@@ -940,28 +900,28 @@ namespace Content.Client.Stylesheets
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelHeadingBigger}, null, null),
new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold, (FontSize) 20)),
new StyleProperty(Label.StylePropertyFont, notoSansBold20),
new StyleProperty(Label.StylePropertyFontColor, NanoGold),
}),
// Small Label
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelSubText}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", default, (FontSize) 10)),
new StyleProperty(Label.StylePropertyFont, notoSans10),
new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray),
}),
// Label Key
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelKeyText}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold, (FontSize) 12)),
new StyleProperty(Label.StylePropertyFont, notoSansBold12),
new StyleProperty(Label.StylePropertyFontColor, NanoGold)
}),
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelSecondaryColor}, null, null),
new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosans", default, (FontSize) 12)),
new StyleProperty(Label.StylePropertyFont, notoSans12),
new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray),
}),
@@ -971,14 +931,14 @@ namespace Content.Client.Stylesheets
new SelectorElement(typeof(Label), null, null, null)),
new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 16))
new StyleProperty("font", notoSans16)
}),
// Popup messages
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassPopupMessage}, null, null),
new[]
{
new StyleProperty("font", new FontClass("notosans", FontStyle.Italic, (FontSize) 10)),
new StyleProperty("font", notoSansItalic10),
new StyleProperty("font-color", Color.LightGray),
}),
@@ -1069,7 +1029,7 @@ namespace Content.Client.Stylesheets
new SelectorElement(typeof(Label), new[] {GameHud.TopButton.StyleClassLabelTopButton}, null, null),
new[]
{
new StyleProperty(Label.StylePropertyFont, new FontClass("notosansdisplay", FontStyle.Bold, (FontSize) 14)),
new StyleProperty(Label.StylePropertyFont, notoSansDisplayBold14),
}),
// Targeting doll
@@ -1119,13 +1079,13 @@ namespace Content.Client.Stylesheets
SelectorElement.Class(StyleClassLabelBig),
new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 16)),
new StyleProperty("font", notoSans16),
}),
// StyleClassItemStatus
new StyleRule(SelectorElement.Class(StyleClassItemStatus), new[]
{
new StyleProperty("font", new FontClass("notosans", default, (FontSize) 10)),
new StyleProperty("font", notoSans10),
}),
// Slider
@@ -1230,7 +1190,7 @@ namespace Content.Client.Stylesheets
}),
Element<Label>().Class("FancyWindowTitle")
.Prop("font", new FontClass("boxfont", default, (FontSize) 13))
.Prop("font", boxFont13)
.Prop("font-color", NanoGold),
Element<PanelContainer>().Class("WindowHeadingBackground")

View File

@@ -5,7 +5,6 @@ using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.StylesheetHelpers;
namespace Content.Client.Stylesheets
@@ -28,6 +27,27 @@ namespace Content.Client.Stylesheets
public StyleSpace(IResourceCache resCache) : base(resCache)
{
var notoSans10 = resCache.GetFont
(
new []
{
"/Fonts/NotoSans/NotoSans-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
},
10
);
var notoSansBold16 = resCache.GetFont
(
new []
{
"/Fonts/NotoSans/NotoSans-Bold.ttf",
"/Fonts/NotoSans/NotoSansSymbols-Regular.ttf",
"/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf"
},
16
);
var progressBarBackground = new StyleBoxFlat
{
BackgroundColor = new Color(0.25f, 0.25f, 0.25f)
@@ -45,11 +65,11 @@ namespace Content.Client.Stylesheets
Stylesheet = new Stylesheet(BaseRules.Concat(new StyleRule[]
{
Element<Label>().Class(StyleClassLabelHeading)
.Prop(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Bold, (FontSize) 16))
.Prop(Label.StylePropertyFont, notoSansBold16)
.Prop(Label.StylePropertyFontColor, SpaceRed),
Element<Label>().Class(StyleClassLabelSubText)
.Prop(Label.StylePropertyFont, new FontClass("notosans", FontStyle.Normal, (FontSize) 10))
.Prop(Label.StylePropertyFont, notoSans10)
.Prop(Label.StylePropertyFontColor, Color.DarkGray),
Element<PanelContainer>().Class(ClassHighDivider)

View File

@@ -8,7 +8,6 @@ using Robust.Shared.Localization;
using Robust.Server.Player;
using Robust.Shared.IoC;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Administration
{
@@ -34,7 +33,7 @@ namespace Content.Server.Administration
return;
}
var escapedText = Basic.EscapeText(message.Text);
var escapedText = FormattedMessage.EscapeText(message.Text);
var bwoinkText = senderAdmin switch

View File

@@ -24,7 +24,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Atmos.Components
@@ -109,7 +108,7 @@ namespace Content.Server.Atmos.Components
UpdateUserInterface(true);
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("comp-gas-tank-examine", ("pressure", Math.Round(Air?.Pressure ?? 0))));
if (IsConnected)

View File

@@ -29,7 +29,6 @@ using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Botany.Components
@@ -844,7 +843,7 @@ namespace Content.Server.Botany.Components
DoHarvest(eventArgs.User);
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!inDetailsRange)
return;

View File

@@ -5,7 +5,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Botany.Components
@@ -27,7 +26,7 @@ namespace Content.Server.Botany.Components
set => _seedName = value?.ID;
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!inDetailsRange)
return;

View File

@@ -25,7 +25,6 @@ using Robust.Shared.Log;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Content.Server.Chat.Managers.IChatManager;
namespace Content.Server.Chat.Managers
@@ -193,7 +192,7 @@ namespace Content.Server.Chat.Managers
var listeners = EntitySystem.Get<ListeningSystem>();
listeners.PingListeners(source, message);
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Local;
@@ -224,7 +223,7 @@ namespace Content.Server.Chat.Managers
return;
}
action = Basic.EscapeText(action);
action = FormattedMessage.EscapeText(action);
var clients = Filter.Empty()
.AddInRange(_entManager.GetComponent<TransformComponent>(source).MapPosition, VoiceRange)
@@ -261,7 +260,7 @@ namespace Content.Server.Chat.Managers
return;
}
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.OOC;
@@ -293,7 +292,7 @@ namespace Content.Server.Chat.Managers
return;
}
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var clients = GetDeadChatClients();
@@ -320,7 +319,7 @@ namespace Content.Server.Chat.Managers
return;
}
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var clients = GetDeadChatClients();
@@ -351,7 +350,7 @@ namespace Content.Server.Chat.Managers
return;
}
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var clients = _adminManager.ActiveAdmins.Select(p => p.ConnectedClient);
@@ -369,7 +368,7 @@ namespace Content.Server.Chat.Managers
{
var clients = _adminManager.ActiveAdmins.Select(p => p.ConnectedClient);
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
@@ -383,7 +382,7 @@ namespace Content.Server.Chat.Managers
public void SendHookOOC(string sender, string message)
{
message = Basic.EscapeText(message);
message = FormattedMessage.EscapeText(message);
var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.OOC;

View File

@@ -8,7 +8,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Construction.Components
@@ -54,7 +53,7 @@ namespace Content.Server.Construction.Components
}
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("machine-board-component-on-examine-label") + "\n");
foreach (var (part, amount) in Requirements)

View File

@@ -4,7 +4,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Construction.Components
@@ -39,7 +38,7 @@ namespace Content.Server.Construction.Components
[DataField("rating")]
public int Rating { get; private set; } = 1;
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("machine-part-component-on-examine-rating-text", ("rating", Rating)) + "\n");
message.AddMarkup(Loc.GetString("machine-part-component-on-examine-type-text", ("type", PartType)) + "\n");

View File

@@ -9,7 +9,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Construction.Conditions
{

View File

@@ -5,18 +5,17 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Examine
{
[UsedImplicitly]
public class ExamineSystem : ExamineSystemShared
{
private static readonly FormattedMessage.Builder _entityNotFoundMessage;
private static readonly FormattedMessage _entityNotFoundMessage;
static ExamineSystem()
{
_entityNotFoundMessage = new FormattedMessage.Builder();
_entityNotFoundMessage = new FormattedMessage();
_entityNotFoundMessage.AddText(Loc.GetString("examine-system-entity-does-not-exist"));
}
@@ -40,7 +39,7 @@ namespace Content.Server.Examine
|| !CanExamine(playerEnt, request.EntityUid))
{
RaiseNetworkEvent(new ExamineSystemMessages.ExamineInfoResponseMessage(
request.EntityUid, _entityNotFoundMessage.Build()), channel);
request.EntityUid, _entityNotFoundMessage), channel);
return;
}

View File

@@ -86,7 +86,7 @@ namespace Content.Server.Headset
RadioRequested = false;
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddText(Loc.GetString("examine-radio-frequency", ("frequency", BroadcastFrequency)));
message.AddText("\n");

View File

@@ -9,7 +9,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Labels
{
@@ -56,7 +55,9 @@ namespace Content.Server.Labels
if (label.CurrentLabel == null)
return;
args.Message.AddText(Loc.GetString("hand-labeler-has-label", ("label", label.CurrentLabel)));
var message = new FormattedMessage();
message.AddText(Loc.GetString("hand-labeler-has-label", ("label", label.CurrentLabel)));
args.PushMessage(message);
}
private void OnExamined(EntityUid uid, PaperLabelComponent comp, ExaminedEvent args)

View File

@@ -9,7 +9,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Light.Components
@@ -149,9 +148,9 @@ namespace Content.Server.Light.Components
}
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMessage(Basic.BuildMarkup(Loc.GetString("emergency-light-component-on-examine",("batteryStateText", Loc.GetString(BatteryStateText[State])))));
message.AddMarkup(Loc.GetString("emergency-light-component-on-examine",("batteryStateText", Loc.GetString(BatteryStateText[State]))));
}
public enum EmergencyLightState

View File

@@ -22,7 +22,6 @@ using Robust.Shared.Maths;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Light.Components
@@ -84,7 +83,7 @@ namespace Content.Server.Light.Components
return true;
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (Activated)
{

View File

@@ -10,7 +10,6 @@ using Robust.Shared.Map;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Mind.Components
@@ -126,7 +125,7 @@ namespace Content.Server.Mind.Components
}
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!ShowExamineInfo || !inDetailsRange)
{

View File

@@ -19,7 +19,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Morgue.Components
@@ -49,7 +48,7 @@ namespace Content.Server.Morgue.Components
private CancellationTokenSource? _cremateCancelToken;
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (Appearance == null) return;

View File

@@ -21,7 +21,6 @@ using Robust.Shared.Maths;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Morgue.Components
@@ -173,7 +172,7 @@ namespace Content.Server.Morgue.Components
}
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (Appearance == null) return;

View File

@@ -7,7 +7,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.NodeContainer
@@ -44,20 +43,28 @@ namespace Content.Server.NodeContainer
return false;
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!_examinable || !inDetailsRange) return;
foreach (var node in Nodes.Values)
{
if (node == null) continue;
message.AddMarkup(node.NodeGroupID switch
switch (node.NodeGroupID)
{
NodeGroupID.HVPower => Loc.GetString("node-container-component-on-examine-details-hvpower") + "\n",
NodeGroupID.MVPower => Loc.GetString("node-container-component-on-examine-details-mvpower") + "\n",
NodeGroupID.Apc => Loc.GetString("node-container-component-on-examine-details-apc") + "\n",
_ => ""
});
case NodeGroupID.HVPower:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-hvpower") + "\n");
break;
case NodeGroupID.MVPower:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-mvpower") + "\n");
break;
case NodeGroupID.Apc:
message.AddMarkup(
Loc.GetString("node-container-component-on-examine-details-apc") + "\n");
break;
}
}
}
}

View File

@@ -29,7 +29,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Nutrition.EntitySystems
{

View File

@@ -10,7 +10,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Paper
@@ -61,7 +60,7 @@ namespace Content.Server.Paper
UserInterface?.SetState(new PaperBoundUserInterfaceState(Content, _mode));
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (!inDetailsRange)
return;

View File

@@ -11,7 +11,6 @@ using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Power.Components
@@ -99,7 +98,7 @@ namespace Content.Server.Power.Components
///<summary>
///Adds some markup to the examine text of whatever object is using this component to tell you if it's powered or not, even if it doesn't have an icon state to do this for you.
///</summary>
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString("power-receiver-component-on-examine-main",
("stateText", Loc.GetString( Powered ? "power-receiver-component-on-examine-powered" :

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Utility;
using Robust.Shared.ViewVariables;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Power.Components
{
@@ -17,7 +16,7 @@ namespace Content.Server.Power.Components
[ViewVariables]
[ComponentDependency] private BatteryComponent? _battery = default!;
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (_battery == null)
return;

View File

@@ -9,7 +9,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.PowerCell.Components
@@ -91,7 +90,7 @@ namespace Content.Server.PowerCell.Components
return (byte) ContentHelpers.RoundToNearestLevels(fraction, 1, SharedPowerCell.PowerCellVisualsLevels);
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (inDetailsRange)
{

View File

@@ -12,7 +12,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.PowerCell.Components
@@ -108,7 +107,7 @@ namespace Content.Server.PowerCell.Components
_cellContainer = ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "cellslot_cell_container", out _);
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (!inDetailsRange) return;
string sizeLetter = SlotSize switch

View File

@@ -10,7 +10,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Radio.Components
@@ -109,7 +108,7 @@ namespace Content.Server.Radio.Components
Use(eventArgs.User);
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddText(Loc.GetString("handheld-radio-component-on-examine",("frequency", BroadcastFrequency)));
}

View File

@@ -13,7 +13,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Players;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Suspicion
@@ -126,7 +125,7 @@ namespace Content.Server.Suspicion
Dirty();
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (!IsDead())
{

View File

@@ -24,7 +24,6 @@ using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Toilet
@@ -124,7 +123,7 @@ namespace Content.Server.Toilet
return true;
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
if (inDetailsRange && LidOpen)
{

View File

@@ -3,7 +3,6 @@ using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Warps
@@ -17,7 +16,7 @@ namespace Content.Server.Warps
[ViewVariables(VVAccess.ReadWrite)] [DataField("location")] public string? Location { get; set; }
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
var loc = Location == null ? "<null>" : $"'{Location}'";
message.AddText(Loc.GetString("warp-point-component-on-examine-success", ("location", loc)));

View File

@@ -13,7 +13,6 @@ using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Weapon.Ranged.Ammunition.Components
{
@@ -157,7 +156,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
EntitySystem.Get<EffectSystem>().CreateParticle(message);
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
var text = Loc.GetString("ammo-component-on-examine",("caliber", Caliber));
message.AddMarkup(text);

View File

@@ -14,7 +14,6 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Weapon.Ranged.Ammunition.Components
{
@@ -169,7 +168,7 @@ namespace Content.Server.Weapon.Ranged.Ammunition.Components
return true;
}
public void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public void Examine(FormattedMessage message, bool inDetailsRange)
{
var text = Loc.GetString("ranged-magazine-component-on-examine", ("magazineType", MagazineType),("caliber", Caliber));
message.AddMarkup(text);

View File

@@ -16,7 +16,6 @@ using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Weapon.Ranged.Barrels.Components
@@ -329,7 +328,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return false;
}
public override void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public override void Examine(FormattedMessage message, bool inDetailsRange)
{
base.Examine(message, inDetailsRange);

View File

@@ -16,7 +16,6 @@ using Robust.Shared.Player;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Weapon.Ranged.Barrels.Components
@@ -238,7 +237,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return TryInsertBullet(eventArgs);
}
public override void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public override void Examine(FormattedMessage message, bool inDetailsRange)
{
base.Examine(message, inDetailsRange);

View File

@@ -20,7 +20,6 @@ using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Weapon.Ranged.Barrels.Components
@@ -431,7 +430,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
return false;
}
public override void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public override void Examine(FormattedMessage message, bool inDetailsRange)
{
base.Examine(message, inDetailsRange);

View File

@@ -27,7 +27,6 @@ using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Server.Weapon.Ranged.Barrels.Components
{
@@ -408,7 +407,7 @@ namespace Content.Server.Weapon.Ranged.Barrels.Components
}
#endregion
public virtual void Examine(FormattedMessage.Builder message, bool inDetailsRange)
public virtual void Examine(FormattedMessage message, bool inDetailsRange)
{
var fireRateMessage = Loc.GetString(FireRateSelector switch
{

View File

@@ -17,7 +17,6 @@ using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.Window
@@ -43,7 +42,7 @@ namespace Content.Server.Window
[DataField("knockSound")]
private SoundSpecifier _knockSound = new SoundPathSpecifier("/Audio/Effects/glass_knock.ogg");
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
if (!_entMan.TryGetComponent(Owner, out DamageableComponent? damageable) ||
!_entMan.TryGetComponent(Owner, out DestructibleComponent? destructible))

View File

@@ -25,7 +25,6 @@ using Robust.Shared.Random;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using Robust.Shared.ViewVariables;
namespace Content.Server.WireHacking
@@ -535,7 +534,7 @@ namespace Content.Server.WireHacking
return false;
}
void IExamine.Examine(FormattedMessage.Builder message, bool inDetailsRange)
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
{
message.AddMarkup(Loc.GetString(IsPanelOpen
? "wires-component-on-examine-panel-open"

View File

@@ -36,13 +36,13 @@ namespace Content.Shared.Actions.Prototypes
/// Name to show in UI. Accepts formatting.
/// </summary>
[DataField("name")]
public FormattedMessage Name { get; private set; } = FormattedMessage.Empty;
public FormattedMessage Name { get; private set; } = new();
/// <summary>
/// Description to show in UI. Accepts formatting.
/// </summary>
[DataField("description")]
public FormattedMessage Description { get; } = FormattedMessage.Empty;
public FormattedMessage Description { get; } = new();
/// <summary>
/// Requirements message to show in UI. Accepts formatting, but generally should be avoided
@@ -101,10 +101,8 @@ namespace Content.Shared.Actions.Prototypes
public virtual void AfterDeserialization()
{
Name = new FormattedMessage(new []
{
new Section {Content=ID}
});
Name = new FormattedMessage();
Name.AddText(ID);
if (BehaviorType == BehaviorType.None)
{

View File

@@ -39,13 +39,13 @@ namespace Content.Shared.Alert
/// Name to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("name")]
public FormattedMessage Name { get; private set; } = FormattedMessage.Empty;
public FormattedMessage Name { get; private set; } = new();
/// <summary>
/// Description to show in tooltip window. Accepts formatting.
/// </summary>
[DataField("description")]
public FormattedMessage Description { get; private set; } = FormattedMessage.Empty;
public FormattedMessage Description { get; private set; } = new();
/// <summary>
/// Category the alert belongs to. Only one alert of a given category

View File

@@ -2,7 +2,6 @@
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
namespace Content.Shared.Construction.Steps
{
@@ -17,7 +16,7 @@ namespace Content.Shared.Construction.Steps
if (string.IsNullOrEmpty(Name))
return;
examinedEvent.Message.AddMessage(Basic.RenderMarkup(Loc.GetString("construction-insert-arbitrary-entity", ("stepName", Name))));
examinedEvent.Message.AddMarkup(Loc.GetString("construction-insert-arbitrary-entity", ("stepName", Name)));
}
public override ConstructionGuideEntry GenerateGuideEntry()

View File

@@ -2,7 +2,6 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility.Markup;
namespace Content.Shared.Construction.Steps
{
@@ -24,15 +23,13 @@ namespace Content.Shared.Construction.Steps
public override void DoExamine(ExaminedEvent examinedEvent)
{
examinedEvent.Message.AddMessage(
Basic.RenderMarkup(string.IsNullOrEmpty(Name)
? Loc.GetString(
"construction-insert-entity-with-component",
("componentName", Component))// Terrible.
: Loc.GetString(
"construction-insert-exact-entity",
("entityName", Name))
));
examinedEvent.Message.AddMarkup(string.IsNullOrEmpty(Name)
? Loc.GetString(
"construction-insert-entity-with-component",
("componentName", Component))// Terrible.
: Loc.GetString(
"construction-insert-exact-entity",
("entityName", Name)));
}
}
}

View File

@@ -7,7 +7,6 @@ using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Utility.Markup;
namespace Content.Shared.Construction.Steps
{
@@ -25,7 +24,7 @@ namespace Content.Shared.Construction.Steps
{
var material = IoCManager.Resolve<IPrototypeManager>().Index<StackPrototype>(MaterialPrototypeId);
examinedEvent.Message.AddMessage(Basic.RenderMarkup(Loc.GetString("construction-insert-material-entity", ("amount", Amount), ("materialName", material.Name))));
examinedEvent.Message.AddMarkup(Loc.GetString("construction-insert-material-entity", ("amount", Amount), ("materialName", material.Name)));
}
public override bool EntityValid(EntityUid uid, IEntityManager entityManager)

View File

@@ -2,7 +2,6 @@
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Utility.Markup;
namespace Content.Shared.Construction.Steps
{
@@ -18,8 +17,7 @@ namespace Content.Shared.Construction.Steps
public override void DoExamine(ExaminedEvent examinedEvent)
{
var nb = new Basic();
nb.AddMarkup(string.IsNullOrEmpty(Name)
examinedEvent.Message.AddMarkup(string.IsNullOrEmpty(Name)
? Loc.GetString(
"construction-insert-prototype-no-name",
("prototypeName", Prototype) // Terrible.
@@ -28,8 +26,6 @@ namespace Content.Shared.Construction.Steps
"construction-insert-prototype",
("entityName", Name)
));
examinedEvent.Message.AddMessage(nb.Render());
}
}
}

View File

@@ -13,7 +13,6 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Utility;
using Robust.Shared.Utility.Markup;
using static Content.Shared.Interaction.SharedInteractionSystem;
namespace Content.Shared.Examine
@@ -26,7 +25,7 @@ namespace Content.Shared.Examine
/// </summary>
/// <param name="message">The message to append to which will be displayed.</param>
/// <param name="inDetailsRange">Whether the examiner is within the 'Details' range, allowing you to show information logically only availabe when close to the examined entity.</param>
void Examine(FormattedMessage.Builder message, bool inDetailsRange);
void Examine(FormattedMessage message, bool inDetailsRange);
}
public abstract class ExamineSystemShared : EntitySystem
@@ -213,11 +212,11 @@ namespace Content.Shared.Examine
public FormattedMessage GetExamineText(EntityUid entity, EntityUid? examiner)
{
var message = new FormattedMessage.Builder();
var message = new FormattedMessage();
if (examiner == null)
{
return new(new Section[] {});
return message;
}
var doNewline = false;
@@ -239,15 +238,21 @@ namespace Content.Shared.Examine
//Add component statuses from components that report one
foreach (var examineComponent in EntityManager.GetComponents<IExamine>(entity))
{
examineComponent.Examine(message, isInDetailsRange);
var subMessage = new FormattedMessage();
examineComponent.Examine(subMessage, isInDetailsRange);
if (subMessage.Tags.Count == 0)
continue;
if (doNewline)
message.AddText("\n");
message.AddMessage(subMessage);
doNewline = true;
}
return message.Build();
message.Pop();
return message;
}
}
@@ -264,7 +269,7 @@ namespace Content.Shared.Examine
/// <seealso cref="PushMessage"/>
/// <seealso cref="PushMarkup"/>
/// <seealso cref="PushText"/>
public FormattedMessage.Builder Message { get; }
public FormattedMessage Message { get; }
/// <summary>
/// The entity performing the examining.
@@ -283,7 +288,7 @@ namespace Content.Shared.Examine
private bool _doNewLine;
public ExaminedEvent(FormattedMessage.Builder message, EntityUid examined, EntityUid examiner, bool isInDetailsRange, bool doNewLine)
public ExaminedEvent(FormattedMessage message, EntityUid examined, EntityUid examiner, bool isInDetailsRange, bool doNewLine)
{
Message = message;
Examined = examined;
@@ -299,6 +304,9 @@ namespace Content.Shared.Examine
/// <seealso cref="PushText"/>
public void PushMessage(FormattedMessage message)
{
if (message.Tags.Count == 0)
return;
if (_doNewLine)
Message.AddText("\n");
@@ -313,7 +321,7 @@ namespace Content.Shared.Examine
/// <seealso cref="PushMessage"/>
public void PushMarkup(string markup)
{
PushMessage(Basic.RenderMarkup(markup));
PushMessage(FormattedMessage.FromMarkup(markup));
}
/// <summary>
@@ -321,6 +329,11 @@ namespace Content.Shared.Examine
/// </summary>
/// <seealso cref="PushMarkup"/>
/// <seealso cref="PushMessage"/>
public void PushText(string text) => Message.AddText(text);
public void PushText(string text)
{
var msg = new FormattedMessage();
msg.AddText(text);
PushMessage(msg);
}
}
}