Files
Fishing2Server/Hotfix/Chat/Handler/C2Chat_CreateChannelRequestHandler.cs

27 lines
761 B
C#

using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
namespace NB.Chat;
/// <summary>
/// 请求创建频道
/// </summary>
public class
C2Chat_CreateChannelRequestHandler : RouteRPC<ChatUnit, C2Chat_CreateChannelRequest, Caht2C_CreateChannelResponse>
{
protected override async FTask Run(ChatUnit entity, C2Chat_CreateChannelRequest request,
Caht2C_CreateChannelResponse response, Action reply)
{
var channelCenter = entity.Scene.GetComponent<ChatChannelCenterComponent>();
if (channelCenter == null)
{
response.ErrorCode = ErrorCode.ErrServer;
return;
}
var channel = await channelCenter.Create(entity);
response.ChannelId = channel.Id;
}
}