50 lines
1.2 KiB
C#
Raw Normal View History

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-07-01 14:39:43 +08:00
internal class NozzleTransform : Packet
{
public int VehicleID { get; set; }
public bool Hover { get; set; }
public override void Pack(NetOutgoingMessage message)
{
#region PacketToNetOutGoingMessage
2022-07-01 12:22:31 +08:00
message.Write((byte)PacketType.NozzleTransform);
List<byte> byteArray = new List<byte>();
byteArray.AddInt(VehicleID);
if (Hover) { byteArray.Add(1); }
byte[] result = byteArray.ToArray();
message.Write(result.Length);
message.Write(result);
#endregion
}
public override void Unpack(byte[] array)
{
#region NetIncomingMessageToPacket
BitReader reader = new BitReader(array);
VehicleID=reader.ReadInt();
Hover=reader.CanRead(1);
#endregion
}
}
}
}