房间创建和进入相关逻辑和协议
This commit is contained in:
@@ -3,6 +3,7 @@ using Fantasy.Async;
|
||||
using Fantasy.Network.Interface;
|
||||
using NB.Chat;
|
||||
using NB.Game;
|
||||
using NB.Map;
|
||||
|
||||
namespace NB.Common;
|
||||
|
||||
@@ -28,6 +29,7 @@ public class G2Common_EnterRequestHandler : RouteRPC<Scene, G2Common_EnterReques
|
||||
}
|
||||
case SceneType.Map:
|
||||
{
|
||||
await RunMap(scene, request, response);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -39,14 +41,15 @@ public class G2Common_EnterRequestHandler : RouteRPC<Scene, G2Common_EnterReques
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var gameAccountManageComponent = scene.GetComponent<PlayerManageComponent>();
|
||||
var account = await gameAccountManageComponent.Online(scene, request.AccountId, request.GateRouteId);
|
||||
var account = await gameAccountManageComponent.Online(request.AccountId, request.GateRouteId);
|
||||
if (account == null)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.ErrServer;
|
||||
return;
|
||||
}
|
||||
|
||||
response.RoleRouteId = account.RuntimeId;
|
||||
response.UnitRouteId = account.RuntimeId;
|
||||
Log.Info($"登录到游戏服成功,id={response.UnitRouteId}");
|
||||
}
|
||||
|
||||
private async FTask RunSocial(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response)
|
||||
@@ -61,6 +64,23 @@ public class G2Common_EnterRequestHandler : RouteRPC<Scene, G2Common_EnterReques
|
||||
return;
|
||||
}
|
||||
|
||||
response.RoleRouteId = account.RuntimeId;
|
||||
response.UnitRouteId = account.RuntimeId;
|
||||
Log.Info($"登录到社交服成功,id={response.UnitRouteId}");
|
||||
}
|
||||
|
||||
private async FTask RunMap(Scene scene, G2Common_EnterRequest request, G2Common_EnterResponse response)
|
||||
{
|
||||
// 在缓存中检查该账号是否存在
|
||||
var chatUnitManageComponent = scene.GetComponent<MapUnitManageComponent>();
|
||||
var account = await chatUnitManageComponent.Online(scene, request.AccountId, request.GateRouteId);
|
||||
|
||||
if (account == null)
|
||||
{
|
||||
response.ErrorCode = ErrorCode.ErrServer;
|
||||
return;
|
||||
}
|
||||
|
||||
response.UnitRouteId = account.RuntimeId;
|
||||
Log.Info($"登录到地图服成功,id={response.UnitRouteId}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user