新增相关协议
This commit is contained in:
55
Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs
Normal file
55
Hotfix/Common/Handler/G2Common_ExitRequestHandler.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using Fantasy;
|
||||
using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
public class G2Common_ExitRequestHandler : RouteRPC<Scene, G2Common_ExitRequest, Common2G_ExitResponse>
|
||||
{
|
||||
protected override async FTask Run(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response,
|
||||
Action reply)
|
||||
{
|
||||
switch (scene.SceneType)
|
||||
{
|
||||
case SceneType.Game:
|
||||
{
|
||||
await RunGame(scene, request, response);
|
||||
|
||||
break;
|
||||
}
|
||||
case SceneType.Social:
|
||||
{
|
||||
await RunSocial(scene, request, response);
|
||||
break;
|
||||
}
|
||||
case SceneType.Map:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
private async FTask RunSocial(Scene scene, G2Common_ExitRequest request, Common2G_ExitResponse response)
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var chatUnitManageComponent = scene.GetComponent<SocialUnitManageComponent>();
|
||||
await chatUnitManageComponent.Offline(scene, request.AccountId, request.GateRouteId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user