Ion law visuals (#22908)
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
HorizontalExpand="True"
|
HorizontalExpand="True"
|
||||||
VerticalExpand="True"
|
VerticalExpand="True"
|
||||||
Margin="5 5 5 5">
|
Margin="5 5 5 5">
|
||||||
<Label Name="LawNumberLabel" StyleClasses="StatusFieldTitle"/>
|
<RichTextLabel Name="LawNumberLabel" StyleClasses="LabelKeyText"/>
|
||||||
<customControls:HSeparator Margin="0 5 0 5"/>
|
<customControls:HSeparator Margin="0 5 0 5"/>
|
||||||
<RichTextLabel Name="LawLabel"/>
|
<RichTextLabel Name="LawLabel"/>
|
||||||
<BoxContainer Name="LawAnnouncementButtons" Orientation="Horizontal" HorizontalExpand="True" Margin="0 5 0 0">
|
<BoxContainer Name="LawAnnouncementButtons" Orientation="Horizontal" HorizontalExpand="True" Margin="0 5 0 0">
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Client.Chat.Managers;
|
using Content.Client.Chat.Managers;
|
||||||
|
using Content.Client.Message;
|
||||||
using Content.Shared.Chat;
|
using Content.Shared.Chat;
|
||||||
using Content.Shared.Radio;
|
using Content.Shared.Radio;
|
||||||
using Content.Shared.Silicons.Laws;
|
using Content.Shared.Silicons.Laws;
|
||||||
@@ -29,7 +30,7 @@ public sealed partial class LawDisplay : Control
|
|||||||
var lawIdentifier = Loc.GetString("laws-ui-law-header", ("id", identifier));
|
var lawIdentifier = Loc.GetString("laws-ui-law-header", ("id", identifier));
|
||||||
var lawDescription = Loc.GetString(law.LawString);
|
var lawDescription = Loc.GetString(law.LawString);
|
||||||
|
|
||||||
LawNumberLabel.Text = lawIdentifier;
|
LawNumberLabel.SetMarkup(lawIdentifier);
|
||||||
LawLabel.SetMessage(lawDescription);
|
LawLabel.SetMessage(lawDescription);
|
||||||
|
|
||||||
// If you can't talk, you can't state your laws...
|
// If you can't talk, you can't state your laws...
|
||||||
|
|||||||
@@ -910,6 +910,12 @@ namespace Content.Client.Stylesheets
|
|||||||
new StyleProperty("font", notoSansItalic12),
|
new StyleProperty("font", notoSansItalic12),
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassLabelKeyText}, null, null), new[]
|
||||||
|
{
|
||||||
|
new StyleProperty(Label.StylePropertyFont, notoSansBold12),
|
||||||
|
new StyleProperty( Control.StylePropertyModulateSelf, NanoGold)
|
||||||
|
}),
|
||||||
|
|
||||||
// alert tooltip
|
// alert tooltip
|
||||||
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipAlertTitle}, null, null), new[]
|
new StyleRule(new SelectorElement(typeof(RichTextLabel), new[] {StyleClassTooltipAlertTitle}, null, null), new[]
|
||||||
{
|
{
|
||||||
|
|||||||
41
Content.Client/UserInterface/RichText/ScrambleTag.cs
Normal file
41
Content.Client/UserInterface/RichText/ScrambleTag.cs
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
using System.Text;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Client.UserInterface.RichText;
|
||||||
|
using Robust.Shared.Timing;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Client.UserInterface.RichText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a specified length of random characters that scramble at a set rate.
|
||||||
|
/// </summary>
|
||||||
|
[UsedImplicitly]
|
||||||
|
public sealed class ScrambleTag : IMarkupTag
|
||||||
|
{
|
||||||
|
[Dependency] private readonly IGameTiming _timing = default!;
|
||||||
|
|
||||||
|
public string Name => "scramble";
|
||||||
|
|
||||||
|
public string TextBefore(MarkupNode node)
|
||||||
|
{
|
||||||
|
if (!node.Attributes.TryGetValue("rate", out var rateParam) ||
|
||||||
|
!rateParam.TryGetLong(out var rate) ||
|
||||||
|
!node.Attributes.TryGetValue("length", out var lengthParam) ||
|
||||||
|
!lengthParam.TryGetLong(out var length) ||
|
||||||
|
!node.Attributes.TryGetValue("chars", out var charsParam) ||
|
||||||
|
!charsParam.TryGetString(out var chars))
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
var seed = (int) (_timing.CurTime.TotalMilliseconds / rate);
|
||||||
|
var rand = new Random(seed + node.GetHashCode());
|
||||||
|
var charOptions = chars.ToCharArray();
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
for (var i = 0; i < length; i++)
|
||||||
|
{
|
||||||
|
var index = rand.Next() % charOptions.Length;
|
||||||
|
sb.Append(charOptions[index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -137,11 +137,11 @@ public sealed class IonStormRule : StationEventSystem<IonStormRuleComponent>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
laws.Laws.Insert(0, new SiliconLaw()
|
laws.Laws.Insert(0, new SiliconLaw
|
||||||
{
|
{
|
||||||
LawString = newLaw,
|
LawString = newLaw,
|
||||||
Order = -1,
|
Order = -1,
|
||||||
LawIdentifierOverride = "#"
|
LawIdentifierOverride = Loc.GetString("ion-storm-law-scrambled-number", ("length", RobustRandom.Next(5, 10)))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
station-event-ion-storm-start-announcement = Ion storm detected near the station. Please check all AI-controlled equipment for errors.
|
station-event-ion-storm-start-announcement = Ion storm detected near the station. Please check all AI-controlled equipment for errors.
|
||||||
|
|
||||||
|
ion-storm-law-scrambled-number = [font="Monospace"][scramble rate=250 length={$length} chars="@@###$$&%!01"/][/font]
|
||||||
|
|
||||||
ion-storm-you = YOU
|
ion-storm-you = YOU
|
||||||
ion-storm-the-station = THE STATION
|
ion-storm-the-station = THE STATION
|
||||||
ion-storm-the-crew = THE CREW
|
ion-storm-the-crew = THE CREW
|
||||||
|
|||||||
@@ -37,3 +37,7 @@
|
|||||||
- type: font
|
- type: font
|
||||||
id: AnimalSilence
|
id: AnimalSilence
|
||||||
path: /Fonts/Animal Silence.otf
|
path: /Fonts/Animal Silence.otf
|
||||||
|
|
||||||
|
- type: font
|
||||||
|
id: Monospace
|
||||||
|
path: /EngineFonts/NotoSans/NotoSansMono-Regular.ttf
|
||||||
|
|||||||
Reference in New Issue
Block a user