ErrorCodeController.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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, "知道了");
  33. }
  34. break;
  35. case ET.ErrorCode.Err_ServerMaintain:
  36. {
  37. AlertSystem.Show("服务器维护中,请稍后再试!")
  38. .SetLeftButton(true, "知道了", (data) =>
  39. {
  40. Application.Quit();
  41. });
  42. }
  43. break;
  44. case ET.ErrorCode.ERR_AntiAddiction:
  45. {
  46. string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
  47. AlertSystem.Show(promptStr)
  48. .SetRightButton(true, "知道啦", (object data) =>
  49. {
  50. });
  51. }
  52. break;
  53. default:
  54. if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  55. {
  56. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  57. ET.Log.Debug("errorCode" + errorCode.ToString());
  58. return true;
  59. }
  60. else
  61. {
  62. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  63. ET.Log.Error("errorCode" + errorCode.ToString());
  64. return true;
  65. }
  66. }
  67. return false;
  68. }
  69. }
  70. }