draft: texture button
This commit is contained in:
40
GlobalClasses/Nodes/Buttons/PoloniumTextureButton.cs
Normal file
40
GlobalClasses/Nodes/Buttons/PoloniumTextureButton.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Godot;
|
||||
using Polonium.Attributes;
|
||||
using Polonium.DataStructures;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace GlobalClasses;
|
||||
[GlobalClass]
|
||||
[Tool]
|
||||
[ProxyNode]
|
||||
public partial class PoloniumTextureButton : TextureButton
|
||||
{
|
||||
[ProxyProperty]
|
||||
public virtual TextureSet TextureSet => null;
|
||||
|
||||
[Export]
|
||||
public GlobalRegistry.TextureSetName TextureSetName { get; set; }
|
||||
|
||||
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()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -20,9 +20,16 @@ public partial class CameraScene : Scene
|
||||
get => Camera.Zoom.X;
|
||||
set => Camera.Zoom = value * Vector2.One;
|
||||
}
|
||||
public override void _Ready()
|
||||
|
||||
[ProxyMethod]
|
||||
public virtual void __Ready()
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void _Ready()
|
||||
{
|
||||
Camera = GetNode<Camera2D>("Camera");
|
||||
__Ready();
|
||||
base._Ready();
|
||||
}
|
||||
protected void ZoomIn() => Zoom = Mathf.Max(Zoom * (1 + ZoomRate), MaxZoom);
|
||||
@@ -12,7 +12,7 @@ public partial class DissolveScene : Scene
|
||||
private bool Finished { get; set; } = false;
|
||||
private bool Terminated { get; set; } = false;
|
||||
|
||||
public override void _Process(double delta)
|
||||
public sealed override void _Process(double delta)
|
||||
{
|
||||
if(Finished && !Terminated)
|
||||
{
|
||||
@@ -21,15 +21,15 @@ public partial class DissolveScene : Scene
|
||||
return;
|
||||
}
|
||||
|
||||
Process(delta);
|
||||
__Process(delta);
|
||||
base._Process(delta);
|
||||
}
|
||||
[ProxyMethod]
|
||||
public virtual void Enter()
|
||||
public virtual void __Enter()
|
||||
{
|
||||
}
|
||||
[ProxyMethod]
|
||||
public virtual void Process(double delta)
|
||||
public virtual void __Process(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public partial class DissolveScene : Scene
|
||||
{
|
||||
Finished = false;
|
||||
Terminated = false;
|
||||
Enter();
|
||||
__Enter();
|
||||
base._EnterTree();
|
||||
}
|
||||
}
|
||||
@@ -19,28 +19,43 @@ public partial class RootScene : Scene
|
||||
CurrentScene = scene;
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
GlobalRegistry.RootScene = this;
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
[ProxyMethod]
|
||||
public virtual void Enter()
|
||||
public virtual void __Enter()
|
||||
{
|
||||
}
|
||||
|
||||
public override void _EnterTree()
|
||||
[ProxyMethod]
|
||||
public virtual void __Ready()
|
||||
{
|
||||
Enter();
|
||||
}
|
||||
|
||||
[ProxyMethod]
|
||||
public virtual void __Process(double delta)
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override void _EnterTree()
|
||||
{
|
||||
GlobalRegistry.Prepare();
|
||||
GlobalRegistry.Start();
|
||||
__Enter();
|
||||
base._EnterTree();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
public sealed override void _Process(double delta)
|
||||
{
|
||||
if(!GlobalRegistry.Paused)
|
||||
foreach (ITimeConsumer tc in GlobalRegistry.TimeConsumers)
|
||||
tc.Process(delta);
|
||||
__Process(delta);
|
||||
base._Process(delta);
|
||||
}
|
||||
|
||||
public sealed override void _Ready()
|
||||
{
|
||||
GlobalRegistry.RootScene = this;
|
||||
__Ready();
|
||||
base._Ready();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user