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

49 lines
1.3 KiB
C#
Raw Normal View History

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