A2C_DisconnectHandler.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using GFGGame;
  2. using GFGGame.Launcher;
  3. using UnityEngine;
  4. namespace ET
  5. {
  6. public class A2C_DisconnectHandler : AMHandler<A2C_Disconnect>
  7. {
  8. protected override async ETTask Run(Session session, A2C_Disconnect message)
  9. {
  10. session?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
  11. session.Dispose();
  12. switch (message.Error)
  13. {
  14. case ErrorCode.ERR_loginTimeOut:
  15. AlertSystem.Show("登录超时,请重新登录!")
  16. .SetLeftButton(true, "返回登录", (obj) =>
  17. {
  18. GameController.QuitToLoginView(false);
  19. });
  20. break;
  21. case ErrorCode.ERR_loginByOther:
  22. QDJHGameManagerInit.Instance.RepeatLogin();
  23. AlertSystem.Show("账号已在其他地方登录!")
  24. .SetLeftButton(true, "返回登录", (obj) =>
  25. {
  26. GameController.QuitToLoginView(true);
  27. });
  28. break;
  29. case ErrorCode.Err_ServerMaintain:
  30. AlertUI.Show("服务器维护中!")
  31. .SetLeftButton(true, "稍后再试", (obj) =>
  32. {
  33. Application.Quit();
  34. });
  35. break;
  36. default:
  37. if (string.IsNullOrEmpty(message.Message))
  38. {
  39. AlertSystem.Show(message.Message)
  40. .SetLeftButton(true, "返回登录", (obj) =>
  41. {
  42. GameController.QuitToLoginView(true);
  43. });
  44. }
  45. else
  46. {
  47. AlertSystem.Show("您已被迫下线!");
  48. }
  49. break;
  50. }
  51. await ETTask.CompletedTask;
  52. }
  53. }
  54. }