quantum-space-buddies/QuantumUNET/QSBULocalConnectionToClient.cs

60 lines
1.4 KiB
C#
Raw Normal View History

2020-12-07 21:19:16 +00:00
using QuantumUNET.Messages;
using QuantumUNET.Transport;
2020-12-07 21:19:16 +00:00
namespace QuantumUNET
2020-12-02 18:40:38 +00:00
{
2020-12-03 08:28:05 +00:00
internal class QSBULocalConnectionToClient : QSBNetworkConnection
2020-12-02 18:40:38 +00:00
{
public QSBULocalConnectionToClient(QSBLocalClient localClient)
{
address = "localClient";
2020-12-08 09:03:10 +00:00
LocalClient = localClient;
2020-12-02 18:40:38 +00:00
}
2020-12-08 09:03:10 +00:00
public QSBLocalClient LocalClient { get; }
2020-12-02 18:40:38 +00:00
2020-12-04 09:23:27 +00:00
public override bool Send(short msgType, QSBMessageBase msg)
2020-12-02 18:40:38 +00:00
{
2020-12-08 09:03:10 +00:00
LocalClient.InvokeHandlerOnClient(msgType, msg, 0);
2020-12-02 18:40:38 +00:00
return true;
}
2020-12-04 09:23:27 +00:00
public override bool SendUnreliable(short msgType, QSBMessageBase msg)
2020-12-02 18:40:38 +00:00
{
2020-12-08 09:03:10 +00:00
LocalClient.InvokeHandlerOnClient(msgType, msg, 1);
2020-12-02 18:40:38 +00:00
return true;
}
2020-12-04 09:23:27 +00:00
public override bool SendByChannel(short msgType, QSBMessageBase msg, int channelId)
2020-12-02 18:40:38 +00:00
{
2020-12-08 09:03:10 +00:00
LocalClient.InvokeHandlerOnClient(msgType, msg, channelId);
2020-12-02 18:40:38 +00:00
return true;
}
public override bool SendBytes(byte[] bytes, int numBytes, int channelId)
{
2020-12-08 09:03:10 +00:00
LocalClient.InvokeBytesOnClient(bytes, channelId);
2020-12-02 18:40:38 +00:00
return true;
}
2020-12-04 09:23:27 +00:00
public override bool SendWriter(QSBNetworkWriter writer, int channelId)
2020-12-02 18:40:38 +00:00
{
2020-12-08 09:03:10 +00:00
LocalClient.InvokeBytesOnClient(writer.AsArray(), channelId);
2020-12-02 18:40:38 +00:00
return true;
}
public override void GetStatsOut(out int numMsgs, out int numBufferedMsgs, out int numBytes, out int lastBufferedPerSecond)
{
numMsgs = 0;
numBufferedMsgs = 0;
numBytes = 0;
lastBufferedPerSecond = 0;
}
public override void GetStatsIn(out int numMsgs, out int numBytes)
{
numMsgs = 0;
numBytes = 0;
}
}
2020-12-03 08:28:05 +00:00
}