Files
AetherBags/KamiToolKit/Nodes/Basic/TextNineGridNode.cs
T
KnackAtNite 8db4ce6094
Debug Build and Test / Build against Latest Dalamud (push) Has been cancelled
Debug Build and Test / Build against Staging Dalamud (push) Has been cancelled
Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 14:46:31 -05:00

94 lines
2.6 KiB
C#

using System.Numerics;
using FFXIVClientStructs.FFXIV.Component.GUI;
using KamiToolKit.Classes;
using Lumina.Text.ReadOnly;
namespace KamiToolKit.Nodes;
public unsafe class TextNineGridNode : ComponentNode<AtkComponentTextNineGrid, AtkUldComponentDataTextNineGrid> {
public readonly NineGridNode BackgroundNineGrid;
public readonly TextNode TextNode;
public TextNineGridNode() {
SetInternalComponentType(ComponentType.TextNineGrid);
BackgroundNineGrid = new SimpleNineGridNode {
TexturePath = "ui/uld/ToolTipS.tex",
TextureCoordinates = new Vector2(0.0f, 0.0f),
TextureSize = new Vector2(32.0f, 24.0f),
TopOffset = 10,
BottomOffset = 10,
LeftOffset = 15,
RightOffset = 15,
};
BackgroundNineGrid.AttachNode(this);
TextNode = new TextNode {
TextOutlineColor = ColorHelper.GetColor(55),
Position = new Vector2(4.0f, 1.0f),
FontSize = 23,
AlignmentType = AlignmentType.Right,
FontType = FontType.TrumpGothic,
TextFlags = TextFlags.Edge,
};
TextNode.AttachNode(this);
Data->Nodes[0] = TextNode.NodeId;
Data->Nodes[1] = 0;
InitializeComponentEvents();
// Disable ParentNode else SetText
// causes this node to resize itself incorrectly.
Component->ParentNode = null;
}
public ReadOnlySeString String {
get => TextNode.String;
set => Component->SetText(value);
}
public int Number {
get => int.Parse(TextNode.String);
set => TextNode.String = value.ToString();
}
public int FontSize {
get => (int)TextNode.FontSize;
set => TextNode.FontSize = (uint)value;
}
public FontType FontType {
get => TextNode.FontType;
set => TextNode.FontType = value;
}
public Vector4 TextOutlineColor {
get => TextNode.TextOutlineColor;
set => TextNode.TextOutlineColor = value;
}
public Vector4 TextColor {
get => TextNode.TextColor;
set => TextNode.TextColor = value;
}
public TextFlags TextFlags {
get => TextNode.TextFlags;
set => TextNode.TextFlags = value;
}
public AlignmentType AlignmentType {
get => TextNode.AlignmentType;
set => TextNode.AlignmentType = value;
}
protected override void OnSizeChanged() {
base.OnSizeChanged();
BackgroundNineGrid.Size = Size;
TextNode.Size = Size - new Vector2(8.0f, 2.0f);
}
}