ErrorCodeController.cs 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using UnityEngine;
  2. namespace GFGGame
  3. {
  4. public class ErrorCodeController
  5. {
  6. public static bool Handler(int errorCode)
  7. {
  8. switch(errorCode)
  9. {
  10. case ET.ErrorCode.ERR_Success:
  11. {
  12. return false;
  13. }
  14. case ET.ErrorCode.ERR_NetWorkError:
  15. {
  16. Alert.Show("网络异常")
  17. .SetRightButton(true, "知道了", (object data) =>
  18. {
  19. Application.Quit();
  20. });
  21. }
  22. break;
  23. case ET.ErrorCode.ERR_ClientVersionError:
  24. {
  25. Alert.Show("客户端版本错误,请联系研发获取最新版本!")
  26. .SetLeftButton(true, "知道了", (data) =>
  27. {
  28. Application.Quit();
  29. });
  30. }
  31. break;
  32. case ET.ErrorCode.Err_LoginCountFull:
  33. {
  34. Alert.Show("游戏已爆满,请稍后再试!")
  35. .SetLeftButton(true, "知道了");
  36. }
  37. break;
  38. case ET.ErrorCode.Err_ServerMaintain:
  39. {
  40. Alert.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. Alert.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. }