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. });
  54. }
  55. break;
  56. default:
  57. if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  58. {
  59. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  60. ET.Log.Debug("errorCode" + errorCode.ToString());
  61. return true;
  62. }
  63. else
  64. {
  65. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  66. ET.Log.Error("errorCode" + errorCode.ToString());
  67. return true;
  68. }
  69. }
  70. return false;
  71. }
  72. }
  73. }