diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 9740c1c11e..0eaf694e59 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -124,6 +124,7 @@ + diff --git a/Content.Client/UserInterface/NanoStyle.cs b/Content.Client/UserInterface/NanoStyle.cs index c173895609..ab7e904bdd 100644 --- a/Content.Client/UserInterface/NanoStyle.cs +++ b/Content.Client/UserInterface/NanoStyle.cs @@ -20,6 +20,7 @@ namespace Content.Client.UserInterface { var resCache = IoCManager.Resolve(); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); + var notoSans16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 16); var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16); var textureCloseButton = resCache.GetTexture("/Nano/cross.svg.png"); var windowHeaderTex = resCache.GetTexture("/Nano/window_header.png"); @@ -140,6 +141,12 @@ namespace Content.Client.UserInterface tooltipBox.SetPatchMargin(StyleBox.Margin.All, 2); tooltipBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5); + // Placeholder + var placeholderTexture = resCache.GetTexture("/Nano/placeholder.png"); + var placeholder = new StyleBoxTexture { Texture = placeholderTexture }; + placeholder.SetPatchMargin(StyleBox.Margin.All, 24); + placeholder.SetExpandMargin(StyleBox.Margin.All, -5); + Stylesheet = new Stylesheet(new[] { // Default font. @@ -376,6 +383,18 @@ namespace Content.Client.UserInterface ContentMarginLeftOverride = 4 }) }), + + // Placeholder + new StyleRule(new SelectorElement(typeof(Placeholder), null, null, null), new [] + { + new StyleProperty(PanelContainer.StylePropertyPanel, placeholder), + }), + + new StyleRule(new SelectorElement(typeof(Label), new []{Placeholder.StyleClassPlaceholderText}, null, null), new [] + { + new StyleProperty(Label.StylePropertyFont, notoSans16), + new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)), + }), }); } } diff --git a/Content.Client/UserInterface/Placeholder.cs b/Content.Client/UserInterface/Placeholder.cs new file mode 100644 index 0000000000..d6a196d6c1 --- /dev/null +++ b/Content.Client/UserInterface/Placeholder.cs @@ -0,0 +1,31 @@ +using Robust.Client.Interfaces.ResourceManagement; +using Robust.Client.UserInterface.Controls; + +namespace Content.Client.UserInterface +{ + public sealed class Placeholder : PanelContainer + { + public const string StyleClassPlaceholderText = "PlaceholderText"; + + private readonly Label _label; + + public string PlaceholderText + { + get => _label.Text; + set => _label.Text = value; + } + + public Placeholder(IResourceCache _resourceCache) + { + _label = new Label + { + SizeFlagsHorizontal = SizeFlags.Fill, + SizeFlagsVertical = SizeFlags.Fill, + Align = Label.AlignMode.Center, + VAlign = Label.VAlignMode.Center + }; + _label.AddStyleClass(StyleClassPlaceholderText); + AddChild(_label); + } + } +} diff --git a/Resources/Nano/placeholder.png b/Resources/Nano/placeholder.png new file mode 100644 index 0000000000..bdae339c2a Binary files /dev/null and b/Resources/Nano/placeholder.png differ