static byte[] FormatMessage(BitStream payload, ushort domainId, ushort typeId, ulong senderId) { Log.Entered(); BitStream stream = new BitStream(); stream.ResetWrite(); HandlerRegistrar.SerializeHeaders(ref stream, ref domainId, ref typeId, ref senderId); Log.Trace($"Adding payload of length {payload.ByteLength} to formatted message of length {stream.ByteLength}"); payload.ResetRead(); stream.WriteBitStream(payload); Log.Trace($"Formatted message final length {stream.ByteLength}"); return(stream.ToBytes()); }
void Terminate() { Log.Entered(); MyAPIGateway.Multiplayer.UnregisterMessageHandler(HandlerId, HandleMessage); Static = null; }
/// <summary> /// Initialized by ComponentSession /// </summary> public HandlerRegistrar() { Log.Entered(); MyAPIGateway.Multiplayer.RegisterMessageHandler(HandlerId, HandleMessage); Static = this; }