Exemplo n.º 1
0
 public void Deserialize(uint tick, ref GameModeSnapshotData baseline, ref DataStreamReader reader,
                         NetworkCompressionModel compressionModel)
 {
     this.tick   = tick;
     changeMask0 = reader.ReadPackedUIntDelta(baseline.changeMask0, compressionModel);
     if ((changeMask0 & (1 << 0)) != 0)
     {
         GameModeDatagameTimerSeconds = reader.ReadPackedIntDelta(baseline.GameModeDatagameTimerSeconds, compressionModel);
     }
     else
     {
         GameModeDatagameTimerSeconds = baseline.GameModeDatagameTimerSeconds;
     }
     if ((changeMask0 & (1 << 1)) != 0)
     {
         GameModeDatagameTimerMessage = reader.ReadPackedStringDelta(baseline.GameModeDatagameTimerMessage, compressionModel);
     }
     else
     {
         GameModeDatagameTimerMessage = baseline.GameModeDatagameTimerMessage;
     }
     if ((changeMask0 & (1 << 2)) != 0)
     {
         GameModeDatateamName0 = reader.ReadPackedStringDelta(baseline.GameModeDatateamName0, compressionModel);
     }
     else
     {
         GameModeDatateamName0 = baseline.GameModeDatateamName0;
     }
     if ((changeMask0 & (1 << 3)) != 0)
     {
         GameModeDatateamName1 = reader.ReadPackedStringDelta(baseline.GameModeDatateamName1, compressionModel);
     }
     else
     {
         GameModeDatateamName1 = baseline.GameModeDatateamName1;
     }
     if ((changeMask0 & (1 << 4)) != 0)
     {
         GameModeDatateamScore0 = reader.ReadPackedIntDelta(baseline.GameModeDatateamScore0, compressionModel);
     }
     else
     {
         GameModeDatateamScore0 = baseline.GameModeDatateamScore0;
     }
     if ((changeMask0 & (1 << 5)) != 0)
     {
         GameModeDatateamScore1 = reader.ReadPackedIntDelta(baseline.GameModeDatateamScore1, compressionModel);
     }
     else
     {
         GameModeDatateamScore1 = baseline.GameModeDatateamScore1;
     }
 }
 public void Deserialize(uint tick, ref GhostSnapshotData baseline, DataStreamReader reader, ref DataStreamReader.Context ctx,
                         NetworkCompressionModel compressionModel)
 {
     #region __GHOST_READ__
     if ((changeMask__GHOST_MASK_BATCH__ & (1 << __GHOST_MASK_INDEX__)) != 0)
     {
         __GHOST_FIELD_NAME__ = reader.ReadPackedStringDelta(ref ctx, baseline.__GHOST_FIELD_NAME__, compressionModel);
     }
     else
     {
         __GHOST_FIELD_NAME__ = baseline.__GHOST_FIELD_NAME__;
     }
     #endregion
 }
Exemplo n.º 3
0
        public void ReadWritePackedStringDelta()
        {
            var dataStream       = new DataStreamWriter(300 * 4, Allocator.Temp);
            var compressionModel = new NetworkCompressionModel(Allocator.Temp);

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

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

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

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

            Assert.AreEqual(src, dst);
        }
Exemplo n.º 4
0
 public void Deserialize(uint tick, ref GameInfoSnapshotData baseline, ref DataStreamReader reader,
                         NetworkCompressionModel compressionModel)
 {
     this.tick   = tick;
     changeMask0 = reader.ReadPackedUIntDelta(baseline.changeMask0, compressionModel);
     if ((changeMask0 & (1 << 0)) != 0)
     {
         GameInfoComponentName = reader.ReadPackedStringDelta(baseline.GameInfoComponentName, compressionModel);
     }
     else
     {
         GameInfoComponentName = baseline.GameInfoComponentName;
     }
     if ((changeMask0 & (1 << 1)) != 0)
     {
         GameInfoComponentSizeX = reader.ReadPackedIntDelta(baseline.GameInfoComponentSizeX, compressionModel);
     }
     else
     {
         GameInfoComponentSizeX = baseline.GameInfoComponentSizeX;
     }
     if ((changeMask0 & (1 << 2)) != 0)
     {
         GameInfoComponentSizeY = reader.ReadPackedIntDelta(baseline.GameInfoComponentSizeY, compressionModel);
     }
     else
     {
         GameInfoComponentSizeY = baseline.GameInfoComponentSizeY;
     }
     if ((changeMask0 & (1 << 3)) != 0)
     {
         GameInfoComponentId = reader.ReadPackedIntDelta(baseline.GameInfoComponentId, compressionModel);
     }
     else
     {
         GameInfoComponentId = baseline.GameInfoComponentId;
     }
 }
