diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn new file mode 100644 index 0000000..2768b3b --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn @@ -0,0 +1,82 @@ +[gd_scene load_steps=2 format=3 uid="uid://bp1e8nom6wugk"] + +[ext_resource type="Script" path="res://src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs" id="1_um8jr"] + +[node name="MapEditorCreatePreinstall" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource("1_um8jr") + +[node name="MarginContainer" type="MarginContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 20 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="PreinstallNameLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 20.0 +text = "预设名称:" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="PreinstallNameInput" type="LineEdit" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 80.0 +placeholder_text = "请输入预设名称" + +[node name="HBoxContainer4" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="WeightNameLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer4"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 20.0 +text = "预设权重:" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="WeightInput" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer4"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 80.0 +min_value = 1.0 +max_value = 1000.0 +value = 100.0 + +[node name="HBoxContainer5" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="RemarkNameLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer5"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 0 +size_flags_stretch_ratio = 20.0 +text = "预设备注:" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="RemarkInput" type="TextEdit" parent="MarginContainer/VBoxContainer/HBoxContainer5"] +custom_minimum_size = Vector2(0, 150) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 80.0 +placeholder_text = "选填" +wrap_mode = 1 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn index 2948f79..1a66cee 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://peo0n8bl15y5"] +[gd_scene load_steps=8 format=3 uid="uid://peo0n8bl15y5"] [ext_resource type="Script" path="res://src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs" id="1_dudey"] [ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="2_osya0"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="4_urq7y"] [ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="5_3tml0"] [ext_resource type="Texture2D" uid="uid://d4gduco55dqpk" path="res://resource/sprite/ui/commonIcon/Down.png" id="5_x5dpw"] +[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="6_jpt3y"] [node name="MapEditorMapMark" type="Control"] layout_mode = 3 @@ -55,15 +56,11 @@ visible = false layout_mode = 2 -[node name="AddMark" type="Button" parent="VBoxContainer/DynamicTool"] -layout_mode = 2 -icon = ExtResource("2_osya0") - -[node name="EditMark" type="Button" parent="VBoxContainer/DynamicTool"] +[node name="EditButton" type="Button" parent="VBoxContainer/DynamicTool"] layout_mode = 2 icon = ExtResource("3_wwaki") -[node name="DeleteMark" type="Button" parent="VBoxContainer/DynamicTool"] +[node name="DeleteButton" type="Button" parent="VBoxContainer/DynamicTool"] layout_mode = 2 icon = ExtResource("4_urq7y") @@ -76,35 +73,76 @@ size_flags_horizontal = 3 size_flags_vertical = 3 -[node name="WaveTemplate" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer"] +[node name="AddWaveButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer"] +layout_mode = 2 +text = "添加波数" + +[node name="WaveItem" type="VBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate"] +[node name="WaveContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem"] layout_mode = 2 -[node name="TextureButton" type="TextureButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/HBoxContainer"] +[node name="TextureButton" type="TextureButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/WaveContainer"] custom_minimum_size = Vector2(36, 36) layout_mode = 2 texture_normal = ExtResource("5_x5dpw") stretch_mode = 3 -[node name="WaveButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/HBoxContainer"] +[node name="WaveButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/WaveContainer"] layout_mode = 2 size_flags_horizontal = 3 text = "第1波" alignment = 0 -[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate"] +[node name="Select" type="NinePatchRect" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/WaveContainer/WaveButton"] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("6_jpt3y") +patch_margin_left = 3 +patch_margin_top = 3 +patch_margin_right = 3 +patch_margin_bottom = 3 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem"] layout_mode = 2 theme_override_constants/margin_left = 40 -[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/MarginContainer"] +[node name="AddMarkButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/MarginContainer"] +layout_mode = 2 +text = "添加标记" +icon_alignment = 1 + +[node name="MarkContainer" type="MarginContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem"] +layout_mode = 2 +theme_override_constants/margin_left = 40 + +[node name="MarkItem" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/MarkContainer"] layout_mode = 2 -[node name="MarkButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/MarginContainer/HBoxContainer"] +[node name="MarkButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/MarkContainer/MarkItem"] layout_mode = 2 size_flags_horizontal = 3 text = "敌人(1001)" icon = ExtResource("5_3tml0") alignment = 0 + +[node name="Select" type="NinePatchRect" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/MarkContainer/MarkItem/MarkButton"] +visible = false +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("6_jpt3y") +patch_margin_left = 3 +patch_margin_top = 3 +patch_margin_right = 3 +patch_margin_bottom = 3 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json index 390cc67..047a131 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json @@ -5,26 +5,11 @@ { "Ready": false, "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json", - "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json" - }, - { - "Ready": false, - "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room2/Room2_roomInfo.json", - "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json" - }, - { - "Ready": false, - "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json", - "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json" + "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json", + "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json" } ], - "InletList": [ - { - "Ready": false, - "RoomPath": "resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_roomInfo.json", - "TilePath": "resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_tileInfo.json" - } - ], + "InletList": [], "OutletList": [], "BossList": [], "RewardList": [], diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json new file mode 100644 index 0000000..9324841 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json @@ -0,0 +1 @@ +[{"Name":"test1","Weight":100,"Remark":""}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json index 58824e2..f276a7c 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json @@ -1 +1 @@ -{"Position":{"X":-9,"Y":-5},"Size":{"X":23,"Y":20},"DoorAreaInfos":[{"Direction":1,"Start":0,"End":176},{"Direction":2,"Start":208,"End":336},{"Direction":0,"Start":64,"End":288},{"Direction":3,"Start":0,"End":256}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":-6,"Y":-6},"Size":{"X":15,"Y":11},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":128},{"Direction":0,"Start":0,"End":144},{"Direction":2,"Start":80,"End":208},{"Direction":1,"Start":0,"End":144}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json index 780e273..eaf38dd 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-120,-56,120,-56,120,8,200,8,200,224,88,224,88,112,-40,112,-40,208,-104,208,-104,112,-120,112]},{"Type":1,"Points":[-40,-32,56,-32,56,72,-8,72,-8,40,-40,40]}],"Floor":[-8,6,0,0,8,-8,5,0,0,8,-8,4,0,0,8,-8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,-5,-2,0,0,8,-5,-3,0,0,8,-5,-4,0,0,8,-5,-5,0,0,8],"Middle":[-5,-6,0,2,7,-4,-6,0,2,7,-3,-6,0,2,7,-2,-6,0,2,7,-1,-6,0,2,7,0,-6,0,2,7,1,-6,0,2,7,2,-6,0,2,7,3,-2,0,1,7,4,-2,0,2,7,5,-2,0,3,7,6,-6,0,2,7,7,-6,0,2,7],"Top":[-6,-6,0,3,4,-6,-5,0,3,3,-6,-4,0,3,3,-6,-3,0,3,3,-6,-2,0,3,3,-6,-1,0,3,3,-6,0,0,3,3,-6,1,0,3,3,-6,2,0,3,3,-6,3,0,3,3,-6,4,0,11,2,-5,4,0,2,2,-4,4,0,2,2,-3,0,0,1,2,-3,1,0,1,3,-3,2,0,1,3,-3,3,0,1,3,-3,4,0,13,2,-2,0,0,2,2,-1,0,0,3,2,-1,1,0,3,3,-1,2,0,3,3,-1,3,0,3,3,-1,4,0,11,2,0,4,0,2,2,1,4,0,2,2,2,4,0,2,2,3,-6,0,1,4,3,-5,0,1,3,3,-4,0,1,3,3,-3,0,1,3,3,4,0,2,2,4,4,0,2,2,5,-6,0,3,4,5,-5,0,3,3,5,-4,0,3,3,5,-3,0,3,3,5,4,0,2,2,6,4,0,2,2,7,4,0,2,2,8,-6,0,1,4,8,-5,0,1,3,8,-4,0,1,3,8,-3,0,1,3,8,-2,0,1,3,8,-1,0,1,3,8,0,0,1,3,8,1,0,1,3,8,2,0,1,3,8,3,0,1,3,8,4,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_roomInfo.json deleted file mode 100644 index 13d9a10..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_roomInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"Position":{"X":-5,"Y":-5},"Size":{"X":13,"Y":12},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":176},{"Direction":0,"Start":0,"End":160},{"Direction":2,"Start":0,"End":176},{"Direction":1,"Start":0,"End":160}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room2","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json deleted file mode 100644 index 7e35f85..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room2/Room2_tileInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"NavigationList":[{"Type":0,"Points":[-56,-56,104,-56,104,96,-56,96]}],"Floor":[0,5,0,0,8,0,4,0,0,8,0,3,0,0,8,0,2,0,0,8,0,-1,0,0,8,0,-2,0,0,8,0,-3,0,0,8,0,-4,0,0,8,0,1,0,0,8,0,0,0,0,8,1,5,0,0,8,1,4,0,0,8,1,3,0,0,8,1,2,0,0,8,1,-1,0,0,8,1,-2,0,0,8,1,-3,0,0,8,1,-4,0,0,8,1,1,0,0,8,1,0,0,0,8,-4,5,0,0,8,-4,4,0,0,8,-4,3,0,0,8,-4,2,0,0,8,-4,1,0,0,8,-4,0,0,0,8,-4,-1,0,0,8,-4,-2,0,0,8,-4,-3,0,0,8,-4,-4,0,0,8,-3,5,0,0,8,-3,4,0,0,8,-3,3,0,0,8,-3,2,0,0,8,-3,1,0,0,8,-3,0,0,0,8,-3,-1,0,0,8,-3,-2,0,0,8,-3,-3,0,0,8,-3,-4,0,0,8,-2,5,0,0,8,-2,4,0,0,8,-2,3,0,0,8,-2,2,0,0,8,-2,1,0,0,8,-2,0,0,0,8,-2,-1,0,0,8,-2,-2,0,0,8,-2,-3,0,0,8,-2,-4,0,0,8,-1,5,0,0,8,-1,4,0,0,8,-1,3,0,0,8,-1,2,0,0,8,-1,1,0,0,8,-1,0,0,0,8,-1,-1,0,0,8,-1,-2,0,0,8,-1,-3,0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,1,3,7,5,0,1,3,7,6,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json deleted file mode 100644 index 5c2da1c..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"Position":{"X":-4,"Y":-4},"Size":{"X":8,"Y":8},"DoorAreaInfos":[{"Direction":3,"Start":16,"End":144},{"Direction":2,"Start":16,"End":144},{"Direction":1,"Start":16,"End":192},{"Direction":0,"Start":16,"End":192}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room3","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json deleted file mode 100644 index 77fe5fd..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"NavigationList":[{"Type":0,"Points":[-40,-40,40,-40,40,48,-40,48]}],"Floor":[-2,-3,0,0,8,-2,-2,0,0,8,-2,-1,0,0,8,-2,0,0,0,8,-2,1,0,0,8,-2,2,0,0,8,1,-3,0,0,8,1,-2,0,0,8,1,-1,0,0,8,1,0,0,0,8,1,1,0,0,8,1,2,0,0,8,2,-3,0,0,8,2,-2,0,0,8,2,-1,0,0,8,2,0,0,0,8,2,1,0,0,8,2,2,0,0,8,-1,-3,0,0,8,-1,-2,0,0,8,-1,-1,0,0,8,-1,0,0,0,8,-1,1,0,0,8,-1,2,0,0,8,0,-3,0,0,8,0,-2,0,0,8,0,-1,0,0,8,0,0,0,0,8,0,1,0,0,8,0,2,0,0,8,-3,-3,0,0,8,-3,-2,0,0,8,-3,-1,0,0,8,-3,0,0,0,8,-3,1,0,0,8,-3,2,0,0,8],"Middle":[-3,-4,0,2,7,-2,-4,0,2,7,-1,-4,0,2,7,0,-4,0,2,7,1,-4,0,2,7,2,-4,0,2,7],"Top":[-4,-4,0,3,4,-4,-3,0,3,3,-4,-2,0,3,3,-4,-1,0,3,3,-4,0,0,3,3,-4,1,0,3,3,-4,2,0,3,3,-4,3,0,11,2,-3,3,0,2,2,-2,3,0,2,2,-1,3,0,2,2,0,3,0,2,2,1,3,0,2,2,2,3,0,2,2,3,-4,0,1,4,3,-3,0,1,3,3,-2,0,1,3,3,-1,0,1,3,3,0,0,1,3,3,1,0,1,3,3,2,0,1,3,3,3,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_roomInfo.json deleted file mode 100644 index b234081..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_roomInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"Position":{"X":-1,"Y":-1},"Size":{"X":11,"Y":9},"DoorAreaInfos":[{"Direction":3,"Start":16,"End":112},{"Direction":2,"Start":16,"End":144},{"Direction":1,"Start":16,"End":112},{"Direction":0,"Start":16,"End":112}],"GroupName":"TestGroup1","RoomType":1,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_tileInfo.json deleted file mode 100644 index 254ba66..0000000 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Room1/Room1_tileInfo.json +++ /dev/null @@ -1 +0,0 @@ -{"NavigationList":[{"Type":0,"Points":[8,8,136,8,136,112,8,112]}],"Floor":[7,6,0,0,8,7,5,0,0,8,7,4,0,0,8,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ite/role/enemy0001/enemy0001.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import index b20c9a6..c36be94 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://chd2vtesap5cf" -path="res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex" +path="res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001.png" -dest_files=["res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001.png" +dest_files=["res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"] [params] diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import index 56388a2..d563acf 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://d2f55lu60x64i" -path="res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex" +path="res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001_Debris.png" -dest_files=["res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001_Debris.png" +dest_files=["res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"] [params] diff --git a/DungeonShooting_Godot/src/framework/common/NodeExtend.cs b/DungeonShooting_Godot/src/framework/common/NodeExtend.cs index 8ef3c99..ebc149f 100644 --- a/DungeonShooting_Godot/src/framework/common/NodeExtend.cs +++ b/DungeonShooting_Godot/src/framework/common/NodeExtend.cs @@ -50,6 +50,29 @@ { GameApplication.Instance.World.GetRoomLayer(layer).AddChild(node); } + + /// + /// 设置Ui布局方式是否横向扩展, 如果为 true, 则 GridContainer 的宽度会撑满父物体 + /// + public static void SetHorizontalExpand(this Control control, bool flag) + { + if (flag) + { + control.SizeFlagsHorizontal |= Control.SizeFlags.Expand; + } + else if ((control.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0) + { + control.SizeFlagsHorizontal ^= Control.SizeFlags.Expand; + } + } + + /// + /// 获取Ui布局方式是否横向扩展 + /// + public static bool GetHorizontalExpand(this Control control) + { + return (control.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0; + } /// /// 延时指定时间调用一个回调函数 diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 3bfd712..ef55ab1 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -232,10 +232,10 @@ return retraction + $"/// \n" + retraction + $"/// 类型: , 路径: {parent}{uiNodeInfo.OriginName}\n" + retraction + $"/// \n" + - retraction + $"public class {uiNodeInfo.ClassName} : UiNode<{uiNodeInfo.UiRootName}, {uiNodeInfo.NodeTypeName}, {uiNodeInfo.ClassName}>\n" + + retraction + $"public class {uiNodeInfo.ClassName} : UiNode<{uiNodeInfo.UiRootName}Panel, {uiNodeInfo.NodeTypeName}, {uiNodeInfo.ClassName}>\n" + retraction + $"{{\n" + GeneratePropertyListClassCode("Instance.", parent, uiNodeInfo, retraction + " ") + - retraction + $" public {uiNodeInfo.ClassName}({uiNodeInfo.UiRootName} uiPanel, {uiNodeInfo.NodeTypeName} node) : base(uiPanel, node) {{ }}\n" + + retraction + $" public {uiNodeInfo.ClassName}({uiNodeInfo.UiRootName}Panel uiPanel, {uiNodeInfo.NodeTypeName} node) : base(uiPanel, node) {{ }}\n" + cloneCode + retraction + $"}}\n\n"; } @@ -260,7 +260,7 @@ string uiPanel; if (string.IsNullOrEmpty(target)) { - uiPanel = "this"; + uiPanel = $"({uiNodeInfo.UiRootName}Panel)this"; } else { diff --git a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs b/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs index e905887..7c71d23 100644 --- a/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs +++ b/DungeonShooting_Godot/src/framework/map/data/DungeonRoomSplit.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; @@ -26,6 +27,12 @@ public string TilePath; /// + /// 房间预设配置数据 + /// + [JsonInclude] + public string PreinstallPath; + + /// /// 房间配置数据, 第一次获取会在资源中加载数据 /// [JsonIgnore] @@ -35,18 +42,7 @@ { if (_roomInfo == null && RoomPath != null) { - var asText = ResourceManager.LoadText(RoomPath); - _roomInfo = JsonSerializer.Deserialize(asText); - - // //需要处理 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)); - // } + ReloadRoomInfo(); } return _roomInfo; @@ -66,8 +62,7 @@ { if (_tileInfo == null && TilePath != null) { - var asText = ResourceManager.LoadText(TilePath); - _tileInfo = JsonSerializer.Deserialize(asText); + ReloadTileInfo(); } return _tileInfo; @@ -76,4 +71,62 @@ } private DungeonTileInfo _tileInfo; + + /// + /// 房间预设数据 + /// + [JsonIgnore] + public List Preinstall + { + get + { + if (_preinstall == null && PreinstallPath != null) + { + ReloadPreinstall(); + } + + return _preinstall; + } + set => _preinstall = value; + } + + private List _preinstall; + + + /// + /// 重新加载房间数据 + /// + public void ReloadRoomInfo() + { + var asText = ResourceManager.LoadText(RoomPath); + _roomInfo = JsonSerializer.Deserialize(asText); + + // //需要处理 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)); + // } + } + + /// + /// 重新加载房间地块配置数据 + /// + public void ReloadTileInfo() + { + var asText = ResourceManager.LoadText(TilePath); + _tileInfo = JsonSerializer.Deserialize(asText); + } + + /// + /// 重新加载房间预设数据 + /// + public void ReloadPreinstall() + { + var asText = ResourceManager.LoadText(PreinstallPath); + _preinstall = JsonSerializer.Deserialize>(asText); + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs new file mode 100644 index 0000000..b8fc223 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs @@ -0,0 +1,26 @@ + +using System.Text.Json.Serialization; + +/// +/// 房间预设数据 +/// +public class RoomPreinstall +{ + /// + /// 预设名称 + /// + [JsonInclude] + public string Name; + + /// + /// 预设权重 + /// + [JsonInclude] + public int Weight; + + /// + /// 预设备注 + /// + [JsonInclude] + public string Remark; +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 016131e..3b7562a 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -32,7 +32,7 @@ /// /// 所属父级Ui, 仅当通过 UiNode.OpenNestedUi() 打开时才会赋值
- /// 注意: 如果是在预制体中放置的子 Ui, 那么子 Ui 的该属性会在 OnCreateUi() 之后赋值 + /// 注意: 如果是在预制体中放置的子 Ui, 那么子 Ui 的该属性会在 父 Ui 的 OnCreateUi() 之后赋值 ///
public UiBase ParentUi { get; private set; } diff --git a/DungeonShooting_Godot/src/framework/ui/grid/IUiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/IUiCell.cs new file mode 100644 index 0000000..4b4e239 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/ui/grid/IUiCell.cs @@ -0,0 +1,27 @@ + +/// +/// 网格组件中单个格子的数据处理类接口, 无泛型 +/// +public interface IUiCell : IDestroy +{ + /// + /// 当前 Cell 在 UiGrid 组件中的索引位置 + /// + public int Index { get; } + + /// + /// 当检测当前 Cell 是否可以被选中时调用 + /// + public bool CanSelect(); + + /// + /// 当前 Cell 选中时调用, 设置 UiGrid.SelectIndex 时触发 + /// + public void OnSelect(); + + /// + /// 当前 Cell 取消选中时调用, 设置 UiGrid.SelectIndex 时触发 + /// + public void OnUnSelect(); + +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs new file mode 100644 index 0000000..2965328 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs @@ -0,0 +1,17 @@ + + +/// +/// Ui网格组件基础接口, 无泛型 +/// +public interface IUiGrid : IDestroy +{ + /// + /// 当前选中的 Cell 索引 + /// + public int SelectIndex { get; set; } + + /// + /// 设置网格组件是否可见 + /// + public bool Visible { get; set; } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs index 656504b..01f61ac 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs @@ -6,13 +6,10 @@ ///
/// ui节点类型 /// 数据类型 -public abstract class UiCell : IDestroy where TUiCellNode : IUiCellNode +public abstract class UiCell : IUiCell where TUiCellNode : IUiCellNode { public bool IsDestroyed { get; private set; } - - /// - /// 当前 Cell 在 UiGrid 组件中的索引位置 - /// + public int Index { get; private set; } = -1; /// @@ -61,30 +58,21 @@ } /// - /// 当禁用当前 Cell 时调用 + /// 当禁用当前 Cell 时调用, 也就是被回收时调用 /// public virtual void OnDisable() { } - /// - /// 当检测当前 Cell 是否可以被选中时调用 - /// public virtual bool CanSelect() { return true; } - /// - /// 当前 Cell 选中时调用, 设置 UiGrid.SelectIndex 时触发 - /// public virtual void OnSelect() { } - - /// - /// 当前 Cell 取消选中时调用, 设置 UiGrid.SelectIndex 时触发 - /// + public virtual void OnUnSelect() { } diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index a13ca3b..29ab909 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -9,13 +9,10 @@ /// /// Ui节点类型 /// 传给Cell的数据类型 -public class UiGrid : IDestroy where TUiCellNode : IUiCellNode +public class UiGrid : IUiGrid where TUiCellNode : IUiCellNode { public bool IsDestroyed { get; private set; } - - /// - /// 当前选中的 Cell 索引 - /// + public int SelectIndex { get => _selectIndex; @@ -53,19 +50,32 @@ } } } + + public bool Visible + { + get => _gridContainer.Visible; + set => _gridContainer.Visible = value; + } + //模板对象 private TUiCellNode _template; + //模板大小 private Vector2 _size = Vector2.Zero; - private Node _parent; + //cell逻辑处理类 private Type _cellType; + //当前活动的cell池 private Stack> _cellPool = new Stack>(); + //当前已被回收的cell池 private List> _cellList = new List>(); - + //godot原生网格组件 private GridContainer _gridContainer; + //单个cell偏移 private Vector2I _cellOffset; + //列数 private int _columns; + //是否自动扩展列数 private bool _autoColumns; - + //选中的cell索引 private int _selectIndex = -1; public UiGrid(TUiCellNode template, Type cellType) @@ -75,9 +85,8 @@ _template = template; _cellType = cellType; var uiInstance = _template.GetUiInstance(); - _parent = uiInstance.GetParent(); - _parent.RemoveChild(uiInstance); - _parent.AddChild(_gridContainer); + uiInstance.AddSibling(_gridContainer); + uiInstance.GetParent().RemoveChild(uiInstance); if (uiInstance is Control control) { _size = control.Size; @@ -87,14 +96,11 @@ /// /// 设置每个 Cell 之间的偏移量 /// - public void SetCellOffset(Vector2I offset) + public void SetCellOffset(Vector2I offset) { - if (_gridContainer != null) - { - _cellOffset = offset; - _gridContainer.AddThemeConstantOverride("h_separation", offset.X); - _gridContainer.AddThemeConstantOverride("v_separation", offset.Y); - } + _cellOffset = offset; + _gridContainer.AddThemeConstantOverride("h_separation", offset.X); + _gridContainer.AddThemeConstantOverride("v_separation", offset.Y); } /// @@ -111,10 +117,7 @@ public void SetColumns(int columns) { _columns = columns; - if (_gridContainer != null) - { - _gridContainer.Columns = columns; - } + _gridContainer.Columns = columns; } /// @@ -122,12 +125,7 @@ /// public int GetColumns() { - if (_gridContainer != null) - { - return _gridContainer.Columns; - } - - return _columns; + return _gridContainer.Columns; } /// @@ -138,18 +136,15 @@ if (flag != _autoColumns) { _autoColumns = flag; - if (_gridContainer != null) + if (_autoColumns) { - if (_autoColumns) - { - _gridContainer.Resized += OnGridResized; - OnGridResized(); - } - else - { - _gridContainer.Columns = _columns; - _gridContainer.Resized -= OnGridResized; - } + _gridContainer.Resized += OnGridResized; + OnGridResized(); + } + else + { + _gridContainer.Columns = _columns; + _gridContainer.Resized -= OnGridResized; } } } @@ -163,34 +158,19 @@ } /// - /// 设置当前组布局方式是否横向扩展, 如果为 true, 则 GridContainer 的宽度会撑满父物体 + /// 设置当前组件布局方式是否横向扩展, 如果为 true, 则 GridContainer 的宽度会撑满父物体 /// public void SetHorizontalExpand(bool flag) { - if (_gridContainer != null) - { - if (flag) - { - _gridContainer.SizeFlagsHorizontal |= Control.SizeFlags.Expand; - } - else if ((_gridContainer.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0) - { - _gridContainer.SizeFlagsHorizontal ^= Control.SizeFlags.Expand; - } - } + _gridContainer.SetHorizontalExpand(flag); } /// - /// 获取当前组布局方式是否横向扩展 + /// 获取当前组件布局方式是否横向扩展 /// public bool GetHorizontalExpand() { - if (_gridContainer != null) - { - return (_gridContainer.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0; - } - - return false; + return _gridContainer.GetHorizontalExpand(); } /// @@ -362,10 +342,7 @@ _cellList = null; _cellPool = null; - if (_gridContainer != null) - { - _gridContainer.QueueFree(); - } + _gridContainer.QueueFree(); } private void OnReady() diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index 3864f49..3726c40 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -1,8 +1,12 @@  using System; +using System.Collections.Generic; using Godot; using UI.EditorTips; using UI.EditorWindow; +using UI.MapEditorCreateGroup; +using UI.MapEditorCreatePreinstall; +using UI.MapEditorCreateRoom; public static class EditorWindowManager { @@ -30,6 +34,128 @@ body.SetMessage(message); } + /// + /// 弹出询问窗口 + /// + /// 标题 + /// 显示内容 + /// 关闭时的回调, 参数如果为 true 表示点击了确定 + public static void ShowConfirm(string title, string message, Action onClose) + { + var window = UiManager.Open_EditorWindow(); + window.SetWindowTitle(title); + window.CloseEvent += () => + { + onClose(false); + }; + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + window.CloseWindow(); + onClose(true); + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + onClose(false); + }) + ); + var body = window.OpenBody(UiManager.UiName.EditorTips); + body.SetMessage(message); + } + + /// + /// 打开创建地牢组弹窗 + /// + /// 创建成功时回调 + public static void ShowCreateGroup(Action onCreateGroup) + { + var window = UiManager.Open_EditorWindow(); + window.SetWindowTitle("创建地牢组"); + window.SetWindowSize(new Vector2I(700, 500)); + var body = window.OpenBody(UiManager.UiName.MapEditorCreateGroup); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + //获取填写的数据, 并创建ui + var groupInfo = body.GetGroupInfo(); + if (groupInfo != null) + { + window.CloseWindow(); + onCreateGroup(groupInfo); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } + + /// + /// 打开创建地牢房间弹窗 + /// + /// 选择的组名称, 如果不需要有选择的项, 则传 null + /// 选择的房间类型 + /// 创建成功时回调 + public static void ShowCreateRoom(string groupName, int roomType, Action onCreateRoom) + { + var window = UiManager.Open_EditorWindow(); + window.SetWindowTitle("创建地牢房间"); + window.SetWindowSize(new Vector2I(700, 600)); + var body = window.OpenBody(UiManager.UiName.MapEditorCreateRoom); + if (groupName != null) + { + body.SetSelectGroup(groupName); + } + body.SetSelectType(roomType); + + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + //获取填写的数据, 并创建ui + var roomSplit = body.GetRoomInfo(); + if (roomSplit != null) + { + window.CloseWindow(); + onCreateRoom(roomSplit); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } + + /// + /// 打开创建房间预设弹窗 + /// + /// 当前房间已经包含的所有预设列表 + /// 创建成功时的回调 + public static void ShowCreatePreinstall(List list, Action onCreatePreinstall) + { + var window = UiManager.Open_EditorWindow(); + window.SetWindowTitle("创建房间预设"); + window.SetWindowSize(new Vector2I(700, 600)); + var body = window.OpenBody(UiManager.UiName.MapEditorCreatePreinstall); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + var roomPreinstall = body.GetRoomPreinstall(list); + if (roomPreinstall != null) + { + window.CloseWindow(); + onCreatePreinstall(roomPreinstall); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } + public static void ShowSelectObject(string title) { var window = UiManager.Open_EditorWindow(); diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs index 568e3df..fd6fbbf 100644 --- a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs +++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs @@ -117,6 +117,14 @@ } /// + /// 获取房间预设数据配置文件名称 + /// + public static string GetRoomPreinstallConfigName(string roomName) + { + return roomName + "_preinstall.json"; + } + + /// /// 创建地牢组 /// public static void CreateGroup(DungeonRoomGroup group) @@ -166,6 +174,9 @@ //将房间地块保存为json var jsonText3 = JsonSerializer.Serialize(roomSplit.TileInfo); File.WriteAllText(roomSplit.TilePath, jsonText3); + //将预设保存为json + var jsonText4 = JsonSerializer.Serialize(roomSplit.Preinstall); + File.WriteAllText(roomSplit.PreinstallPath, jsonText4); //创建完成事件 EventManager.EmitEvent(EventEnum.OnCreateRoomFinish, roomSplit); } diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 8ebc3ab..5bf0865 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -54,6 +54,7 @@ public const string prefab_ui_Main_tscn = "res://prefab/ui/Main.tscn"; public const string prefab_ui_MapEditor_tscn = "res://prefab/ui/MapEditor.tscn"; public const string prefab_ui_MapEditorCreateGroup_tscn = "res://prefab/ui/MapEditorCreateGroup.tscn"; + public const string prefab_ui_MapEditorCreatePreinstall_tscn = "res://prefab/ui/MapEditorCreatePreinstall.tscn"; public const string prefab_ui_MapEditorCreateRoom_tscn = "res://prefab/ui/MapEditorCreateRoom.tscn"; public const string prefab_ui_MapEditorMapLayer_tscn = "res://prefab/ui/MapEditorMapLayer.tscn"; public const string prefab_ui_MapEditorMapMark_tscn = "res://prefab/ui/MapEditorMapMark.tscn"; diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index e5d3dab..e076168 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -14,6 +14,7 @@ public const string Main = "Main"; public const string MapEditor = "MapEditor"; public const string MapEditorCreateGroup = "MapEditorCreateGroup"; + public const string MapEditorCreatePreinstall = "MapEditorCreatePreinstall"; public const string MapEditorCreateRoom = "MapEditorCreateRoom"; public const string MapEditorMapLayer = "MapEditorMapLayer"; public const string MapEditorMapMark = "MapEditorMapMark"; @@ -409,6 +410,54 @@ } /// + /// 创建 MapEditorCreatePreinstall, 并返回UI实例, 该函数不会打开 Ui + /// + public static UI.MapEditorCreatePreinstall.MapEditorCreatePreinstallPanel Create_MapEditorCreatePreinstall() + { + return CreateUi(UiName.MapEditorCreatePreinstall); + } + + /// + /// 打开 MapEditorCreatePreinstall, 并返回UI实例 + /// + public static UI.MapEditorCreatePreinstall.MapEditorCreatePreinstallPanel Open_MapEditorCreatePreinstall() + { + return OpenUi(UiName.MapEditorCreatePreinstall); + } + + /// + /// 隐藏 MapEditorCreatePreinstall 的所有实例 + /// + public static void Hide_MapEditorCreatePreinstall() + { + var uiInstance = Get_MapEditorCreatePreinstall_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 MapEditorCreatePreinstall 的所有实例 + /// + public static void Destroy_MapEditorCreatePreinstall() + { + var uiInstance = Get_MapEditorCreatePreinstall_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.Destroy(); + } + } + + /// + /// 获取所有 MapEditorCreatePreinstall 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.MapEditorCreatePreinstall.MapEditorCreatePreinstallPanel[] Get_MapEditorCreatePreinstall_Instance() + { + return GetUiInstance(nameof(UI.MapEditorCreatePreinstall.MapEditorCreatePreinstall)); + } + + /// /// 创建 MapEditorCreateRoom, 并返回UI实例, 该函数不会打开 Ui /// public static UI.MapEditorCreateRoom.MapEditorCreateRoomPanel Create_MapEditorCreateRoom() diff --git a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs index 7d8e3ee..993e6ce 100644 --- a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs @@ -34,18 +34,9 @@ public override void OnCreateUi() { S_CustomButton.Instance.Visible = false; - } - - public override void OnShowUi() - { S_Window.Instance.CloseRequested += CloseWindow; } - public override void OnHideUi() - { - S_Window.Instance.CloseRequested -= CloseWindow; - } - /// /// 设置自定义按钮 /// diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs index 6d1e0cc..cb3091c 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -58,10 +58,6 @@ private void OnBackClick() { //返回上一个Ui - if (PrevUi != null) - { - Destroy(); - PrevUi.ShowUi(); - } + OpenPrevUi(); } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index eea44cd..de3e2cb 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -115,8 +115,10 @@ private int _terrain = 0; private AutoTileConfig _autoTileConfig = new AutoTileConfig(); - //原数据 - private DungeonRoomSplit _roomSplit; + /// + /// 正在编辑的房间数据 + /// + public DungeonRoomSplit RoomSplit { get; private set; } //变动过的数据 @@ -382,6 +384,7 @@ { SaveRoomInfoConfig(); SaveTileInfoConfig(); + SavePreinstallConfig(); } /// @@ -389,7 +392,12 @@ /// public bool Load(DungeonRoomSplit roomSplit) { - _roomSplit = roomSplit; + //重新加载数据 + roomSplit.ReloadRoomInfo(); + roomSplit.ReloadTileInfo(); + roomSplit.ReloadPreinstall(); + + RoomSplit = roomSplit; var roomInfo = roomSplit.RoomInfo; var tileInfo = roomSplit.TileInfo; @@ -421,6 +429,9 @@ { MapEditorToolsPanel.CreateDoorTool(doorAreaInfo); } + + //聚焦 + OnClickCenterTool(null); return true; } @@ -858,7 +869,7 @@ private void SaveRoomInfoConfig() { //存入本地 - var roomInfo = _roomSplit.RoomInfo; + var roomInfo = RoomSplit.RoomInfo; var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName); if (!Directory.Exists(path)) { @@ -879,14 +890,14 @@ public void SaveTileInfoConfig() { //存入本地 - var roomInfo = _roomSplit.RoomInfo; + var roomInfo = RoomSplit.RoomInfo; var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } - var tileInfo = _roomSplit.TileInfo; + var tileInfo = RoomSplit.TileInfo; tileInfo.NavigationList.Clear(); tileInfo.NavigationList.AddRange(_dungeonTileMap.GetPolygonData()); tileInfo.Floor.Clear(); @@ -902,6 +913,22 @@ File.WriteAllText(path, jsonStr); } + //保存预设数据 + public void SavePreinstallConfig() + { + //存入本地 + var roomInfo = RoomSplit.RoomInfo; + var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + + path += "/" + MapProjectManager.GetRoomPreinstallConfigName(roomInfo.RoomName); + var jsonStr = JsonSerializer.Serialize(RoomSplit.Preinstall); + File.WriteAllText(path, jsonStr); + } + //设置地图坐标 private void SetMapPosition(Vector2 pos) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs index eb9b839..aa73a0b 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs @@ -14,12 +14,8 @@ _editorTileMap.Instance.MapEditorToolsPanel = editorPanel.S_MapEditorTools.Instance; _editorTileMap.Instance.MapEditorToolsPanel.EditorMap = _editorTileMap; - _eventFactory = EventManager.CreateEventFactory(); - } - - public void OnShow() - { _editorTileMap.L_Brush.Instance.Draw += OnDrawGuides; + _eventFactory = EventManager.CreateEventFactory(); _eventFactory.AddEventListener(EventEnum.OnSelectDragTool, _editorTileMap.Instance.OnSelectHandTool); _eventFactory.AddEventListener(EventEnum.OnSelectPenTool, _editorTileMap.Instance.OnSelectPenTool); _eventFactory.AddEventListener(EventEnum.OnSelectRectTool, _editorTileMap.Instance.OnSelectRectTool); @@ -27,10 +23,14 @@ _eventFactory.AddEventListener(EventEnum.OnClickCenterTool, _editorTileMap.Instance.OnClickCenterTool); } + public void OnShow() + { + + } + public void OnHide() { - _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides; - _eventFactory.RemoveAllEventListener(); + } public void Process(float delta) @@ -45,6 +45,7 @@ public void OnDestroy() { - + _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides; + _eventFactory.RemoveAllEventListener(); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateGroup/MapEditorCreateGroupPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateGroup/MapEditorCreateGroupPanel.cs index eb2f954..cbc213d 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateGroup/MapEditorCreateGroupPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateGroup/MapEditorCreateGroupPanel.cs @@ -16,9 +16,9 @@ var groupName = S_GroupNameInput.Instance.Text; //检查名称是否合规 - if (!Regex.IsMatch(groupName, "^\\w+$")) + if (string.IsNullOrEmpty(groupName)) { - EditorWindowManager.ShowTips("错误", "组名称'" + groupName + "'不符合名称约束, 组名称只允许包含大小写字母和数字!"); + EditorWindowManager.ShowTips("错误", "组名称不能为空!"); return null; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstall.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstall.cs new file mode 100644 index 0000000..21b973f --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstall.cs @@ -0,0 +1,315 @@ +namespace UI.MapEditorCreatePreinstall; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class MapEditorCreatePreinstall : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer + /// + public MarginContainer L_MarginContainer + { + get + { + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer((MapEditorCreatePreinstallPanel)this, GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer _L_MarginContainer; + + + public MapEditorCreatePreinstall() : base(nameof(MapEditorCreatePreinstall)) + { + } + + public sealed override void OnInitNestedUi() + { + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer.PreinstallNameLabel + /// + public class PreinstallNameLabel : UiNode + { + public PreinstallNameLabel(MapEditorCreatePreinstallPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override PreinstallNameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer.PreinstallNameInput + /// + public class PreinstallNameInput : UiNode + { + public PreinstallNameInput(MapEditorCreatePreinstallPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } + public override PreinstallNameInput Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer + /// + public class HBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.PreinstallNameLabel + /// + public PreinstallNameLabel L_PreinstallNameLabel + { + get + { + if (_L_PreinstallNameLabel == null) _L_PreinstallNameLabel = new PreinstallNameLabel(UiPanel, Instance.GetNodeOrNull("PreinstallNameLabel")); + return _L_PreinstallNameLabel; + } + } + private PreinstallNameLabel _L_PreinstallNameLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.PreinstallNameInput + /// + public PreinstallNameInput L_PreinstallNameInput + { + get + { + if (_L_PreinstallNameInput == null) _L_PreinstallNameInput = new PreinstallNameInput(UiPanel, Instance.GetNodeOrNull("PreinstallNameInput")); + return _L_PreinstallNameInput; + } + } + private PreinstallNameInput _L_PreinstallNameInput; + + public HBoxContainer(MapEditorCreatePreinstallPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4.WeightNameLabel + /// + public class WeightNameLabel : UiNode + { + public WeightNameLabel(MapEditorCreatePreinstallPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override WeightNameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4.WeightInput + /// + public class WeightInput : UiNode + { + public WeightInput(MapEditorCreatePreinstallPanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { } + public override WeightInput Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4 + /// + public class HBoxContainer4 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.WeightNameLabel + /// + public WeightNameLabel L_WeightNameLabel + { + get + { + if (_L_WeightNameLabel == null) _L_WeightNameLabel = new WeightNameLabel(UiPanel, Instance.GetNodeOrNull("WeightNameLabel")); + return _L_WeightNameLabel; + } + } + private WeightNameLabel _L_WeightNameLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.WeightInput + /// + public WeightInput L_WeightInput + { + get + { + if (_L_WeightInput == null) _L_WeightInput = new WeightInput(UiPanel, Instance.GetNodeOrNull("WeightInput")); + return _L_WeightInput; + } + } + private WeightInput _L_WeightInput; + + public HBoxContainer4(MapEditorCreatePreinstallPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer4 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5.RemarkNameLabel + /// + public class RemarkNameLabel : UiNode + { + public RemarkNameLabel(MapEditorCreatePreinstallPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override RemarkNameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5.RemarkInput + /// + public class RemarkInput : UiNode + { + public RemarkInput(MapEditorCreatePreinstallPanel uiPanel, Godot.TextEdit node) : base(uiPanel, node) { } + public override RemarkInput Clone() => new (UiPanel, (Godot.TextEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5 + /// + public class HBoxContainer5 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.RemarkNameLabel + /// + public RemarkNameLabel L_RemarkNameLabel + { + get + { + if (_L_RemarkNameLabel == null) _L_RemarkNameLabel = new RemarkNameLabel(UiPanel, Instance.GetNodeOrNull("RemarkNameLabel")); + return _L_RemarkNameLabel; + } + } + private RemarkNameLabel _L_RemarkNameLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.RemarkInput + /// + public RemarkInput L_RemarkInput + { + get + { + if (_L_RemarkInput == null) _L_RemarkInput = new RemarkInput(UiPanel, Instance.GetNodeOrNull("RemarkInput")); + return _L_RemarkInput; + } + } + private RemarkInput _L_RemarkInput; + + public HBoxContainer5(MapEditorCreatePreinstallPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer5 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.HBoxContainer + /// + public HBoxContainer L_HBoxContainer + { + get + { + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); + return _L_HBoxContainer; + } + } + private HBoxContainer _L_HBoxContainer; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.HBoxContainer4 + /// + public HBoxContainer4 L_HBoxContainer4 + { + get + { + if (_L_HBoxContainer4 == null) _L_HBoxContainer4 = new HBoxContainer4(UiPanel, Instance.GetNodeOrNull("HBoxContainer4")); + return _L_HBoxContainer4; + } + } + private HBoxContainer4 _L_HBoxContainer4; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.HBoxContainer5 + /// + public HBoxContainer5 L_HBoxContainer5 + { + get + { + if (_L_HBoxContainer5 == null) _L_HBoxContainer5 = new HBoxContainer5(UiPanel, Instance.GetNodeOrNull("HBoxContainer5")); + return _L_HBoxContainer5; + } + } + private HBoxContainer5 _L_HBoxContainer5; + + public VBoxContainer(MapEditorCreatePreinstallPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreatePreinstall.MarginContainer + /// + public class MarginContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreatePreinstall.VBoxContainer + /// + public VBoxContainer L_VBoxContainer + { + get + { + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNodeOrNull("VBoxContainer")); + return _L_VBoxContainer; + } + } + private VBoxContainer _L_VBoxContainer; + + public MarginContainer(MapEditorCreatePreinstallPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer.PreinstallNameLabel + /// + public PreinstallNameLabel S_PreinstallNameLabel => L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_PreinstallNameLabel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer.PreinstallNameInput + /// + public PreinstallNameInput S_PreinstallNameInput => L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_PreinstallNameInput; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer + /// + public HBoxContainer S_HBoxContainer => L_MarginContainer.L_VBoxContainer.L_HBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4.WeightNameLabel + /// + public WeightNameLabel S_WeightNameLabel => L_MarginContainer.L_VBoxContainer.L_HBoxContainer4.L_WeightNameLabel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4.WeightInput + /// + public WeightInput S_WeightInput => L_MarginContainer.L_VBoxContainer.L_HBoxContainer4.L_WeightInput; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer4 + /// + public HBoxContainer4 S_HBoxContainer4 => L_MarginContainer.L_VBoxContainer.L_HBoxContainer4; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5.RemarkNameLabel + /// + public RemarkNameLabel S_RemarkNameLabel => L_MarginContainer.L_VBoxContainer.L_HBoxContainer5.L_RemarkNameLabel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5.RemarkInput + /// + public RemarkInput S_RemarkInput => L_MarginContainer.L_VBoxContainer.L_HBoxContainer5.L_RemarkInput; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer.HBoxContainer5 + /// + public HBoxContainer5 S_HBoxContainer5 => L_MarginContainer.L_VBoxContainer.L_HBoxContainer5; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer.VBoxContainer + /// + public VBoxContainer S_VBoxContainer => L_MarginContainer.L_VBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreatePreinstall.MarginContainer + /// + public MarginContainer S_MarginContainer => L_MarginContainer; + +} diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs new file mode 100644 index 0000000..5cad8a5 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Text.RegularExpressions; +using Godot; + +namespace UI.MapEditorCreatePreinstall; + +public partial class MapEditorCreatePreinstallPanel : MapEditorCreatePreinstall +{ + /// + /// 填完数据后创建数据进行验证并创建数据对象, 如果验证失败, 则返回null + /// + /// + /// + public RoomPreinstall GetRoomPreinstall(List roomPreinstalls) + { + var data = new RoomPreinstall(); + data.Name = S_PreinstallNameInput.Instance.Text; + //检查名称是否合规 + if (string.IsNullOrEmpty(data.Name)) + { + EditorWindowManager.ShowTips("错误", "预设名称不能为空!"); + return null; + } + + var index = roomPreinstalls.FindIndex(preinstall => preinstall.Name == data.Name); + if (index >= 0) + { + EditorWindowManager.ShowTips("错误", "当前房间已经存在预设名称'" + data.Name + "', 请使用其他名称!"); + return null; + } + + data.Remark = S_RemarkInput.Instance.Text; + data.Weight = (int)S_WeightInput.Instance.Value; + return data; + } + +} diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs index 963b2e1..ac87b22 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateRoom/MapEditorCreateRoomPanel.cs @@ -65,9 +65,9 @@ roomInfo.RoomName = S_RoomNameInput.Instance.Text; roomInfo.Remark = S_RemarkInput.Instance.Text; //检查名称是否合规 - if (!Regex.IsMatch(roomInfo.RoomName, "^\\w+$")) + if (string.IsNullOrEmpty(roomInfo.RoomName)) { - EditorWindowManager.ShowTips("错误", "房间名称'" + roomInfo.RoomName + "'不符合名称约束, 房间名称只允许包含大小写字母和数字!"); + EditorWindowManager.ShowTips("错误", "房间名称不能为空!"); return null; } @@ -98,6 +98,7 @@ return null; } + roomInfo.Weight = (int)S_WeightInput.Instance.Value; roomInfo.Size = new SerializeVector2(); roomInfo.Position = new SerializeVector2(); roomInfo.DoorAreaInfos = new List(); @@ -111,9 +112,12 @@ tileInfo.Floor = new List(); tileInfo.Middle = new List(); tileInfo.Top = new List(); - + roomSplit.TilePath = dirPath + "/" + MapProjectManager.GetTileInfoConfigName(roomInfo.RoomName); roomSplit.TileInfo = tileInfo; + + roomSplit.PreinstallPath = dirPath + "/" + MapProjectManager.GetRoomPreinstallConfigName(roomInfo.RoomName); + roomSplit.Preinstall = new List(); return roomSplit; } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs new file mode 100644 index 0000000..17082cc --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs @@ -0,0 +1,24 @@ +namespace UI.MapEditorMapMark; + +public class EditorMarkCell : UiCell +{ + public override void OnInit() + { + CellNode.L_MarkButton.Instance.Pressed += OnClick; + } + + public override void OnClick() + { + CellNode.UiPanel.SetSelectCell(this, CellNode.Instance, MapEditorMapMarkPanel.SelectToolType.Mark); + } + + public override void OnSelect() + { + CellNode.L_MarkButton.L_Select.Instance.Visible = true; + } + + public override void OnUnSelect() + { + CellNode.L_MarkButton.L_Select.Instance.Visible = false; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs deleted file mode 100644 index 405b8dc..0000000 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs +++ /dev/null @@ -1,26 +0,0 @@ -namespace UI.MapEditorMapMark; - -public class EditorMarkWaveCell : UiCell -{ - public override void OnInit() - { - CellNode.L_HBoxContainer.L_TextureButton.Instance.Pressed += OnExpandOrClose; - } - - //展开/收起按钮点击 - private void OnExpandOrClose() - { - var textureButton = CellNode.L_HBoxContainer.L_TextureButton.Instance; - var marginContainer = CellNode.L_MarginContainer.Instance; - var flag = !marginContainer.Visible; - marginContainer.Visible = flag; - if (flag) - { - textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Down_png); - } - else - { - textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Left_png); - } - } -} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs new file mode 100644 index 0000000..66b42e5 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs @@ -0,0 +1,68 @@ +using Godot; + +namespace UI.MapEditorMapMark; + +public class EditorWaveCell : UiCell +{ + private UiGrid _grid; + + public override void OnInit() + { + CellNode.L_WaveContainer.L_WaveButton.Instance.Pressed += OnClick; + CellNode.L_WaveContainer.L_TextureButton.Instance.Pressed += OnExpandOrClose; + + CellNode.L_MarkContainer.L_MarkItem.Instance.SetHorizontalExpand(true); + _grid = new UiGrid(CellNode.L_MarkContainer.L_MarkItem, typeof(EditorMarkCell)); + _grid.SetColumns(1); + _grid.SetHorizontalExpand(true); + _grid.SetCellOffset(new Vector2I(0, 5)); + } + + public override void OnSetData(object data) + { + //_grid.SetDataList(new object[] { 1, 2, 3, 4, 5, 6, 7 }); + } + + public override void OnRefreshIndex() + { + CellNode.L_WaveContainer.L_WaveButton.Instance.Text = $"第{Index + 1}波"; + } + + public override void OnDestroy() + { + _grid.Destroy(); + } + + //展开/收起按钮点击 + private void OnExpandOrClose() + { + var marginContainer = CellNode.L_MarkContainer.Instance; + var flag = !marginContainer.Visible; + marginContainer.Visible = flag; + CellNode.L_MarginContainer.Instance.Visible = flag; + var textureButton = CellNode.L_WaveContainer.L_TextureButton.Instance; + if (flag) + { + textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Down_png); + } + else + { + textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Left_png); + } + } + + public override void OnClick() + { + CellNode.UiPanel.SetSelectCell(this, CellNode.L_WaveContainer.Instance, MapEditorMapMarkPanel.SelectToolType.Wave); + } + + public override void OnSelect() + { + CellNode.L_WaveContainer.L_WaveButton.L_Select.Instance.Visible = true; + } + + public override void OnUnSelect() + { + CellNode.L_WaveContainer.L_WaveButton.L_Select.Instance.Visible = false; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMark.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMark.cs index 7c24e26..2661fec 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMark.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMark.cs @@ -12,7 +12,7 @@ { get { - if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(this, GetNodeOrNull("VBoxContainer")); + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer((MapEditorMapMarkPanel)this, GetNodeOrNull("VBoxContainer")); return _L_VBoxContainer; } } @@ -30,52 +30,52 @@ /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.MarkLabel /// - public class MarkLabel : UiNode + public class MarkLabel : UiNode { - public MarkLabel(MapEditorMapMark uiPanel, Godot.Label node) : base(uiPanel, node) { } + public MarkLabel(MapEditorMapMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } public override MarkLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.HBoxContainer.PreinstallOption /// - public class PreinstallOption : UiNode + public class PreinstallOption : UiNode { - public PreinstallOption(MapEditorMapMark uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } + public PreinstallOption(MapEditorMapMarkPanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } public override PreinstallOption Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.HBoxContainer.AddPreinstall /// - public class AddPreinstall : UiNode + public class AddPreinstall : UiNode { - public AddPreinstall(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } + public AddPreinstall(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override AddPreinstall Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.HBoxContainer.EditPreinstall /// - public class EditPreinstall : UiNode + public class EditPreinstall : UiNode { - public EditPreinstall(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } + public EditPreinstall(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override EditPreinstall Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.HBoxContainer.DeletePreinstall /// - public class DeletePreinstall : UiNode + public class DeletePreinstall : UiNode { - public DeletePreinstall(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } + public DeletePreinstall(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override DeletePreinstall Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.HBoxContainer /// - public class HBoxContainer : UiNode + public class HBoxContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.PreinstallOption @@ -129,119 +129,128 @@ } private DeletePreinstall _L_DeletePreinstall; - public HBoxContainer(MapEditorMapMark uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public HBoxContainer(MapEditorMapMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.MarkLabel2 /// - public class MarkLabel2 : UiNode + public class MarkLabel2 : UiNode { - public MarkLabel2(MapEditorMapMark uiPanel, Godot.Label node) : base(uiPanel, node) { } + public MarkLabel2(MapEditorMapMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } public override MarkLabel2 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool.AddMark + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool.EditButton /// - public class AddMark : UiNode + public class EditButton : UiNode { - public AddMark(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override AddMark Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + public EditButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override EditButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool.EditMark + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool.DeleteButton /// - public class EditMark : UiNode + public class DeleteButton : UiNode { - public EditMark(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override EditMark Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool.DeleteMark - /// - public class DeleteMark : UiNode - { - public DeleteMark(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override DeleteMark Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + public DeleteButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override DeleteButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.DynamicTool /// - public class DynamicTool : UiNode + public class DynamicTool : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.AddMark + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.EditButton /// - public AddMark L_AddMark + public EditButton L_EditButton { get { - if (_L_AddMark == null) _L_AddMark = new AddMark(UiPanel, Instance.GetNodeOrNull("AddMark")); - return _L_AddMark; + if (_L_EditButton == null) _L_EditButton = new EditButton(UiPanel, Instance.GetNodeOrNull("EditButton")); + return _L_EditButton; } } - private AddMark _L_AddMark; + private EditButton _L_EditButton; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.EditMark + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DeleteButton /// - public EditMark L_EditMark + public DeleteButton L_DeleteButton { get { - if (_L_EditMark == null) _L_EditMark = new EditMark(UiPanel, Instance.GetNodeOrNull("EditMark")); - return _L_EditMark; + if (_L_DeleteButton == null) _L_DeleteButton = new DeleteButton(UiPanel, Instance.GetNodeOrNull("DeleteButton")); + return _L_DeleteButton; } } - private EditMark _L_EditMark; + private DeleteButton _L_DeleteButton; - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DeleteMark - /// - public DeleteMark L_DeleteMark - { - get - { - if (_L_DeleteMark == null) _L_DeleteMark = new DeleteMark(UiPanel, Instance.GetNodeOrNull("DeleteMark")); - return _L_DeleteMark; - } - } - private DeleteMark _L_DeleteMark; - - public DynamicTool(MapEditorMapMark uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public DynamicTool(MapEditorMapMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override DynamicTool Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer.TextureButton + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.AddWaveButton /// - public class TextureButton : UiNode + public class AddWaveButton : UiNode { - public TextureButton(MapEditorMapMark uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public AddWaveButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override AddWaveButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.TextureButton + /// + public class TextureButton : UiNode + { + public TextureButton(MapEditorMapMarkPanel uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } public override TextureButton Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer.WaveButton + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.WaveButton.Select /// - public class WaveButton : UiNode + public class Select : UiNode { - public WaveButton(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } + public Select(MapEditorMapMarkPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.WaveButton + /// + public class WaveButton : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.Select + /// + public Select L_Select + { + get + { + if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNodeOrNull("Select")); + return _L_Select; + } + } + private Select _L_Select; + + public WaveButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override WaveButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer /// - public class HBoxContainer_1 : UiNode + public class WaveContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.TextureButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.TextureButton /// public TextureButton L_TextureButton { @@ -254,7 +263,7 @@ private TextureButton _L_TextureButton; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.WaveButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveButton /// public WaveButton L_WaveButton { @@ -266,26 +275,79 @@ } private WaveButton _L_WaveButton; - public HBoxContainer_1(MapEditorMapMark uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } - public override HBoxContainer_1 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + public WaveContainer(MapEditorMapMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override WaveContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer.HBoxContainer.MarkButton + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarginContainer.AddMarkButton /// - public class MarkButton : UiNode + public class AddMarkButton : UiNode { - public MarkButton(MapEditorMapMark uiPanel, Godot.Button node) : base(uiPanel, node) { } + public AddMarkButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override AddMarkButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarginContainer + /// + public class MarginContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.AddMarkButton + /// + public AddMarkButton L_AddMarkButton + { + get + { + if (_L_AddMarkButton == null) _L_AddMarkButton = new AddMarkButton(UiPanel, Instance.GetNodeOrNull("AddMarkButton")); + return _L_AddMarkButton; + } + } + private AddMarkButton _L_AddMarkButton; + + public MarginContainer(MapEditorMapMarkPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem.MarkButton.Select + /// + public class Select_1 : UiNode + { + public Select_1(MapEditorMapMarkPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override Select_1 Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem.MarkButton + /// + public class MarkButton : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem.Select + /// + public Select_1 L_Select + { + get + { + if (_L_Select == null) _L_Select = new Select_1(UiPanel, Instance.GetNodeOrNull("Select")); + return _L_Select; + } + } + private Select_1 _L_Select; + + public MarkButton(MapEditorMapMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override MarkButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer.HBoxContainer + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem /// - public class HBoxContainer_2 : UiNode + public class MarkItem : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer.MarkButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkButton /// public MarkButton L_MarkButton { @@ -297,49 +359,49 @@ } private MarkButton _L_MarkButton; - public HBoxContainer_2(MapEditorMapMark uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } - public override HBoxContainer_2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + public MarkItem(MapEditorMapMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override MarkItem Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer /// - public class MarginContainer : UiNode + public class MarkContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkItem /// - public HBoxContainer_2 L_HBoxContainer + public MarkItem L_MarkItem { get { - if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_2(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); - return _L_HBoxContainer; + if (_L_MarkItem == null) _L_MarkItem = new MarkItem(UiPanel, Instance.GetNodeOrNull("MarkItem")); + return _L_MarkItem; } } - private HBoxContainer_2 _L_HBoxContainer; + private MarkItem _L_MarkItem; - public MarginContainer(MapEditorMapMark uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } - public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + public MarkContainer(MapEditorMapMarkPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarkContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate + /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem /// - public class WaveTemplate : UiNode + public class WaveItem : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.HBoxContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveContainer /// - public HBoxContainer_1 L_HBoxContainer + public WaveContainer L_WaveContainer { get { - if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_1(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); - return _L_HBoxContainer; + if (_L_WaveContainer == null) _L_WaveContainer = new WaveContainer(UiPanel, Instance.GetNodeOrNull("WaveContainer")); + return _L_WaveContainer; } } - private HBoxContainer_1 _L_HBoxContainer; + private WaveContainer _L_WaveContainer; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.MarginContainer @@ -354,36 +416,62 @@ } private MarginContainer _L_MarginContainer; - public WaveTemplate(MapEditorMapMark uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } - public override WaveTemplate Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.MarkContainer + /// + public MarkContainer L_MarkContainer + { + get + { + if (_L_MarkContainer == null) _L_MarkContainer = new MarkContainer(UiPanel, Instance.GetNodeOrNull("MarkContainer")); + return _L_MarkContainer; + } + } + private MarkContainer _L_MarkContainer; + + public WaveItem(MapEditorMapMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override WaveItem Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer /// - public class VBoxContainer_1 : UiNode + public class VBoxContainer_1 : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.WaveTemplate + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.AddWaveButton /// - public WaveTemplate L_WaveTemplate + public AddWaveButton L_AddWaveButton { get { - if (_L_WaveTemplate == null) _L_WaveTemplate = new WaveTemplate(UiPanel, Instance.GetNodeOrNull("WaveTemplate")); - return _L_WaveTemplate; + if (_L_AddWaveButton == null) _L_AddWaveButton = new AddWaveButton(UiPanel, Instance.GetNodeOrNull("AddWaveButton")); + return _L_AddWaveButton; } } - private WaveTemplate _L_WaveTemplate; + private AddWaveButton _L_AddWaveButton; - public VBoxContainer_1(MapEditorMapMark uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.WaveItem + /// + public WaveItem L_WaveItem + { + get + { + if (_L_WaveItem == null) _L_WaveItem = new WaveItem(UiPanel, Instance.GetNodeOrNull("WaveItem")); + return _L_WaveItem; + } + } + private WaveItem _L_WaveItem; + + public VBoxContainer_1(MapEditorMapMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer_1 Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer.ScrollContainer /// - public class ScrollContainer : UiNode + public class ScrollContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.VBoxContainer @@ -398,14 +486,14 @@ } private VBoxContainer_1 _L_VBoxContainer; - public ScrollContainer(MapEditorMapMark uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public ScrollContainer(MapEditorMapMarkPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorMapMark.VBoxContainer /// - public class VBoxContainer : UiNode + public class VBoxContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapMark.MarkLabel @@ -472,7 +560,7 @@ } private ScrollContainer _L_ScrollContainer; - public VBoxContainer(MapEditorMapMark uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public VBoxContainer(MapEditorMapMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } @@ -503,24 +591,24 @@ public DeletePreinstall S_DeletePreinstall => L_VBoxContainer.L_HBoxContainer.L_DeletePreinstall; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.HBoxContainer + /// + public HBoxContainer S_HBoxContainer => L_VBoxContainer.L_HBoxContainer; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.MarkLabel2 /// public MarkLabel2 S_MarkLabel2 => L_VBoxContainer.L_MarkLabel2; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool.AddMark + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool.EditButton /// - public AddMark S_AddMark => L_VBoxContainer.L_DynamicTool.L_AddMark; + public EditButton S_EditButton => L_VBoxContainer.L_DynamicTool.L_EditButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool.EditMark + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool.DeleteButton /// - public EditMark S_EditMark => L_VBoxContainer.L_DynamicTool.L_EditMark; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool.DeleteMark - /// - public DeleteMark S_DeleteMark => L_VBoxContainer.L_DynamicTool.L_DeleteMark; + public DeleteButton S_DeleteButton => L_VBoxContainer.L_DynamicTool.L_DeleteButton; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.DynamicTool @@ -528,29 +616,54 @@ public DynamicTool S_DynamicTool => L_VBoxContainer.L_DynamicTool; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer.TextureButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.AddWaveButton /// - public TextureButton S_TextureButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveTemplate.L_HBoxContainer.L_TextureButton; + public AddWaveButton S_AddWaveButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_AddWaveButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.HBoxContainer.WaveButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.TextureButton /// - public WaveButton S_WaveButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveTemplate.L_HBoxContainer.L_WaveButton; + public TextureButton S_TextureButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_WaveContainer.L_TextureButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer.HBoxContainer.MarkButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer.WaveButton /// - public MarkButton S_MarkButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveTemplate.L_MarginContainer.L_HBoxContainer.L_MarkButton; + public WaveButton S_WaveButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_WaveContainer.L_WaveButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate.MarginContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.WaveContainer /// - public MarginContainer S_MarginContainer => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveTemplate.L_MarginContainer; + public WaveContainer S_WaveContainer => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_WaveContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveTemplate + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarginContainer.AddMarkButton /// - public WaveTemplate S_WaveTemplate => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveTemplate; + public AddMarkButton S_AddMarkButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_MarginContainer.L_AddMarkButton; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarginContainer + /// + public MarginContainer S_MarginContainer => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_MarginContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem.MarkButton + /// + public MarkButton S_MarkButton => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_MarkContainer.L_MarkItem.L_MarkButton; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer.MarkItem + /// + public MarkItem S_MarkItem => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_MarkContainer.L_MarkItem; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem.MarkContainer + /// + public MarkContainer S_MarkContainer => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem.L_MarkContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer.VBoxContainer.WaveItem + /// + public WaveItem S_WaveItem => L_VBoxContainer.L_ScrollContainer.L_VBoxContainer.L_WaveItem; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapMark.VBoxContainer.ScrollContainer diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index acda11a..a00efa2 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -1,19 +1,56 @@ using Godot; +using UI.MapEditor; namespace UI.MapEditorMapMark; public partial class MapEditorMapMarkPanel : MapEditorMapMark { - - private UiGrid _grid; + public enum SelectToolType + { + None, + Wave, + Mark + } + /// + /// 选中的cell选项 + /// + public IUiCell SelectCell { get; private set; } + + /// + /// Cell 上的工具类型 + /// + public SelectToolType ToolType { get; private set; } = SelectToolType.None; + + /// + /// 编辑器Tile对象 + /// + public EditorTileMap EditorTileMap { get; private set; } + + private UiGrid _grid; + public override void OnCreateUi() { - _grid = new UiGrid(S_WaveTemplate, typeof(EditorMarkWaveCell)); + var editorPanel = (MapEditorPanel)ParentUi; + EditorTileMap = editorPanel.S_TileMap.Instance; + + S_DynamicTool.Instance.GetParent().RemoveChild(S_DynamicTool.Instance); + S_DynamicTool.Instance.Visible = true; + + _grid = new UiGrid(S_WaveItem, typeof(EditorWaveCell)); _grid.SetCellOffset(new Vector2I(0, 10)); _grid.SetColumns(1); - _grid.SetDataList(new object[] { 1, 2, 3, 4}); + //_grid.SetDataList(new object[] { 1, 2, 3, 4}); + S_AddPreinstall.Instance.Pressed += OnAddPreinstall; + S_AddWaveButton.Instance.Pressed += OnAddWave; + + //S_Test.Instance. + } + + public override void OnShowUi() + { + RefreshPreinstallSelect(); } public override void OnDestroyUi() @@ -21,4 +58,139 @@ _grid.Destroy(); } + /// + /// 刷新预设下拉框 + /// + public void RefreshPreinstallSelect(int index = -1) + { + var preinstall = EditorTileMap.RoomSplit.Preinstall; + var optionButton = S_PreinstallOption.Instance; + var selectIndex = index < 0 ? optionButton.Selected : index; + optionButton.Clear(); + foreach (var item in preinstall) + { + optionButton.AddItem($"{item.Name} ({item.Weight})"); + } + + optionButton.Selected = selectIndex; + } + + /// + /// 选中 cell, 并设置显示的工具 + /// + /// 选中 cell 对象 + /// 按钮工具绑定的父节点 + /// 选择工具类型 + public void SetSelectCell(IUiCell uiCell, Node toolRoot, SelectToolType toolType) + { + if (SelectCell == uiCell) + { + return; + } + + if (uiCell == null) + { + RemoveSelectCell(); + return; + } + + var parent = S_DynamicTool.Instance.GetParent(); + if (parent != null) + { + parent.RemoveChild(S_DynamicTool.Instance); + } + + toolRoot.AddChild(S_DynamicTool.Instance); + if (SelectCell != null) + { + SelectCell.OnUnSelect(); + } + SelectCell = uiCell; + ToolType = toolType; + SelectCell.OnSelect(); + } + + /// + /// 移除选中的 cell 对象 + /// + public void RemoveSelectCell() + { + if (SelectCell == null) + { + return; + } + var parent = S_DynamicTool.Instance.GetParent(); + if (parent != null) + { + parent.RemoveChild(S_DynamicTool.Instance); + } + SelectCell.OnUnSelect(); + SelectCell = null; + } + + /// + /// 创建预设 + /// + public void OnAddPreinstall() + { + var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; + EditorWindowManager.ShowCreatePreinstall(roomSplitPreinstall, preinstall => + { + roomSplitPreinstall.Add(preinstall); + RefreshPreinstallSelect(roomSplitPreinstall.Count - 1); + }); + } + + /// + /// 添加波数 + /// + public void OnAddWave() + { + if (S_PreinstallOption.Instance.Selected == -1) + { + EditorWindowManager.ShowTips("警告", "请先选择预设!"); + return; + } + } + + /// + /// 编辑波数据 + /// + public void OnEditWave() + { + + } + + + /// + /// 删除波数据 + /// + public void OnDeleteWave() + { + + } + + /// + /// 添加标记 + /// + public void OnAddMark() + { + + } + + /// + /// 编辑标记数据 + /// + public void OnEditMark() + { + + } + + /// + /// 删除标记数据 + /// + public void OnDeleteMark() + { + + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs index 030eff2..823ed06 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs @@ -12,7 +12,7 @@ { get { - if (_L_Bg == null) _L_Bg = new Bg(this, GetNodeOrNull("Bg")); + if (_L_Bg == null) _L_Bg = new Bg((MapEditorProjectPanel)this, GetNodeOrNull("Bg")); return _L_Bg; } } @@ -30,16 +30,16 @@ /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Head.Back /// - public class Back : UiNode + public class Back : UiNode { - public Back(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public Back(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override Back Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Head /// - public class Head : UiNode + public class Head : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Back @@ -54,41 +54,41 @@ } private Back _L_Back; - public Head(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public Head(MapEditorProjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Head Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.HBoxContainer.GroupSearchInput /// - public class GroupSearchInput : UiNode + public class GroupSearchInput : UiNode { - public GroupSearchInput(MapEditorProject uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } + public GroupSearchInput(MapEditorProjectPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } public override GroupSearchInput Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.HBoxContainer.GroupSearchButton /// - public class GroupSearchButton : UiNode + public class GroupSearchButton : UiNode { - public GroupSearchButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public GroupSearchButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override GroupSearchButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.HBoxContainer.GroupAddButton /// - public class GroupAddButton : UiNode + public class GroupAddButton : UiNode { - public GroupAddButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public GroupAddButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override GroupAddButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.HBoxContainer /// - public class HBoxContainer_1 : UiNode + public class HBoxContainer_1 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.GroupSearchInput @@ -129,23 +129,23 @@ } private GroupAddButton _L_GroupAddButton; - public HBoxContainer_1(MapEditorProject uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public HBoxContainer_1(MapEditorProjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override HBoxContainer_1 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.GroupButton /// - public class GroupButton : UiNode + public class GroupButton : UiNode { - public GroupButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public GroupButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override GroupButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer /// - public class ScrollContainer : UiNode + public class ScrollContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.GroupButton @@ -160,14 +160,14 @@ } private GroupButton _L_GroupButton; - public ScrollContainer(MapEditorProject uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public ScrollContainer(MapEditorProjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer /// - public class VBoxContainer_1 : UiNode + public class VBoxContainer_1 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.HBoxContainer @@ -195,14 +195,14 @@ } private ScrollContainer _L_ScrollContainer; - public VBoxContainer_1(MapEditorProject uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public VBoxContainer_1(MapEditorProjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer_1 Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer /// - public class MarginContainer : UiNode + public class MarginContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.VBoxContainer @@ -217,14 +217,14 @@ } private VBoxContainer_1 _L_VBoxContainer; - public MarginContainer(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public MarginContainer(MapEditorProjectPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel /// - public class Panel : UiNode + public class Panel : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.MarginContainer @@ -239,50 +239,50 @@ } private MarginContainer _L_MarginContainer; - public Panel(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public Panel(MapEditorProjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomSearchInput /// - public class RoomSearchInput : UiNode + public class RoomSearchInput : UiNode { - public RoomSearchInput(MapEditorProject uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } + public RoomSearchInput(MapEditorProjectPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } public override RoomSearchInput Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomTypeButton /// - public class RoomTypeButton : UiNode + public class RoomTypeButton : UiNode { - public RoomTypeButton(MapEditorProject uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } + public RoomTypeButton(MapEditorProjectPanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } public override RoomTypeButton Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomSearchButton /// - public class RoomSearchButton : UiNode + public class RoomSearchButton : UiNode { - public RoomSearchButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public RoomSearchButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override RoomSearchButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomAddButton /// - public class RoomAddButton : UiNode + public class RoomAddButton : UiNode { - public RoomAddButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public RoomAddButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override RoomAddButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer /// - public class HBoxContainer_2 : UiNode + public class HBoxContainer_2 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.RoomSearchInput @@ -336,41 +336,41 @@ } private RoomAddButton _L_RoomAddButton; - public HBoxContainer_2(MapEditorProject uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public HBoxContainer_2(MapEditorProjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override HBoxContainer_2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton.PreviewImage /// - public class PreviewImage : UiNode + public class PreviewImage : UiNode { - public PreviewImage(MapEditorProject uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public PreviewImage(MapEditorProjectPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } public override PreviewImage Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton.RoomName /// - public class RoomName : UiNode + public class RoomName : UiNode { - public RoomName(MapEditorProject uiPanel, Godot.Label node) : base(uiPanel, node) { } + public RoomName(MapEditorProjectPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } public override RoomName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton.RoomType /// - public class RoomType : UiNode + public class RoomType : UiNode { - public RoomType(MapEditorProject uiPanel, Godot.Label node) : base(uiPanel, node) { } + public RoomType(MapEditorProjectPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } public override RoomType Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton /// - public class RoomButton : UiNode + public class RoomButton : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.PreviewImage @@ -411,14 +411,14 @@ } private RoomType _L_RoomType; - public RoomButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public RoomButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override RoomButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer /// - public class ScrollContainer_1 : UiNode + public class ScrollContainer_1 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.RoomButton @@ -433,14 +433,14 @@ } private RoomButton _L_RoomButton; - public ScrollContainer_1(MapEditorProject uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public ScrollContainer_1(MapEditorProjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } public override ScrollContainer_1 Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer /// - public class VBoxContainer_2 : UiNode + public class VBoxContainer_2 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.HBoxContainer @@ -468,14 +468,14 @@ } private ScrollContainer_1 _L_ScrollContainer; - public VBoxContainer_2(MapEditorProject uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public VBoxContainer_2(MapEditorProjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer_2 Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer /// - public class MarginContainer_1 : UiNode + public class MarginContainer_1 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.VBoxContainer @@ -490,14 +490,14 @@ } private VBoxContainer_2 _L_VBoxContainer; - public MarginContainer_1(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public MarginContainer_1(MapEditorProjectPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2 /// - public class Panel2 : UiNode + public class Panel2 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.MarginContainer @@ -512,14 +512,14 @@ } private MarginContainer_1 _L_MarginContainer; - public Panel2(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public Panel2(MapEditorProjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Panel2 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer /// - public class HBoxContainer : UiNode + public class HBoxContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Panel @@ -547,14 +547,14 @@ } private Panel2 _L_Panel2; - public HBoxContainer(MapEditorProject uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public HBoxContainer(MapEditorProjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer /// - public class VBoxContainer : UiNode + public class VBoxContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.Head @@ -582,14 +582,14 @@ } private HBoxContainer _L_HBoxContainer; - public VBoxContainer(MapEditorProject uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public VBoxContainer(MapEditorProjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg /// - public class Bg : UiNode + public class Bg : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.VBoxContainer @@ -604,7 +604,7 @@ } private VBoxContainer _L_VBoxContainer; - public Bg(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public Bg(MapEditorProjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Bg Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs index a6e4307..95ca976 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs @@ -41,14 +41,15 @@ _roomGrid.SetAutoColumns(true); _roomGrid.SetCellOffset(new Vector2I(10, 10)); _roomGrid.SetHorizontalExpand(true); - } - - public override void OnShowUi() - { + S_GroupSearchButton.Instance.Pressed += OnSearchGroupButtonClick; S_RoomSearchButton.Instance.Pressed += OnSearchRoomButtonClick; S_RoomAddButton.Instance.Pressed += OnCreateRoomClick; S_GroupAddButton.Instance.Pressed += OnCreateGroupClick; + } + + public override void OnShowUi() + { RefreshGroup(); _eventFactory = EventManager.CreateEventFactory(); _eventFactory.AddEventListener(EventEnum.OnCreateGroupFinish, OnCreateGroupFinish); @@ -57,10 +58,6 @@ public override void OnHideUi() { - S_GroupSearchButton.Instance.Pressed -= OnSearchGroupButtonClick; - S_RoomSearchButton.Instance.Pressed -= OnSearchRoomButtonClick; - S_RoomAddButton.Instance.Pressed -= OnCreateRoomClick; - S_GroupAddButton.Instance.Pressed -= OnCreateGroupClick; _eventFactory.RemoveAllEventListener(); } @@ -97,11 +94,13 @@ public void SelectRoom(DungeonRoomSplit room) { HideUi(); - //打开地牢Ui - var mapEditor = UiManager.Open_MapEditor(); + //创建地牢Ui + var mapEditor = UiManager.Create_MapEditor(); mapEditor.PrevUi = this; //加载地牢 mapEditor.LoadMap(room); + //打开Ui + mapEditor.ShowUi(); } //搜索组按钮点击 @@ -168,57 +167,14 @@ //创建组按钮点击 private void OnCreateGroupClick() { - var window = UiManager.Open_EditorWindow(); - window.SetWindowTitle("创建地牢组"); - window.SetWindowSize(new Vector2I(700, 500)); - var body = window.OpenBody(UiManager.UiName.MapEditorCreateGroup); - window.SetButtonList( - new EditorWindowPanel.ButtonData("确定", () => - { - //获取填写的数据, 并创建ui - var groupInfo = body.GetGroupInfo(); - if (groupInfo != null) - { - window.CloseWindow(); - CreateGroup(groupInfo); - } - }), - new EditorWindowPanel.ButtonData("取消", () => - { - window.CloseWindow(); - }) - ); + EditorWindowManager.ShowCreateGroup(CreateGroup); } //创建地牢房间按钮点击 private void OnCreateRoomClick() { - var window = UiManager.Open_EditorWindow(); - window.SetWindowTitle("创建地牢房间"); - window.SetWindowSize(new Vector2I(700, 600)); - var body = window.OpenBody(UiManager.UiName.MapEditorCreateRoom); - if (SelectGroupInfo != null) - { - body.SetSelectGroup(SelectGroupInfo.GroupName); - } - body.SetSelectType(Mathf.Max(S_RoomTypeButton.Instance.Selected - 1, 0)); - - window.SetButtonList( - new EditorWindowPanel.ButtonData("确定", () => - { - //获取填写的数据, 并创建ui - var roomSplit = body.GetRoomInfo(); - if (roomSplit != null) - { - window.CloseWindow(); - CreateRoom(roomSplit); - } - }), - new EditorWindowPanel.ButtonData("取消", () => - { - window.CloseWindow(); - }) - ); + var groupName = SelectGroupInfo != null ? SelectGroupInfo.GroupName : null; + EditorWindowManager.ShowCreateRoom(groupName, Mathf.Max(S_RoomTypeButton.Instance.Selected - 1, 0), CreateRoom); } //创建地牢组 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs index c279ded..8fdb45e 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs @@ -30,7 +30,7 @@ if (_focus) { //打开房间编辑器 - ((MapEditorProjectPanel)CellNode.UiPanel).SelectRoom(Data); + CellNode.UiPanel.SelectRoom(Data); CellNode.Instance.ReleaseFocus(); } else diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index 6a54fae..58b7196 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -72,11 +72,6 @@ _toolGrid.SelectIndex = 1; } - public override void OnShowUi() - { - EventManager.EmitEvent(EventEnum.OnClickCenterTool); - } - public override void OnDestroyUi() { S_DoorToolTemplate.Instance.QueueFree();