diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn index 7e28155..7af9347 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -212,6 +212,8 @@ [node name="SubViewport" type="SubViewport" parent="Bg/VBoxContainer/HSplitContainer/HSplitContainer2/HBoxContainer/Left/MarginContainer/MapView"] handle_input_locally = false +snap_2d_transforms_to_pixel = true +snap_2d_vertices_to_pixel = true canvas_item_default_texture_filter = 0 size = Vector2i(980, 1002) render_target_update_mode = 4 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start/Preview.png index 10b7a4e..bf23f36 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start/Preview.png +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start/Preview.png Binary files differ diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index a604cad..b55999a 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -24,6 +24,8 @@ [node name="SubViewport" type="SubViewport" parent="ViewCanvas/SubViewportContainer"] disable_3d = true handle_input_locally = false +snap_2d_transforms_to_pixel = true +snap_2d_vertices_to_pixel = true use_hdr_2d = true canvas_item_default_texture_filter = 0 size = Vector2i(320, 180) diff --git a/DungeonShooting_Godot/src/game/hall/DungeonEntrance.cs b/DungeonShooting_Godot/src/game/hall/DungeonEntrance.cs index 59b4665..1df3aa2 100644 --- a/DungeonShooting_Godot/src/game/hall/DungeonEntrance.cs +++ b/DungeonShooting_Godot/src/game/hall/DungeonEntrance.cs @@ -14,6 +14,7 @@ { if (body is Player) { + UiManager.Open_Loading(); GameApplication.Instance.DungeonManager.ExitHall(() => { // 验证该组是否满足生成地牢的条件 @@ -21,11 +22,15 @@ var result = DungeonManager.CheckDungeon(config.GroupName); if (result.HasError) { + UiManager.Destroy_Loading(); EditorWindowManager.ShowTips("警告", "当前组'" + config.GroupName + "'" + result.ErrorMessage + ", 不能生成地牢!"); } else { - GameApplication.Instance.DungeonManager.LoadDungeon(config); + GameApplication.Instance.DungeonManager.LoadDungeon(config, () => + { + UiManager.Destroy_Loading(); + }); } }); } diff --git a/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs index 376de4a..da7453f 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs @@ -9,7 +9,7 @@ public static bool IsPlay { get; set; } private static DungeonConfig _config; - + public static void Play(UiBase prevUi) { if (IsPlay) @@ -23,8 +23,12 @@ _config.DesignatedType = EditorTileMapManager.SelectRoom.RoomInfo.RoomType; _config.DesignatedRoom = new List(); _config.DesignatedRoom.Add(EditorTileMapManager.SelectRoom); - GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config); - } + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config, () => + { + UiManager.Destroy_Loading(); + }); +} public static void Exit() { @@ -34,7 +38,11 @@ } IsPlay = false; - GameApplication.Instance.DungeonManager.EditorExitDungeon(); + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.EditorExitDungeon(() => + { + UiManager.Destroy_Loading(); + }); } public static void Restart() @@ -43,10 +51,13 @@ { return; } - + UiManager.Open_Loading(); GameApplication.Instance.DungeonManager.ExitDungeon(() => { - GameApplication.Instance.DungeonManager.EditorPlayDungeon(_config); + GameApplication.Instance.DungeonManager.EditorPlayDungeon(_config, () => + { + UiManager.Destroy_Loading(); + }); }); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index bd96155..a3226f9 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -149,13 +149,13 @@ /// /// 重启地牢 /// - public void RestartDungeon(DungeonConfig config) + public void RestartDungeon(DungeonConfig config, Action finish = null) { IsEditorMode = false; CurrConfig = config; ExitDungeon(() => { - LoadDungeon(CurrConfig); + LoadDungeon(CurrConfig, finish); }); } @@ -174,7 +174,8 @@ /// 在编辑器模式下进入地牢 /// /// 地牢配置 - public void EditorPlayDungeon(DungeonConfig config) + /// 执行完成回调 + public void EditorPlayDungeon(DungeonConfig config, Action finish = null) { IsEditorMode = true; CurrConfig = config; @@ -182,15 +183,16 @@ { _prevUi.HideUi(); } - GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(null)); + GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(finish)); } - + /// /// 在编辑器模式下进入地牢 /// /// 记录上一个Ui /// 地牢配置 - public void EditorPlayDungeon(UiBase prevUi, DungeonConfig config) + /// 执行完成回调 + public void EditorPlayDungeon(UiBase prevUi, DungeonConfig config, Action finish = null) { IsEditorMode = true; CurrConfig = config; @@ -199,13 +201,13 @@ { _prevUi.HideUi(); } - GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(null)); + GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(finish)); } /// /// 在编辑器模式下退出地牢, 并且打开上一个Ui /// - public void EditorExitDungeon() + public void EditorExitDungeon(Action finish = null) { IsInDungeon = false; GameApplication.Instance.StartCoroutine(RunExitDungeonCoroutine(() => @@ -216,6 +218,10 @@ { _prevUi.ShowUi(); } + if (finish != null) + { + finish(); + } })); } @@ -258,10 +264,9 @@ } } + //执行加载大厅流程 private IEnumerator RunLoadHallCoroutine(Action finish) { - //打开 loading UI - UiManager.Open_Loading(); yield return 0; var hall = (Hall)CreateNewWorld(Utils.Random, ResourcePath.scene_Hall_tscn); @@ -313,10 +318,10 @@ player.WeaponPack.PickupItem(ActivityObject.Create(ActivityObject.Ids.Id_weapon0001)); GameApplication.Instance.Cursor.SetGuiMode(false); yield return 0; - + + IsInDungeon = true; //打开游戏中的ui UiManager.Open_RoomUI(); - UiManager.Destroy_Loading(); if (finish != null) { @@ -324,10 +329,10 @@ } } + //执行退出大厅流程 private IEnumerator RunExitHallCoroutine(Action finish) { - //打开 loading UI - UiManager.Open_Loading(); + IsInDungeon = false; yield return 0; CurrWorld.Pause = true; @@ -351,8 +356,6 @@ GameApplication.Instance.Cursor.SetGuiMode(true); yield return 0; - //关闭 loading UI - UiManager.Destroy_Loading(); if (finish != null) { finish(); @@ -363,8 +366,6 @@ //执行加载地牢协程 private IEnumerator RunLoadDungeonCoroutine(Action finish) { - //打开 loading UI - UiManager.Open_Loading(); yield return 0; //生成地牢房间 @@ -387,25 +388,22 @@ if (!dungeonGenerator.Generate(rule)) //生成房间失败 { dungeonGenerator.EachRoom(DisposeRoomInfo); - UiManager.Destroy_Loading(); - - if (IsEditorMode) //在编辑器模式下打开的Ui - { - EditorPlayManager.IsPlay = false; - IsEditorMode = false; - //显示上一个Ui - if (_prevUi != null) - { - _prevUi.ShowUi(); - } - } - else //正常关闭Ui - { - UiManager.Open_Main(); - } - if (i == maxCount - 1) { + if (IsEditorMode) //在编辑器模式下打开的Ui + { + EditorPlayManager.IsPlay = false; + IsEditorMode = false; + //显示上一个Ui + if (_prevUi != null) + { + _prevUi.ShowUi(); + } + } + else //正常关闭Ui + { + UiManager.Open_Main(); + } EditorWindowManager.ShowTips("错误", "生成房间尝试次数过多,生成地牢房间失败,请加大房间门连接区域,或者修改地牢生成规则!"); yield break; } @@ -469,8 +467,6 @@ IsInDungeon = true; QueueRedraw(); yield return 0; - //关闭 loading UI - UiManager.Destroy_Loading(); if (finish != null) { finish(); @@ -480,8 +476,6 @@ //执行退出地牢流程 private IEnumerator RunExitDungeonCoroutine(Action finish) { - //打开 loading UI - UiManager.Open_Loading(); yield return 0; CurrWorld.Pause = true; yield return 0; @@ -505,8 +499,6 @@ //派发退出地牢事件 EventManager.EmitEvent(EventEnum.OnExitDungeon); yield return 0; - //关闭 loading UI - UiManager.Destroy_Loading(); if (finish != null) { finish(); @@ -849,7 +841,7 @@ private void OnCheckEnemy() { var activeRoom = ActiveRoomInfo; - if (activeRoom != null) + if (activeRoom != null && activeRoom.RoomPreinstall != null) { if (activeRoom.RoomPreinstall.IsRunWave) //正在生成标记 { diff --git a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs index bfabcbc..b6473d1 100644 --- a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs @@ -19,7 +19,11 @@ //点击开始游戏 private void OnStartGameClick() { - GameApplication.Instance.DungeonManager.LoadHall(); + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.LoadHall(() => + { + UiManager.Destroy_Loading(); + }); HideUi(); } diff --git a/DungeonShooting_Godot/src/game/ui/pauseMenu/PauseMenuPanel.cs b/DungeonShooting_Godot/src/game/ui/pauseMenu/PauseMenuPanel.cs index 22eb40e..e1cc910 100644 --- a/DungeonShooting_Godot/src/game/ui/pauseMenu/PauseMenuPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/pauseMenu/PauseMenuPanel.cs @@ -15,6 +15,14 @@ { S_Exit.Instance.Text = "返回编辑器"; } + else if (World.Current is Dungeon) //在游戏地牢中 + { + S_Exit.Instance.Text = "退出地牢"; + } + else //在大厅中 + { + S_Restart.Instance.Visible = false; + } } public override void Process(float delta) @@ -43,7 +51,11 @@ } else //正常重新开始 { - GameApplication.Instance.DungeonManager.RestartDungeon(GameApplication.Instance.DungeonConfig); + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.RestartDungeon(GameApplication.Instance.DungeonConfig, () => + { + UiManager.Destroy_Loading(); + }); } } @@ -55,10 +67,23 @@ { EditorPlayManager.Exit(); } - else //正常关闭Ui + else if (World.Current is Dungeon) //在游戏地牢中 { + UiManager.Open_Loading(); GameApplication.Instance.DungeonManager.ExitDungeon(() => { + GameApplication.Instance.DungeonManager.LoadHall(() => + { + UiManager.Destroy_Loading(); + }); + }); + } + else //在大厅中 + { + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.ExitHall(() => + { + UiManager.Destroy_Loading(); UiManager.Open_Main(); }); } diff --git a/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs b/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs index b0ac795..0d6f231 100644 --- a/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs @@ -28,7 +28,11 @@ } else //正常重新开始 { - GameApplication.Instance.DungeonManager.RestartDungeon(GameApplication.Instance.DungeonConfig); + UiManager.Open_Loading(); + GameApplication.Instance.DungeonManager.RestartDungeon(GameApplication.Instance.DungeonConfig, () => + { + UiManager.Destroy_Loading(); + }); } }