Tippy, the helpful hint clown! (#26767)

* Tippy is BACK

* Clean up clippy from aprils fools

* Changed names from clippy to tippy, added localization, removed local_clippy command, made it easier to target a specific player

* Rename clippy.yml to tippy.yml

---------

Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
SlamBamActionman
2024-04-29 06:38:16 +02:00
committed by GitHub
parent eb9ee4541f
commit 373c368b94
14 changed files with 534 additions and 2 deletions

View File

@@ -0,0 +1,54 @@
using Content.Client.Paper;
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;
Label.ModulateSelfOverride = visuals.FontAccentColor;
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,
}
}