C2R_LoginHandler.cs 836 B

12345678910111213141516171819202122232425
  1. using System;
  2. using System.Net;
  3. namespace ET.Server
  4. {
  5. [MessageHandler(SceneType.Realm)]
  6. public class C2R_LoginHandler : AMRpcHandler<C2R_Login, R2C_Login>
  7. {
  8. protected override async ETTask Run(Session session, C2R_Login request, R2C_Login response)
  9. {
  10. // 随机分配一个Game
  11. StartSceneConfig config = RealmGameAddressHelper.GetGame(session.DomainZone());
  12. Log.Debug($"gate address: {MongoHelper.ToJson(config)}");
  13. // 向gate请求一个key,客户端可以拿着这个key连接gate
  14. G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await ActorMessageSenderComponent.Instance.Call(
  15. config.InstanceId, new R2G_GetLoginKey() {Account = request.Account});
  16. response.Address = config.InnerIPOutPort.ToString();
  17. response.Key = g2RGetLoginKey.Key;
  18. response.GateId = g2RGetLoginKey.GateId;
  19. }
  20. }
  21. }