ErrorCodeController.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. Application.Quit();
  30. });
  31. }
  32. else if (errorCode == ET.ErrorCode.ERR_AntiAddiction)
  33. {
  34. string promptStr = "您属于未成年人,已被纳入防沉迷系统。每日22时至次日8时,本游戏将无法为未成年人用户提供游戏服务。";
  35. Alert.Show(promptStr)
  36. .SetRightButton(true, "知道啦", (object data) =>
  37. {
  38. });
  39. }
  40. else
  41. {
  42. PromptController.Instance.ShowFloatTextPrompt("errorCode " + errorCode.ToString());
  43. ET.Log.Error("errorCode" + errorCode.ToString());
  44. return true;
  45. }
  46. return false;
  47. }
  48. }
  49. }