ErrorCodeController.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. if (errorCode == ET.ErrorCode.ERR_Success)
  14. {
  15. return false;
  16. }
  17. else if (errorCode == ET.ErrorCode.ERR_NetWorkError)
  18. {
  19. Alert.Show("连接服务器失败:\n请检查网络和服务器状态")
  20. .SetRightButton(true, "知道啦", (object data) =>
  21. {
  22. Application.Quit();
  23. });
  24. }
  25. else if (errorCode == ET.ErrorCode.ERR_ClientVersionError)
  26. {
  27. Alert.Show("版本已更新,请联系研发获取最新版本")
  28. .SetLeftButton(true, "知道了", (data) =>
  29. {
  30. Application.Quit();
  31. });
  32. }
  33. else if (errorCode == ET.ErrorCode.ERR_AntiAddiction)
  34. {
  35. string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
  36. Alert.Show(promptStr)
  37. .SetRightButton(true, "知道啦", (object data) =>
  38. {
  39. });
  40. }
  41. else if (ErrorCodeCfgArray.Instance.GetCfg(errorCode) != null)
  42. {
  43. PromptController.Instance.ShowFloatTextPrompt(ErrorCodeCfgArray.Instance.GetCfg(errorCode).tips);
  44. ET.Log.Error("errorCode" + errorCode.ToString());
  45. return true;
  46. }
  47. else
  48. {
  49. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  50. ET.Log.Error("errorCode" + errorCode.ToString());
  51. return true;
  52. }
  53. return false;
  54. }
  55. }
  56. }