51 lines
1.1 KiB
C#
Raw Normal View History

2022-05-22 15:55:26 +08:00
using System;
using System.Collections.Generic;
using System.Text;
using Lidgren.Network;
namespace RageCoop.Core
{
2022-07-01 14:39:43 +08:00
internal partial class Packets
2022-05-22 15:55:26 +08:00
{
2022-07-01 14:39:43 +08:00
internal class EnteredVehicle : Packet
2022-05-22 15:55:26 +08:00
{
2022-08-06 10:49:55 +08:00
public override PacketType Type => PacketType.EnteredVehicle;
2022-05-22 15:55:26 +08:00
public int PedID { get; set; }
public int VehicleID { get; set; }
public short VehicleSeat { get; set; }
2022-08-06 10:43:24 +08:00
public override byte[] Serialize()
2022-05-22 15:55:26 +08:00
{
List<byte> byteArray = new List<byte>();
byteArray.AddInt(PedID);
byteArray.AddInt(VehicleID);
2022-08-06 11:40:38 +08:00
byteArray.AddShort(VehicleSeat);
2022-05-22 15:55:26 +08:00
2022-08-06 10:43:24 +08:00
return byteArray.ToArray();
2022-05-22 15:55:26 +08:00
}
2022-08-06 10:43:24 +08:00
public override void Deserialize(byte[] array)
2022-05-22 15:55:26 +08:00
{
#region NetIncomingMessageToPacket
BitReader reader = new BitReader(array);
2022-08-06 11:40:38 +08:00
PedID=reader.ReadInt32();
VehicleID=reader.ReadInt32();
VehicleSeat=reader.ReadInt16();
2022-05-22 15:55:26 +08:00
#endregion
}
}
}
}