Files
godot-host-test/addons/AetherBind/BuilderExtensions.cs
T
2026-07-18 17:05:03 +02:00

24 lines
918 B
C#

using OwofGames.GodotLume;
namespace GodotHostTest.AetherBind;
public static class BuilderExtensions
{
public static Builder AddValueProvider<TValueType, TSourceScope, TDestinationScope>(this Builder builder)
where TSourceScope : RootScope
where TDestinationScope : TSourceScope
{
var valueProvider = new ValueProvider<TValueType>();
return builder
.AddScoped<IValueSetter<TValueType>, IValueSetter<TValueType>, TSourceScope>(Builder.NoDependencies,
_ => valueProvider.Setter)
.AddScoped<IValueGetter<TValueType>, IValueGetter<TValueType>, TDestinationScope>(Builder.NoDependencies,
_ => valueProvider.Getter);
}
public static Builder AddValueProvider<TValueType, TScope>(this Builder builder)
where TScope : RootScope
{
return builder.AddValueProvider<TValueType, TScope, TScope>();
}
}