2022-05-22 15:55:26 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
using Lidgren.Network;
|
|
|
|
|
|
|
|
|
|
namespace RageCoop.Core
|
|
|
|
|
{
|
|
|
|
|
public partial class Packets
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public class OwnerChanged : Packet
|
|
|
|
|
{
|
|
|
|
|
public int ID { get; set; }
|
|
|
|
|
|
|
|
|
|
public int NewOwnerID { get; set; }
|
|
|
|
|
|
|
|
|
|
public override void Pack(NetOutgoingMessage message)
|
|
|
|
|
{
|
|
|
|
|
#region PacketToNetOutGoingMessage
|
2022-07-01 12:22:31 +08:00
|
|
|
|
message.Write((byte)PacketType.OwnerChanged);
|
2022-05-22 15:55:26 +08:00
|
|
|
|
|
|
|
|
|
List<byte> byteArray = new List<byte>();
|
|
|
|
|
|
|
|
|
|
byteArray.AddInt(ID);
|
|
|
|
|
byteArray.AddInt(NewOwnerID);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
ID=reader.ReadInt();
|
|
|
|
|
NewOwnerID=reader.ReadInt();
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|