diff --git a/.idea/.idea.godot-host-test/.idea/libraries/GdSdk.xml b/.idea/.idea.godot-host-test/.idea/libraries/GdSdk.xml
index 0059883..04a2e8b 100644
--- a/.idea/.idea.godot-host-test/.idea/libraries/GdSdk.xml
+++ b/.idea/.idea.godot-host-test/.idea/libraries/GdSdk.xml
@@ -3,7 +3,7 @@
-
+
\ No newline at end of file
diff --git a/Game/GameServiceSource.cs b/Game/GameServiceSource.cs
deleted file mode 100644
index ea88273..0000000
--- a/Game/GameServiceSource.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using Godot;
-using GodotHostTest.GodotDI;
-using GodotHostTest.Interfaces;
-using OwofGames.GodotLume;
-
-namespace GodotHostTest.Game;
-
-public partial class GameServiceSource : RootServiceSource
-{
- [Export] private LevelsData _levelsData = null!;
-
- protected override void Configure(Builder builder)
- {
- builder
- .AddSingleton()
- .AddInstance(_levelsData)
- .AddValueProvider()
- .AddValueProvider()
- .AddValueProvider();
- }
-}
\ No newline at end of file
diff --git a/Game/CurrentLevel.cs b/Game/Level/CurrentLevel.cs
similarity index 84%
rename from Game/CurrentLevel.cs
rename to Game/Level/CurrentLevel.cs
index c8ff99a..ea1b3a0 100644
--- a/Game/CurrentLevel.cs
+++ b/Game/Level/CurrentLevel.cs
@@ -1,6 +1,6 @@
using GodotHostTest.Interfaces;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Level;
public class CurrentLevel : ICurrentLevel
{
diff --git a/Game/CurrentLevel.cs.uid b/Game/Level/CurrentLevel.cs.uid
similarity index 100%
rename from Game/CurrentLevel.cs.uid
rename to Game/Level/CurrentLevel.cs.uid
diff --git a/Game/LevelData.cs b/Game/Level/LevelData.cs
similarity index 87%
rename from Game/LevelData.cs
rename to Game/Level/LevelData.cs
index e977a06..7a30ac2 100644
--- a/Game/LevelData.cs
+++ b/Game/Level/LevelData.cs
@@ -2,7 +2,7 @@ using System;
using Godot;
using GodotHostTest.Interfaces;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Level;
[GlobalClass]
public partial class LevelData : Resource, ILevel
diff --git a/Game/LevelData.cs.uid b/Game/Level/LevelData.cs.uid
similarity index 100%
rename from Game/LevelData.cs.uid
rename to Game/Level/LevelData.cs.uid
diff --git a/Game/Level/LevelScope.cs b/Game/Level/LevelScope.cs
new file mode 100644
index 0000000..d69299b
--- /dev/null
+++ b/Game/Level/LevelScope.cs
@@ -0,0 +1,5 @@
+using OwofGames.GodotLume;
+
+namespace GodotHostTest.Game.Level;
+
+public class LevelScope : RootScope;
\ No newline at end of file
diff --git a/Game/LevelScope.cs.uid b/Game/Level/LevelScope.cs.uid
similarity index 100%
rename from Game/LevelScope.cs.uid
rename to Game/Level/LevelScope.cs.uid
diff --git a/Game/LevelServiceSource.cs b/Game/Level/LevelServiceSource.cs
similarity index 72%
rename from Game/LevelServiceSource.cs
rename to Game/Level/LevelServiceSource.cs
index bcfbf58..c1192c7 100644
--- a/Game/LevelServiceSource.cs
+++ b/Game/Level/LevelServiceSource.cs
@@ -1,9 +1,11 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
+using GodotHostTest.Game.Target;
using GodotHostTest.Interfaces;
using OwofGames.GodotLume;
+using ServiceSource = GodotHostTest.AetherBind.ServiceSource;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Level;
public partial class LevelServiceSource : ServiceSource
{
diff --git a/Game/LevelServiceSource.cs.uid b/Game/Level/LevelServiceSource.cs.uid
similarity index 100%
rename from Game/LevelServiceSource.cs.uid
rename to Game/Level/LevelServiceSource.cs.uid
diff --git a/Game/Level/LevelServices.cs b/Game/Level/LevelServices.cs
new file mode 100644
index 0000000..23747cc
--- /dev/null
+++ b/Game/Level/LevelServices.cs
@@ -0,0 +1,21 @@
+using GodotHostTest.AetherBind;
+using GodotHostTest.Interfaces;
+using OwofGames.GodotLume;
+
+namespace GodotHostTest.Game.Level;
+
+public static class LevelServices
+{
+ public static void AddLevelServices(this Builder builder, LevelsData levelsData)
+ {
+ builder
+ // current level / level data management
+ .AddSingleton()
+ .AddInstance(levelsData)
+ // value providers to send data into level scope
+ .AddValueProvider()
+ // value provider for level scope setup
+ .AddValueProvider()
+ .AddValueProvider();
+ }
+}
\ No newline at end of file
diff --git a/Game/LevelsData.cs b/Game/Level/LevelsData.cs
similarity index 89%
rename from Game/LevelsData.cs
rename to Game/Level/LevelsData.cs
index 5cb5d53..0065161 100644
--- a/Game/LevelsData.cs
+++ b/Game/Level/LevelsData.cs
@@ -1,7 +1,7 @@
using Godot;
using GodotHostTest.Interfaces;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Level;
[GlobalClass]
public partial class LevelsData : Resource, ILevelDataProvider
diff --git a/Game/LevelsData.cs.uid b/Game/Level/LevelsData.cs.uid
similarity index 100%
rename from Game/LevelsData.cs.uid
rename to Game/Level/LevelsData.cs.uid
diff --git a/Game/LevelScope.cs b/Game/LevelScope.cs
deleted file mode 100644
index 295b645..0000000
--- a/Game/LevelScope.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-using OwofGames.GodotLume;
-
-namespace GodotHostTest.Game;
-
-public class LevelScope : RootScope;
\ No newline at end of file
diff --git a/Game/Projectile.cs b/Game/Projectile/Projectile.cs
similarity index 64%
rename from Game/Projectile.cs
rename to Game/Projectile/Projectile.cs
index 80896a9..95f7dfe 100644
--- a/Game/Projectile.cs
+++ b/Game/Projectile/Projectile.cs
@@ -1,16 +1,18 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
using GodotHostTest.Helpers;
using GodotHostTest.Interfaces;
using Microsoft.Extensions.Logging;
+using OwofGames.AetherBind;
using R3;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Projectile;
+[Injected]
public partial class Projectile : Node2D
{
- [Inject] private readonly ILogger _logger = null!;
- [Inject] private readonly IValueGetter _targetSpawner = null!;
+ [Inject] private ILogger _logger = null!;
+ [Inject] private IValueGetter _targetSpawner = null!;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
diff --git a/Game/Projectile.cs.uid b/Game/Projectile/Projectile.cs.uid
similarity index 100%
rename from Game/Projectile.cs.uid
rename to Game/Projectile/Projectile.cs.uid
diff --git a/Game/Root/GameServiceSource.cs b/Game/Root/GameServiceSource.cs
new file mode 100644
index 0000000..9741cfd
--- /dev/null
+++ b/Game/Root/GameServiceSource.cs
@@ -0,0 +1,16 @@
+using Godot;
+using GodotHostTest.Game.Level;
+using OwofGames.GodotLume;
+using RootServiceSource = GodotHostTest.AetherBind.RootServiceSource;
+
+namespace GodotHostTest.Game.Root;
+
+public partial class GameServiceSource : RootServiceSource
+{
+ [Export] private LevelsData _levelsData = null!;
+
+ protected override void Configure(Builder builder)
+ {
+ builder.AddLevelServices(_levelsData);
+ }
+}
\ No newline at end of file
diff --git a/Game/GameServiceSource.cs.uid b/Game/Root/GameServiceSource.cs.uid
similarity index 100%
rename from Game/GameServiceSource.cs.uid
rename to Game/Root/GameServiceSource.cs.uid
diff --git a/Game/Root.cs b/Game/Root/Root.cs
similarity index 57%
rename from Game/Root.cs
rename to Game/Root/Root.cs
index 1ac64be..6c100d2 100644
--- a/Game/Root.cs
+++ b/Game/Root/Root.cs
@@ -1,15 +1,17 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
using GodotHostTest.Interfaces;
+using OwofGames.AetherBind;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Root;
+[Injected]
public partial class Root : Node2D
{
- [Inject] private readonly ICurrentLevel _currentLevel = null!;
- [Inject] private readonly ILevelDataProvider _levelDataProvider = null!;
- [Inject] private readonly ISceneInstantiator _sceneInstantiator = null!;
+ [Inject] private ICurrentLevel _currentLevel = null!;
+ [Inject] private ILevelDataProvider _levelDataProvider = null!;
[Export] private PackedScene _levelScene = null!;
+ [Inject] private ISceneInstantiator _sceneInstantiator = null!;
public override void _Ready()
{
diff --git a/Game/Root.cs.uid b/Game/Root/Root.cs.uid
similarity index 100%
rename from Game/Root.cs.uid
rename to Game/Root/Root.cs.uid
diff --git a/Game/Score.cs b/Game/Score/Score.cs
similarity index 81%
rename from Game/Score.cs
rename to Game/Score/Score.cs
index 9c7e2c0..f1f7ced 100644
--- a/Game/Score.cs
+++ b/Game/Score/Score.cs
@@ -1,18 +1,20 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
using GodotHostTest.Helpers;
using GodotHostTest.Interfaces;
+using OwofGames.AetherBind;
using R3;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Score;
+[Injected]
public partial class Score : Control, IScore
{
- [Inject] private readonly IValueGetter _targetSpawner = null!;
[Export] private AnimationPlayer _animationPlayer = null!;
[Export] private Label _label = null!;
private int _score;
+ [Inject] private IValueGetter _targetSpawner = null!;
int IScore.Score => _score;
diff --git a/Game/Score.cs.uid b/Game/Score/Score.cs.uid
similarity index 100%
rename from Game/Score.cs.uid
rename to Game/Score/Score.cs.uid
diff --git a/Game/Target.cs b/Game/Target/Target.cs
similarity index 87%
rename from Game/Target.cs
rename to Game/Target/Target.cs
index 03d09a3..e24064a 100644
--- a/Game/Target.cs
+++ b/Game/Target/Target.cs
@@ -1,22 +1,24 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
using GodotHostTest.Interfaces;
+using OwofGames.AetherBind;
using R3;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Target;
+[Injected]
public partial class Target : Node2D, ITarget
{
private readonly Subject _hit = new();
- [Inject] private readonly IValueGetter _targetCollector = null!;
-
private readonly Subject _timedOut = new();
[Export] public required Area2D CollisionArea;
[Export] public required Sprite2D Image;
[Export] public double TimeOutDurationInSeconds;
[Export] public required Timer TimeOutTimer;
+ [Inject] private IValueGetter _targetCollector = null!;
+
public Observable TimedOut => _timedOut.AsObservable();
public Observable Hit => _hit.AsObservable();
diff --git a/Game/Target.cs.uid b/Game/Target/Target.cs.uid
similarity index 100%
rename from Game/Target.cs.uid
rename to Game/Target/Target.cs.uid
diff --git a/Game/TargetSpawner.cs b/Game/Target/TargetSpawner.cs
similarity index 97%
rename from Game/TargetSpawner.cs
rename to Game/Target/TargetSpawner.cs
index 71f9ce9..43f5252 100644
--- a/Game/TargetSpawner.cs
+++ b/Game/Target/TargetSpawner.cs
@@ -4,15 +4,24 @@ using GodotHostTest.Helpers;
using GodotHostTest.Interfaces;
using R3;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Target;
public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
{
+ private readonly List _availableTargets = [];
+
+ private readonly Subject _targetSpawned = new();
[Export] public double TimeBetweenSpawns;
[Export] public required Timer Timer;
- private readonly List _availableTargets = [];
+ public void NewTarget(ITarget target)
+ {
+ _availableTargets.Add(target);
+ target.Hit.Merge(target.TimedOut).Select(_ => target).Subscribe(MakeTargetAvailable).AddTo(this);
+ }
+
+ public Observable TargetSpawned => _targetSpawned.AsObservable();
public override void _Ready()
{
@@ -44,18 +53,9 @@ public partial class TargetSpawner : Node2D, ITargetCollector, ITargetSpawner
_targetSpawned.OnNext(target);
}
- public void NewTarget(ITarget target)
- {
- _availableTargets.Add(target);
- target.Hit.Merge(target.TimedOut).Select(_ => target).Subscribe(MakeTargetAvailable).AddTo(this);
- }
-
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
_targetSpawned.Dispose();
}
-
- private readonly Subject _targetSpawned = new();
- public Observable TargetSpawned => _targetSpawned.AsObservable();
}
\ No newline at end of file
diff --git a/Game/TargetSpawner.cs.uid b/Game/Target/TargetSpawner.cs.uid
similarity index 100%
rename from Game/TargetSpawner.cs.uid
rename to Game/Target/TargetSpawner.cs.uid
diff --git a/Game/Turret.cs b/Game/Turret/Turret.cs
similarity index 61%
rename from Game/Turret.cs
rename to Game/Turret/Turret.cs
index 370af4d..b290b69 100644
--- a/Game/Turret.cs
+++ b/Game/Turret/Turret.cs
@@ -1,12 +1,14 @@
using Godot;
-using GodotHostTest.GodotDI;
+using GodotHostTest.AetherBind;
+using OwofGames.AetherBind;
-namespace GodotHostTest.Game;
+namespace GodotHostTest.Game.Turret;
+[Injected]
public partial class Turret : Sprite2D
{
- [Inject] private readonly ISceneInstantiator _sceneInstantiator = null!;
[Export] private PackedScene _projectilePackedScene = null!;
+ [Inject] private ISceneInstantiator _sceneInstantiator = null!;
public override void _Ready()
{
diff --git a/Game/Turret.cs.uid b/Game/Turret/Turret.cs.uid
similarity index 100%
rename from Game/Turret.cs.uid
rename to Game/Turret/Turret.cs.uid
diff --git a/Game/level.tscn b/Game/level.tscn
index 522fe5e..0f1a040 100644
--- a/Game/level.tscn
+++ b/Game/level.tscn
@@ -1,11 +1,11 @@
[gd_scene format=3 uid="uid://xfd48ep5qi1k"]
-[ext_resource type="Script" uid="uid://dk578xnlxjwrr" path="res://Game/LevelServiceSource.cs" id="1_5saw1"]
+[ext_resource type="Script" uid="uid://dk578xnlxjwrr" path="res://Game/Level/LevelServiceSource.cs" id="1_5saw1"]
[ext_resource type="PackedScene" uid="uid://3v8kq1rfwhmr" path="res://Game/target.tscn" id="1_y7rhs"]
-[ext_resource type="Script" uid="uid://cxfrtglku2gfa" path="res://Game/TargetSpawner.cs" id="2_5saw1"]
-[ext_resource type="Script" uid="uid://bgrjeadxhgmvi" path="res://Game/Score.cs" id="3_spj1u"]
+[ext_resource type="Script" uid="uid://cxfrtglku2gfa" path="res://Game/Target/TargetSpawner.cs" id="2_5saw1"]
+[ext_resource type="Script" uid="uid://bgrjeadxhgmvi" path="res://Game/Score/Score.cs" id="3_spj1u"]
[ext_resource type="Texture2D" uid="uid://y1ros3y7hag2" path="res://icon.svg" id="4_esqs7"]
-[ext_resource type="Script" uid="uid://ce7gnp1lcrrdv" path="res://Game/Turret.cs" id="5_himod"]
+[ext_resource type="Script" uid="uid://ce7gnp1lcrrdv" path="res://Game/Turret/Turret.cs" id="5_himod"]
[ext_resource type="PackedScene" uid="uid://brbufibn7hi3o" path="res://Game/projectile.tscn" id="6_sin03"]
[sub_resource type="Animation" id="Animation_bbjqm"]
@@ -74,7 +74,7 @@ _data = {
[node name="LevelScope" type="Node" parent="." unique_id=1267156771 node_paths=PackedStringArray("_targetSpawner", "InjectedNodes")]
script = ExtResource("1_5saw1")
_targetSpawner = NodePath("../Spawner")
-_serviceScope = "GodotHostTest.Game.LevelScope, godot-host-test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
+_serviceScope = "GodotHostTest.Game.Level.LevelScope, godot-host-test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
InjectedNodes = [NodePath("../Target"), NodePath("../Target2"), NodePath("../Target3"), NodePath("../Target4"), NodePath("../Target5"), NodePath("../Target6"), NodePath("../Score"), NodePath("../Turret")]
[node name="Target" parent="." unique_id=2101558052 instance=ExtResource("1_y7rhs")]
diff --git a/Game/levels_data.tres b/Game/levels_data.tres
index 4998e80..fb20401 100644
--- a/Game/levels_data.tres
+++ b/Game/levels_data.tres
@@ -1,7 +1,7 @@
[gd_resource type="Resource" script_class="LevelsData" format=3 uid="uid://c4ym7vrpgk4e6"]
-[ext_resource type="Script" uid="uid://ywe7vkywrdvk" path="res://Game/LevelData.cs" id="1_bkfnq"]
-[ext_resource type="Script" uid="uid://cl200m5rnkboq" path="res://Game/LevelsData.cs" id="1_e2ehm"]
+[ext_resource type="Script" uid="uid://ywe7vkywrdvk" path="res://Game/Level/LevelData.cs" id="1_bkfnq"]
+[ext_resource type="Script" uid="uid://cl200m5rnkboq" path="res://Game/Level/LevelsData.cs" id="1_e2ehm"]
[sub_resource type="Resource" id="Resource_bbjqm"]
script = ExtResource("1_bkfnq")
diff --git a/addons/GodotDI/BuilderExtensions.cs b/addons/AetherBind/BuilderExtensions.cs
similarity index 95%
rename from addons/GodotDI/BuilderExtensions.cs
rename to addons/AetherBind/BuilderExtensions.cs
index 87d672b..aa9499a 100644
--- a/addons/GodotDI/BuilderExtensions.cs
+++ b/addons/AetherBind/BuilderExtensions.cs
@@ -1,6 +1,6 @@
using OwofGames.GodotLume;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public static class BuilderExtensions
{
diff --git a/addons/GodotDI/BuilderExtensions.cs.uid b/addons/AetherBind/BuilderExtensions.cs.uid
similarity index 100%
rename from addons/GodotDI/BuilderExtensions.cs.uid
rename to addons/AetherBind/BuilderExtensions.cs.uid
diff --git a/addons/GodotDI/Editor/GodotScriptPathCache.cs b/addons/AetherBind/Editor/GodotScriptPathCache.cs
similarity index 98%
rename from addons/GodotDI/Editor/GodotScriptPathCache.cs
rename to addons/AetherBind/Editor/GodotScriptPathCache.cs
index d93a620..5722ff6 100644
--- a/addons/GodotDI/Editor/GodotScriptPathCache.cs
+++ b/addons/AetherBind/Editor/GodotScriptPathCache.cs
@@ -7,7 +7,7 @@ using System.Reflection;
using System.Runtime.Loader;
using Godot;
-namespace GodotHostTest.GodotDI.Editor;
+namespace GodotHostTest.AetherBind.Editor;
///
/// Taken from https://github.com/godotengine/godot-proposals/issues/12294
diff --git a/addons/GodotDI/Editor/GodotScriptPathCache.cs.uid b/addons/AetherBind/Editor/GodotScriptPathCache.cs.uid
similarity index 100%
rename from addons/GodotDI/Editor/GodotScriptPathCache.cs.uid
rename to addons/AetherBind/Editor/GodotScriptPathCache.cs.uid
diff --git a/addons/GodotDI/Editor/Plugin.cs b/addons/AetherBind/Editor/Plugin.cs
similarity index 98%
rename from addons/GodotDI/Editor/Plugin.cs
rename to addons/AetherBind/Editor/Plugin.cs
index 8f10577..cc7e2c9 100644
--- a/addons/GodotDI/Editor/Plugin.cs
+++ b/addons/AetherBind/Editor/Plugin.cs
@@ -2,9 +2,10 @@
using System.Linq;
using System.Reflection;
using Godot;
+using OwofGames.AetherBind;
using Array = Godot.Collections.Array;
-namespace GodotHostTest.GodotDI.Editor;
+namespace GodotHostTest.AetherBind.Editor;
[Tool]
public partial class Plugin : EditorPlugin
diff --git a/addons/GodotDI/Editor/Plugin.cs.uid b/addons/AetherBind/Editor/Plugin.cs.uid
similarity index 100%
rename from addons/GodotDI/Editor/Plugin.cs.uid
rename to addons/AetherBind/Editor/Plugin.cs.uid
diff --git a/addons/GodotDI/Editor/ScopeInspectorPlugin.cs b/addons/AetherBind/Editor/ScopeInspectorPlugin.cs
similarity index 95%
rename from addons/GodotDI/Editor/ScopeInspectorPlugin.cs
rename to addons/AetherBind/Editor/ScopeInspectorPlugin.cs
index da37aa8..fd66147 100644
--- a/addons/GodotDI/Editor/ScopeInspectorPlugin.cs
+++ b/addons/AetherBind/Editor/ScopeInspectorPlugin.cs
@@ -1,7 +1,7 @@
#if TOOLS
using Godot;
-namespace GodotHostTest.GodotDI.Editor;
+namespace GodotHostTest.AetherBind.Editor;
// it's inside ServiceSource so that it can safely access nameof(_serviceScope)
public partial class ScopeInspectorPlugin : EditorInspectorPlugin
diff --git a/addons/GodotDI/Editor/ScopeInspectorPlugin.cs.uid b/addons/AetherBind/Editor/ScopeInspectorPlugin.cs.uid
similarity index 100%
rename from addons/GodotDI/Editor/ScopeInspectorPlugin.cs.uid
rename to addons/AetherBind/Editor/ScopeInspectorPlugin.cs.uid
diff --git a/addons/GodotDI/Editor/ScopePickerEditor.cs b/addons/AetherBind/Editor/ScopePickerEditor.cs
similarity index 98%
rename from addons/GodotDI/Editor/ScopePickerEditor.cs
rename to addons/AetherBind/Editor/ScopePickerEditor.cs
index 6b56a9d..7ca871e 100644
--- a/addons/GodotDI/Editor/ScopePickerEditor.cs
+++ b/addons/AetherBind/Editor/ScopePickerEditor.cs
@@ -3,7 +3,7 @@ using System;
using System.Linq;
using Godot;
-namespace GodotHostTest.GodotDI.Editor;
+namespace GodotHostTest.AetherBind.Editor;
public partial class ScopePickerEditor : EditorProperty
{
diff --git a/addons/GodotDI/Editor/ScopePickerEditor.cs.uid b/addons/AetherBind/Editor/ScopePickerEditor.cs.uid
similarity index 100%
rename from addons/GodotDI/Editor/ScopePickerEditor.cs.uid
rename to addons/AetherBind/Editor/ScopePickerEditor.cs.uid
diff --git a/addons/GodotDI/EnumerableExtensions.cs b/addons/AetherBind/EnumerableExtensions.cs
similarity index 95%
rename from addons/GodotDI/EnumerableExtensions.cs
rename to addons/AetherBind/EnumerableExtensions.cs
index bc5af7f..075ae4e 100644
--- a/addons/GodotDI/EnumerableExtensions.cs
+++ b/addons/AetherBind/EnumerableExtensions.cs
@@ -1,6 +1,6 @@
using System.Collections.Generic;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public static class EnumerableExtensions
{
diff --git a/addons/GodotDI/EnumerableExtensions.cs.uid b/addons/AetherBind/EnumerableExtensions.cs.uid
similarity index 100%
rename from addons/GodotDI/EnumerableExtensions.cs.uid
rename to addons/AetherBind/EnumerableExtensions.cs.uid
diff --git a/addons/GodotDI/ISceneInstantiator.cs b/addons/AetherBind/ISceneInstantiator.cs
similarity index 95%
rename from addons/GodotDI/ISceneInstantiator.cs
rename to addons/AetherBind/ISceneInstantiator.cs
index 2a6a6ca..f016112 100644
--- a/addons/GodotDI/ISceneInstantiator.cs
+++ b/addons/AetherBind/ISceneInstantiator.cs
@@ -1,7 +1,7 @@
using System;
using Godot;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public interface ISceneInstantiator
{
diff --git a/addons/GodotDI/ISceneInstantiator.cs.uid b/addons/AetherBind/ISceneInstantiator.cs.uid
similarity index 100%
rename from addons/GodotDI/ISceneInstantiator.cs.uid
rename to addons/AetherBind/ISceneInstantiator.cs.uid
diff --git a/addons/GodotDI/IValueGetter.cs b/addons/AetherBind/IValueGetter.cs
similarity index 64%
rename from addons/GodotDI/IValueGetter.cs
rename to addons/AetherBind/IValueGetter.cs
index 2fd112c..a4a3d16 100644
--- a/addons/GodotDI/IValueGetter.cs
+++ b/addons/AetherBind/IValueGetter.cs
@@ -1,4 +1,4 @@
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public interface IValueGetter
{
diff --git a/addons/GodotDI/IValueGetter.cs.uid b/addons/AetherBind/IValueGetter.cs.uid
similarity index 100%
rename from addons/GodotDI/IValueGetter.cs.uid
rename to addons/AetherBind/IValueGetter.cs.uid
diff --git a/addons/GodotDI/IValueSetter.cs b/addons/AetherBind/IValueSetter.cs
similarity index 65%
rename from addons/GodotDI/IValueSetter.cs
rename to addons/AetherBind/IValueSetter.cs
index 9663090..54acf08 100644
--- a/addons/GodotDI/IValueSetter.cs
+++ b/addons/AetherBind/IValueSetter.cs
@@ -1,4 +1,4 @@
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public interface IValueSetter
{
diff --git a/addons/GodotDI/IValueSetter.cs.uid b/addons/AetherBind/IValueSetter.cs.uid
similarity index 100%
rename from addons/GodotDI/IValueSetter.cs.uid
rename to addons/AetherBind/IValueSetter.cs.uid
diff --git a/addons/AetherBind/README.md b/addons/AetherBind/README.md
new file mode 100644
index 0000000..b629d3d
--- /dev/null
+++ b/addons/AetherBind/README.md
@@ -0,0 +1,18 @@
+TOC:
+
+- what GodotDI offers (in short):
+ - logging
+ - configuration
+ - possibility to attach extra DI-based services like telemetry)
+ - minimal description of what problems DI tackles
+- minimal example with logging, configuration, decoupling of components
+- how to install
+- creation of the root service source
+ - example
+- scopes
+ - why
+ - definition
+ - deep dive into why it's all done at composition root
+ - using extension methods to split the code as necessary
+ - sending data into a scope
+ - initializing data in the scope
\ No newline at end of file
diff --git a/addons/GodotDI/RootServiceSource.cs b/addons/AetherBind/RootServiceSource.cs
similarity index 98%
rename from addons/GodotDI/RootServiceSource.cs
rename to addons/AetherBind/RootServiceSource.cs
index b53aa86..f86f023 100644
--- a/addons/GodotDI/RootServiceSource.cs
+++ b/addons/AetherBind/RootServiceSource.cs
@@ -5,7 +5,7 @@ using OwofGames.GodotHost;
using OwofGames.GodotLume;
using OwofGames.GodotLume.Microsoft.DependencyInjection;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
///
/// The base class for a root scope. Implement this class and its abstract methods to kick off the DI system.
diff --git a/addons/GodotDI/RootServiceSource.cs.uid b/addons/AetherBind/RootServiceSource.cs.uid
similarity index 100%
rename from addons/GodotDI/RootServiceSource.cs.uid
rename to addons/AetherBind/RootServiceSource.cs.uid
diff --git a/addons/GodotDI/SceneInstantiator.cs b/addons/AetherBind/SceneInstantiator.cs
similarity index 96%
rename from addons/GodotDI/SceneInstantiator.cs
rename to addons/AetherBind/SceneInstantiator.cs
index 26128d0..58791e3 100644
--- a/addons/GodotDI/SceneInstantiator.cs
+++ b/addons/AetherBind/SceneInstantiator.cs
@@ -4,7 +4,7 @@ using Godot;
using Microsoft.Extensions.Logging;
using OwofGames.GodotLume;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
internal class SceneInstantiator(IProvider provider) : ISceneInstantiator
{
diff --git a/addons/GodotDI/SceneInstantiator.cs.uid b/addons/AetherBind/SceneInstantiator.cs.uid
similarity index 100%
rename from addons/GodotDI/SceneInstantiator.cs.uid
rename to addons/AetherBind/SceneInstantiator.cs.uid
diff --git a/addons/GodotDI/SceneInstantiatorExtensions.cs b/addons/AetherBind/SceneInstantiatorExtensions.cs
similarity index 96%
rename from addons/GodotDI/SceneInstantiatorExtensions.cs
rename to addons/AetherBind/SceneInstantiatorExtensions.cs
index 9fe431d..edd1d0f 100644
--- a/addons/GodotDI/SceneInstantiatorExtensions.cs
+++ b/addons/AetherBind/SceneInstantiatorExtensions.cs
@@ -1,7 +1,7 @@
using System;
using Godot;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public static class SceneInstantiatorExtensions
{
diff --git a/addons/GodotDI/SceneInstantiatorExtensions.cs.uid b/addons/AetherBind/SceneInstantiatorExtensions.cs.uid
similarity index 100%
rename from addons/GodotDI/SceneInstantiatorExtensions.cs.uid
rename to addons/AetherBind/SceneInstantiatorExtensions.cs.uid
diff --git a/addons/GodotDI/ScopeTypesAndNames.cs b/addons/AetherBind/ScopeTypesAndNames.cs
similarity index 98%
rename from addons/GodotDI/ScopeTypesAndNames.cs
rename to addons/AetherBind/ScopeTypesAndNames.cs
index a834ea7..199a322 100644
--- a/addons/GodotDI/ScopeTypesAndNames.cs
+++ b/addons/AetherBind/ScopeTypesAndNames.cs
@@ -7,7 +7,7 @@ using System.Runtime.Loader;
using Godot;
using OwofGames.GodotLume;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
public static class ScopeTypesAndNames
{
diff --git a/addons/GodotDI/ScopeTypesAndNames.cs.uid b/addons/AetherBind/ScopeTypesAndNames.cs.uid
similarity index 100%
rename from addons/GodotDI/ScopeTypesAndNames.cs.uid
rename to addons/AetherBind/ScopeTypesAndNames.cs.uid
diff --git a/addons/GodotDI/ServiceSource.cs b/addons/AetherBind/ServiceSource.cs
similarity index 55%
rename from addons/GodotDI/ServiceSource.cs
rename to addons/AetherBind/ServiceSource.cs
index b0fc86f..76cb2ae 100644
--- a/addons/GodotDI/ServiceSource.cs
+++ b/addons/AetherBind/ServiceSource.cs
@@ -1,18 +1,18 @@
using System;
using System.Linq;
-using System.Reflection;
using Godot;
using Microsoft.Extensions.Logging;
+using OwofGames.AetherBind;
using OwofGames.GodotLume;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
-[Icon("res://addons/GodotDI/ServiceSource.svg")]
+[Icon("res://addons/AetherBind/ServiceSource.svg")]
public partial class ServiceSource : Node
{
private static readonly string RootScopeQualifiedName = typeof(RootScope).AssemblyQualifiedName!;
- [Export] private string _serviceScope = RootScopeQualifiedName;
[Export] protected Node?[] InjectedNodes = [];
+ [Export] private string _serviceScope = RootScopeQualifiedName;
internal void ResolveInjectedNodes(IProvider provider, Delegate? onScopeCreated)
{
@@ -25,7 +25,7 @@ public partial class ServiceSource : Node
var serviceScope = ScopeTypesAndNames.GetType(_serviceScope);
provider = provider.GetScopedProvider(serviceScope);
// invoke onScopeCreated, if present
- // TODO: replace with a source code generation by turning this method private partial with Action argument, and every invocation site calls the necessary provider.Get<...> to build the argument list
+ // TODO: replace with a source code generation by turning this method private with Action argument, and every invocation site calls the necessary provider.Get<...> to build the argument list
if (onScopeCreated != null)
{
var parameters = onScopeCreated.Method
@@ -43,37 +43,42 @@ public partial class ServiceSource : Node
}
// resolve the injected nodes against the chosen service provider
- // TODO: move to source generator, make it the only way for injection
foreach (var node in InjectedNodes)
{
if (node == null) continue;
logger.LogTrace("Injecting {Node}.", node.Name);
- var nodeType = node.GetType();
- foreach (var field in nodeType
- .GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
+
+ if (node is IInjectable injectable)
{
- if (field.GetCustomAttribute() == null) continue;
- var fieldType = field.FieldType;
- var service = provider.Get(fieldType);
- field.SetValue(node, service);
+ injectable.Inject(provider);
}
- foreach (var method in nodeType.GetMethods(BindingFlags.Instance | BindingFlags.Public |
- BindingFlags.NonPublic))
- {
- if (method.GetCustomAttribute() == null) continue;
- var parameters = method.GetParameters();
- var values = new object?[parameters.Length];
- var i = 0;
- foreach (var parameter in parameters)
- {
- var parameterType = parameter.ParameterType;
- var service = provider.Get(parameterType);
- values[i++] = service;
- }
-
- method.Invoke(node, values);
- }
+ // var nodeType = node.GetType();
+ // foreach (var field in nodeType
+ // .GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic))
+ // {
+ // if (field.GetCustomAttribute() == null) continue;
+ // var fieldType = field.FieldType;
+ // var service = provider.Get(fieldType);
+ // field.SetValue(node, service);
+ // }
+ //
+ // foreach (var method in nodeType.GetMethods(BindingFlags.Instance | BindingFlags.Public |
+ // BindingFlags.NonPublic))
+ // {
+ // if (method.GetCustomAttribute() == null) continue;
+ // var parameters = method.GetParameters();
+ // var values = new object?[parameters.Length];
+ // var i = 0;
+ // foreach (var parameter in parameters)
+ // {
+ // var parameterType = parameter.ParameterType;
+ // var service = provider.Get(parameterType);
+ // values[i++] = service;
+ // }
+ //
+ // method.Invoke(node, values);
+ // }
}
}
diff --git a/addons/GodotDI/ServiceSource.cs.uid b/addons/AetherBind/ServiceSource.cs.uid
similarity index 100%
rename from addons/GodotDI/ServiceSource.cs.uid
rename to addons/AetherBind/ServiceSource.cs.uid
diff --git a/addons/GodotDI/ServiceSource.svg b/addons/AetherBind/ServiceSource.svg
similarity index 100%
rename from addons/GodotDI/ServiceSource.svg
rename to addons/AetherBind/ServiceSource.svg
diff --git a/addons/GodotDI/ServiceSource.svg.import b/addons/AetherBind/ServiceSource.svg.import
similarity index 77%
rename from addons/GodotDI/ServiceSource.svg.import
rename to addons/AetherBind/ServiceSource.svg.import
index fa5c5e7..7597bcf 100644
--- a/addons/GodotDI/ServiceSource.svg.import
+++ b/addons/AetherBind/ServiceSource.svg.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://ce5hi46doaiv8"
-path="res://.godot/imported/ServiceSource.svg-ca2976082d4f895e226f23d45377b764.ctex"
+path="res://.godot/imported/ServiceSource.svg-22939ab8c3bebd4d414fabd470fcc1cf.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://addons/GodotDI/ServiceSource.svg"
-dest_files=["res://.godot/imported/ServiceSource.svg-ca2976082d4f895e226f23d45377b764.ctex"]
+source_file="res://addons/AetherBind/ServiceSource.svg"
+dest_files=["res://.godot/imported/ServiceSource.svg-22939ab8c3bebd4d414fabd470fcc1cf.ctex"]
[params]
diff --git a/addons/GodotDI/ValueProvider.cs b/addons/AetherBind/ValueProvider.cs
similarity index 97%
rename from addons/GodotDI/ValueProvider.cs
rename to addons/AetherBind/ValueProvider.cs
index 9d49640..bc2e238 100644
--- a/addons/GodotDI/ValueProvider.cs
+++ b/addons/AetherBind/ValueProvider.cs
@@ -1,6 +1,6 @@
using System;
-namespace GodotHostTest.GodotDI;
+namespace GodotHostTest.AetherBind;
///
/// An object that allows communication through scopes, by providing a couple getter/setter that can be injected in
diff --git a/addons/GodotDI/ValueProvider.cs.uid b/addons/AetherBind/ValueProvider.cs.uid
similarity index 100%
rename from addons/GodotDI/ValueProvider.cs.uid
rename to addons/AetherBind/ValueProvider.cs.uid
diff --git a/addons/GodotDI/plugin.cfg b/addons/AetherBind/plugin.cfg
similarity index 82%
rename from addons/GodotDI/plugin.cfg
rename to addons/AetherBind/plugin.cfg
index 8e61c65..7b7a475 100644
--- a/addons/GodotDI/plugin.cfg
+++ b/addons/AetherBind/plugin.cfg
@@ -1,6 +1,6 @@
[plugin]
-name="GodotDI"
+name="AetherBind"
description=""
author="owof games"
version="0.1"
diff --git a/addons/GodotDI/InjectAttribute.cs b/addons/GodotDI/InjectAttribute.cs
deleted file mode 100644
index c96462e..0000000
--- a/addons/GodotDI/InjectAttribute.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-using System;
-
-namespace GodotHostTest.GodotDI;
-
-[AttributeUsage(AttributeTargets.Field | AttributeTargets.Method)]
-public class InjectAttribute: Attribute;
\ No newline at end of file
diff --git a/addons/GodotDI/InjectAttribute.cs.uid b/addons/GodotDI/InjectAttribute.cs.uid
deleted file mode 100644
index d63b7fb..0000000
--- a/addons/GodotDI/InjectAttribute.cs.uid
+++ /dev/null
@@ -1 +0,0 @@
-uid://mshffj1jlgi7
diff --git a/godot-host-test.csproj b/godot-host-test.csproj
index 9a1ffb4..f70202f 100644
--- a/godot-host-test.csproj
+++ b/godot-host-test.csproj
@@ -1,34 +1,40 @@
-
- net8.0
- net9.0
- true
- GodotHostTest
- enable
-
-
-
-
-
-
- ..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotHost.dll
-
-
- ..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotLogger.dll
-
-
-
-
-
-
-
-
-
-
- ..\OwofGames.Godot\OwofGames.GodotLume\bin\Debug\net8.0\OwofGames.GodotLume.dll
-
-
- ..\OwofGames.Godot\OwofGames.GodotLume.Microsoft.DependencyInjection\bin\Debug\net8.0\OwofGames.GodotLume.Microsoft.DependencyInjection.dll
-
-
+
+ net8.0
+ net9.0
+ true
+ GodotHostTest
+ enable
+
+
+
+
+
+
+ ..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotHost.dll
+
+
+ ..\OwofGames.Godot\OwofGames.GodotHost\bin\Debug\net8.0\OwofGames.GodotLogger.dll
+
+
+
+
+
+
+
+
+
+
+ ..\OwofGames.Godot\OwofGames.GodotLume\bin\Debug\net8.0\OwofGames.GodotLume.dll
+
+
+ ..\OwofGames.Godot\OwofGames.GodotLume.Microsoft.DependencyInjection\bin\Debug\net8.0\OwofGames.GodotLume.Microsoft.DependencyInjection.dll
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/godot-host-test.sln.DotSettings.user b/godot-host-test.sln.DotSettings.user
index 7fb3b90..41e70a1 100644
--- a/godot-host-test.sln.DotSettings.user
+++ b/godot-host-test.sln.DotSettings.user
@@ -1,9 +1,12 @@
+ True
+ True
True
True
True
True
ForceIncluded
+ ForceIncluded
ForceIncluded
ForceIncluded
ForceIncluded
diff --git a/project.godot b/project.godot
index fbfad0e..fc970ca 100644
--- a/project.godot
+++ b/project.godot
@@ -26,7 +26,7 @@ project/assembly_name="godot-host-test"
[editor_plugins]
-enabled=PackedStringArray("res://addons/GodotDI/plugin.cfg")
+enabled=PackedStringArray("res://addons/AetherBind/plugin.cfg")
[physics]