AlertSystem.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * 使用示例:
  3. AlertSystem.Show("喜欢吗!")
  4. .SetTitle("温馨提示")
  5. .SetLeftButton(true, "喜欢", (object data1) =>
  6. {
  7. })
  8. .SetRightButton(true, "不喜欢")
  9. .SetData("aa");
  10. */
  11. namespace GFGGame
  12. {
  13. public class AlertSystem
  14. {
  15. private static AlertWindow _alertWindow;
  16. public static IAlert Show(string message, string tips = "")
  17. {
  18. if (_alertWindow == null)
  19. {
  20. _alertWindow = new AlertWindow();
  21. }
  22. _alertWindow.Reset();
  23. _alertWindow.viewName = "AlertSystem";
  24. _alertWindow.SetLayer(ConstViewLayer.ALERT);
  25. _alertWindow.SetMessage(message);
  26. _alertWindow.SetTips(tips);
  27. _alertWindow.Show();
  28. return _alertWindow;
  29. }
  30. public static void Hide()
  31. {
  32. if (_alertWindow != null)
  33. {
  34. _alertWindow.Hide();
  35. }
  36. }
  37. public static void Dispose()
  38. {
  39. _alertWindow = null;
  40. }
  41. public static bool IsShow
  42. {
  43. get
  44. {
  45. if (_alertWindow == null)
  46. {
  47. return false;
  48. }
  49. return _alertWindow.isShowing;
  50. }
  51. }
  52. }
  53. }