add: LoadingScene, ProxyNode

This commit is contained in:
h z
2025-02-09 01:07:12 +00:00
parent 15c667c3c4
commit 0a8b275176
10 changed files with 85 additions and 23 deletions

View File

@@ -0,0 +1,30 @@
using Godot;
using Polonium.DataStructures;
using Polonium.Managers;
namespace Polonium.Scenes;
public abstract partial class LoadingScene<T> : Scene
where T : ProgressInfo
{
public Scene AfterLoaded { get; set; }
private double CoolDown { get; set; } = 0;
public LoaderManager<T> Manager { get; set; }
protected abstract void ConsumeProgressInfo(T progressInfo);
public override void _Process(double delta)
{
CoolDown += delta;
if (CoolDown < 1)
return;
CoolDown = 0;
T progress = Manager.QueryProgress();
ConsumeProgressInfo(progress);
if(Manager.Finished)
PoloniumRegistry.Instance.RootScene.SwitchScene(AfterLoaded);
base._Process(delta);
}
}