-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDepthMonitorConfigurator.cs
More file actions
51 lines (43 loc) · 1.53 KB
/
DepthMonitorConfigurator.cs
File metadata and controls
51 lines (43 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using Bindito.Core;
using Timberborn.Automation;
using Timberborn.EntityPanelSystem;
using Timberborn.TemplateInstantiation;
namespace Calloatti.DepthMonitor
{
[Context("Game")]
internal class DepthMonitorConfigurator : Configurator
{
private class EntityPanelModuleProvider : IProvider<EntityPanelModule>
{
private readonly DepthMonitorFragment _fragment;
public EntityPanelModuleProvider(DepthMonitorFragment fragment)
{
_fragment = fragment;
}
public EntityPanelModule Get()
{
EntityPanelModule.Builder builder = new EntityPanelModule.Builder();
builder.AddMiddleFragment(_fragment);
return builder.Build();
}
}
protected override void Configure()
{
Bind<DepthMonitor>().AsTransient();
Bind<DepthMonitorMarker>().AsTransient();
Bind<DepthMonitorFragment>().AsSingleton();
MultiBind<EntityPanelModule>().ToProvider<EntityPanelModuleProvider>().AsSingleton();
MultiBind<TemplateModule>().ToProvider(ProvideTemplateModule).AsSingleton();
}
private static TemplateModule ProvideTemplateModule()
{
TemplateModule.Builder builder = new TemplateModule.Builder();
// Critical attachments matching your vanilla layout
builder.AddDecorator<DepthMonitorSpec, DepthMonitor>();
builder.AddDecorator<DepthMonitor, Automator>();
builder.AddDecorator<DepthMonitor, AutomatorIlluminator>();
builder.AddDecorator<DepthMonitor, DepthMonitorMarker>();
return builder.Build();
}
}
}