Skip to content

Commit

Permalink
Minor fixes for CSync docs (#119)
Browse files Browse the repository at this point in the history
* Update csync entry on overview page

* fix generic type parameters

* remove duplicated information
  • Loading branch information
Lordfirespeed authored Apr 21, 2024
1 parent 8510da0 commit 633d7b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions docs/dev/apis/csync/usage-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ Please use the [CSync 4 usage guide](/dev/apis/csync/v4-usage-guide) for the tim
Create a new class extending `SyncedConfig2`.

```csharp
public class MyConfig : SyncedConfig2<Config>
public class MyConfig : SyncedConfig2<MyConfig>
```

Within this class, we declare fields for each config entry we would like to sync.
Optionally, you can also declare non-synced config entries too.
Each `SyncedEntry` must be annotated with the `[SyncedEntryField]` attribute.

```csharp
public class MyConfig : SyncedConfig2<Config> {
public class MyConfig : SyncedConfig2<MyConfig> {
public ConfigEntry<float> DebugLevel { get; private set; }

[SyncedEntryField] public SyncedEntry<float> MovementSpeed; // fields may be annotated directly
Expand All @@ -43,7 +43,7 @@ When using client side and synced entries in the same class, any instance of `Co
We add a constructor to our config class that calls the base constructor.

```csharp
public class MyConfig : SyncedConfig2<Config> {
public class MyConfig : SyncedConfig2<MyConfig> {
public MyConfig(ConfigFile configFile) : base("My.Plugin.Guid") { } // [!code focus]
}
```
Expand Down Expand Up @@ -72,9 +72,6 @@ public MyConfig(ConfigFile cfg) : base("My.Plugin.Guid") {
```

After binding, we add the following line at the end of the constructor.
```csharp
ConfigManager.Register(this);
```

```csharp
public MyConfig(ConfigFile cfg) : base("My.Plugin.Guid") {
Expand Down
6 changes: 3 additions & 3 deletions docs/dev/apis/csync/v4-usage-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ description: The main guide to using CSync (v4).
Create a new class extending `SyncedConfig`.

```csharp
public class MyConfig : SyncedConfig<Config>
public class MyConfig : SyncedConfig<MyConfig>
```

Within this class, we declare fields for each config entry we would like to sync.
Optionally, you can also declare non-synced config entries too.
Each `SyncedEntry` must be annotated with the `[DataMember]` attribute.

```csharp
public class MyConfig : SyncedConfig<Config> {
public class MyConfig : SyncedConfig<MyConfig> {
public ConfigEntry<float> DebugLevel { get; private set; }

[DataMember] public SyncedEntry<float> MovementSpeed; // fields may be annotated directly
Expand All @@ -36,7 +36,7 @@ When using client side and synced entries in the same class, any instance of `Co
We add a constructor to our config class that calls the base constructor.

```csharp
public class MyConfig : SyncedConfig<Config> {
public class MyConfig : SyncedConfig<MyConfig> {
public MyConfig(ConfigFile configFile) : base("My.Plugin.Guid") { } // [!code focus]
}
```
Expand Down

0 comments on commit 633d7b4

Please sign in to comment.