Class RosterWire
- Namespace
- Unity.Multiplayer.Core
The bytes the roster travels in (UM-T55): roster updates from the server, and a player's change request and the
server's reply. Engine-free so dotnet test covers it; the adapter carries the bytes in named messages.
Decoding is strict and never throws: anything malformed is refused.
public static class RosterWire
- Inheritance
-
RosterWire
- Inherited Members
Remarks
Every message starts with Version. A roster update is the flags byte (bit 0: full), then the players (count, then per player: seat, client id, name, colour as RGBA, flags host/connected, ping), then the freed seats. IsLocal never travels: each peer works it out.
Fields
MaxEntries
The most players or seats one message may carry.
public const int MaxEntries = 1024
Field Value
MaxReasonLength
The longest refusal reason a reply carries, in characters.
public const int MaxReasonLength = 256
Field Value
Version
The format version every message starts with.
public const byte Version = 1
Field Value
Methods
EncodeChangeReply(uint, bool, string)
Encodes the server's reply to change request requestId.
public static byte[] EncodeChangeReply(uint requestId, bool accepted, string reason)
Parameters
Returns
- byte[]
EncodeChangeRequest(uint, PlayerChangeRequest)
Encodes a change request (requestId matches the reply to it).
public static byte[] EncodeChangeRequest(uint requestId, PlayerChangeRequest request)
Parameters
requestIduintrequestPlayerChangeRequest
Returns
- byte[]
EncodeUpdate(RosterUpdate)
Encodes a roster update.
public static byte[] EncodeUpdate(RosterUpdate update)
Parameters
updateRosterUpdate
Returns
- byte[]
Exceptions
- ArgumentNullException
updateis null.- ArgumentException
It carries more than MaxEntries players or seats.
TryDecodeChangeReply(byte[], out uint, out bool, out string)
Decodes a reply; false for anything malformed.
public static bool TryDecodeChangeReply(byte[] data, out uint requestId, out bool accepted, out string reason)
Parameters
Returns
TryDecodeChangeRequest(byte[], out uint, out PlayerChangeRequest)
Decodes a change request; false for anything malformed (the request itself is checked with Validate()).
public static bool TryDecodeChangeRequest(byte[] data, out uint requestId, out PlayerChangeRequest request)
Parameters
databyte[]requestIduintrequestPlayerChangeRequest
Returns
TryDecodeUpdate(byte[], out RosterUpdate)
Decodes a roster update; false (and null) for anything malformed.
public static bool TryDecodeUpdate(byte[] data, out RosterUpdate update)
Parameters
databyte[]updateRosterUpdate