Local playback is working a bit

This commit is contained in:
Pascal Serrarens 2024-12-31 08:46:53 +01:00
parent 1429f0a9d6
commit 49920220c3

View File

@ -47,31 +47,14 @@ namespace Passer.Control.Core {
public const byte length = 2; public const byte length = 2;
public byte networkId; public byte networkId;
public ClientMsg(byte networkId) {
this.networkId = networkId;
}
public ClientMsg(byte[] buffer) : base(buffer) { } public ClientMsg(byte[] buffer) : base(buffer) { }
public override byte Serialize(ref byte[] buffer) {
byte ix = 0;
buffer[ix++] = ClientMsg.Id;
buffer[ix++] = networkId;
return ix;
}
public override void Deserialize(byte[] buffer) { public override void Deserialize(byte[] buffer) {
base.Deserialize(buffer); base.Deserialize(buffer);
uint ix = 0; uint ix = 0;
networkId = buffer[ix]; networkId = buffer[ix];
} }
public static bool Send(Participant client, byte networkId) {
ClientMsg msg = new(networkId);
return SendMsg(client, msg);
}
//public static bool Publish(Participant client, byte networkId) {
// ClientMsg msg = new(networkId);
// return PublishMsg(client, msg);
//}
public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) { public static async Task<bool> Receive(Stream dataStream, Participant client, byte packetSize) {
if (packetSize != length) if (packetSize != length)
return false; return false;