/// <summary>
/// 发送灵活数据包
/// </summary>
/// <param name="client">客户端集合</param>
/// <param name="cmd"></param>
/// <param name="buffer">要包装的数据,你自己来定</param>
/// <param name="kernel">内核? 你包装的数据在客户端是否被内核NetConvert序列化?</param>
/// <param name="serialize">序列化? 你包装的数据是否在服务器即将发送时NetConvert序列化?</param>
public void SendRT(Player client, byte cmd, byte[] buffer, bool kernel, bool serialize)
{
if (client.CloseSend)
return;
if (client.tcpRPCModels.Count >= ushort.MaxValue)
{
Debug.LogError($"[{client.UserID}]数据缓存列表超出限制!");
return;
}
if (buffer.Length / MTU > ushort.MaxValue)
{
Debug.LogError("数据太大,请分块发送!");
return;
}
client.tcpRPCModels.Enqueue(new RPCModel(cmd, buffer, kernel, serialize) { bigData = buffer.Length > short.MaxValue });
}