Newer
Older
DungeonShooting / DungeonShooting_Godot / src / game / manager / EditorPlayManager.cs
  1.  
  2. using System.Collections.Generic;
  3.  
  4. public static class EditorPlayManager
  5. {
  6. /// <summary>
  7. /// 是否正在播放
  8. /// </summary>
  9. public static bool IsPlay { get; set; }
  10.  
  11. private static DungeonConfig _config;
  12. public static void Play(UiBase prevUi)
  13. {
  14. if (IsPlay)
  15. {
  16. return;
  17. }
  18.  
  19. IsPlay = true;
  20. _config = new DungeonConfig();
  21. _config.GroupName = EditorManager.SelectDungeonGroup.GroupName;
  22. _config.DesignatedType = EditorManager.SelectRoom.RoomInfo.RoomType;
  23. _config.DesignatedRoom = new List<DungeonRoomSplit>();
  24. _config.DesignatedRoom.Add(EditorManager.SelectRoom);
  25. GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config);
  26. }
  27.  
  28. public static void Exit()
  29. {
  30. if (!IsPlay)
  31. {
  32. return;
  33. }
  34.  
  35. IsPlay = false;
  36. GameApplication.Instance.DungeonManager.EditorExitDungeon();
  37. }
  38.  
  39. public static void Restart()
  40. {
  41. if (!IsPlay)
  42. {
  43. return;
  44. }
  45. GameApplication.Instance.DungeonManager.ExitDungeon(() =>
  46. {
  47. GameApplication.Instance.DungeonManager.EditorPlayDungeon(_config);
  48. });
  49. }
  50. }