mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* Allow PaperVisualsComponent to specify default text colour instead of modulation * Update Content.Client/Tips/TippyUI.xaml.cs Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com> --------- Co-authored-by: Pok <113675512+Pok27@users.noreply.github.com>
55 lines
1.7 KiB
C#
55 lines
1.7 KiB
C#
using Content.Client.Paper.UI;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.Graphics;
|
|
using Robust.Client.ResourceManagement;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client.Tips;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class TippyUI : UIWidget
|
|
{
|
|
public TippyState State = TippyState.Hidden;
|
|
public bool ModifyLayers = true;
|
|
|
|
public TippyUI()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
}
|
|
|
|
public void InitLabel(PaperVisualsComponent? visuals, IResourceCache resCache)
|
|
{
|
|
if (visuals == null)
|
|
return;
|
|
|
|
if (visuals.DefaultTextColor != null)
|
|
Label.ModulateSelfOverride = visuals.DefaultTextColor;
|
|
|
|
if (visuals.BackgroundImagePath == null)
|
|
return;
|
|
|
|
LabelPanel.ModulateSelfOverride = visuals.BackgroundModulate;
|
|
var backgroundImage = resCache.GetResource<TextureResource>(visuals.BackgroundImagePath);
|
|
var backgroundImageMode = visuals.BackgroundImageTile ? StyleBoxTexture.StretchMode.Tile : StyleBoxTexture.StretchMode.Stretch;
|
|
var backgroundPatchMargin = visuals.BackgroundPatchMargin;
|
|
LabelPanel.PanelOverride = new StyleBoxTexture
|
|
{
|
|
Texture = backgroundImage,
|
|
TextureScale = visuals.BackgroundScale,
|
|
Mode = backgroundImageMode,
|
|
PatchMarginLeft = backgroundPatchMargin.Left,
|
|
PatchMarginBottom = backgroundPatchMargin.Bottom,
|
|
PatchMarginRight = backgroundPatchMargin.Right,
|
|
PatchMarginTop = backgroundPatchMargin.Top
|
|
};
|
|
}
|
|
|
|
public enum TippyState : byte
|
|
{
|
|
Hidden,
|
|
Revealing,
|
|
Speaking,
|
|
Hiding,
|
|
}
|
|
}
|