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
Implements
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
Offset
Event code offset assigned to this RPC class. Generated by the source generator in derived classes.
protected byte Offset { get; }
Property Value
RelayClient
RPC client to use for sending RPCs. This is injected by the DI container.
protected IRpcClient RelayClient { get; }
Property Value
Serializer
Serializer to use for serializing RPC parameters. This is injected by the DI container.
protected IRelaySerializer Serializer { get; }
Property Value
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()