feat: new ValueProvider improvements and source generator.
This commit is contained in:
+7
-8
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user