跳到主要内容
版本:0.4.1

Class ServerModBase

Namespace: ReadyM.Relay.Server.Sdk
Assembly: ReadyM.Relay.Server.Sdk.dll

public abstract class ServerModBase

Inheritance​

object ← ServerModBase

Inherited Members​

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors​

ServerModBase()​

protected ServerModBase()

Properties​

ModDirectory​

This mod's own server folder, which holds its assemblies and any config files.

protected string ModDirectory { get; }

Property Value​

string

Services​

protected IServerDependencyContainer Services { get; }

Property Value​

IServerDependencyContainer

Methods​

Init()​

protected abstract void Init()

Initialize(IServerDependencyContainer, string)​

public void Initialize(IServerDependencyContainer services, string modDirectory)

Parameters​

services IServerDependencyContainer

modDirectory string

InitializeAot(IComponentRegistry)​

public void InitializeAot(IComponentRegistry registry)

Parameters​

registry IComponentRegistry

RegisterArchetypes(Action<IArchetypeRegistry>)​

Register new archetypes or modify existing.

protected void RegisterArchetypes(Action<IArchetypeRegistry> configure)

Parameters​

configure Action<IArchetypeRegistry>

The configuration callback.

RegisterComponents(IComponentRegistry)​

Any components defined in the mod must be registered here.

protected virtual void RegisterComponents(IComponentRegistry registry)

Parameters​

registry IComponentRegistry

RegisterConfig<TConfig>(string)​

Reads fileName from this mod's server folder and registers the result as a singleton.

protected void RegisterConfig<TConfig>(string fileName = "config.json") where TConfig : class, new()

Parameters​

fileName string

Type Parameters​

TConfig

Remarks​

A missing file yields defaults. A file that exists but does not parse, or that carries a key the config type does not declare, throws ModConfigException.

  • Constructors
    • ServerModBase()
  • Properties
    • ModDirectory
    • Services
  • Methods
    • Init()
    • Initialize(IServerDependencyContainer, string)
    • InitializeAot(IComponentRegistry)
    • RegisterArchetypes(Action<IArchetypeRegistry>)
    • RegisterComponents(IComponentRegistry)
    • RegisterConfig<TConfig>(string)