Files
RAGECOOP-V/Core/Packets/Misc.cs

49 lines
1.3 KiB
C#
Raw Normal View History

2022-09-08 12:41:56 -07:00
using Lidgren.Network;
using System.Collections.Generic;
namespace RageCoop.Core
{
internal partial class Packets
{
2022-08-06 11:40:38 +08:00
/// <summary>
/// Request direct connection to another client
/// </summary>
internal class ConnectionRequest : Packet
{
public int TargetID { get; set; }
public override PacketType Type => PacketType.ConnectionRequest;
protected override void Serialize(NetOutgoingMessage m)
{
2022-09-08 12:41:56 -07:00
var data = new List<byte>(10);
m.Write(TargetID);
}
public override void Deserialize(NetIncomingMessage m)
{
TargetID = m.ReadInt32();
}
}
2022-08-08 17:03:41 +08:00
/// <summary>
/// Sent to the host when a direct connection has been established
/// </summary>
2022-08-10 20:42:47 +08:00
internal class P2PConnect : Packet
2022-08-08 17:03:41 +08:00
{
public int ID { get; set; }
2022-08-10 20:42:47 +08:00
public override PacketType Type => PacketType.P2PConnect;
protected override void Serialize(NetOutgoingMessage m)
2022-08-08 17:03:41 +08:00
{
var data = new List<byte>(10);
m.Write(ID);
2022-08-08 17:03:41 +08:00
}
public override void Deserialize(NetIncomingMessage m)
2022-08-08 17:03:41 +08:00
{
ID = m.ReadInt32();
2022-08-08 17:03:41 +08:00
}
}
}
}