62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
#pragma warning disable IDE0130
|
|
using Godot;
|
|
using Polonium.Attributes;
|
|
using Polonium.DataStructures;
|
|
using System.Collections.Generic;
|
|
using Polonium.Interfaces;
|
|
|
|
// ReSharper disable once CheckNamespace
|
|
namespace GlobalClasses;
|
|
[GlobalClass]
|
|
[Tool]
|
|
[ProxyNode]
|
|
public partial class PoloniumTextureButton : TextureButton
|
|
{
|
|
[ProxyProperty]
|
|
public virtual TextureSet TextureSet => null;
|
|
|
|
private GlobalRegistry.TextureSetName PrivateTextureSetName { get; set; }
|
|
|
|
[Export]
|
|
public GlobalRegistry.TextureSetName TextureSetName
|
|
{
|
|
get => PrivateTextureSetName;
|
|
set
|
|
{
|
|
PrivateTextureSetName = value;
|
|
TextureSet t = GlobalRegistry.TextureSetMap.GetValueOrDefault(value, null);
|
|
if (t is not null)
|
|
{
|
|
TextureNormal = t.Normal;
|
|
TextureHover = t.Hover;
|
|
TexturePressed = t.Pressed;
|
|
TextureDisabled = t.Disabled;
|
|
TextureFocused = t.Focused;
|
|
}
|
|
}
|
|
}
|
|
|
|
public sealed override void _Ready()
|
|
{
|
|
TextureSet t = TextureSet;
|
|
if (t is null)
|
|
t = GlobalRegistry.TextureSetMap.GetValueOrDefault(TextureSetName, null);
|
|
if (t is not null)
|
|
{
|
|
TextureNormal = t.Normal;
|
|
TextureHover = t.Hover;
|
|
TexturePressed = t.Pressed;
|
|
TextureDisabled = t.Disabled;
|
|
TextureFocused = t.Focused;
|
|
}
|
|
|
|
__Ready();
|
|
base._Ready();
|
|
}
|
|
[ProxyMethod]
|
|
public virtual void __Ready()
|
|
{
|
|
}
|
|
}
|
|
#pragma warning restore IDE0130
|