public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo) { if ((mode & SerializationModeFlags.ConstantDataFromServer) != 0) { weight = reader.ReadSingle(); spawnTypeName = reader.ReadCanonicalString(); } }
public void TestByteOrderSingle() { byte[] data = { 1, 2, 3, 4 }; NetworkBinaryReader reader = new NetworkBinaryReader(new MemoryStream(data)); float value = reader.ReadSingle(); if (BitConverter.IsLittleEndian) Array.Reverse(data); Assert.AreEqual(BitConverter.ToSingle(data, 0), value); }
public override void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo) { base.Deserialize(reader, mode, framesAgo); if ((mode & SerializationModeFlags.ConstantDataFromServer) != 0) { _spawnInterval = reader.ReadSingle(); int spawnTypesCount = reader.ReadByte(); _spawnTypes = new SpawnType[spawnTypesCount]; for (int i = 0; i < spawnTypesCount; ++i) _spawnTypes[i].Deserialize(reader, SerializationModeFlags.ConstantDataFromServer, framesAgo); } }
public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo) { if ((mode & SerializationModeFlags.ConstantDataFromServer) != 0) { #if TRUSTED_VISIBILITY_BREACH Vector2 _min, _max; #endif _min = new Vector2 { X = reader.ReadSingle(), Y = reader.ReadSingle() }; _max = new Vector2 { X = reader.ReadSingle(), Y = reader.ReadSingle() }; #if TRUSTED_VISIBILITY_BREACH Min = _min; Max = _max; #endif } }
public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo) { if (mode.HasFlag(SerializationModeFlags.VaryingDataFromServer)) { Lives = reader.ReadInt16(); Kills = reader.ReadInt16(); Deaths = reader.ReadInt16(); DamageInflictedToMinions = reader.ReadSingle(); BonusesCollected = reader.ReadInt16(); } }
public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo) { if ((mode & SerializationModeFlags.ConstantDataFromServer) != 0) { #if TRUSTED_VISIBILITY_BREACH Vector2 _p1, _p2, _p3; #endif _p1 = new Vector2 { X = reader.ReadSingle(), Y = reader.ReadSingle() }; _p2 = new Vector2 { X = reader.ReadSingle(), Y = reader.ReadSingle() }; _p3 = new Vector2 { X = reader.ReadSingle(), Y = reader.ReadSingle() }; #if TRUSTED_VISIBILITY_BREACH P1 = _p1; P2 = _p2; P3 = _p3; #endif } }