Adds a UI element to act as placeholder.
This commit is contained in:
@@ -124,6 +124,7 @@
|
||||
<Compile Include="GameObjects\Components\Power\PowerDebugTool.cs" />
|
||||
<Compile Include="UserInterface\LobbyGui.cs" />
|
||||
<Compile Include="UserInterface\NanoStyle.cs" />
|
||||
<Compile Include="UserInterface\Placeholder.cs" />
|
||||
<Compile Include="Utility\ResourceCacheExtensions.cs" />
|
||||
<Compile Include="GameObjects\Components\Mobs\SpeciesVisualizer2D.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Content.Client.UserInterface
|
||||
{
|
||||
var resCache = IoCManager.Resolve<IResourceCache>();
|
||||
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)),
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
31
Content.Client/UserInterface/Placeholder.cs
Normal file
31
Content.Client/UserInterface/Placeholder.cs
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Resources/Nano/placeholder.png
Normal file
BIN
Resources/Nano/placeholder.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 271 B |
Reference in New Issue
Block a user