ErrorCodeController.cs 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. Application.Quit();
  17. });
  18. }
  19. break;
  20. case ET.ErrorCode.ERR_ClientVersionError:
  21. {
  22. AlertSystem.Show("客户端版本错误,请联系研发获取最新版本!")
  23. .SetLeftButton(true, "知道了", (data) =>
  24. {
  25. Application.Quit();
  26. });
  27. }
  28. break;
  29. case ET.ErrorCode.Err_LoginCountFull:
  30. {
  31. AlertSystem.Show("游戏已爆满!")
  32. .SetLeftButton(true, "稍后再试", (data) =>
  33. {
  34. Application.Quit();
  35. });
  36. }
  37. break;
  38. case ET.ErrorCode.Err_ServerMaintain:
  39. {
  40. AlertSystem.Show("服务器维护中!")
  41. .SetLeftButton(true, "稍后再试", (data) =>
  42. {
  43. Application.Quit();
  44. });
  45. }
  46. break;
  47. case ET.ErrorCode.ERR_AntiAddiction:
  48. {
  49. string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
  50. AlertSystem.Show(promptStr)
  51. .SetRightButton(true, "稍后再试", (object data) =>
  52. {
  53. Application.Quit();
  54. });
  55. }
  56. break;
  57. default:
  58. if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  59. {
  60. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  61. ET.Log.Debug("errorCode" + errorCode.ToString());
  62. return true;
  63. }
  64. else
  65. {
  66. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  67. ET.Log.Error("errorCode" + errorCode.ToString());
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. }
  74. }