A2C_DisconnectHandler.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using GFGGame;
  6. namespace ET
  7. {
  8. public class A2C_DisconnectHandler : AMHandler<A2C_Disconnect>
  9. {
  10. protected override async ETTask Run(Session session, A2C_Disconnect message)
  11. {
  12. session?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
  13. session.Dispose();
  14. switch(message.Error)
  15. {
  16. case ErrorCode.ERR_loginTimeOut:
  17. Alert.Show("登录超时,请重新登录!")
  18. .SetLeftButton(true, "返回登录", (obj) =>
  19. {
  20. GameController.QuitToLoginView(false);
  21. });
  22. break;
  23. case ErrorCode.ERR_loginByOther:
  24. Alert.Show("账号已在其他地方登录!")
  25. .SetLeftButton(true, "返回登录", (obj) =>
  26. {
  27. GameController.QuitToLoginView(true);
  28. });
  29. break;
  30. default:
  31. Alert.Show("您已被迫下线!");
  32. break;
  33. }
  34. await ETTask.CompletedTask;
  35. }
  36. }
  37. }