Skip to content

Commit e3ce6d8

Browse files
committed
update readme
1 parent a5add97 commit e3ce6d8

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,21 @@ Your project should already reference `SwiftlyS2.CS2`.
2626
## Basic Usage
2727

2828
Inside your `BasePlugin` class, create a scoped service provider when the plugin
29-
loads and register SwDevtools services via `AddSwDevtools`:
29+
loads and register SwDevtools services via `AddSwDevtoolsKit`:
3030

3131
```csharp
32+
using SwDevtools;
33+
using SwiftlyS2.Shared;
34+
using SwiftlyS2.Shared.Plugins;
35+
3236
public sealed class Plugin(ISwiftlyCore core) : BasePlugin(core)
3337
{
3438
public override void Load(bool hotReload)
3539
{
3640
ServiceCollection services = new();
3741
services
3842
.AddSwiftly(this.Core)
39-
.AddSwDevtools(this.Core, this)
43+
.AddSwDevtoolsKit(this.Core, this)
4044
.AddSingleton<TestService>();
4145

4246
var provider = services.BuildServiceProvider();
@@ -46,11 +50,12 @@ public sealed class Plugin(ISwiftlyCore core) : BasePlugin(core)
4650
}
4751
```
4852

49-
`AddSwDevtools` wires up (for now):
53+
`AddSwDevtoolsKit` wires up (for now):
5054

5155
- `ISwiftlyCore` – the Swiftly core instance
5256
- `IPluginLogger` – plugin-scoped logger
5357
- `IJsonConfig` – JSON configuration helper
58+
- `ITomlConfig` – TOML configuration helper
5459
- `ITranslate` – player-localized translation helper
5560

5661
_More services will be added in the future._
@@ -60,30 +65,33 @@ _More services will be added in the future._
6065
Prefer constructor injection for your services:
6166

6267
```csharp
68+
using SwDevtools.Logging;
69+
6370
public sealed class TestService(IPluginLogger logger)
6471
{
6572
public void Run() =>
66-
logger.Info("TestService running for {0}", core.GetType().Name);
73+
logger.Info("TestService running");
6774
}
6875
```
6976

7077
Property injection is optional and only applies to properties explicitly
7178
annotated with `[Inject]`.
7279

7380
```csharp
81+
using SwDevtools;
82+
using SwDevtools.Injection;
83+
using SwDevtools.Logging;
84+
7485
public sealed class Plugin(ISwiftlyCore core) : BasePlugin(core)
7586
{
7687
[Inject] public IPluginLogger Logger { get; set; } = null!;
7788

7889
public override void Load(bool hotReload)
7990
{
8091
ServiceCollection services = new();
81-
services.AddSwiftly(this.Core)
82-
// 1. Initialize Context (Core + Identity)
83-
.AddS2Core(this.Core, this)
84-
.AddS2Logging() // Chain services you need
85-
.AddS2Config()
86-
.AddS2Translation();
92+
services
93+
.AddSwiftly(this.Core)
94+
.AddSwDevtoolsKit(this.Core, this);
8795

8896
var provider = services.BuildServiceProvider();
8997
provider.InjectProperties(this);

0 commit comments

Comments
 (0)