/// <summary>
/// 发送自定义网络数据
/// </summary>
/// <param name="client">发送到客户端</param>
/// <param name="cmd">网络命令</param>
/// <param name="buffer">数据缓冲区</param>
public virtual void Send(Player client, byte cmd, byte[] buffer)
{
if (client.CloseSend)
return;
if (client.udpRPCModels.Count >= ushort.MaxValue)
{
Debug.LogError($"[{client.UserID}]数据缓存列表超出限制!");
return;
}
if (buffer.Length > 65507)
{
Debug.LogError("数据太大,请分块发送!");
return;
}
client.udpRPCModels.Enqueue(new RPCModel(cmd, buffer) { bigData = buffer.Length > short.MaxValue });
}