using System.Numerics; using FFXIVClientStructs.FFXIV.Component.GUI; using KamiToolKit.Classes; using Lumina.Text.ReadOnly; namespace KamiToolKit.Nodes; public unsafe class TextButtonNode : ButtonBase { public readonly NineGridNode BackgroundNode; public readonly TextNode LabelNode; public TextButtonNode() { BackgroundNode = new SimpleNineGridNode { TexturePath = "ui/uld/ButtonA.tex", TextureSize = new Vector2(100.0f, 28.0f), LeftOffset = 16.0f, RightOffset = 16.0f, }; BackgroundNode.AttachNode(this); LabelNode = new TextNode { AlignmentType = AlignmentType.Center, Position = new Vector2(16.0f, 3.0f), TextColor = ColorHelper.GetColor(50), }; LabelNode.AttachNode(this); LoadTimelines(); Data->Nodes[0] = LabelNode.NodeId; Data->Nodes[1] = BackgroundNode.NodeId; InitializeComponentEvents(); } public ReadOnlySeString String { get => LabelNode.String; set => LabelNode.String = value; } protected override void OnSizeChanged() { base.OnSizeChanged(); LabelNode.Size = new Vector2(Width - 32.0f, Height - 8.0f); BackgroundNode.Size = Size; } private void LoadTimelines() => LoadThreePartTimelines(this, BackgroundNode, LabelNode, new Vector2(16.0f, 3.0f)); }