diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs index 27c2b46..0c4f640 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs @@ -49,12 +49,6 @@ "res://addons/dungeonShooting_plugin/ActivityObject.svg" ), new CustomTypeInfo( - "DungeonRoomTemplate", - "TileMap", - "res://src/framework/activity/ActivityObjectTemplate.cs", - "res://addons/dungeonShooting_plugin/Map.svg" - ), - new CustomTypeInfo( "ActivityMark", "Node2D", "res://src/framework/map/mark/ActivityMark.cs", @@ -261,9 +255,12 @@ if (_uiMonitor != null) { _uiMonitor.ChangeCurrentNode(null); - if (CheckIsUi(node)) + if (node != null) { - _uiMonitor.ChangeCurrentNode(node); + if (CheckIsUi(node)) + { + _uiMonitor.ChangeCurrentNode(node); + } } } } diff --git a/DungeonShooting_Godot/prefab/ui/EditorTools.tscn b/DungeonShooting_Godot/prefab/ui/EditorTools.tscn index 59f0d92..8dd3024 100644 --- a/DungeonShooting_Godot/prefab/ui/EditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/EditorTools.tscn @@ -46,30 +46,6 @@ size_flags_horizontal = 0 text = "运行" -[node name="HBoxContainer2" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_constants/separation = 5 - -[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"] -layout_mode = 2 -text = "重新打包地牢房间配置" - -[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"] -layout_mode = 2 -text = "运行" - -[node name="HBoxContainer4" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_constants/separation = 5 - -[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer4"] -layout_mode = 2 -text = "重新生成当前UI的代码" - -[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer4"] -layout_mode = 2 -text = "运行" - [node name="HBoxContainer3" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 theme_override_constants/separation = 5 @@ -88,6 +64,18 @@ text = "创建 " +[node name="HBoxContainer4" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 5 + +[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer4"] +layout_mode = 2 +text = "重新生成当前UI的代码" + +[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer4"] +layout_mode = 2 +text = "运行" + [node name="HBoxContainer5" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] layout_mode = 2 theme_override_constants/separation = 5 @@ -100,6 +88,36 @@ layout_mode = 2 text = "运行" +[node name="HBoxContainer6" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 5 + +[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6"] +layout_mode = 2 +text = "创建地牢房间" + +[node name="LineEdit" type="LineEdit" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6"] +custom_minimum_size = Vector2(400, 0) +layout_mode = 2 +placeholder_text = "请输入房间名称" + +[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer6"] +layout_mode = 2 +text = "创建 +" + +[node name="HBoxContainer2" type="HBoxContainer" parent="ScrollContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 5 + +[node name="Label" type="Label" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +text = "重新打包地牢房间配置" + +[node name="Button" type="Button" parent="ScrollContainer/MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +text = "运行" + [node name="Confirm" type="ConfirmationDialog" parent="."] initial_position = 1 size = Vector2i(200, 124) diff --git a/DungeonShooting_Godot/resource/map/RoomConfig.json b/DungeonShooting_Godot/resource/map/RoomConfig.json index 4857947..7f313b7 100644 --- a/DungeonShooting_Godot/resource/map/RoomConfig.json +++ b/DungeonShooting_Godot/resource/map/RoomConfig.json @@ -1,274 +1,18 @@ [ { "ScenePath": "res://resource/map/tileMaps/Room1.tscn", - "ConfigPath": "res://resource/map/tiledata/Room1.json", - "RoomInfo": { - "Position": { - "X": -10, - "Y": -6 - }, - "Size": { - "X": 20, - "Y": 13 - }, - "DoorAreaInfos": [], - "NavigationList": [ - { - "Type": 0, - "Points": [ - { - "X": -136, - "Y": -72 - }, - { - "X": 136, - "Y": -72 - }, - { - "X": 136, - "Y": 88 - }, - { - "X": -136, - "Y": 88 - } - ] - }, - { - "Type": 1, - "Points": [ - { - "X": -104, - "Y": -40 - }, - { - "X": 104, - "Y": -40 - }, - { - "X": 104, - "Y": 56 - }, - { - "X": -104, - "Y": 56 - } - ] - } - ] - } + "ConfigPath": "res://resource/map/tiledata/Room1.json" }, { "ScenePath": "res://resource/map/tileMaps/Room2.tscn", - "ConfigPath": "res://resource/map/tiledata/Room2.json", - "RoomInfo": { - "Position": { - "X": -1, - "Y": -1 - }, - "Size": { - "X": 19, - "Y": 12 - }, - "DoorAreaInfos": [ - { - "Direction": 1, - "Start": 16, - "End": 176 - }, - { - "Direction": 2, - "Start": 16, - "End": 176 - }, - { - "Direction": 3, - "Start": 128, - "End": 288 - }, - { - "Direction": 0, - "Start": 16, - "End": 176 - } - ], - "NavigationList": [ - { - "Type": 0, - "Points": [ - { - "X": 8, - "Y": 8 - }, - { - "X": 40, - "Y": 8 - }, - { - "X": 40, - "Y": 120 - }, - { - "X": 120, - "Y": 120 - }, - { - "X": 120, - "Y": 8 - }, - { - "X": 264, - "Y": 8 - }, - { - "X": 264, - "Y": 152 - }, - { - "X": 232, - "Y": 152 - }, - { - "X": 232, - "Y": 24 - }, - { - "X": 152, - "Y": 24 - }, - { - "X": 152, - "Y": 152 - }, - { - "X": 8, - "Y": 152 - } - ] - } - ] - } + "ConfigPath": "res://resource/map/tiledata/Room2.json" }, { "ScenePath": "res://resource/map/tileMaps/Room3.tscn", - "ConfigPath": "res://resource/map/tiledata/Room3.json", - "RoomInfo": { - "Position": { - "X": 5, - "Y": 3 - }, - "Size": { - "X": 21, - "Y": 21 - }, - "DoorAreaInfos": [], - "NavigationList": [ - { - "Type": 0, - "Points": [ - { - "X": 104, - "Y": 72 - }, - { - "X": 392, - "Y": 72 - }, - { - "X": 392, - "Y": 360 - }, - { - "X": 104, - "Y": 360 - } - ] - }, - { - "Type": 1, - "Points": [ - { - "X": 136, - "Y": 104 - }, - { - "X": 232, - "Y": 104 - }, - { - "X": 232, - "Y": 200 - }, - { - "X": 136, - "Y": 200 - } - ] - }, - { - "Type": 1, - "Points": [ - { - "X": 264, - "Y": 104 - }, - { - "X": 360, - "Y": 104 - }, - { - "X": 360, - "Y": 200 - }, - { - "X": 264, - "Y": 200 - } - ] - }, - { - "Type": 1, - "Points": [ - { - "X": 136, - "Y": 232 - }, - { - "X": 232, - "Y": 232 - }, - { - "X": 232, - "Y": 328 - }, - { - "X": 136, - "Y": 328 - } - ] - }, - { - "Type": 1, - "Points": [ - { - "X": 264, - "Y": 232 - }, - { - "X": 360, - "Y": 232 - }, - { - "X": 360, - "Y": 328 - }, - { - "X": 264, - "Y": 328 - } - ] - } - ] - } + "ConfigPath": "res://resource/map/tiledata/Room3.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/Room4.tscn", + "ConfigPath": "res://resource/map/tiledata/Room4.json" } ] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Room4.tscn b/DungeonShooting_Godot/resource/map/tileMaps/Room4.tscn new file mode 100644 index 0000000..ca484b5 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/Room4.tscn @@ -0,0 +1,82 @@ +[gd_scene load_steps=5 format=3 uid="uid://b8wy4ni1nkrvp"] + +[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="1_pxj2g"] +[ext_resource type="Script" path="res://src/framework/map/mark/EnemyMark.cs" id="3_k574h"] +[ext_resource type="Script" path="res://src/framework/map/mark/WeaponMark.cs" id="4_5hiyo"] +[ext_resource type="Script" path="res://src/framework/map/DungeonRoomTemplate.cs" id="dungeonRoomTemplate"] + +[node name="Room4" type="TileMap"] +tile_set = ExtResource("1_pxj2g") +format = 2 +layer_0/tile_data = PackedInt32Array(1179686, 0, 8, 1114150, 0, 8, 1048614, 0, 8, 983078, 0, 8, 917542, 0, 8, 852006, 0, 8, 786470, 0, 8, 720934, 0, 8, 655398, 0, 8, 589862, 0, 8, 524326, 0, 8, 458790, 0, 8, 1179685, 0, 8, 1114149, 0, 8, 1048613, 0, 8, 983077, 0, 8, 917541, 0, 8, 852005, 0, 8, 786469, 0, 8, 720933, 0, 8, 655397, 0, 8, 589861, 0, 8, 524325, 0, 8, 458789, 0, 8, 1179684, 0, 8, 1114148, 0, 8, 1048612, 0, 8, 983076, 0, 8, 917540, 0, 8, 852004, 0, 8, 786468, 0, 8, 720932, 0, 8, 655396, 0, 8, 589860, 0, 8, 524324, 0, 8, 458788, 0, 8, 1179683, 0, 8, 1114147, 0, 8, 1048611, 0, 8, 983075, 0, 8, 917539, 0, 8, 852003, 0, 8, 786467, 0, 8, 720931, 0, 8, 655395, 0, 8, 589859, 0, 8, 524323, 0, 8, 458787, 0, 8, 1179682, 0, 8, 1114146, 0, 8, 1048610, 0, 8, 983074, 0, 8, 917538, 0, 8, 852002, 0, 8, 786466, 0, 8, 720930, 0, 8, 655394, 0, 8, 589858, 0, 8, 524322, 0, 8, 458786, 0, 8, 1507361, 0, 8, 1441825, 0, 8, 1376289, 0, 8, 1310753, 0, 8, 1245217, 0, 8, 1179681, 0, 8, 1114145, 0, 8, 1048609, 0, 8, 983073, 0, 8, 917537, 0, 8, 852001, 0, 8, 786465, 0, 8, 720929, 0, 8, 655393, 0, 8, 589857, 0, 8, 524321, 0, 8, 458785, 0, 8, 393249, 0, 8, 327713, 0, 8, 262177, 0, 8, 196641, 0, 8, 131105, 0, 8, 1507360, 0, 8, 1441824, 0, 8, 1376288, 0, 8, 1310752, 0, 8, 1245216, 0, 8, 1179680, 0, 8, 1114144, 0, 8, 1048608, 0, 8, 983072, 0, 8, 917536, 0, 8, 852000, 0, 8, 786464, 0, 8, 720928, 0, 8, 655392, 0, 8, 589856, 0, 8, 524320, 0, 8, 458784, 0, 8, 393248, 0, 8, 327712, 0, 8, 262176, 0, 8, 196640, 0, 8, 131104, 0, 8, 1507359, 0, 8, 1441823, 0, 8, 1376287, 0, 8, 1310751, 0, 8, 1245215, 0, 8, 1179679, 0, 8, 1114143, 0, 8, 1048607, 0, 8, 983071, 0, 8, 917535, 0, 8, 851999, 0, 8, 786463, 0, 8, 720927, 0, 8, 655391, 0, 8, 589855, 0, 8, 524319, 0, 8, 458783, 0, 8, 393247, 0, 8, 327711, 0, 8, 262175, 0, 8, 196639, 0, 8, 131103, 0, 8, 1507358, 0, 8, 1441822, 0, 8, 1376286, 0, 8, 1310750, 0, 8, 1245214, 0, 8, 1179678, 0, 8, 1114142, 0, 8, 1048606, 0, 8, 983070, 0, 8, 917534, 0, 8, 851998, 0, 8, 786462, 0, 8, 720926, 0, 8, 655390, 0, 8, 589854, 0, 8, 524318, 0, 8, 458782, 0, 8, 393246, 0, 8, 327710, 0, 8, 262174, 0, 8, 196638, 0, 8, 131102, 0, 8, 1507357, 0, 8, 1441821, 0, 8, 1376285, 0, 8, 1310749, 0, 8, 1245213, 0, 8, 1179677, 0, 8, 1114141, 0, 8, 1048605, 0, 8, 983069, 0, 8, 917533, 0, 8, 851997, 0, 8, 786461, 0, 8, 720925, 0, 8, 655389, 0, 8, 589853, 0, 8, 524317, 0, 8, 458781, 0, 8, 393245, 0, 8, 327709, 0, 8, 262173, 0, 8, 196637, 0, 8, 131101, 0, 8, 1507356, 0, 8, 1441820, 0, 8, 1376284, 0, 8, 1310748, 0, 8, 1245212, 0, 8, 1179676, 0, 8, 1114140, 0, 8, 1048604, 0, 8, 983068, 0, 8, 917532, 0, 8, 851996, 0, 8, 786460, 0, 8, 720924, 0, 8, 655388, 0, 8, 589852, 0, 8, 524316, 0, 8, 458780, 0, 8, 393244, 0, 8, 327708, 0, 8, 262172, 0, 8, 196636, 0, 8, 131100, 0, 8, 1507355, 0, 8, 1441819, 0, 8, 1376283, 0, 8, 1310747, 0, 8, 1245211, 0, 8, 1179675, 0, 8, 1114139, 0, 8, 1048603, 0, 8, 983067, 0, 8, 917531, 0, 8, 851995, 0, 8, 786459, 0, 8, 720923, 0, 8, 655387, 0, 8, 589851, 0, 8, 524315, 0, 8, 458779, 0, 8, 393243, 0, 8, 327707, 0, 8, 262171, 0, 8, 196635, 0, 8, 131099, 0, 8, 1507354, 0, 8, 1441818, 0, 8, 1376282, 0, 8, 1310746, 0, 8, 1245210, 0, 8, 1179674, 0, 8, 1114138, 0, 8, 1048602, 0, 8, 983066, 0, 8, 917530, 0, 8, 851994, 0, 8, 786458, 0, 8, 720922, 0, 8, 655386, 0, 8, 589850, 0, 8, 524314, 0, 8, 458778, 0, 8, 393242, 0, 8, 327706, 0, 8, 262170, 0, 8, 196634, 0, 8, 131098, 0, 8, 1507353, 0, 8, 1441817, 0, 8, 1376281, 0, 8, 1310745, 0, 8, 1245209, 0, 8, 1179673, 0, 8, 1114137, 0, 8, 1048601, 0, 8, 983065, 0, 8, 917529, 0, 8, 851993, 0, 8, 786457, 0, 8, 720921, 0, 8, 655385, 0, 8, 589849, 0, 8, 524313, 0, 8, 458777, 0, 8, 393241, 0, 8, 327705, 0, 8, 262169, 0, 8, 196633, 0, 8, 131097, 0, 8, 917528, 0, 8, 851992, 0, 8, 786456, 0, 8, 720920, 0, 8, 655384, 0, 8, 917527, 0, 8, 851991, 0, 8, 786455, 0, 8, 720919, 0, 8, 655383, 0, 8, 917526, 0, 8, 851990, 0, 8, 786454, 0, 8, 720918, 0, 8, 655382, 0, 8, 917525, 0, 8, 851989, 0, 8, 786453, 0, 8, 720917, 0, 8, 655381, 0, 8, 917524, 0, 8, 851988, 0, 8, 786452, 0, 8, 720916, 0, 8, 655380, 0, 8, 917523, 0, 8, 851987, 0, 8, 786451, 0, 8, 720915, 0, 8, 655379, 0, 8, 917522, 0, 8, 851986, 0, 8, 786450, 0, 8, 720914, 0, 8, 655378, 0, 8, 917521, 0, 8, 851985, 0, 8, 786449, 0, 8, 720913, 0, 8, 655377, 0, 8, 917520, 0, 8, 851984, 0, 8, 786448, 0, 8, 720912, 0, 8, 655376, 0, 8, 589840, 0, 8, 524304, 0, 8, 458768, 0, 8, 393232, 0, 8, 327696, 0, 8, 262160, 0, 8, 196624, 0, 8, 131088, 0, 8, 1507343, 0, 8, 1441807, 0, 8, 1376271, 0, 8, 1310735, 0, 8, 1245199, 0, 8, 1179663, 0, 8, 1114127, 0, 8, 1048591, 0, 8, 983055, 0, 8, 917519, 0, 8, 851983, 0, 8, 786447, 0, 8, 720911, 0, 8, 655375, 0, 8, 589839, 0, 8, 524303, 0, 8, 458767, 0, 8, 393231, 0, 8, 327695, 0, 8, 262159, 0, 8, 196623, 0, 8, 131087, 0, 8, 1507342, 0, 8, 1441806, 0, 8, 1376270, 0, 8, 1310734, 0, 8, 1245198, 0, 8, 1179662, 0, 8, 1114126, 0, 8, 1048590, 0, 8, 983054, 0, 8, 917518, 0, 8, 851982, 0, 8, 786446, 0, 8, 720910, 0, 8, 655374, 0, 8, 589838, 0, 8, 524302, 0, 8, 458766, 0, 8, 393230, 0, 8, 327694, 0, 8, 262158, 0, 8, 196622, 0, 8, 131086, 0, 8, 1507341, 0, 8, 1441805, 0, 8, 1376269, 0, 8, 1310733, 0, 8, 1245197, 0, 8, 1179661, 0, 8, 1114125, 0, 8, 1048589, 0, 8, 983053, 0, 8, 917517, 0, 8, 851981, 0, 8, 786445, 0, 8, 720909, 0, 8, 655373, 0, 8, 589837, 0, 8, 524301, 0, 8, 458765, 0, 8, 393229, 0, 8, 327693, 0, 8, 262157, 0, 8, 196621, 0, 8, 131085, 0, 8, 1507340, 0, 8, 1441804, 0, 8, 1376268, 0, 8, 1310732, 0, 8, 1245196, 0, 8, 1179660, 0, 8, 1114124, 0, 8, 1048588, 0, 8, 983052, 0, 8, 917516, 0, 8, 851980, 0, 8, 786444, 0, 8, 720908, 0, 8, 655372, 0, 8, 589836, 0, 8, 524300, 0, 8, 458764, 0, 8, 393228, 0, 8, 327692, 0, 8, 262156, 0, 8, 196620, 0, 8, 131084, 0, 8, 1507339, 0, 8, 1441803, 0, 8, 1376267, 0, 8, 1310731, 0, 8, 1245195, 0, 8, 1179659, 0, 8, 1114123, 0, 8, 1048587, 0, 8, 983051, 0, 8, 917515, 0, 8, 851979, 0, 8, 786443, 0, 8, 720907, 0, 8, 655371, 0, 8, 589835, 0, 8, 524299, 0, 8, 458763, 0, 8, 393227, 0, 8, 327691, 0, 8, 262155, 0, 8, 196619, 0, 8, 131083, 0, 8, 1507338, 0, 8, 1441802, 0, 8, 1376266, 0, 8, 1310730, 0, 8, 1245194, 0, 8, 1179658, 0, 8, 1114122, 0, 8, 1048586, 0, 8, 983050, 0, 8, 917514, 0, 8, 851978, 0, 8, 786442, 0, 8, 720906, 0, 8, 655370, 0, 8, 589834, 0, 8, 524298, 0, 8, 458762, 0, 8, 393226, 0, 8, 327690, 0, 8, 262154, 0, 8, 196618, 0, 8, 131082, 0, 8, 1507337, 0, 8, 1441801, 0, 8, 1376265, 0, 8, 1310729, 0, 8, 1245193, 0, 8, 1179657, 0, 8, 1114121, 0, 8, 1048585, 0, 8, 983049, 0, 8, 917513, 0, 8, 851977, 0, 8, 786441, 0, 8, 720905, 0, 8, 655369, 0, 8, 589833, 0, 8, 524297, 0, 8, 458761, 0, 8, 393225, 0, 8, 327689, 0, 8, 262153, 0, 8, 196617, 0, 8, 131081, 0, 8, 1507336, 0, 8, 1441800, 0, 8, 1376264, 0, 8, 1310728, 0, 8, 1245192, 0, 8, 1179656, 0, 8, 1114120, 0, 8, 1048584, 0, 8, 983048, 0, 8, 917512, 0, 8, 851976, 0, 8, 786440, 0, 8, 720904, 0, 8, 655368, 0, 8, 589832, 0, 8, 524296, 0, 8, 458760, 0, 8, 393224, 0, 8, 327688, 0, 8, 262152, 0, 8, 196616, 0, 8, 131080, 0, 8, 1179655, 0, 8, 1114119, 0, 8, 1048583, 0, 8, 983047, 0, 8, 917511, 0, 8, 851975, 0, 8, 786439, 0, 8, 720903, 0, 8, 655367, 0, 8, 589831, 0, 8, 524295, 0, 8, 458759, 0, 8, 1179654, 0, 8, 1114118, 0, 8, 1048582, 0, 8, 983046, 0, 8, 917510, 0, 8, 851974, 0, 8, 786438, 0, 8, 720902, 0, 8, 655366, 0, 8, 589830, 0, 8, 524294, 0, 8, 458758, 0, 8, 1179653, 0, 8, 1114117, 0, 8, 1048581, 0, 8, 983045, 0, 8, 917509, 0, 8, 851973, 0, 8, 786437, 0, 8, 720901, 0, 8, 655365, 0, 8, 589829, 0, 8, 524293, 0, 8, 458757, 0, 8, 1179652, 0, 8, 1114116, 0, 8, 1048580, 0, 8, 983044, 0, 8, 917508, 0, 8, 851972, 0, 8, 786436, 0, 8, 720900, 0, 8, 655364, 0, 8, 589828, 0, 8, 524292, 0, 8, 458756, 0, 8, 1179651, 0, 8, 1114115, 0, 8, 1048579, 0, 8, 983043, 0, 8, 917507, 0, 8, 851971, 0, 8, 786435, 0, 8, 720899, 0, 8, 655363, 0, 8, 589827, 0, 8, 524291, 0, 8, 458755, 0, 8, 65543, 131072, 7, 65544, 131072, 7, 1572872, 131072, 2, 65545, 131072, 7, 1572873, 131072, 2, 65546, 131072, 7, 1572874, 131072, 2, 65547, 131072, 7, 1572875, 131072, 2, 65548, 131072, 7, 1572876, 131072, 2, 65549, 131072, 7, 1572877, 131072, 2, 65550, 131072, 7, 1572878, 131072, 2, 65551, 131072, 7, 1572879, 131072, 2, 65552, 131072, 7, 65561, 131072, 7, 1572889, 131072, 2, 65562, 131072, 7, 1572890, 131072, 2, 65563, 131072, 7, 1572891, 131072, 2, 65564, 131072, 7, 1572892, 131072, 2, 65565, 131072, 7, 1572893, 131072, 2, 65566, 131072, 7, 1572894, 131072, 2, 65567, 131072, 7, 1572895, 131072, 2, 65568, 131072, 7, 1572896, 131072, 2, 65569, 131072, 7, 1572897, 131072, 2, 458791, 65536, 3, 524327, 65536, 3, 589863, 65536, 3, 655399, 65536, 3, 720935, 65536, 3, 786471, 65536, 3, 852007, 65536, 3, 917543, 65536, 3, 983079, 65536, 3, 1048615, 65536, 3, 1114151, 65536, 3, 1179687, 65536, 3, 983064, 0, 8, 983063, 0, 8, 983062, 0, 8, 983061, 0, 8, 983060, 0, 8, 983059, 0, 8, 983058, 0, 8, 983057, 0, 8, 1572880, 131072, 2, 1507344, 0, 8, 1441808, 0, 8, 1376272, 0, 8, 1310736, 0, 8, 1245200, 0, 8, 1179664, 0, 8, 1114128, 0, 8, 1048592, 0, 8, 983056, 0, 8, 1048593, 65536, 2, 1048594, 131072, 2, 1048595, 131072, 2, 1048596, 131072, 2, 1048597, 131072, 2, 1048598, 131072, 2, 1048599, 131072, 2, 1048600, 196608, 2, 1114136, 196608, 3, 1179672, 196608, 3, 1245208, 196608, 3, 1310744, 196608, 3, 1376280, 196608, 3, 1441816, 196608, 3, 1507352, 196608, 3, 1572888, 720896, 2, 1114129, 65536, 3, 1179665, 65536, 3, 1245201, 65536, 3, 1310737, 65536, 3, 1376273, 65536, 3, 1441809, 65536, 3, 1507345, 65536, 3, 1572881, 851968, 2, 589841, 65536, 7, 524305, 65536, 3, 458769, 65536, 3, 393233, 65536, 3, 327697, 65536, 3, 262161, 65536, 3, 196625, 65536, 3, 131089, 65536, 3, 589842, 131072, 7, 589843, 131072, 7, 589844, 131072, 7, 589845, 131072, 7, 589846, 131072, 7, 589847, 131072, 7, 589848, 196608, 7, 524312, 196608, 3, 458776, 196608, 3, 393240, 196608, 3, 327704, 196608, 3, 262168, 196608, 3, 196632, 196608, 3, 131096, 196608, 3, 65560, 196608, 4, 65553, 65536, 4, 131106, 65536, 3, 196642, 65536, 3, 65570, 65536, 4, 262178, 65536, 3, 327714, 65536, 3, 393250, 65536, 7, 393252, 131072, 7, 393253, 131072, 7, 393254, 131072, 7, 393255, 65536, 4, 393251, 131072, 7, 1245223, 851968, 2, 1245222, 131072, 2, 1245221, 131072, 2, 1245220, 131072, 2, 1245219, 131072, 2, 1245218, 65536, 2, 1310754, 65536, 3, 1376290, 65536, 3, 1441826, 65536, 3, 1507362, 65536, 3, 1572898, 851968, 2, 458754, 196608, 3, 196615, 0, 8, 131079, 0, 8, 262151, 0, 8, 327687, 0, 8, 393223, 0, 8, 393222, 0, 8, 393221, 0, 8, 393220, 0, 8, 393219, 0, 8, 524290, 196608, 3, 393218, 196608, 3, 589826, 196608, 3, 655362, 196608, 3, 720898, 196608, 3, 786434, 196608, 3, 851970, 196608, 3, 917506, 196608, 3, 983042, 196608, 3, 1048578, 196608, 3, 1114114, 196608, 3, 1179650, 196608, 3, 1245188, 131072, 2, 1245187, 131072, 2, 1245186, 720896, 2, 1245189, 131072, 2, 1245190, 131072, 2, 1245191, 196608, 2, 1310727, 196608, 3, 1376263, 196608, 3, 1441799, 196608, 3, 1507335, 196608, 3, 1572871, 720896, 2, 131075, 0, 8, 196611, 0, 8, 262147, 0, 8, 327683, 0, 8, 327682, 196608, 3, 327684, 0, 8, 262146, 196608, 3, 262148, 0, 8, 196610, 196608, 3, 196612, 0, 8, 131074, 196608, 3, 131076, 0, 8, 65538, 196608, 4, 65539, 131072, 7, 65540, 131072, 7, 131078, 0, 8, 131077, 0, 8, 196613, 0, 8, 65541, 131072, 7, 196614, 0, 8, 65542, 131072, 7, 262149, 0, 8, 262150, 0, 8, 327686, 0, 8, 327685, 0, 8) +script = ExtResource("dungeonRoomTemplate") + +[node name="Level1" type="Node" parent="."] + +[node name="EnemyMark" type="Node2D" parent="Level1"] +position = Vector2(198, 94) +script = ExtResource("3_k574h") +Weapon1Id = "0003" +Weapon1Ammo = 20 +Type = 3 +ItemId = "0001" +Layer = 1 + +[node name="EnemyMark2" type="Node2D" parent="Level1"] +position = Vector2(195, 331) +script = ExtResource("3_k574h") +Weapon1Id = "0003" +Weapon1Ammo = 20 +Type = 3 +ItemId = "0001" +Layer = 1 + +[node name="EnemyMark3" type="Node2D" parent="Level1"] +position = Vector2(480, 334) +script = ExtResource("3_k574h") +Weapon1Id = "0003" +Weapon1Ammo = 20 +Type = 3 +ItemId = "0001" +Layer = 1 + +[node name="EnemyMark4" type="Node2D" parent="Level1"] +position = Vector2(470, 98) +script = ExtResource("3_k574h") +Weapon1Id = "0003" +Weapon1Ammo = 20 +Type = 3 +ItemId = "0001" +Layer = 1 + +[node name="Level2" type="Node" parent="."] + +[node name="EnemyMark" type="Node2D" parent="Level2"] +position = Vector2(120, 204) +script = ExtResource("3_k574h") +Weapon1Id = "0001" +Weapon1Ammo = 45 +Type = 3 +ItemId = "0001" +Layer = 1 +WaveNumber = 2 +DelayTime = 1.5 + +[node name="EnemyMark2" type="Node2D" parent="Level2"] +position = Vector2(561, 207) +script = ExtResource("3_k574h") +Weapon1Id = "0001" +Weapon1Ammo = 45 +Type = 3 +ItemId = "0001" +Layer = 1 +WaveNumber = 2 +DelayTime = 1.5 + +[node name="WeaponMark" type="Node2D" parent="."] +position = Vector2(331, 208) +script = ExtResource("4_5hiyo") +Type = 4 +ItemId = "0001" +WaveNumber = 3 +DelayTime = 1.0 diff --git a/DungeonShooting_Godot/resource/map/tiledata/Room4.json b/DungeonShooting_Godot/resource/map/tiledata/Room4.json new file mode 100644 index 0000000..7d8140c --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tiledata/Room4.json @@ -0,0 +1,121 @@ +{ + "Position": { + "X": 2, + "Y": 1 + }, + "Size": { + "X": 38, + "Y": 24 + }, + "DoorAreaInfos": [ + { + "Direction": 1, + "Start": 16, + "End": 288 + }, + { + "Direction": 2, + "Start": 96, + "End": 240 + }, + { + "Direction": 2, + "Start": 368, + "End": 512 + }, + { + "Direction": 0, + "Start": 80, + "End": 288 + }, + { + "Direction": 3, + "Start": 368, + "End": 512 + }, + { + "Direction": 3, + "Start": 16, + "End": 240 + } + ], + "NavigationList": [ + { + "Type": 0, + "Points": [ + { + "X": 56, + "Y": 40 + }, + { + "X": 264, + "Y": 40 + }, + { + "X": 264, + "Y": 168 + }, + { + "X": 408, + "Y": 168 + }, + { + "X": 408, + "Y": 40 + }, + { + "X": 536, + "Y": 40 + }, + { + "X": 536, + "Y": 120 + }, + { + "X": 616, + "Y": 120 + }, + { + "X": 616, + "Y": 296 + }, + { + "X": 536, + "Y": 296 + }, + { + "X": 536, + "Y": 376 + }, + { + "X": 408, + "Y": 376 + }, + { + "X": 408, + "Y": 248 + }, + { + "X": 264, + "Y": 248 + }, + { + "X": 264, + "Y": 376 + }, + { + "X": 136, + "Y": 376 + }, + { + "X": 136, + "Y": 296 + }, + { + "X": 56, + "Y": 296 + } + ] + } + ] +} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index a963a84..581dab1 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -352,7 +352,7 @@ [sub_resource type="ImageTexture" id="58"] -[sub_resource type="Image" id="Image_mscx5"] +[sub_resource type="Image" id="Image_6layu"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -362,7 +362,7 @@ } [sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_mscx5") +image = SubResource("Image_6layu") [sub_resource type="StyleBoxTexture" id="61"] content_margin_left = 2.0 @@ -372,7 +372,7 @@ texture = SubResource("60") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_0l3gk"] +[sub_resource type="Image" id="Image_x1jp8"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -382,7 +382,7 @@ } [sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_0l3gk") +image = SubResource("Image_x1jp8") [sub_resource type="StyleBoxTexture" id="64"] content_margin_left = 2.0 @@ -392,7 +392,7 @@ texture = SubResource("63") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_4exhg"] +[sub_resource type="Image" id="Image_k3p0a"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -402,7 +402,7 @@ } [sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_4exhg") +image = SubResource("Image_k3p0a") [sub_resource type="StyleBoxTexture" id="67"] content_margin_left = 2.0 @@ -412,7 +412,7 @@ texture = SubResource("66") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_1suh6"] +[sub_resource type="Image" id="Image_tuih0"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -422,7 +422,7 @@ } [sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_1suh6") +image = SubResource("Image_tuih0") [sub_resource type="StyleBoxTexture" id="70"] content_margin_left = 0.0 @@ -446,7 +446,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_3pmbh"] +[sub_resource type="Image" id="Image_227kg"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 228, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 228, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 18, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 17, 255, 255, 255, 186, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 191, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 186, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 189, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 77, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 77, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -456,7 +456,7 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_3pmbh") +image = SubResource("Image_227kg") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 diff --git a/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs new file mode 100644 index 0000000..5c77cfc --- /dev/null +++ b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs @@ -0,0 +1,195 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.Json; +using Godot; + +namespace Generator; + +/// +/// 地牢房间数据生成器 +/// +public static class DungeonRoomGenerator +{ + /// + /// 根据名称在编辑器中创建地牢的预制房间, open 表示创建完成后是否在编辑器中打开这个房间 + /// + public static bool CreateDungeonRoom(string roomName, bool open = false) + { + try + { + //创建场景资源 + var prefabFile = GameConfig.RoomTileDir + roomName + ".tscn"; + var prefabResPath = "res://" + prefabFile; + if (!Directory.Exists(GameConfig.RoomTileDir)) + { + Directory.CreateDirectory(GameConfig.RoomTileDir); + } + + //加载脚本资源 + + // 这段代码在 Godot4.0.1rc1中会报错, 应该是个bug + // var scriptRes = GD.Load("res://src/framework/map/DungeonRoomTemplate.cs"); + // var tileMap = new TileMap(); + // tileMap.Name = roomName; + // tileMap.SetScript(scriptRes); + // var scene = new PackedScene(); + // scene.Pack(tileMap); //报错在这一行, 报的是访问了被销毁的资源 scriptRes + // ResourceSaver.Save(scene, prefabResPath); + + //临时处理 + { + var tscnCode = $"[gd_scene load_steps=2 format=3]\n" + + $"\n" + + $"[ext_resource type=\"Script\" path=\"res://src/framework/map/DungeonRoomTemplate.cs\" id=\"dungeonRoomTemplate\"]\n" + + $"\n" + + $"[node name=\"{roomName}\" type=\"TileMap\"]\n" + + $"format = 2\n" + + $"script = ExtResource(\"dungeonRoomTemplate\")\n"; + File.WriteAllText(prefabFile, tscnCode); + //重新保存一遍, 以让编辑器生成资源Id + var scene = GD.Load(prefabResPath); + ResourceSaver.Save(scene, prefabResPath); + } + + //打包房间配置 + GenerateRoomConfig(); + + //生成 UiManager_Methods.cs 代码 + UiManagerMethodsGenerator.Generate(); +#if TOOLS + //打开房间 + if (open) + { + Plugin.Plugin.Instance.GetEditorInterface().OpenSceneFromPath(prefabResPath); + } +#endif + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + return false; + } + + return true; + } + + /// + /// 执行生成 RoomConfig.json 操作, 返回是否执行成功 + /// + public static bool GenerateRoomConfig() + { + try + { + //地图路径 + var tileDir = GameConfig.RoomTileDir; + //地图描述数据路径 + var tileDataDir = GameConfig.RoomTileDataDir; + + var tileDirInfo = new DirectoryInfo(tileDir); + var tileDataDirInfo = new DirectoryInfo(tileDataDir); + + //所有地图列表 + var mapList = new HashSet(); + + //收集所有名称 + var fileDataInfos = tileDataDirInfo.GetFiles(); + foreach (var fileInfo in fileDataInfos) + { + mapList.Add(RemoveExtension(fileInfo.Name)); + } + //收集所有名称 + var fileInfos = tileDirInfo.GetFiles(); + foreach (var fileInfo in fileInfos) + { + if (fileInfo.Extension == ".tscn") + { + mapList.Add(RemoveExtension(fileInfo.Name)); + } + } + + //剔除多余的 tile.json + var arrays = mapList.ToArray(); + foreach (var item in arrays) + { + if (!File.Exists(tileDir + item + ".tscn")) + { + mapList.Remove(item); + var filePath = tileDataDir + item + ".json"; + if (File.Exists(filePath)) + { + GD.Print($"未找到'{tileDir + item}.tscn', 删除配置文件: {filePath}"); + File.Delete(filePath); + } + } + } + + //手动生成缺失的 tile.json + foreach (var item in mapList) + { + if (!File.Exists(tileDataDir + item + ".json")) + { + var tscnName = tileDir + item + ".tscn"; + var packedScene = ResourceManager.Load(tscnName, false); + if (packedScene != null) + { + var dungeonRoomTemplate = packedScene.Instantiate(); + var usedRect = dungeonRoomTemplate.GetUsedRect(); + var dungeonTile = new DungeonTile(dungeonRoomTemplate); + dungeonTile.SetFloorAtlasCoords(new List() { new Vector2I(0, 8) }); + //计算导航网格 + dungeonTile.GenerateNavigationPolygon(0); + var polygonData = dungeonTile.GetPolygonData(); + DungeonRoomTemplate.SaveConfig(new List(), usedRect.Position, usedRect.Size, polygonData.ToList(), item); + dungeonRoomTemplate.QueueFree(); + } + } + } + + var list = new List(); + //整合操作 + foreach (var item in mapList) + { + var configPath = tileDataDir + item + ".json"; + var split = new DungeonRoomSplit(); + split.ScenePath = ToResPath(tileDir + item + ".tscn"); + split.ConfigPath = ToResPath(configPath); + list.Add(split); + } + + //写出配置 + var config = new JsonSerializerOptions(); + config.WriteIndented = true; + var text = JsonSerializer.Serialize(list, config); + File.WriteAllText(GameConfig.RoomTileConfigFile, text); + + GD.Print("地牢房间配置, 重新打包完成!"); + } + catch (Exception e) + { + GD.PrintErr(e.ToString()); + return false; + } + + return true; + } + + private static string ToResPath(string path) + { + var field = path.Replace("\\", "/"); + return "res://" + field; + } + + private static string RemoveExtension(string name) + { + var index = name.LastIndexOf(".", StringComparison.Ordinal); + if (index >= 0) + { + return name.Substring(0, index); + } + + return name; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/RoomPackGenerator.cs b/DungeonShooting_Godot/src/framework/generator/RoomPackGenerator.cs deleted file mode 100644 index 510757f..0000000 --- a/DungeonShooting_Godot/src/framework/generator/RoomPackGenerator.cs +++ /dev/null @@ -1,135 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using Godot; - -namespace Generator; - -/// -/// 预制房间数据生成器 -/// -public static class RoomPackGenerator -{ - /// - /// 执行生成操作, 返回是否执行成功 - /// - public static bool Generate() - { - try - { - //地图路径 - var tileDir = GameConfig.RoomTileDir; - //地图描述数据路径 - var tileDataDir = GameConfig.RoomTileDataDir; - - var tileDirInfo = new DirectoryInfo(tileDir); - var tileDataDirInfo = new DirectoryInfo(tileDataDir); - - //所有地图列表 - var mapList = new HashSet(); - - //收集所有名称 - var fileDataInfos = tileDataDirInfo.GetFiles(); - foreach (var fileInfo in fileDataInfos) - { - mapList.Add(RemoveExtension(fileInfo.Name)); - } - //收集所有名称 - var fileInfos = tileDirInfo.GetFiles(); - foreach (var fileInfo in fileInfos) - { - if (fileInfo.Extension == ".tscn") - { - mapList.Add(RemoveExtension(fileInfo.Name)); - } - } - - //剔除多余的 tile.json - var arrays = mapList.ToArray(); - foreach (var item in arrays) - { - if (!File.Exists(tileDir + item + ".tscn")) - { - mapList.Remove(item); - var filePath = tileDataDir + item + ".json"; - if (File.Exists(filePath)) - { - GD.Print($"未找到'{tileDir + item}.tscn', 删除配置文件: {filePath}"); - File.Delete(filePath); - } - } - } - - //手动生成缺失的 tile.json - foreach (var item in mapList) - { - if (!File.Exists(tileDataDir + item + ".json")) - { - var tscnName = tileDir + item + ".tscn"; - var packedScene = ResourceManager.Load(tscnName, false); - if (packedScene != null) - { - var dungeonRoomTemplate = packedScene.Instantiate(); - var usedRect = dungeonRoomTemplate.GetUsedRect(); - var dungeonTile = new DungeonTile(dungeonRoomTemplate); - dungeonTile.SetFloorAtlasCoords(new List() { new Vector2I(0, 8) }); - //计算导航网格 - dungeonTile.GenerateNavigationPolygon(0); - var polygonData = dungeonTile.GetPolygonData(); - DungeonRoomTemplate.SaveConfig(new List(), usedRect.Position, usedRect.Size, polygonData.ToList(), item); - dungeonRoomTemplate.QueueFree(); - } - } - } - - var list = new List(); - //整合操作 - foreach (var item in mapList) - { - var configPath = tileDataDir + item + ".json"; - var configText = File.ReadAllText(configPath); - var roomInfo = DungeonRoomTemplate.DeserializeDungeonRoomInfo(configText); - var split = new DungeonRoomSplit(); - split.ScenePath = ToResPath(tileDir + item + ".tscn"); - split.ConfigPath = ToResPath(configPath); - split.RoomInfo = roomInfo; - list.Add(split); - } - - //写出配置 - var config = new JsonSerializerOptions(); - config.WriteIndented = true; - var text = JsonSerializer.Serialize(list, config); - File.WriteAllText(GameConfig.RoomTileConfigFile, text); - - GD.Print("地牢房间配置, 重新打包完成!"); - } - catch (Exception e) - { - GD.PrintErr(e.ToString()); - return false; - } - - return true; - } - - private static string ToResPath(string path) - { - var field = path.Replace("\\", "/"); - return "res://" + field; - } - - private static string RemoveExtension(string name) - { - var index = name.LastIndexOf(".", StringComparison.Ordinal); - if (index >= 0) - { - return name.Substring(0, index); - } - - return name; - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/DungeonRoomSplit.cs b/DungeonShooting_Godot/src/framework/map/DungeonRoomSplit.cs index aa0c847..32f00c7 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonRoomSplit.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonRoomSplit.cs @@ -1,5 +1,7 @@  +using System.Text.Json; using System.Text.Json.Serialization; +using FileAccess = Godot.FileAccess; /// /// 房间配置文件相关信息, 将会在 RoomConfig.json 中汇总 @@ -19,8 +21,34 @@ public string ConfigPath; /// - /// 房间配置数据 + /// 房间配置数据, 第一次获取会要在资源中加载数据 /// - [JsonInclude] - public DungeonRoomInfo RoomInfo; + [JsonIgnore] + public DungeonRoomInfo RoomInfo + { + get + { + if (_roomInfo == null) + { + var file = FileAccess.Open(ConfigPath, FileAccess.ModeFlags.Read); + var asText = file.GetAsText(); + _roomInfo = JsonSerializer.Deserialize(asText); + file.Dispose(); + + //需要处理 DoorAreaInfos 长度为 0 的房间, 并为其配置默认值 + var areaInfos = _roomInfo.DoorAreaInfos; + if (areaInfos.Count == 0) + { + areaInfos.Add(new DoorAreaInfo(DoorDirection.N, GameConfig.TileCellSize, (_roomInfo.Size.X - 1) * GameConfig.TileCellSize)); + areaInfos.Add(new DoorAreaInfo(DoorDirection.S, GameConfig.TileCellSize, (_roomInfo.Size.X - 1) * GameConfig.TileCellSize)); + areaInfos.Add(new DoorAreaInfo(DoorDirection.W, GameConfig.TileCellSize, (_roomInfo.Size.Y - 1) * GameConfig.TileCellSize)); + areaInfos.Add(new DoorAreaInfo(DoorDirection.E, GameConfig.TileCellSize, (_roomInfo.Size.Y - 1) * GameConfig.TileCellSize)); + } + } + + return _roomInfo; + } + } + + private DungeonRoomInfo _roomInfo; } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs b/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs index a14edd6..7b0b16c 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonRoomTemplate.cs @@ -69,6 +69,11 @@ return; } + if (TileSet == null) + { + return; + } + if (_dungeonTile == null) { _dungeonTile = new DungeonTile(this); diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 39f0116..393a861 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -118,18 +118,5 @@ var asText = file.GetAsText(); RoomConfig = JsonSerializer.Deserialize>(asText); file.Dispose(); - - //需要处理 DoorAreaInfos 长度为 0 的房间, 并为其配置默认值 - foreach (var roomSplit in RoomConfig) - { - var areaInfos = roomSplit.RoomInfo.DoorAreaInfos; - if (areaInfos.Count == 0) - { - areaInfos.Add(new DoorAreaInfo(DoorDirection.N, GameConfig.TileCellSize, (roomSplit.RoomInfo.Size.X - 1) * GameConfig.TileCellSize)); - areaInfos.Add(new DoorAreaInfo(DoorDirection.S, GameConfig.TileCellSize, (roomSplit.RoomInfo.Size.X - 1) * GameConfig.TileCellSize)); - areaInfos.Add(new DoorAreaInfo(DoorDirection.W, GameConfig.TileCellSize, (roomSplit.RoomInfo.Size.Y - 1) * GameConfig.TileCellSize)); - areaInfos.Add(new DoorAreaInfo(DoorDirection.E, GameConfig.TileCellSize, (roomSplit.RoomInfo.Size.Y - 1) * GameConfig.TileCellSize)); - } - } } } diff --git a/DungeonShooting_Godot/src/game/GameConfig.cs b/DungeonShooting_Godot/src/game/GameConfig.cs index 238deea..53f94c4 100644 --- a/DungeonShooting_Godot/src/game/GameConfig.cs +++ b/DungeonShooting_Godot/src/game/GameConfig.cs @@ -40,7 +40,7 @@ public const int RoomSpace = 4; /// - /// 地图数据路径 + /// 地图场景路径 /// public const string RoomTileDir = "resource/map/tileMaps/"; /// diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs index 8616e70..ca9d027 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs @@ -103,7 +103,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2.Label + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.Label /// public class UiNode1_Label : IUiNode { @@ -112,7 +112,16 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2.Button + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.LineEdit + /// + public class UiNode_LineEdit : IUiNode + { + public UiNode_LineEdit(Godot.LineEdit node) : base(node) { } + public override UiNode_LineEdit Clone() => new ((Godot.LineEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.Button /// public class UiNode1_Button : IUiNode { @@ -121,9 +130,9 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2 + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3 /// - public class UiNode_HBoxContainer2 : IUiNode + public class UiNode_HBoxContainer3 : IUiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label @@ -139,6 +148,19 @@ private UiNode1_Label _L_Label; /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.LineEdit + /// + public UiNode_LineEdit L_LineEdit + { + get + { + if (_L_LineEdit == null) _L_LineEdit = new UiNode_LineEdit(Instance.GetNodeOrNull("LineEdit")); + return _L_LineEdit; + } + } + private UiNode_LineEdit _L_LineEdit; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button /// public UiNode1_Button L_Button @@ -151,8 +173,8 @@ } private UiNode1_Button _L_Button; - public UiNode_HBoxContainer2(Godot.HBoxContainer node) : base(node) { } - public override UiNode_HBoxContainer2 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); + public UiNode_HBoxContainer3(Godot.HBoxContainer node) : base(node) { } + public override UiNode_HBoxContainer3 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); } /// @@ -209,7 +231,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.Label + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5.Label /// public class UiNode3_Label : IUiNode { @@ -218,16 +240,7 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.LineEdit - /// - public class UiNode_LineEdit : IUiNode - { - public UiNode_LineEdit(Godot.LineEdit node) : base(node) { } - public override UiNode_LineEdit Clone() => new ((Godot.LineEdit)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.Button + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5.Button /// public class UiNode3_Button : IUiNode { @@ -236,9 +249,9 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3 + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5 /// - public class UiNode_HBoxContainer3 : IUiNode + public class UiNode_HBoxContainer5 : IUiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label @@ -254,19 +267,6 @@ private UiNode3_Label _L_Label; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.LineEdit - /// - public UiNode_LineEdit L_LineEdit - { - get - { - if (_L_LineEdit == null) _L_LineEdit = new UiNode_LineEdit(Instance.GetNodeOrNull("LineEdit")); - return _L_LineEdit; - } - } - private UiNode_LineEdit _L_LineEdit; - - /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button /// public UiNode3_Button L_Button @@ -279,12 +279,12 @@ } private UiNode3_Button _L_Button; - public UiNode_HBoxContainer3(Godot.HBoxContainer node) : base(node) { } - public override UiNode_HBoxContainer3 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); + public UiNode_HBoxContainer5(Godot.HBoxContainer node) : base(node) { } + public override UiNode_HBoxContainer5 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5.Label + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label /// public class UiNode4_Label : IUiNode { @@ -293,7 +293,16 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5.Button + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.LineEdit + /// + public class UiNode1_LineEdit : IUiNode + { + public UiNode1_LineEdit(Godot.LineEdit node) : base(node) { } + public override UiNode1_LineEdit Clone() => new ((Godot.LineEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Button /// public class UiNode4_Button : IUiNode { @@ -302,9 +311,9 @@ } /// - /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5 + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6 /// - public class UiNode_HBoxContainer5 : IUiNode + public class UiNode_HBoxContainer6 : IUiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label @@ -320,6 +329,19 @@ private UiNode4_Label _L_Label; /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.LineEdit + /// + public UiNode1_LineEdit L_LineEdit + { + get + { + if (_L_LineEdit == null) _L_LineEdit = new UiNode1_LineEdit(Instance.GetNodeOrNull("LineEdit")); + return _L_LineEdit; + } + } + private UiNode1_LineEdit _L_LineEdit; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button /// public UiNode4_Button L_Button @@ -332,8 +354,61 @@ } private UiNode4_Button _L_Button; - public UiNode_HBoxContainer5(Godot.HBoxContainer node) : base(node) { } - public override UiNode_HBoxContainer5 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); + public UiNode_HBoxContainer6(Godot.HBoxContainer node) : base(node) { } + public override UiNode_HBoxContainer6 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2.Label + /// + public class UiNode5_Label : IUiNode + { + public UiNode5_Label(Godot.Label node) : base(node) { } + public override UiNode5_Label Clone() => new ((Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2.Button + /// + public class UiNode5_Button : IUiNode + { + public UiNode5_Button(Godot.Button node) : base(node) { } + public override UiNode5_Button Clone() => new ((Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2 + /// + public class UiNode_HBoxContainer2 : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Label + /// + public UiNode5_Label L_Label + { + get + { + if (_L_Label == null) _L_Label = new UiNode5_Label(Instance.GetNodeOrNull("Label")); + return _L_Label; + } + } + private UiNode5_Label _L_Label; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.Button + /// + public UiNode5_Button L_Button + { + get + { + if (_L_Button == null) _L_Button = new UiNode5_Button(Instance.GetNodeOrNull("Button")); + return _L_Button; + } + } + private UiNode5_Button _L_Button; + + public UiNode_HBoxContainer2(Godot.HBoxContainer node) : base(node) { } + public override UiNode_HBoxContainer2 Clone() => new ((Godot.HBoxContainer)Instance.Duplicate()); } /// @@ -355,17 +430,17 @@ private UiNode_HBoxContainer _L_HBoxContainer; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer2 + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer3 /// - public UiNode_HBoxContainer2 L_HBoxContainer2 + public UiNode_HBoxContainer3 L_HBoxContainer3 { get { - if (_L_HBoxContainer2 == null) _L_HBoxContainer2 = new UiNode_HBoxContainer2(Instance.GetNodeOrNull("HBoxContainer2")); - return _L_HBoxContainer2; + if (_L_HBoxContainer3 == null) _L_HBoxContainer3 = new UiNode_HBoxContainer3(Instance.GetNodeOrNull("HBoxContainer3")); + return _L_HBoxContainer3; } } - private UiNode_HBoxContainer2 _L_HBoxContainer2; + private UiNode_HBoxContainer3 _L_HBoxContainer3; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer4 @@ -381,19 +456,6 @@ private UiNode_HBoxContainer4 _L_HBoxContainer4; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer3 - /// - public UiNode_HBoxContainer3 L_HBoxContainer3 - { - get - { - if (_L_HBoxContainer3 == null) _L_HBoxContainer3 = new UiNode_HBoxContainer3(Instance.GetNodeOrNull("HBoxContainer3")); - return _L_HBoxContainer3; - } - } - private UiNode_HBoxContainer3 _L_HBoxContainer3; - - /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer5 /// public UiNode_HBoxContainer5 L_HBoxContainer5 @@ -406,6 +468,32 @@ } private UiNode_HBoxContainer5 _L_HBoxContainer5; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer6 + /// + public UiNode_HBoxContainer6 L_HBoxContainer6 + { + get + { + if (_L_HBoxContainer6 == null) _L_HBoxContainer6 = new UiNode_HBoxContainer6(Instance.GetNodeOrNull("HBoxContainer6")); + return _L_HBoxContainer6; + } + } + private UiNode_HBoxContainer6 _L_HBoxContainer6; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.HBoxContainer2 + /// + public UiNode_HBoxContainer2 L_HBoxContainer2 + { + get + { + if (_L_HBoxContainer2 == null) _L_HBoxContainer2 = new UiNode_HBoxContainer2(Instance.GetNodeOrNull("HBoxContainer2")); + return _L_HBoxContainer2; + } + } + private UiNode_HBoxContainer2 _L_HBoxContainer2; + public UiNode_VBoxContainer(Godot.VBoxContainer node) : base(node) { } public override UiNode_VBoxContainer Clone() => new ((Godot.VBoxContainer)Instance.Duplicate()); } diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs index 8552b8b..9d69408 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs @@ -35,14 +35,16 @@ var container = L_ScrollContainer.L_MarginContainer.L_VBoxContainer; //重新生成 ResourcePath container.L_HBoxContainer.L_Button.Instance.Pressed += GenerateResourcePath; - //重新生成 RoomPack - container.L_HBoxContainer2.L_Button.Instance.Pressed += GenerateRoomPack; + //重新打包房间配置 + container.L_HBoxContainer2.L_Button.Instance.Pressed += GenerateRoomConfig; //重新生成ui代码 container.L_HBoxContainer4.L_Button.Instance.Pressed += OnGenerateCurrentUiCode; //创建ui container.L_HBoxContainer3.L_Button.Instance.Pressed += OnCreateUI; //重新生成UiManagerMethods.cs代码 container.L_HBoxContainer5.L_Button.Instance.Pressed += GenerateUiManagerMethods; + //创建地牢房间 + container.L_HBoxContainer6.L_Button.Instance.Pressed += GenerateDungeonRoom; } public override void OnHideUi() @@ -57,10 +59,11 @@ var container = L_ScrollContainer.L_MarginContainer.L_VBoxContainer; container.L_HBoxContainer.L_Button.Instance.Pressed -= GenerateResourcePath; - container.L_HBoxContainer2.L_Button.Instance.Pressed -= GenerateRoomPack; + container.L_HBoxContainer2.L_Button.Instance.Pressed -= GenerateRoomConfig; container.L_HBoxContainer4.L_Button.Instance.Pressed -= OnGenerateCurrentUiCode; container.L_HBoxContainer3.L_Button.Instance.Pressed -= OnCreateUI; container.L_HBoxContainer5.L_Button.Instance.Pressed -= GenerateUiManagerMethods; + container.L_HBoxContainer6.L_Button.Instance.Pressed -= GenerateDungeonRoom; } /// @@ -184,7 +187,7 @@ if (Plugin.Plugin.Instance != null) { var root = Plugin.Plugin.Instance.GetEditorInterface().GetEditedSceneRoot(); - if (Plugin.Plugin.Instance.CheckIsUi(root)) + if (root != null && Plugin.Plugin.Instance.CheckIsUi(root)) { if (UiGenerator.GenerateUiCodeFromEditor(root)) { @@ -260,9 +263,9 @@ /// /// 重新打包房间配置 /// - private void GenerateRoomPack() + private void GenerateRoomConfig() { - if (RoomPackGenerator.Generate()) + if (DungeonRoomGenerator.GenerateRoomConfig()) { ShowTips("提示", "打包地牢房间配置执行完成!"); } @@ -286,4 +289,43 @@ ShowTips("错误", "生成UiManagerMethods.cs代码执行失败! 前往控制台查看错误日志!"); } } + + /// + /// 创建地牢房间 + /// + private void GenerateDungeonRoom() + { + var roomName = L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_LineEdit.Instance.Text; + ShowConfirm("提示", "是否创建房间:" + roomName, (result) => + { + if (result) + { + //检查名称是否合规 + if (!Regex.IsMatch(roomName, "^\\w*$")) + { + ShowTips("错误", "房间名称'" + roomName + "'不符合名称约束, 房间名称只允许包含大写字母和数字!"); + return; + } + + //检查是否有同名的Ui + var path = GameConfig.RoomTileDir + roomName + ".tscn"; + if (File.Exists(path)) + { + ShowTips("错误", "已经存在相同名称'" + roomName + "'的房间了, 不能重复创建!"); + return; + } + + //执行创建操作 + if (DungeonRoomGenerator.CreateDungeonRoom(roomName, true)) + { + ShowTips("提示", "创建房间成功!"); + } + else + { + ShowTips("错误", "创建房间失败! 前往控制台查看错误日志!"); + } + + } + }); + } }