Initial commit: AetherBags + KamiToolKit for FC Gitea
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using System.Numerics;
|
||||
|
||||
namespace KamiToolKit.Nodes;
|
||||
|
||||
/// <summary>
|
||||
/// Uses a GameIconId to display that icon as the decorator for the button.
|
||||
/// </summary>
|
||||
public class IconButtonNode : ButtonBase {
|
||||
|
||||
public readonly NineGridNode BackgroundNode;
|
||||
public readonly IconImageNode ImageNode;
|
||||
|
||||
public IconButtonNode() {
|
||||
BackgroundNode = new SimpleNineGridNode {
|
||||
TexturePath = "ui/uld/BgParts.tex",
|
||||
TextureSize = new Vector2(32.0f, 32.0f),
|
||||
TextureCoordinates = new Vector2(33.0f, 65.0f),
|
||||
TopOffset = 8.0f,
|
||||
LeftOffset = 8.0f,
|
||||
RightOffset = 8.0f,
|
||||
BottomOffset = 8.0f,
|
||||
};
|
||||
BackgroundNode.AttachNode(this);
|
||||
|
||||
ImageNode = new IconImageNode {
|
||||
TextureSize = new Vector2(32.0f, 32.0f),
|
||||
FitTexture = true,
|
||||
};
|
||||
ImageNode.AttachNode(this);
|
||||
|
||||
LoadTimelines();
|
||||
|
||||
InitializeComponentEvents();
|
||||
}
|
||||
|
||||
public uint IconId {
|
||||
get => ImageNode.IconId;
|
||||
set => ImageNode.IconId = value;
|
||||
}
|
||||
|
||||
protected override void OnSizeChanged() {
|
||||
base.OnSizeChanged();
|
||||
|
||||
ImageNode.Size = Size - new Vector2(16.0f, 16.0f);
|
||||
ImageNode.Position = BackgroundNode.Position + new Vector2(BackgroundNode.LeftOffset, BackgroundNode.TopOffset);
|
||||
BackgroundNode.Size = Size;
|
||||
}
|
||||
|
||||
private void LoadTimelines()
|
||||
=> LoadThreePartTimelines(this, BackgroundNode, ImageNode, new Vector2(8.0f, 8.0f));
|
||||
}
|
||||
Reference in New Issue
Block a user