Пример #1
0
        public ClientMsgInputs(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Frame     = MsgSerializer.ReadUInt32(buffer, ref offset);
            InputMask = MsgSerializer.ReadUInt64(buffer, ref offset);
        }
Пример #2
0
        public ServerMsgFinish(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Frames = MsgSerializer.ReadUInt32Array(buffer, ref offset);
            Hashes = MsgSerializer.ReadInt32Array(buffer, ref offset);
        }
Пример #3
0
        public ClientMsgFinished(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Frame     = MsgSerializer.ReadUInt32(buffer, ref offset);
            StateHash = MsgSerializer.ReadInt32(buffer, ref offset);
        }
Пример #4
0
        public ClientMsgJoin(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Game       = MsgSerializer.ReadString(buffer, ref offset);
            Version    = MsgSerializer.ReadUInt16(buffer, ref offset);
            PlayerName = MsgSerializer.ReadString(buffer, ref offset);
        }
Пример #5
0
        public ServerMsgInput(byte[] buffer, int offset)
        {
            MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);

            Frame       = MsgSerializer.ReadUInt32(buffer, ref offset);
            InputMask   = MsgSerializer.ReadUInt64(buffer, ref offset);
            PlayerIndex = MsgSerializer.ReadByte(buffer, ref offset);
        }
Пример #6
0
        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);
        }
Пример #7
0
        public void ShouldSerializeKeepAlive()
        {
            var msg = new ClientMsgKeepAlive();

            var buf     = CreateBuffer(msg);
            var written = msg.WriteTo(buf, 0);

            Assert.True(written == buf.Length);

            var idx = 0;

            MsgSerializer.ValidateHeader(buf, (byte)ClientMsgId.KeepAlive, ref idx);
        }
Пример #8
0
        public void ShouldSerializeJoined()
        {
            var msg = new ServerMsgJoined();

            var buf     = CreateBuffer(msg);
            var written = msg.WriteTo(buf, 0);

            Assert.True(written == buf.Length);

            var idx = 0;

            MsgSerializer.ValidateHeader(buf, (byte)ServerMsgId.Joined, ref idx);
        }
Пример #9
0
 public ServerMsgError(byte[] buffer, int offset)
 {
     MsgSerializer.ValidateHeader(buffer, MsgId, ref offset);
     ErrorId = (ServerErrorId)MsgSerializer.ReadByte(buffer, ref offset);
 }