广播聊天

This commit is contained in:
bob
2025-08-07 17:51:25 +08:00
parent 70bfe43a80
commit e1a4db89ae
19 changed files with 347 additions and 21 deletions

View File

@@ -11,5 +11,6 @@ public sealed class
Caht2C_SendMessageResponse response, Action reply)
{
ChatSceneHelper.Broadcast(chatUnit.Scene, request.Message);
await FTask.CompletedTask;
}
}

View File

@@ -0,0 +1,22 @@
using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
using NB.Game;
namespace NB.Chat;
public class G2Chat_EnterRequestHandler: RouteRPC<Scene, G2Chat_EnterRequest, Chat2G_EnterResponse>
{
protected override async FTask Run(Scene scene, G2Chat_EnterRequest request, Chat2G_EnterResponse response,
Action reply)
{
Log.Debug($"收到 G2Chat_EnterRequestHandler {request.AccountId}");
// 在缓存中检查该账号是否存在
var chatUnitManageComponent = scene.GetComponent<ChatUnitManageComponent>();
var account = await chatUnitManageComponent.Online(scene, request.AccountId, request.GateRouteId);
response.RoleRouteId = account.RuntimeId;
await FTask.CompletedTask;
}
}