The DeterministicCommandSerializer is used to serialize and de-serialize DeterministicCommands. More...
Public Member Functions | |
DeterministicCommandSerializer () | |
Constructor. More... | |
bool | EncodeCommand (DeterministicCommand command, out byte[] result) |
Encodes the command into a byte array. Creates a new byte array and returns it. Reusing byte arrays is not recommended because of the uncertain resulting size. More... | |
Boolean | PackNext (BitStream s, DeterministicCommand cmd) |
Packing a command into a bitstream. More... | |
Boolean | ReadNext (BitStream s, out DeterministicCommand cmd) |
Read commands from the bitstream. More... | |
void | RegisterFactories (params IDeterministicCommandFactory[] factories) |
Register a list of command factories. More... | |
void | RegisterFactory (IDeterministicCommandFactory factory) |
Register one command factory. More... | |
bool | TryDecodeCommand< T > (byte[] data, out T result) |
Decodes command message byte array into a specific command type. More... | |
Public Attributes | |
BitStream | CommandSerializerStreamRead |
The reusable read stream. Use BitStream.SetBuffer(byte[]) before using. More... | |
BitStream | CommandSerializerStreamWrite |
The re-useable write stream. Use BitStream.Reset(int) before using. More... | |
The DeterministicCommandSerializer is used to serialize and de-serialize DeterministicCommands.
|
inline |
Constructor.
|
inline |
Register one command factory.
factory | Factory instance |
|
inline |
Register a list of command factories.
factories | Factory params |
|
inline |
Decodes command message byte array into a specific command type.
T | Command type to cast to |
data | Serialized command data. |
result | Resulting command instance. |
true
when successfully decoded and casted.T | : | DeterministicCommand |
|
inline |
Encodes the command into a byte array. Creates a new byte array and returns it. Reusing byte arrays is not recommended because of the uncertain resulting size.
command | Command instance |
result | Serialized command to be send to the clients for example. |
true
when successfully encoded.
|
inline |
Packing a command into a bitstream.
s | Stream |
cmd | Command object |
true
if successfully written the command into the stream
|
inline |
Read commands from the bitstream.
s | Stream |
cmd | Command that was read from the stream. |
true
when a command has successfully been read form the stream.BitStream Photon.Deterministic.DeterministicCommandSerializer.CommandSerializerStreamRead |
The reusable read stream. Use BitStream.SetBuffer(byte[]) before using.
BitStream Photon.Deterministic.DeterministicCommandSerializer.CommandSerializerStreamWrite |
The re-useable write stream. Use BitStream.Reset(int) before using.