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..5bacc76 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,37 @@ 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 +text = "请输入房间名称" +placeholder_text = "请输入ui名称" + +[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/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index ba2d1ac..9954f51 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_onet3"] +[sub_resource type="Image" id="Image_83fu4"] 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_onet3") +image = SubResource("Image_83fu4") [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_johb3"] +[sub_resource type="Image" id="Image_lr2ho"] 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_johb3") +image = SubResource("Image_lr2ho") [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_rybql"] +[sub_resource type="Image" id="Image_m2fwq"] 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_rybql") +image = SubResource("Image_m2fwq") [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_oklon"] +[sub_resource type="Image" id="Image_gl0jc"] 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_oklon") +image = SubResource("Image_gl0jc") [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_db311"] +[sub_resource type="Image" id="Image_rratt"] 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_db311") +image = SubResource("Image_rratt") [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..69dbe18 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs @@ -0,0 +1,174 @@ + +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 scriptRes = GD.Load("res://src/framework/activity/ActivityObjectTemplate.cs"); + //创建场景资源 + var prefabFile = GameConfig.RoomTileDir + roomName + ".tscn"; + var prefabResPath = "res://" + prefabFile; + if (!Directory.Exists(GameConfig.RoomTileDir)) + { + Directory.CreateDirectory(GameConfig.RoomTileDir); + } + var tileMap = new TileMap(); + tileMap.Name = roomName; + tileMap.SetScript(scriptRes); + var scene = new PackedScene(); + scene.Pack(tileMap); + ResourceSaver.Save(scene, prefabResPath); + + //打包房间配置 + GenerateRoomConfig(); +#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 3f0b9d6..0000000 --- a/DungeonShooting_Godot/src/framework/generator/RoomPackGenerator.cs +++ /dev/null @@ -1,132 +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 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/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..2d74ff4 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("提示", "是否创建UI:" + roomName, (result) => + { + if (result) + { + //检查名称是否合规 + if (!Regex.IsMatch(roomName, "^\\w*$")) + { + ShowTips("错误", "房间名称'" + roomName + "'不符合名称约束, 房间名称只允许包含大写字母和数字!"); + return; + } + + //检查是否有同名的Ui + var path = GameConfig.RoomTileDataDir + roomName + ".tscn"; + if (File.Exists(path)) + { + ShowTips("错误", "已经存在相同名称'" + roomName + "'的房间了, 不能重复创建!"); + return; + } + + //执行创建操作 + if (DungeonRoomGenerator.CreateDungeonRoom(roomName, true)) + { + ShowTips("提示", "创建UI成功!"); + } + else + { + ShowTips("错误", "创建UI失败! 前往控制台查看错误日志!"); + } + + } + }); + } }