feat: new ValueProvider improvements and source generator.

This commit is contained in:
redglow
2026-07-20 11:06:35 +02:00
parent 036e4af431
commit c540b99eb6
12 changed files with 79 additions and 37 deletions
+7 -8
View File
@@ -1,13 +1,10 @@
using System;
using Godot;
using GodotHostTest.AetherBind;
using GodotHostTest.Interfaces;
using OwofGames.AetherBind;
using OwofGames.GodotLume;
namespace GodotHostTest.Game.Root;
[Injected]
public partial class Root : Node2D
{
[Inject] private ICurrentLevel _currentLevel = null!;
@@ -17,11 +14,13 @@ public partial class Root : Node2D
public override void _Ready()
{
var levelData = _levelDataProvider.GetLevelData(_currentLevel.LevelNumber);
AddChild(_sceneInstantiator.Instantiate(_levelScene,
OnInstantiate(levelValueSetter => levelValueSetter.Set(levelData))));
AddChild(_sceneInstantiator.Instantiate(_levelScene, OnInstantiateWithProvider));
}
[ServiceMethod]
private partial Action<IProvider> OnInstantiate(Action<IValueSetter<ILevel>> a);
[WithProvider]
private void OnInstantiate(IValueSetter<ILevel> levelValueSetter)
{
var levelData = _levelDataProvider.GetLevelData(_currentLevel.LevelNumber);
levelValueSetter.Set(levelData);
}
}