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.  
  13. public static void Play(UiBase prevUi)
  14. {
  15. if (IsPlay)
  16. {
  17. return;
  18. }
  19.  
  20. IsPlay = true;
  21. _config = new DungeonConfig();
  22. _config.GroupName = EditorTileMapManager.SelectDungeonGroup.GroupName;
  23. _config.DesignatedType = EditorTileMapManager.SelectRoom.RoomInfo.RoomType;
  24. _config.DesignatedRoom = new List<DungeonRoomSplit>();
  25. _config.DesignatedRoom.Add(EditorTileMapManager.SelectRoom);
  26. UiManager.Open_Loading();
  27. GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config, () =>
  28. {
  29. UiManager.Destroy_Loading();
  30. });
  31. }
  32.  
  33. public static void Exit()
  34. {
  35. if (!IsPlay)
  36. {
  37. return;
  38. }
  39.  
  40. IsPlay = false;
  41. UiManager.Open_Loading();
  42. GameApplication.Instance.DungeonManager.EditorExitDungeon(false, () =>
  43. {
  44. UiManager.Destroy_Loading();
  45. });
  46. }
  47.  
  48. public static void Restart()
  49. {
  50. if (!IsPlay)
  51. {
  52. return;
  53. }
  54. UiManager.Open_Loading();
  55. GameApplication.Instance.DungeonManager.ExitDungeon(false, () =>
  56. {
  57. GameApplication.Instance.DungeonManager.EditorPlayDungeon(_config, () =>
  58. {
  59. UiManager.Destroy_Loading();
  60. });
  61. });
  62. }
  63. }