房间创建和进入相关逻辑和协议

This commit is contained in:
2025-08-27 00:04:40 +08:00
parent 7325e268ce
commit f6d85a1e0a
45 changed files with 1246 additions and 729 deletions

View File

@@ -2,6 +2,8 @@
using Fantasy.Async;
using Fantasy.Network.Interface;
using NB.Chat;
using NB.Game;
using NB.Map;
namespace NB.Common;
@@ -25,6 +27,7 @@ public class G2Common_ExitRequestHandler : RouteRPC<Scene, G2Common_ExitRequest,
}
case SceneType.Map:
{
await RunMap(scene, request, response);
break;
}
}
@@ -34,16 +37,10 @@ public class G2Common_ExitRequestHandler : RouteRPC<Scene, G2Common_ExitRequest,
private async FTask RunGame(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
{
// // 在缓存中检查该账号是否存在
// var gameAccountManageComponent = scene.GetComponent<PlayerManageComponent>();
// var account = await gameAccountManageComponent.Online(scene, request.AccountId, request.GateRouteId);
// if (account == null)
// {
// response.ErrorCode = ErrorCode.ErrServer;
// return;
// }
//
// response.RoleRouteId = account.RuntimeId;
// 在缓存中检查该账号是否存在
var gameAccountManageComponent = scene.GetComponent<PlayerManageComponent>();
await gameAccountManageComponent.Offline(request.AccountId, request.GateRouteId);
Log.Info("退出游戏服成功==");
}
private async FTask RunSocial(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
@@ -51,5 +48,14 @@ public class G2Common_ExitRequestHandler : RouteRPC<Scene, G2Common_ExitRequest,
// 在缓存中检查该账号是否存在
var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId);
Log.Info("退出聊天服成功==");
}
private async FTask RunMap(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
{
// 在缓存中检查该账号是否存在
var chatUnitManageComponent = scene.GetComponent<MapUnitManageComponent>();
await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId);
Log.Info("退出房间服成功==");
}
}