Exemplo n.º 5
0
 public void Deserialize(uint tick, ref CharacterSnapshotData baseline, ref DataStreamReader reader,
                         NetworkCompressionModel compressionModel)
 {
     this.tick   = tick;
     changeMask0 = reader.ReadPackedUIntDelta(baseline.changeMask0, compressionModel);
     if ((changeMask0 & (1 << 0)) != 0)
     {
         AttackAttackType = reader.ReadPackedIntDelta(baseline.AttackAttackType, compressionModel);
     }
     else
     {
         AttackAttackType = baseline.AttackAttackType;
     }
     if ((changeMask0 & (1 << 1)) != 0)
     {
         AttackSeed = reader.ReadPackedIntDelta(baseline.AttackSeed, compressionModel);
     }
     else
     {
         AttackSeed = baseline.AttackSeed;
     }
     if ((changeMask0 & (1 << 2)) != 0)
     {
         AttackAttackDirectionX = reader.ReadPackedIntDelta(baseline.AttackAttackDirectionX, compressionModel);
         AttackAttackDirectionY = reader.ReadPackedIntDelta(baseline.AttackAttackDirectionY, compressionModel);
     }
     else
     {
         AttackAttackDirectionX = baseline.AttackAttackDirectionX;
         AttackAttackDirectionY = baseline.AttackAttackDirectionY;
     }
     if ((changeMask0 & (1 << 3)) != 0)
     {
         AttackTarget = reader.ReadPackedIntDelta(baseline.AttackTarget, compressionModel);
     }
     else
     {
         AttackTarget = baseline.AttackTarget;
     }
     if ((changeMask0 & (1 << 4)) != 0)
     {
         AttackNeedApplyDamage = reader.ReadPackedUIntDelta(baseline.AttackNeedApplyDamage, compressionModel);
     }
     else
     {
         AttackNeedApplyDamage = baseline.AttackNeedApplyDamage;
     }
     if ((changeMask0 & (1 << 5)) != 0)
     {
         DamageDamageType = reader.ReadPackedIntDelta(baseline.DamageDamageType, compressionModel);
     }
     else
     {
         DamageDamageType = baseline.DamageDamageType;
     }
     if ((changeMask0 & (1 << 6)) != 0)
     {
         MovableCharacterComponentPlayerId = reader.ReadPackedIntDelta(baseline.MovableCharacterComponentPlayerId, compressionModel);
     }
     else
     {
         MovableCharacterComponentPlayerId = baseline.MovableCharacterComponentPlayerId;
     }
     if ((changeMask0 & (1 << 7)) != 0)
     {
         PlayerDatahealth = reader.ReadPackedIntDelta(baseline.PlayerDatahealth, compressionModel);
     }
     else
     {
         PlayerDatahealth = baseline.PlayerDatahealth;
     }
     if ((changeMask0 & (1 << 8)) != 0)
     {
         PlayerDataprimarySkillId = reader.ReadPackedIntDelta(baseline.PlayerDataprimarySkillId, compressionModel);
     }
     else
     {
         PlayerDataprimarySkillId = baseline.PlayerDataprimarySkillId;
     }
     if ((changeMask0 & (1 << 9)) != 0)
     {
         PlayerDatamaxHealth = reader.ReadPackedIntDelta(baseline.PlayerDatamaxHealth, compressionModel);
     }
     else
     {
         PlayerDatamaxHealth = baseline.PlayerDatamaxHealth;
     }
     if ((changeMask0 & (1 << 10)) != 0)
     {
         PlayerDatapower = reader.ReadPackedIntDelta(baseline.PlayerDatapower, compressionModel);
     }
     else
     {
         PlayerDatapower = baseline.PlayerDatapower;
     }
     if ((changeMask0 & (1 << 11)) != 0)
     {
         PlayerDatamagic = reader.ReadPackedIntDelta(baseline.PlayerDatamagic, compressionModel);
     }
     else
     {
         PlayerDatamagic = baseline.PlayerDatamagic;
     }
     if ((changeMask0 & (1 << 12)) != 0)
     {
         PlayerDatadamageRadius = reader.ReadPackedIntDelta(baseline.PlayerDatadamageRadius, compressionModel);
     }
     else
     {
         PlayerDatadamageRadius = baseline.PlayerDatadamageRadius;
     }
     if ((changeMask0 & (1 << 13)) != 0)
     {
         PlayerDatainventory = reader.ReadPackedUIntDelta(baseline.PlayerDatainventory, compressionModel);
     }
     else
     {
         PlayerDatainventory = baseline.PlayerDatainventory;
     }
     if ((changeMask0 & (1 << 14)) != 0)
     {
         PlayerDataattackSkillId = reader.ReadPackedIntDelta(baseline.PlayerDataattackSkillId, compressionModel);
     }
     else
     {
         PlayerDataattackSkillId = baseline.PlayerDataattackSkillId;
     }
     if ((changeMask0 & (1 << 15)) != 0)
     {
         PlayerDatadefenceSkillId = reader.ReadPackedIntDelta(baseline.PlayerDatadefenceSkillId, compressionModel);
     }
     else
     {
         PlayerDatadefenceSkillId = baseline.PlayerDatadefenceSkillId;
     }
     if ((changeMask0 & (1 << 16)) != 0)
     {
         PlayerDatautilsSkillId = reader.ReadPackedIntDelta(baseline.PlayerDatautilsSkillId, compressionModel);
     }
     else
     {
         PlayerDatautilsSkillId = baseline.PlayerDatautilsSkillId;
     }
     if ((changeMask0 & (1 << 17)) != 0)
     {
         PlayerDataspeedMod = reader.ReadPackedFloatDelta(baseline.PlayerDataspeedMod, compressionModel);
     }
     else
     {
         PlayerDataspeedMod = baseline.PlayerDataspeedMod;
     }
     if ((changeMask0 & (1 << 18)) != 0)
     {
         PlayerDatastun = reader.ReadPackedUIntDelta(baseline.PlayerDatastun, compressionModel);
     }
     else
     {
         PlayerDatastun = baseline.PlayerDatastun;
     }
     if ((changeMask0 & (1 << 19)) != 0)
     {
         PrefabCreatorNameId = reader.ReadPackedUIntDelta(baseline.PrefabCreatorNameId, compressionModel);
     }
     else
     {
         PrefabCreatorNameId = baseline.PrefabCreatorNameId;
     }
     if ((changeMask0 & (1 << 20)) != 0)
     {
         PrefabCreatorSkinId = reader.ReadPackedUIntDelta(baseline.PrefabCreatorSkinId, compressionModel);
     }
     else
     {
         PrefabCreatorSkinId = baseline.PrefabCreatorSkinId;
     }
     if ((changeMask0 & (1 << 21)) != 0)
     {
         PrefabCreatorSkinSetting = reader.ReadPackedStringDelta(baseline.PrefabCreatorSkinSetting, compressionModel);
     }
     else
     {
         PrefabCreatorSkinSetting = baseline.PrefabCreatorSkinSetting;
     }
     if ((changeMask0 & (1 << 22)) != 0)
     {
         RotationValueX = reader.ReadPackedIntDelta(baseline.RotationValueX, compressionModel);
         RotationValueY = reader.ReadPackedIntDelta(baseline.RotationValueY, compressionModel);
         RotationValueZ = reader.ReadPackedIntDelta(baseline.RotationValueZ, compressionModel);
         RotationValueW = reader.ReadPackedIntDelta(baseline.RotationValueW, compressionModel);
     }
     else
     {
         RotationValueX = baseline.RotationValueX;
         RotationValueY = baseline.RotationValueY;
         RotationValueZ = baseline.RotationValueZ;
         RotationValueW = baseline.RotationValueW;
     }
     if ((changeMask0 & (1 << 23)) != 0)
     {
         TranslationValueX = reader.ReadPackedIntDelta(baseline.TranslationValueX, compressionModel);
         TranslationValueY = reader.ReadPackedIntDelta(baseline.TranslationValueY, compressionModel);
         TranslationValueZ = reader.ReadPackedIntDelta(baseline.TranslationValueZ, compressionModel);
     }
     else
     {
         TranslationValueX = baseline.TranslationValueX;
         TranslationValueY = baseline.TranslationValueY;
         TranslationValueZ = baseline.TranslationValueZ;
     }
 }