diff --git a/DungeonShooting_Godot/scene/Dungeon.tscn b/DungeonShooting_Godot/scene/Dungeon.tscn new file mode 100644 index 0000000..8944b1e --- /dev/null +++ b/DungeonShooting_Godot/scene/Dungeon.tscn @@ -0,0 +1,38 @@ +[gd_scene load_steps=3 format=3 uid="uid://bqf2vks5ggnsp"] + +[ext_resource type="Script" path="res://src/game/room/Dungeon.cs" id="1_txiyv"] + +[sub_resource type="Environment" id="Environment_g06jj"] +background_mode = 3 +glow_enabled = true +glow_normalized = true +glow_strength = 1.05 +glow_blend_mode = 1 + +[node name="Dungeon" type="CanvasModulate"] +script = ExtResource("1_txiyv") +metadata/_edit_vertical_guides_ = [] + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_g06jj") + +[node name="TileRoot" type="TileMap" parent="." groups=["navigation"]] +y_sort_enabled = true +format = 2 + +[node name="NavigationRoot" type="Node2D" parent="TileRoot"] +z_index = -2 + +[node name="StaticSpriteRoot" type="Node2D" parent="TileRoot"] +z_index = -2 + +[node name="NormalLayer" type="Node2D" parent="TileRoot"] +z_index = -1 + +[node name="YSortLayer" type="Node2D" parent="TileRoot"] +z_index = 2 +y_sort_enabled = true + +[node name="AffiliationAreaRoot" type="Node2D" parent="TileRoot"] + +[node name="FogMaskRoot" type="Node2D" parent="TileRoot"] diff --git a/DungeonShooting_Godot/scene/Hall.tscn b/DungeonShooting_Godot/scene/Hall.tscn index c912614..531af2c 100644 --- a/DungeonShooting_Godot/scene/Hall.tscn +++ b/DungeonShooting_Godot/scene/Hall.tscn @@ -1,10 +1,11 @@ [gd_scene load_steps=6 format=3 uid="uid://c2hynqudkykxl"] -[ext_resource type="PackedScene" uid="uid://bqf2vks5ggnsp" path="res://scene/World.tscn" id="1_31od0"] +[ext_resource type="PackedScene" uid="uid://bqf2vks5ggnsp" path="res://scene/Dungeon.tscn" id="1_31od0"] [ext_resource type="Script" path="res://src/game/hall/Hall.cs" id="2_43fdu"] [ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="3_3cr4y"] [ext_resource type="Script" path="res://src/game/hall/DungeonEntrance.cs" id="3_t3my6"] + [sub_resource type="RectangleShape2D" id="RectangleShape2D_ru8u4"] size = Vector2(122, 116) diff --git a/DungeonShooting_Godot/scene/World.tscn b/DungeonShooting_Godot/scene/World.tscn deleted file mode 100644 index 50f8a64..0000000 --- a/DungeonShooting_Godot/scene/World.tscn +++ /dev/null @@ -1,38 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://bqf2vks5ggnsp"] - -[ext_resource type="Script" path="res://src/game/World.cs" id="1_kt3mm"] - -[sub_resource type="Environment" id="Environment_g06jj"] -background_mode = 3 -glow_enabled = true -glow_normalized = true -glow_strength = 1.05 -glow_blend_mode = 1 - -[node name="World" type="CanvasModulate"] -script = ExtResource("1_kt3mm") -metadata/_edit_vertical_guides_ = [] - -[node name="WorldEnvironment" type="WorldEnvironment" parent="."] -environment = SubResource("Environment_g06jj") - -[node name="TileRoot" type="TileMap" parent="." groups=["navigation"]] -y_sort_enabled = true -format = 2 - -[node name="NavigationRoot" type="Node2D" parent="TileRoot"] -z_index = -2 - -[node name="StaticSpriteRoot" type="Node2D" parent="TileRoot"] -z_index = -2 - -[node name="NormalLayer" type="Node2D" parent="TileRoot"] -z_index = -1 - -[node name="YSortLayer" type="Node2D" parent="TileRoot"] -z_index = 2 -y_sort_enabled = true - -[node name="AffiliationAreaRoot" type="Node2D" parent="TileRoot"] - -[node name="FogMaskRoot" type="Node2D" parent="TileRoot"] diff --git a/DungeonShooting_Godot/src/game/World.cs b/DungeonShooting_Godot/src/game/World.cs index 7438e4e..6b0ff4d 100644 --- a/DungeonShooting_Godot/src/game/World.cs +++ b/DungeonShooting_Godot/src/game/World.cs @@ -99,14 +99,6 @@ } /// - /// 初始化 TileMap 中的层级 - /// - public void InitLayer() - { - MapLayerManager.InitMapLayer(TileRoot); - } - - /// /// 获取指定层级根节点 /// public Node2D GetRoomLayer(RoomLayerEnum layerEnum) diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 7b26aa8..3f272cb 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -6,64 +6,12 @@ public const string default_bus_layout_tres = "res://default_bus_layout.tres"; public const string default_env_tres = "res://default_env.tres"; public const string icon_png = "res://icon.png"; - public const string build_windows_data_DungeonShooting_windows_x86_64_DungeonShooting_deps_json = "res://build/windows/data_DungeonShooting_windows_x86_64/DungeonShooting.deps.json"; - public const string build_windows_data_DungeonShooting_windows_x86_64_DungeonShooting_runtimeconfig_json = "res://build/windows/data_DungeonShooting_windows_x86_64/DungeonShooting.runtimeconfig.json"; - public const string build_windows_resource_map_tileMaps_GroupConfig_json = "res://build/windows/resource/map/tileMaps/GroupConfig.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle1_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle1/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle1_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle1/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle1_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle1/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle1_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle1/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle2_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle2/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle2_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle2/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle2_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle2/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle2_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle2/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle3_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle3/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle3_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle3/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle3_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle3/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle3_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle3/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle4_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle4/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle4_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle4/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle4_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle4/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle4_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle4/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle5_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle5/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle5_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle5/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle5_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle5/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_battle_Battle5_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/battle/Battle5/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_boss_Boss1_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/boss/Boss1/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_boss_Boss1_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/boss/Boss1/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_boss_Boss1_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/boss/Boss1/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_boss_Boss1_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/boss/Boss1/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_inlet_Start_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/inlet/Start/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_inlet_Start_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/inlet/Start/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_inlet_Start_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/inlet/Start/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_inlet_Start_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/inlet/Start/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_outlet_End1_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/outlet/End1/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_outlet_End1_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/outlet/End1/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_outlet_End1_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/outlet/End1/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_outlet_End1_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/outlet/End1/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_reward_Award1_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/reward/Award1/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_reward_Award1_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/reward/Award1/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_reward_Award1_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/reward/Award1/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_reward_Award1_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/reward/Award1/TileInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_shop_Shop1_Preinstall_json = "res://build/windows/resource/map/tileMaps/Test1/shop/Shop1/Preinstall.json"; - public const string build_windows_resource_map_tileMaps_Test1_shop_Shop1_Preview_png = "res://build/windows/resource/map/tileMaps/Test1/shop/Shop1/Preview.png"; - public const string build_windows_resource_map_tileMaps_Test1_shop_Shop1_RoomInfo_json = "res://build/windows/resource/map/tileMaps/Test1/shop/Shop1/RoomInfo.json"; - public const string build_windows_resource_map_tileMaps_Test1_shop_Shop1_TileInfo_json = "res://build/windows/resource/map/tileMaps/Test1/shop/Shop1/TileInfo.json"; - public const string build_windows_resource_map_tileSet_TileSetConfig_json = "res://build/windows/resource/map/tileSet/TileSetConfig.json"; - public const string build_windows_resource_map_tileSet_TileSet1_Main_png = "res://build/windows/resource/map/tileSet/TileSet1/Main.png"; - public const string build_windows_resource_map_tileSet_TileSet1_Test1_png = "res://build/windows/resource/map/tileSet/TileSet1/Test1.png"; - public const string build_windows_resource_map_tileSet_TileSet1_Test2_png = "res://build/windows/resource/map/tileSet/TileSet1/Test2.png"; - public const string build_windows_resource_map_tileSet_TileSet1_Test3_png = "res://build/windows/resource/map/tileSet/TileSet1/Test3.png"; - public const string build_windows_resource_map_tileSet_TileSet1_TileSet_json = "res://build/windows/resource/map/tileSet/TileSet1/TileSet.json"; - public const string build_windows_resource_map_tileSet_TileSet2_Main_png = "res://build/windows/resource/map/tileSet/TileSet2/Main.png"; - public const string build_windows_resource_map_tileSet_TileSet2_Test2_png = "res://build/windows/resource/map/tileSet/TileSet2/Test2.png"; - public const string build_windows_resource_map_tileSet_TileSet2_TileSet_json = "res://build/windows/resource/map/tileSet/TileSet2/TileSet.json"; public const string excelTool_bin_Release_net8_0_winx64_ExcelTool_deps_json = "res://excelTool/bin/Release/net8.0/win-x64/ExcelTool.deps.json"; public const string excelTool_bin_Release_net8_0_winx64_ExcelTool_runtimeconfig_json = "res://excelTool/bin/Release/net8.0/win-x64/ExcelTool.runtimeconfig.json"; public const string excelTool_obj_ExcelTool_csproj_nuget_dgspec_json = "res://excelTool/obj/ExcelTool.csproj.nuget.dgspec.json"; public const string excelTool_obj_project_assets_json = "res://excelTool/obj/project.assets.json"; public const string excelTool_obj_Release_net8_0_winx64_ExcelTool_csproj_FileListAbsolute_txt = "res://excelTool/obj/Release/net8.0/win-x64/ExcelTool.csproj.FileListAbsolute.txt"; - public const string excelTool_obj_Release_net8_0_winx64_PublishOutputs_a0fcfe3642_txt = "res://excelTool/obj/Release/net8.0/win-x64/PublishOutputs.a0fcfe3642.txt"; + public const string excelTool_obj_Release_net8_0_winx64_PublishOutputs_77891b5d25_txt = "res://excelTool/obj/Release/net8.0/win-x64/PublishOutputs.77891b5d25.txt"; public const string excelTool_publish_winx64_ExcelTool_deps_json = "res://excelTool/publish/win-x64/ExcelTool.deps.json"; public const string excelTool_publish_winx64_ExcelTool_runtimeconfig_json = "res://excelTool/publish/win-x64/ExcelTool.runtimeconfig.json"; public const string prefab_Cursor_tscn = "res://prefab/Cursor.tscn"; @@ -568,9 +516,9 @@ public const string resource_spriteFrames_weapon_Weapon0016_tres = "res://resource/spriteFrames/weapon/Weapon0016.tres"; public const string resource_theme_mainTheme_tres = "res://resource/theme/mainTheme.tres"; public const string resource_theme_theme1_tres = "res://resource/theme/theme1.tres"; + public const string scene_Dungeon_tscn = "res://scene/Dungeon.tscn"; public const string scene_Hall_tscn = "res://scene/Hall.tscn"; public const string scene_Main_tscn = "res://scene/Main.tscn"; - public const string scene_World_tscn = "res://scene/World.tscn"; public const string scene_test_TestCreateSector_tscn = "res://scene/test/TestCreateSector.tscn"; public const string scene_test_TestDrawSprite_tscn = "res://scene/test/TestDrawSprite.tscn"; public const string scene_test_TestGridData_tscn = "res://scene/test/TestGridData.tscn"; diff --git a/DungeonShooting_Godot/src/game/room/Dungeon.cs b/DungeonShooting_Godot/src/game/room/Dungeon.cs new file mode 100644 index 0000000..8efe81a --- /dev/null +++ b/DungeonShooting_Godot/src/game/room/Dungeon.cs @@ -0,0 +1,14 @@ + +/// +/// 地牢类 +/// +public partial class Dungeon : World +{ + /// + /// 初始化 TileMap 中的层级 + /// + public void InitLayer() + { + MapLayerManager.InitMapLayer(TileRoot); + } +} \ 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 11195d7..bd96155 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -68,7 +68,7 @@ /// /// 创建新的 World 对象, 相当于清理房间 /// - public World CreateNewWorld(SeedRandom random, string scenePath = ResourcePath.scene_World_tscn) + public World CreateNewWorld(SeedRandom random, string scenePath) { if (CurrWorld != null) { @@ -77,11 +77,6 @@ } CurrWorld = ResourceManager.LoadAndInstantiate(scenePath); GameApplication.Instance.SceneRoot.AddChild(CurrWorld); - if (CurrWorld is not Hall) - { - CurrWorld.InitLayer(); - } - CurrWorld.InitRandomPool(random); return CurrWorld; } @@ -428,7 +423,8 @@ yield return 0; //创建世界场景 - CurrWorld = CreateNewWorld(_dungeonGenerator.Random); + var dungeon = (Dungeon)CreateNewWorld(_dungeonGenerator.Random, ResourcePath.scene_Dungeon_tscn); + dungeon.InitLayer(); yield return 0; var group = GameApplication.Instance.RoomConfig[CurrConfig.GroupName]; var tileSetSplit = GameApplication.Instance.TileSetConfig[group.TileSet];