Beispiel #1
0
        protected void ApplyState(byte[] compressed, int offset, int size)
        {
            var decompressed = _compressor.UnCompress(compressed, offset, size, out var length);
            var deserialize  =
                (WorldState)ProtoBuf.Serializer.NonGeneric.Deserialize(typeof(WorldState),
                                                                       new ReadOnlyMemory <byte>(decompressed, 0, length));

            foreach (var player in deserialize.Players)
            {
                if (player.Id == _state.Id)
                {
                    _state = player;
                }
            }
        }
Beispiel #2
0
 protected BaseClient(ICompressor compressor)
 {
     _compressor = compressor;
     _state      = GenerateState();
 }