diff --git a/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs b/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs index 208ad6a..76a5b9e 100644 --- a/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs +++ b/MiraAPI.Example/Buttons/Teleporter/TeleportButton.cs @@ -19,7 +19,7 @@ public class TeleportButton : CustomActionButton public override int MaxUses => 2; public override LoadableAsset Sprite => ExampleAssets.TeleportButton; - + public override Color TextOutlineColor => new Color32(221, 176, 152, 255); public static bool IsZoom { get; private set; } public override bool Enabled(RoleBehaviour? role) diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs index 4981e15..4136e99 100644 --- a/MiraAPI/Hud/CustomActionButton.cs +++ b/MiraAPI/Hud/CustomActionButton.cs @@ -46,6 +46,11 @@ public abstract class CustomActionButton /// public virtual int MaxUses => 0; + /// + /// Gets the button's text outline color. + /// + public virtual Color TextOutlineColor => Color.clear; + /// /// Gets the location of the button on the screen. /// @@ -114,6 +119,11 @@ public abstract class CustomActionButton Button.SetInfiniteUses(); } + if (TextOutlineColor != Color.clear) + { + SetTextOutline(TextOutlineColor); + } + var pb = Button.GetComponent(); pb.OnClick = new Button.ButtonClickedEvent(); pb.OnClick.AddListener((UnityAction)(() => @@ -207,6 +217,16 @@ public abstract class CustomActionButton EffectActive = false; } + /// + /// A utility function to change the outline color of the button's text. + /// + /// The new color. + /// The thickness of the outline. Set to 0 if you want to remove it. + public virtual void SetTextOutline(Color color) + { + Button?.buttonLabelText.SetOutlineColor(color); + } + /// /// A utility function to override the sprite of the button. ///