ErrorCodeController.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using UnityEngine;
  2. namespace GFGGame
  3. {
  4. public class ErrorCodeController
  5. {
  6. //返回结果为true时,表示可以在错误提示后继续处理后续逻辑
  7. public static bool Handler(int errorCode)
  8. {
  9. switch (errorCode)
  10. {
  11. case ET.ErrorCode.ERR_NetWorkError:
  12. {
  13. AlertSystem.Show("网络异常,也有可能是服务器异常,请稍后再试!")
  14. .SetRightButton(true, "好的", (object data) =>
  15. {
  16. GameController.QuitToLoginView(false);
  17. });
  18. }
  19. break;
  20. case ET.ErrorCode.ERR_ClientVersionError:
  21. {
  22. AlertSystem.Show("客户端版本错误,请联系研发获取最新版本!")
  23. .SetLeftButton(true, "知道了", (data) =>
  24. {
  25. Application.Quit();
  26. });
  27. return false;
  28. }
  29. case ET.ErrorCode.Err_LoginCountFull:
  30. {
  31. AlertSystem.Show("游戏已爆满,请稍后再试!")
  32. .SetLeftButton(true, "好的", (data) =>
  33. {
  34. });
  35. }
  36. break;
  37. case ET.ErrorCode.Err_ServerMaintain:
  38. {
  39. AlertSystem.Show("服务器维护中,请稍后再试!")
  40. .SetLeftButton(true, "好的", (data) =>
  41. {
  42. });
  43. }
  44. break;
  45. case ET.ErrorCode.ERR_AntiAddiction:
  46. {
  47. AntiAddictionController.ShowAntiAddictionAlert();
  48. return false;
  49. }
  50. default:
  51. if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  52. {
  53. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  54. ET.Log.Debug("errorCode" + errorCode.ToString());
  55. }
  56. else
  57. {
  58. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  59. ET.Log.Error("errorCode" + errorCode.ToString());
  60. }
  61. break;
  62. }
  63. return true;
  64. }
  65. }
  66. }