Alert.cs 885 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 Alert
  14. {
  15. private static AlertWindow _alertWindow;
  16. public static IAlert Show(string message)
  17. {
  18. if (_alertWindow == null)
  19. {
  20. _alertWindow = new AlertWindow();
  21. }
  22. _alertWindow.Reset();
  23. _alertWindow.SetLayer(ConstViewLayer.TOP);
  24. _alertWindow.SetMessage(message);
  25. _alertWindow.Show();
  26. return _alertWindow;
  27. }
  28. public static void hide()
  29. {
  30. if (_alertWindow != null)
  31. {
  32. _alertWindow.Hide();
  33. }
  34. }
  35. }
  36. }