feat: aetherbind, first source generator
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Godot;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OwofGames.GodotLume;
|
||||
|
||||
namespace GodotHostTest.AetherBind;
|
||||
|
||||
internal class SceneInstantiator(IProvider provider) : ISceneInstantiator
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Node Instantiate(PackedScene packedScene, Delegate? onScopeCreated = null)
|
||||
{
|
||||
var node = packedScene.Instantiate();
|
||||
var scope = node.GetChildren().OfType<ServiceSource>().SingleOrDefault();
|
||||
if (scope == null)
|
||||
provider.Get<ILogger<SceneInstantiator>>().LogDebug(
|
||||
"Instantiated the scene {PackedSceneName} through ISceneInstantiator.Instantiate, but no scope found.",
|
||||
packedScene.GetName());
|
||||
else
|
||||
scope.ResolveInjectedNodes(provider, onScopeCreated);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
public T Instantiate<T>(PackedScene packedScene, Delegate? onScopeCreated = null) where T : Node
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user