R2G_GetLoginKeyHandler.cs 597 B

12345678910111213141516171819202122232425
  1. using System;
  2. using ETModel;
  3. namespace ETHotfix
  4. {
  5. [MessageHandler(AppType.Gate)]
  6. public class R2G_GetLoginKeyHandler : AMRpcHandler<R2G_GetLoginKey, G2R_GetLoginKey>
  7. {
  8. protected override void Run(Session session, R2G_GetLoginKey message, Action<G2R_GetLoginKey> reply)
  9. {
  10. G2R_GetLoginKey response = new G2R_GetLoginKey();
  11. try
  12. {
  13. long key = RandomHelper.RandInt64();
  14. Game.Scene.GetComponent<GateSessionKeyComponent>().Add(key, message.Account);
  15. response.Key = key;
  16. reply(response);
  17. }
  18. catch (Exception e)
  19. {
  20. ReplyError(response, e, reply);
  21. }
  22. }
  23. }
  24. }