30 lines
764 B
C#
30 lines
764 B
C#
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);
|
|
}
|
|
} |