diff --git a/.idea/.idea.Polonium/.idea/vcs.xml b/.idea/.idea.Polonium/.idea/vcs.xml
index 62477ea..fa68d10 100644
--- a/.idea/.idea.Polonium/.idea/vcs.xml
+++ b/.idea/.idea.Polonium/.idea/vcs.xml
@@ -3,6 +3,5 @@
-
\ No newline at end of file
diff --git a/Polonium.csproj b/Polonium.csproj
index c31c712..b46706b 100644
--- a/Polonium.csproj
+++ b/Polonium.csproj
@@ -8,7 +8,7 @@
false
Polonium
true
- 0.0.4
+ 0.0.8
Hangman
diff --git a/Polonium.sln.DotSettings.user b/Polonium.sln.DotSettings.user
index 0e44675..c7012a2 100644
--- a/Polonium.sln.DotSettings.user
+++ b/Polonium.sln.DotSettings.user
@@ -1,7 +1,9 @@
-
+
ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
- ForceIncluded
\ No newline at end of file
+ ForceIncluded
+ True
+ True
\ No newline at end of file
diff --git a/src/Attributes/ProxyNode.cs b/src/Attributes/ProxyNode.cs
new file mode 100644
index 0000000..3b9bfb2
--- /dev/null
+++ b/src/Attributes/ProxyNode.cs
@@ -0,0 +1,6 @@
+namespace Polonium.Attributes;
+[AttributeUsage(AttributeTargets.Class)]
+public class ProxyNode : Attribute
+{
+
+}
\ No newline at end of file
diff --git a/src/DataStructures/ProgressInfo.cs b/src/DataStructures/ProgressInfo.cs
new file mode 100644
index 0000000..55b0f20
--- /dev/null
+++ b/src/DataStructures/ProgressInfo.cs
@@ -0,0 +1,9 @@
+namespace Polonium.DataStructures;
+
+public abstract class ProgressInfo
+{
+ public int CurrentTaskIndex { get; set; }
+ public int TotalTasks { get; set; }
+ public abstract float Progress { get; }
+ public string Message { get; set; }
+}
\ No newline at end of file
diff --git a/src/Managers/LoaderManager.cs b/src/Managers/LoaderManager.cs
new file mode 100644
index 0000000..d6489ca
--- /dev/null
+++ b/src/Managers/LoaderManager.cs
@@ -0,0 +1,29 @@
+using Polonium.DataStructures;
+
+namespace Polonium.Managers;
+
+public abstract class LoaderManager
+ where T : ProgressInfo
+{
+ public bool Started { get; private set; } = false;
+ public bool Finished { get; protected set; } = false;
+ public void Start()
+ {
+ if(Started)
+ throw new InvalidOperationException("Loader is already started");
+ Started = true;
+ Thread load = new Thread(LoadTask);
+ load.Start();
+
+ }
+
+ public abstract T QueryProgress();
+
+ public abstract void Load();
+
+ public void LoadTask()
+ {
+ Load();
+ Finished = true;
+ }
+}
\ No newline at end of file
diff --git a/src/Scenes/CameraScene.cs b/src/Scenes/CameraScene.cs
index bbc4ab9..171beb8 100644
--- a/src/Scenes/CameraScene.cs
+++ b/src/Scenes/CameraScene.cs
@@ -1,8 +1,8 @@
using Godot;
+using Polonium.Attributes;
namespace Polonium.Scenes;
-[GlobalClass]
-[Tool]
+[ProxyNode]
public partial class CameraScene : Scene
{
private Camera2D Camera { get; set; }
@@ -20,8 +20,7 @@ public partial class CameraScene : Scene
}
public override void _Ready()
{
- Camera = new Camera2D();
- AddChild(Camera);
+ Camera = GetNode("Camera");
base._Ready();
}
protected void ZoomIn() => Zoom = Mathf.Max(Zoom * (1 + ZoomRate), MaxZoom);
diff --git a/src/Scenes/LayerCameraScene.cs b/src/Scenes/LayerCameraScene.cs
deleted file mode 100644
index 6f1d6fc..0000000
--- a/src/Scenes/LayerCameraScene.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-using Godot;
-
-namespace Polonium.Scenes;
-[GlobalClass]
-public partial class LayerCameraScene : CameraScene
-{
- private Node2D LayerHolder { get; set; }
-
- public override void _Ready()
- {
- LayerHolder = new Node2D();
- base._Ready();
- }
-}
\ No newline at end of file
diff --git a/src/Scenes/LoadingScene.cs b/src/Scenes/LoadingScene.cs
new file mode 100644
index 0000000..af4c8ea
--- /dev/null
+++ b/src/Scenes/LoadingScene.cs
@@ -0,0 +1,30 @@
+using Godot;
+using Polonium.DataStructures;
+using Polonium.Managers;
+
+namespace Polonium.Scenes;
+
+public abstract partial class LoadingScene : Scene
+ where T : ProgressInfo
+{
+ public Scene AfterLoaded { get; set; }
+
+ private double CoolDown { get; set; } = 0;
+
+ public LoaderManager 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);
+ }
+}
\ No newline at end of file
diff --git a/src/Scenes/RootScene.cs b/src/Scenes/RootScene.cs
index 4d07b6c..4ee35f2 100644
--- a/src/Scenes/RootScene.cs
+++ b/src/Scenes/RootScene.cs
@@ -1,6 +1,8 @@
using Godot;
+using Polonium.Attributes;
+
namespace Polonium.Scenes;
-[GlobalClass]
+[ProxyNode]
public partial class RootScene : Node2D
{
private Scene CurrentScene { get; set; }