Files
tbd-station-14/Content.Client/Paper/UI/PaperSheetlet.cs
2025-10-21 22:21:32 +00:00

44 lines
1.7 KiB
C#

using Content.Client.Resources;
using Content.Client.Stylesheets;
using Content.Client.Stylesheets.SheetletConfigs;
using Content.Client.Stylesheets.Stylesheets;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using static Content.Client.Stylesheets.StylesheetHelpers;
namespace Content.Client.Paper.UI;
[CommonSheetlet]
public sealed class PaperSheetlet : Sheetlet<NanotrasenStylesheet>
{
public override StyleRule[] GetRules(NanotrasenStylesheet sheet, object config)
{
var windowCfg = (IWindowConfig)sheet;
var paperBackground = ResCache.GetTexture("/Textures/Interface/Paper/paper_background_default.svg.96dpi.png")
.IntoPatch(StyleBox.Margin.All, 16);
var paperBox = new StyleBoxTexture
{ Texture = sheet.GetTexture(windowCfg.TransparentWindowBackgroundBorderedPath) };
paperBox.SetPatchMargin(StyleBox.Margin.All, 2);
var borderedTransparentTex = ResCache.GetTexture("/Textures/Interface/Nano/transparent_window_background_bordered.png");
var borderedTransparentBackground = new StyleBoxTexture
{
Texture = borderedTransparentTex,
};
borderedTransparentBackground.SetPatchMargin(StyleBox.Margin.All, 2);
return
[
E<PanelContainer>().Identifier("PaperContainer").Panel(paperBox),
E<PanelContainer>()
.Identifier("PaperDefaultBorder")
.Prop(PanelContainer.StylePropertyPanel, paperBackground),
E<PanelContainer>()
.Identifier("PaperEditBackground")
.Prop(PanelContainer.StylePropertyPanel, borderedTransparentBackground),
];
}
}