Skip to main content
Version: 0.1.0

Class RpcClassBase

Namespace: ReadyM.Api.Multiplayer.RPC
Assembly: ReadyM.Api.Multiplayer.dll

Base class for an RPC container. Each class that defines RPC methods with [RpcEvent] attributes must inherit from this class.

public abstract class RpcClassBase : IHostedService, IDisposable

Inheritance​

object ← RpcClassBase

Implements​

IHostedService, IDisposable

Inherited Members​

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

Constructors​

RpcClassBase(IRpcClient, IRelaySerializer)​

Base class for an RPC container. Each class that defines RPC methods with [RpcEvent] attributes must inherit from this class.

protected RpcClassBase(IRpcClient client, IRelaySerializer serializer)

Parameters​

client IRpcClient

RPC client to use for sending RPCs. This is injected by the DI container.

serializer IRelaySerializer

Serializer to use for serializing RPC parameters. This is injected by the DI container.

Properties​

EventsCount​

Number of RPC events defined in this class. Generated by the source generator in derived classes.

protected abstract byte EventsCount { get; }

Property Value​

byte

Offset​

Event code offset assigned to this RPC class. Generated by the source generator in derived classes.

protected byte Offset { get; }

Property Value​

byte

RelayClient​

RPC client to use for sending RPCs. This is injected by the DI container.

protected IRpcClient RelayClient { get; }

Property Value​

IRpcClient

Serializer​

Serializer to use for serializing RPC parameters. This is injected by the DI container.

protected IRelaySerializer Serializer { get; }

Property Value​

IRelaySerializer

Methods​

DeInitRpc()​

De-initializes the RPC class, e.g. by unregistering RPC handlers. Generated by the source generator in derived classes.

protected abstract void DeInitRpc()

Dispose()​

public void Dispose()

InitRpc()​

Initializes the RPC class, e.g. by registering RPC handlers. Generated by the source generator in derived classes.

protected abstract void InitRpc()

OnScopeStart()​

Called when the DI container is initialized (on game start). This allows the service to perform any necessary setup at the appropriate time, such as registering event handlers.

public virtual void OnScopeStart()
  • Constructors
    • RpcClassBase(IRpcClient, IRelaySerializer)
  • Properties
    • EventsCount
    • Offset
    • RelayClient
    • Serializer
  • Methods
    • DeInitRpc()
    • Dispose()
    • InitRpc()
    • OnScopeStart()