InfoShow.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using UnityEngine.UI;
  3. internal class InfoShow
  4. {
  5. private static InfoShow _instance;
  6. public static InfoShow Instance
  7. {
  8. get
  9. {
  10. if (_instance == null)
  11. {
  12. _instance = new InfoShow();
  13. }
  14. return _instance;
  15. }
  16. }
  17. public Text titleText;
  18. public Text infoText;
  19. public Action action;
  20. public bool isAction = false;
  21. public void LogNetError(string errorMsg)
  22. {
  23. action = new Action(() =>
  24. {
  25. titleText.text = "网络错误";
  26. infoText.text = errorMsg;
  27. });
  28. isAction = true;
  29. }
  30. public void LogAuthorError(string errorMsg)
  31. {
  32. action = new Action(() =>
  33. {
  34. titleText.text = "授权错误";
  35. infoText.text = errorMsg;
  36. });
  37. isAction = true;
  38. }
  39. public void LogError(string errorMsg)
  40. {
  41. action = new Action(() =>
  42. {
  43. titleText.text = "错误";
  44. infoText.text = errorMsg;
  45. });
  46. isAction = true;
  47. }
  48. }