mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
26 lines
844 B
C#
26 lines
844 B
C#
using System;
|
|
using System.Net;
|
|
|
|
|
|
namespace ET.Server
|
|
{
|
|
[MessageHandler(SceneType.Realm)]
|
|
public class C2R_LoginHandler : MessageHandler<C2R_Login, R2C_Login>
|
|
{
|
|
protected override async ETTask Run(Session session, C2R_Login request, R2C_Login response)
|
|
{
|
|
// 随机分配一个Gate
|
|
StartSceneConfig config = RealmGateAddressHelper.GetGate(session.Zone(), request.Account);
|
|
Log.Debug($"gate address: {config}");
|
|
|
|
// 向gate请求一个key,客户端可以拿着这个key连接gate
|
|
G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await session.Fiber().Root.GetComponent<ActorSenderComponent>().Call(
|
|
config.ActorId, new R2G_GetLoginKey() {Account = request.Account});
|
|
|
|
response.Address = config.InnerIPPort.ToString();
|
|
response.Key = g2RGetLoginKey.Key;
|
|
response.GateId = g2RGetLoginKey.GateId;
|
|
}
|
|
}
|
|
}
|