ErrorCodeController.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using UnityEngine;
  7. namespace GFGGame
  8. {
  9. public class ErrorCodeController
  10. {
  11. public static bool Handler(int errorCode)
  12. {
  13. switch(errorCode)
  14. {
  15. case ET.ErrorCode.ERR_Success:
  16. {
  17. return false;
  18. }
  19. case ET.ErrorCode.ERR_NetWorkError:
  20. {
  21. Alert.Show("网络异常")
  22. .SetRightButton(true, "知道了", (object data) =>
  23. {
  24. Application.Quit();
  25. });
  26. }
  27. break;
  28. case ET.ErrorCode.ERR_ClientVersionError:
  29. {
  30. Alert.Show("客户端版本错误,请联系研发获取最新版本!")
  31. .SetLeftButton(true, "知道了", (data) =>
  32. {
  33. Application.Quit();
  34. });
  35. }
  36. break;
  37. case ET.ErrorCode.Err_LoginCountFull:
  38. {
  39. Alert.Show("游戏已爆满,请稍后再试!")
  40. .SetLeftButton(true, "知道了");
  41. }
  42. break;
  43. case ET.ErrorCode.Err_ServerMaintain:
  44. {
  45. Alert.Show("服务器维护中,请稍后再试!")
  46. .SetLeftButton(true, "知道了", (data) =>
  47. {
  48. Application.Quit();
  49. });
  50. }
  51. break;
  52. case ET.ErrorCode.ERR_AntiAddiction:
  53. {
  54. string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
  55. Alert.Show(promptStr)
  56. .SetRightButton(true, "知道啦", (object data) =>
  57. {
  58. });
  59. }
  60. break;
  61. default:
  62. if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  63. {
  64. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  65. ET.Log.Error("errorCode" + errorCode.ToString());
  66. return true;
  67. }
  68. else
  69. {
  70. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  71. ET.Log.Error("errorCode" + errorCode.ToString());
  72. return true;
  73. }
  74. }
  75. return false;
  76. }
  77. }
  78. }