public ClientMsgFinished(byte[] buffer, int offset) { MsgSerializer.ValidateHeader(buffer, MsgId, ref offset); Frame = MsgSerializer.ReadUInt32(buffer, ref offset); StateHash = MsgSerializer.ReadInt32(buffer, ref offset); }
public ServerMsgStart(byte[] buffer, int offset) { MsgSerializer.ValidateHeader(buffer, MsgId, ref offset); Seed = MsgSerializer.ReadInt32(buffer, ref offset); Players = MsgSerializer.ReadStringArray(buffer, ref offset); YourIndex = MsgSerializer.ReadByte(buffer, ref offset); TicksPerSecond = MsgSerializer.ReadByte(buffer, ref offset); }
public void ShouldSerializeAndDeserializeInt32(int value) { var written = MsgSerializer.WriteInt32(value, _buffer, 0); Assert.True(written == sizeof(int), $"Bad write size: {written}"); var offset = 0; var deserialized = MsgSerializer.ReadInt32(_buffer, ref offset); Assert.True(offset == sizeof(int), $"Bad read size: {offset}"); Assert.True(value == deserialized, $"Bad result: {deserialized}"); }