using System.Numerics; using FFXIVClientStructs.FFXIV.Component.GUI; using KamiToolKit.Timelines; namespace KamiToolKit.Nodes; public unsafe class ScrollBarForegroundButtonNode : ComponentNode { public readonly NineGridNode ButtonTexture; public ScrollBarForegroundButtonNode() { SetInternalComponentType(ComponentType.Button); ButtonTexture = new SimpleNineGridNode { TexturePath = "ui/uld/ScrollBarA.tex", TextureCoordinates = new Vector2(0.0f, 0.0f), TextureSize = new Vector2(8.0f, 16.0f), TopOffset = 4, BottomOffset = 4, }; ButtonTexture.AttachNode(this); Data->Nodes[0] = 0; Data->Nodes[1] = ButtonTexture.NodeId; BuildTimelines(); InitializeComponentEvents(); } protected override void OnSizeChanged() { base.OnSizeChanged(); ButtonTexture.Size = Size; } private void BuildTimelines() { AddTimeline(new TimelineBuilder() .BeginFrameSet(1, 59) .AddLabel(1, 1, AtkTimelineJumpBehavior.Start, 0) .AddLabel(9, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .AddLabel(10, 2, AtkTimelineJumpBehavior.Start, 0) .AddLabel(19, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .AddLabel(20, 3, AtkTimelineJumpBehavior.Start, 0) .AddLabel(29, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .AddLabel(30, 7, AtkTimelineJumpBehavior.Start, 0) .AddLabel(39, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .AddLabel(40, 6, AtkTimelineJumpBehavior.Start, 0) .AddLabel(49, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .AddLabel(50, 4, AtkTimelineJumpBehavior.Start, 0) .AddLabel(59, 0, AtkTimelineJumpBehavior.PlayOnce, 0) .EndFrameSet() .Build() ); ButtonTexture.AddTimeline(new TimelineBuilder() .BeginFrameSet(1, 9) .AddFrame(1, alpha: 255) .AddFrame(1, addColor: new Vector3(0, 0, 0), multiplyColor: new Vector3(100, 100, 100)) .EndFrameSet() .BeginFrameSet(10, 19) .AddFrame(10, alpha: 255) .AddFrame(12, alpha: 255) .AddFrame(10, addColor: new Vector3(0, 0, 0), multiplyColor: new Vector3(100, 100, 100)) .AddFrame(12, addColor: new Vector3(16, 16, 16), multiplyColor: new Vector3(100, 100, 100)) .EndFrameSet() .BeginFrameSet(20, 29) .AddFrame(20, alpha: 255) .AddFrame(20, addColor: new Vector3(16, 16, 16), multiplyColor: new Vector3(100, 100, 100)) .EndFrameSet() .BeginFrameSet(30, 39) .AddFrame(30, alpha: 178) .AddFrame(30, addColor: new Vector3(0, 0, 0), multiplyColor: new Vector3(50, 50, 50)) .EndFrameSet() .BeginFrameSet(40, 49) .AddFrame(40, alpha: 255) .AddFrame(40, addColor: new Vector3(16, 16, 16), multiplyColor: new Vector3(100, 100, 100)) .EndFrameSet() .BeginFrameSet(50, 59) .AddFrame(50, alpha: 255) .AddFrame(52, alpha: 255) .AddFrame(50, addColor: new Vector3(16, 16, 16), multiplyColor: new Vector3(100, 100, 100)) .AddFrame(52, addColor: new Vector3(0, 0, 0), multiplyColor: new Vector3(100, 100, 100)) .EndFrameSet() .Build() ); } }