protected override void Deserialize(NetworkBinaryReader reader)
 {
     int count = reader.ReadByte();
     int totalByteCount = reader.ReadUInt16();
     _ids.Clear();
     for (int i = 0; i < count; i++) _ids.Add(reader.ReadByte());
     StreamedData = reader.ReadBytes(totalByteCount);
 }
Пример #2
0
 protected override void Deserialize(NetworkBinaryReader reader)
 {
     base.Deserialize(reader);
     PlayerID = reader.ReadInt16();
     int byteCount = reader.ReadUInt16();
     StreamedData = reader.ReadBytes(byteCount);
     Message = new PlayerMessage();
     Read(Message, SerializationModeFlags.AllFromServer, 0);
 }
Пример #3
0
 public void Deserialize(NetworkBinaryReader reader, SerializationModeFlags mode, int framesAgo)
 {
     var packedValue = reader.ReadUInt16();
     Weapon1 = (ShipDevice.FiringResult)(packedValue & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), Weapon1)) Weapon1 = ShipDevice.FiringResult.Void;
     Weapon2 = (ShipDevice.FiringResult)((packedValue >> 4) & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), Weapon2)) Weapon2 = ShipDevice.FiringResult.Void;
     ExtraDevice = (ShipDevice.FiringResult)((packedValue >> 8) & 0x07);
     if (!Enum.IsDefined(typeof(ShipDevice.FiringResult), ExtraDevice)) ExtraDevice = ShipDevice.FiringResult.Void;
 }
 public void TestByteOrderUint16()
 {
     byte[][] datas = { new byte[] { 1, 2 }, new byte[] { 253, 255 } };
     foreach (byte[] data in datas)
     {
         NetworkBinaryReader reader = new NetworkBinaryReader(new MemoryStream(data));
         ushort value = reader.ReadUInt16();
         if (BitConverter.IsLittleEndian)
             Array.Reverse(data);
         Assert.AreEqual(BitConverter.ToUInt16(data, 0), value);
     }
 }
Пример #5
0
 protected override void Deserialize(NetworkBinaryReader reader)
 {
     base.Deserialize(reader);
     ArenaID = reader.ReadByte();
     int gobCount = reader.ReadInt16();
     _layerIndices = new List<int>(gobCount);
     _gobTypeNames = new List<CanonicalString>(gobCount);
     for (int i = 0; i < gobCount; ++i) _layerIndices.Add(reader.ReadByte());
     for (int i = 0; i < gobCount; ++i) _gobTypeNames.Add(reader.ReadCanonicalString());
     int byteCount = reader.ReadUInt16();
     StreamedData = reader.ReadBytes(byteCount);
 }
Пример #6
0
 protected override void Deserialize(NetworkBinaryReader reader)
 {
     base.Deserialize(reader);
     var gobCount = reader.ReadByte();
     _collisionEventCount = reader.ReadByte();
     var totalByteCount = reader.ReadUInt16();
     _gobIds.Clear();
     for (int i = 0; i < gobCount; i++) _gobIds.Add(reader.ReadInt16());
     StreamedData = reader.ReadBytes(totalByteCount);
 }
 protected override void Deserialize(NetworkBinaryReader reader)
 {
     IsRegisteredToServer = reader.ReadBoolean();
     IsRequestingSpawnForArenaID = reader.ReadNullableByte();
     IsGameClientReadyToStartArena = reader.ReadBoolean();
     SpectatorID = reader.ReadByte();
     Subclass = (SubclassType)reader.ReadByte();
     if (!Enum.IsDefined(typeof(SubclassType), Subclass)) throw new NetworkException("Invalid value for Subclass, " + Subclass);
     int byteCount = reader.ReadUInt16();
     StreamedData = reader.ReadBytes(byteCount);
 }