C2G_LoginGateHandler.cs 773 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using Base;
  3. using Model;
  4. namespace Hotfix
  5. {
  6. [MessageHandler(AppType.Gate)]
  7. public class C2G_LoginGateHandler : AMRpcHandler<C2G_LoginGate, G2C_LoginGate>
  8. {
  9. protected override async void Run(Session session, C2G_LoginGate message, Action<G2C_LoginGate> reply)
  10. {
  11. G2C_LoginGate response = new G2C_LoginGate();
  12. try
  13. {
  14. bool isCheckOK = Game.Scene.GetComponent<GateSessionKeyComponent>().Check(message.Key);
  15. if (!isCheckOK)
  16. {
  17. response.Error = ErrorCode.ERR_ConnectGateKeyError;
  18. response.Message = "Gate key验证失败!";
  19. }
  20. reply(response);
  21. await Game.Scene.GetComponent<TimerComponent>().WaitAsync(5000);
  22. session.Dispose();
  23. }
  24. catch (Exception e)
  25. {
  26. ReplyError(response, e, reply);
  27. }
  28. }
  29. }
  30. }