chore: cleanup
This commit is contained in:
@@ -13,7 +13,8 @@ namespace GodotHostTest.Game.Level;
|
||||
|
||||
public partial class LevelServiceSource : ServiceSource
|
||||
{
|
||||
private Activity? _activityValue;
|
||||
private Activity? _levelActivity;
|
||||
|
||||
[Export] private TargetSpawner _targetSpawner = null!;
|
||||
|
||||
protected override void OnScopeCreated(IProvider serviceProvider)
|
||||
@@ -22,15 +23,13 @@ public partial class LevelServiceSource : ServiceSource
|
||||
}
|
||||
|
||||
[WithProvider]
|
||||
private void OnScopeCreated(IValueSetter<ITargetCollector> targetCollector,
|
||||
IValueSetter<ITargetSpawner> targetSpawner, IActivitySourceFactory activitySourceFactory,
|
||||
IValueSetter<Activity> activity)
|
||||
private void OnScopeCreated(IActivitySourceFactory activitySourceFactory,
|
||||
IValueSetter<ITargetCollector> targetCollector, IValueSetter<ITargetSpawner> targetSpawner)
|
||||
{
|
||||
// ReSharper disable once ExplicitCallerInfoArgument - the caller name is not significant in this case
|
||||
_activityValue = activitySourceFactory.ActivitySource.StartActivity("Level") ??
|
||||
_levelActivity = activitySourceFactory.ActivitySource.StartActivity("Level") ??
|
||||
throw new InvalidOperationException(
|
||||
"No listeners for the activity - is OpenTelemetry running?");
|
||||
activity.Set(_activityValue);
|
||||
targetCollector.Set(_targetSpawner);
|
||||
targetSpawner.Set(_targetSpawner);
|
||||
}
|
||||
@@ -38,6 +37,6 @@ public partial class LevelServiceSource : ServiceSource
|
||||
public override void _Ready()
|
||||
{
|
||||
// after 3 seconds, dispose the activity for simulation purposes
|
||||
GetTree().CreateTimer(3).Timeout += _activityValue!.Dispose;
|
||||
GetTree().CreateTimer(3).Timeout += _levelActivity!.Dispose;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Diagnostics;
|
||||
using GodotHostTest.AetherBind;
|
||||
using GodotHostTest.Interfaces;
|
||||
using OwofGames.GodotLume;
|
||||
@@ -7,17 +6,12 @@ namespace GodotHostTest.Game.Level;
|
||||
|
||||
public static class LevelServices
|
||||
{
|
||||
public static void AddLevelServices(this Builder builder, LevelsData levelsData)
|
||||
public static void AddLevelServices(this Builder builder)
|
||||
{
|
||||
builder
|
||||
// current level / level data management
|
||||
.AddSingleton<ICurrentLevel, CurrentLevel>()
|
||||
.AddInstance<ILevelDataProvider, LevelsData>(levelsData)
|
||||
// value provider for activity
|
||||
.AddValueProvider<Activity, LevelScope>()
|
||||
// value providers to send data into level scope
|
||||
// value providers to send level data from root to level scope
|
||||
.AddValueProvider<ILevel, RootScope, LevelScope>()
|
||||
// value provider for level scope setup
|
||||
// value providers for level scope setup
|
||||
.AddValueProvider<ITargetCollector, LevelScope>()
|
||||
.AddValueProvider<ITargetSpawner, LevelScope>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user