Class DuneModule
A server module to easily hook into DuneNet's server functionality.
Implements
Inherited Members
Namespace: DuneNet.Server
Assembly: DuneNet.Server.dll
Syntax
public abstract class DuneModule : DuneBehaviour, IEventCompatible
Remarks
This is the preferable way to extend DuneNet's functionality.
Methods
OnHandshakeError(DuneConnection)
Overridable method called when the server rejected the authentication request of a client.
Declaration
protected virtual void OnHandshakeError(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection of the rejected client. |
OnHandshakeErrorInternal(EventArguments)
Declaration
[EventReg("OnServerAuthenticationError", NetworkContext.Server, false)]
protected void OnHandshakeErrorInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnHandshakeSuccessful(DuneConnection)
Overridable method called when the server accepted the authentication request of a client.
Declaration
protected virtual void OnHandshakeSuccessful(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection of the authenticated client. |
OnHandshakeSuccessfulInternal(EventArguments)
Declaration
[EventReg("OnServerAuthenticationSuccess", NetworkContext.Server, false)]
protected void OnHandshakeSuccessfulInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnNetConnected(DuneConnection)
Overridable method called when a client connects to the NetworkController.
Declaration
protected virtual void OnNetConnected(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection that got connected. |
OnNetConnectedInternal(EventArguments)
Declaration
[EventReg("OnServerConnect", NetworkContext.Server, false)]
protected void OnNetConnectedInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnNetDisconnected(DuneConnection)
Overridable method called when a client disconnects from the NetworkController.
Declaration
protected virtual void OnNetDisconnected(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection that got disconnected. |
OnNetDisconnectedInternal(EventArguments)
Declaration
[EventReg("OnServerDisconnect", NetworkContext.Server, false)]
protected void OnNetDisconnectedInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnNetError(DuneConnection, NetworkError)
Overridable method called when the NetworkController experiences a connection error.
Declaration
protected virtual void OnNetError(DuneConnection conn, NetworkError error)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection the error occurred in. |
NetworkError | error | The connection error. |
OnNetErrorInternal(EventArguments)
Declaration
[EventReg("OnServerError", NetworkContext.Server, false)]
protected void OnNetErrorInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnNetNotReady(DuneConnection)
Overridable method called when a client sets itself not ready.
Declaration
protected virtual void OnNetNotReady(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection that was set not ready. |
OnNetNotReadyInternal(EventArguments)
Declaration
[EventReg("OnServerNotReady", NetworkContext.Server, false)]
protected void OnNetNotReadyInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnNetReady(DuneConnection)
Overridable method called when a client sets itself ready.
Declaration
protected virtual void OnNetReady(DuneConnection conn)
Parameters
Type | Name | Description |
---|---|---|
DuneConnection | conn | The connection that was set ready. |
OnNetReadyInternal(EventArguments)
Declaration
[EventReg("OnServerReady", NetworkContext.Server, false)]
protected void OnNetReadyInternal(EventArguments args)
Parameters
Type | Name | Description |
---|---|---|
EventArguments | args |
OnRespondHandshake(HandshakeResponse, String, Byte[])
Overridable method called when the server is expected to respond to a client's authentication request.
Declaration
protected virtual HandshakeResponse OnRespondHandshake(HandshakeResponse previous, string idToken, byte[] secret)
Parameters
Type | Name | Description |
---|---|---|
HandshakeResponse | previous | The HandshakeResponse received from the previous module. This is never null but it may contain empty elements if this is the first module of the chain. |
System.String | idToken | The authentication token received from the client. |
System.Byte[] | secret | The authentication secret received from the client. |
Returns
Type | Description |
---|---|
HandshakeResponse | A HandshakeResponse instance to be passed onto the next module of the chain. |
Remarks
Since modules are chained together, multiple modules can be used to generate the final HandshakeResponse by modifying the previous HandshakeResponse and returning it.
OnStopUsing()
Overridable method called when the module is removed from the module chain.
Declaration
protected virtual void OnStopUsing()
OnUpdate()
Overridable method called every frame.
Declaration
protected virtual void OnUpdate()
OnUse()
Overridable method called when the module is added to the module chain.
Declaration
protected virtual void OnUse()
StartCoroutine(IEnumerator)
Starts a coroutine
Declaration
protected Coroutine StartCoroutine(IEnumerator routine)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.IEnumerator | routine |
Returns
Type | Description |
---|---|
Coroutine |