Exemplo n.º 1
0
 public void Deserialize(ref Snapshot snapshot, ref Snapshot baseline, ref DataStreamReader reader, ref NetworkCompressionModel compressionModel, uint changeMask)
 {
     #region __GHOST_READ__
     if ((changeMask__GHOST_MASK_BATCH__ & (1 << __GHOST_MASK_INDEX__)) != 0)
     {
         snapshot.__GHOST_FIELD_NAME__ = reader.ReadPackedFixedString512Delta(baseline.__GHOST_FIELD_NAME__, compressionModel);
     }
     else
     {
         snapshot.__GHOST_FIELD_NAME__ = baseline.__GHOST_FIELD_NAME__;
     }
     #endregion
 }
Exemplo n.º 2
0
        public void ReadWritePackedFixedString512Delta()
        {
            var dataStream       = new DataStreamWriter(300 * 4, Allocator.Temp);
            var compressionModel = new NetworkCompressionModel(Allocator.Temp);

            var src      = new FixedString512("This is a string");
            var baseline = new FixedString512("This is another string");

            dataStream.WritePackedFixedString512Delta(src, baseline, compressionModel);
            dataStream.Flush();

            //Assert.LessOrEqual(dataStream.Length, src.LengthInBytes+2);

            var reader = new DataStreamReader(dataStream.AsNativeArray());
            var dst    = reader.ReadPackedFixedString512Delta(baseline, compressionModel);

            Assert.AreEqual(src, dst);
        }