ServerSync
A class in Root.Township, Alta.Networking.
The server side ISync that SyncFactory.Create makes on the server. Keeps the server read and write handlers and can limit incoming messages to one owner player.
- Listed in Networking and servers
- Inherits or implements
BaseSync,ISync
Constructors
| Member | What it is |
|---|---|
ServerSync(INetworkEntity entity, EntityMessageType type) | Creates a ServerSync from entity and type. |
Fields
2 private and internal fields
| Member | What it is |
|---|---|
private bool isRelay | Set by OnServerReadAndRelay; not read anywhere. |
private IPlayer owner | The only player allowed to send this sync, or null for anyone. |
Methods
| Member | What it is |
|---|---|
ISync OnClientRead(SerializeMethod reader) | Does nothing on the server. |
ISync OnClientWrite(SerializeMethod writer) | Does nothing on the server. |
ISync OnServerRead(SerializeMethod reader) | Sets the method that reads messages from clients. |
ISync OnServerReadAndRelay(SerializeMethod reader, SerializeMethod writer) | Sets both the reader and the writer, for data the server reads and passes on. |
ISync OnServerWrite(SerializeMethod writer) | Sets the method that writes data sent to clients. |
void SendToPlayer(IPlayer player) | Sends this sync's data to one player. |
ISync SetOwner(IPlayer player) | Sets the only player whose messages are accepted. |
protected override void MessageHandler(IPlayer player, Stream stream) | Runs the reader only for messages from a valid sender. |
1 private and internal method
| Member | What it is |
|---|---|
private bool IsValidMessageOrigin(IPlayer player) | True if no owner is set or the sender is the owner; otherwise logs an error. |