diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn index 7655510..46a135f 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -1,8 +1,10 @@ -[gd_scene load_steps=12 format=3 uid="uid://csbxfkdupsckv"] +[gd_scene load_steps=14 format=3 uid="uid://csbxfkdupsckv"] [ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"] [ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"] [ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileSet/TileSet1.tres" id="2_vrg60"] +[ext_resource type="Texture2D" uid="uid://cat35d7ueu7gu" path="res://resource/sprite/ui/commonIcon/Save.png" id="3_qq8k4"] +[ext_resource type="Texture2D" uid="uid://7l7aqhsaexoh" path="res://resource/sprite/ui/commonIcon/Play.png" id="4_2imnr"] [ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/mapEditor/ErrorCell.png" id="4_465u2"] [ext_resource type="Script" path="res://src/game/ui/mapEditor/tileView/EditorTileMap.cs" id="4_mhy1a"] [ext_resource type="PackedScene" uid="uid://b4u66mxndxbrg" path="res://prefab/ui/MapEditorTools.tscn" id="6_7pvgu"] @@ -106,10 +108,45 @@ offset_top = 2.0 offset_right = 62.0 offset_bottom = 68.0 +grow_vertical = 2 size_flags_horizontal = 0 icon = ExtResource("2_gkcw7") icon_alignment = 1 +[node name="Save" type="Button" parent="Bg/VBoxContainer/Head"] +layout_mode = 2 +offset_left = 64.0 +offset_top = 2.0 +offset_right = 124.0 +offset_bottom = 68.0 +grow_vertical = 2 +size_flags_horizontal = 0 +icon = ExtResource("3_qq8k4") +icon_alignment = 1 + +[node name="Title" type="Label" parent="Bg/VBoxContainer/Head"] +layout_mode = 0 +offset_left = 136.0 +offset_top = 2.0 +offset_right = 272.0 +offset_bottom = 68.0 +text = "正在编辑" +vertical_alignment = 1 + +[node name="Play" type="Button" parent="Bg/VBoxContainer/Head"] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = -30.0 +offset_top = 2.0 +offset_right = 30.0 +offset_bottom = 68.0 +grow_horizontal = 2 +size_flags_horizontal = 0 +icon = ExtResource("4_2imnr") +icon_alignment = 1 + [node name="HSplitContainer" type="HSplitContainer" parent="Bg/VBoxContainer"] layout_mode = 2 size_flags_vertical = 3 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn index 2768b3b..a90e76d 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreatePreinstall.tscn @@ -7,6 +7,8 @@ anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 script = ExtResource("1_um8jr") [node name="MarginContainer" type="MarginContainer" parent="."] diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn index 4d910c6..b39b3e1 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn @@ -5,9 +5,9 @@ [ext_resource type="Texture2D" uid="uid://dggb6p4sdmfry" path="res://resource/sprite/ui/commonIcon/Edit.png" id="3_wwaki"] [ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="4_urq7y"] [ext_resource type="Texture2D" uid="uid://d4gduco55dqpk" path="res://resource/sprite/ui/commonIcon/Down.png" id="5_x5dpw"] -[ext_resource type="Texture2D" uid="uid://dxpdjj1abmejh" path="res://resource/sprite/ui/commonIcon/DoorTool.png" id="6_he4th"] +[ext_resource type="Texture2D" uid="uid://cgtmjuiks7mot" path="res://resource/sprite/ui/commonIcon/WaveCell.png" id="6_eod5i"] [ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="6_jpt3y"] -[ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="7_jnnw0"] +[ext_resource type="Texture2D" uid="uid://bylf0kxccwgdw" path="res://resource/sprite/ui/commonIcon/MarkCell.png" id="8_xyhe6"] [node name="MapEditorMapMark" type="Control"] layout_mode = 3 @@ -95,7 +95,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "第1波" -icon = ExtResource("6_he4th") +icon = ExtResource("6_eod5i") alignment = 0 [node name="Select" type="NinePatchRect" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveItem/WaveContainer/WaveButton"] @@ -132,7 +132,7 @@ layout_mode = 2 size_flags_horizontal = 3 text = "1001" -icon = ExtResource("7_jnnw0") +icon = ExtResource("8_xyhe6") alignment = 0 text_overrun_behavior = 3 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 index 57c5d2c..9ce9005 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-30,"Y":-36},"Size":{"X":50,"Y":50},"Preloading":false,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0007","CurrAmmon":"60","ResidueAmmo":"50"}}]}]]},{"Name":"test2","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":5,"Y":-51},"Size":{"X":61,"Y":31},"Preloading":true,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0001","CurrAmmon":"30","ResidueAmmo":"30"}}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-30,"Y":-36},"Size":{"X":50,"Y":50},"Preloading":false,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0007","CurrAmmon":"60","ResidueAmmo":"50"}}]}]]},{"Name":"test2","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":5,"Y":-51},"Size":{"X":61,"Y":31},"Preloading":true,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0001","CurrAmmon":"30","ResidueAmmo":"30"}}]}]]},{"Name":"test3","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-36,"Y":-41},"Size":{"X":30,"Y":60},"Preloading":false,"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"}}]},{"Position":{"X":98,"Y":8},"Size":{"X":30,"Y":90},"Preloading":false,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0001","CurrAmmon":"30","ResidueAmmo":"50"}}]}],[{"Position":{"X":35,"Y":24},"Size":{"X":54,"Y":44},"Preloading":false,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Weapon":"weapon0007","CurrAmmon":"60","ResidueAmmo":"50"}}]}]]}] \ 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 e093afa..a3b6b99 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":-6,"Y":-6},"Size":{"X":15,"Y":15},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":128},{"Direction":0,"Start":0,"End":144},{"Direction":2,"Start":96,"End":208},{"Direction":1,"Start":0,"End":144}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":-6,"Y":-11},"Size":{"X":15,"Y":20},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":192},{"Direction":0,"Start":96,"End":224},{"Direction":2,"Start":96,"End":208},{"Direction":1,"Start":80,"End":224}],"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 e4e7b41..4bea290 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":[-72,-72,40,-72,40,-8,104,-8,104,-72,120,-72,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,64,-72,64]}],"Floor":[-5,-5,0,0,8,-5,-4,0,0,8,-5,-3,0,0,8,-5,-2,0,0,8,-5,-1,0,0,8,-5,0,0,0,8,-5,1,0,0,8,-5,2,0,0,8,-5,3,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,-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,-2,-5,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,0,2,7,2,5,0,3,7,3,-2,0,1,7,4,-2,0,2,7,5,-2,0,3,7,5,5,0,1,7,6,-6,0,2,7,6,5,0,2,7,7,-6,0,2,7,7,5,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,0,5,0,3,4,0,6,0,3,3,0,7,0,3,3,0,8,0,11,2,1,4,0,2,2,1,8,0,2,2,2,4,0,3,2,2,8,0,2,2,3,-6,0,1,4,3,-5,0,1,3,3,-4,0,1,3,3,-3,0,1,3,3,8,0,2,2,4,8,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,1,2,5,8,0,2,2,6,4,0,2,2,6,8,0,2,2,7,4,0,2,2,7,8,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,8,5,0,1,4,8,6,0,1,3,8,7,0,1,3,8,8,0,13,2]} \ No newline at end of file +{"NavigationList":[{"Type":0,"Points":[-72,-152,104,-152,104,-96,56,-96,56,-80,40,-80,40,-8,104,-8,104,-56,120,-56,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,64,-72,64]}],"Floor":[7,3,0,0,8,7,2,0,0,8,7,1,0,0,8,7,0,0,0,8,7,-1,0,0,8,7,-2,0,0,8,7,-3,0,0,8,7,-4,0,0,8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7,0,3,3,-6,-6,0,3,3,-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,0,5,0,3,4,0,6,0,3,3,0,7,0,3,3,0,8,0,11,2,1,4,0,2,2,1,8,0,2,2,2,4,0,3,2,2,8,0,2,2,3,-5,0,1,2,3,-4,0,1,3,3,-3,0,1,3,3,8,0,2,2,4,-6,0,1,2,4,-5,0,13,2,4,8,0,2,2,5,-6,0,2,2,5,-5,0,3,4,5,-4,0,3,3,5,-3,0,3,3,5,4,0,1,2,5,8,0,2,2,6,-6,0,2,2,6,4,0,2,2,6,8,0,2,2,7,-11,0,1,4,7,-10,0,1,3,7,-9,0,1,3,7,-8,0,1,3,7,-7,0,1,3,7,-6,0,13,2,7,4,0,2,2,7,8,0,2,2,8,-5,0,1,4,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,8,5,0,1,4,8,6,0,1,3,8,7,0,1,3,8,8,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png new file mode 100644 index 0000000..659e915 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png.import new file mode 100644 index 0000000..fc492df --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/MarkCell.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bylf0kxccwgdw" +path="res://.godot/imported/MarkCell.png-ab0d15ace59a4d983e80be2394fc73d8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/MarkCell.png" +dest_files=["res://.godot/imported/MarkCell.png-ab0d15ace59a4d983e80be2394fc73d8.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png new file mode 100644 index 0000000..4d38dcb --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png.import new file mode 100644 index 0000000..f1e5720 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Play.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://7l7aqhsaexoh" +path="res://.godot/imported/Play.png-c41306005c6cbbe7b8ce33cef0264a2e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Play.png" +dest_files=["res://.godot/imported/Play.png-c41306005c6cbbe7b8ce33cef0264a2e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png new file mode 100644 index 0000000..aa66dc9 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png.import new file mode 100644 index 0000000..52dac1a --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Save.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cat35d7ueu7gu" +path="res://.godot/imported/Save.png-7a9e9cb711135f7b76ecf0a63087d524.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Save.png" +dest_files=["res://.godot/imported/Save.png-7a9e9cb711135f7b76ecf0a63087d524.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png new file mode 100644 index 0000000..514f045 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png.import new file mode 100644 index 0000000..f7b4f36 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/WaveCell.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cgtmjuiks7mot" +path="res://.godot/imported/WaveCell.png-9b14701b6e40a6505bb357db2699b41e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/WaveCell.png" +dest_files=["res://.godot/imported/WaveCell.png-9b14701b6e40a6505bb357db2699b41e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index e9ab17e..b034a25 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -46,7 +46,6 @@ [node name="SceneRoot" type="Node2D" parent="ViewCanvas/SubViewportContainer/SubViewport"] [node name="Camera2D" type="Camera2D" parent="ViewCanvas/SubViewportContainer/SubViewport"] -position = Vector2(253, 219) process_callback = 0 limit_smoothed = true editor_draw_drag_margin = true diff --git a/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs index a46fc8d..905d447 100644 --- a/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs +++ b/DungeonShooting_Godot/src/framework/map/data/RoomPreinstall.cs @@ -30,4 +30,15 @@ /// [JsonInclude] public List> WaveList; + + /// + /// 从指定对象浅拷贝数据 + /// + public void CloneFrom(RoomPreinstall preinstall) + { + Name = preinstall.Name; + Weight = preinstall.Weight; + Remark = preinstall.Remark; + WaveList = preinstall.WaveList; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs index 0fae09b..f59d2f6 100644 --- a/DungeonShooting_Godot/src/game/event/EventEnum.cs +++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs @@ -94,7 +94,7 @@ /// OnClickCenterTool, /// - /// 选中预设, , 参数 + /// 选中预设, 参数 /// OnSelectPreinstall, /// diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index f6791e1..b28e4dd 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -162,6 +162,36 @@ } /// + /// 打开编辑房间预设弹窗 + /// + /// 当前房间已经包含的所有预设列表 + /// 需要编辑的预设数据 + /// 保存时的回调 + public static void ShowEditPreinstall(List list, RoomPreinstall preinstall, Action onSavePreinstall) + { + var window = UiManager.Open_EditorWindow(); + window.SetWindowTitle("创建房间预设"); + window.SetWindowSize(new Vector2I(700, 600)); + var body = window.OpenBody(UiManager.UiName.MapEditorCreatePreinstall); + body.InitData(preinstall); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + var roomPreinstall = body.GetRoomPreinstall(list); + if (roomPreinstall != null) + { + window.CloseWindow(); + onSavePreinstall(roomPreinstall); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + } + + /// /// 打开创建标记页面 /// /// 创建标记回调 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs index a636f84..6ff2ac1 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs @@ -12,7 +12,7 @@ { get { - if (_L_Bg == null) _L_Bg = new Bg((MapEditorPanel)this, GetNodeOrNull("Bg")); + if (_L_Bg == null) _L_Bg = new Bg((MapEditorPanel)this, GetNode("Bg")); return _L_Bg; } } @@ -53,6 +53,33 @@ } /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head.Save + /// + public class Save : UiNode + { + public Save(MapEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Save Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head.Title + /// + public class Title : UiNode + { + public Title(MapEditorPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Title Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head.Play + /// + public class Play : UiNode + { + public Play(MapEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Play Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head /// public class Head : UiNode @@ -64,12 +91,51 @@ { get { - if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNodeOrNull("Back")); + if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNode("Back")); return _L_Back; } } private Back _L_Back; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Save + /// + public Save L_Save + { + get + { + if (_L_Save == null) _L_Save = new Save(UiPanel, Instance.GetNode("Save")); + return _L_Save; + } + } + private Save _L_Save; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Title + /// + public Title L_Title + { + get + { + if (_L_Title == null) _L_Title = new Title(UiPanel, Instance.GetNode("Title")); + return _L_Title; + } + } + private Title _L_Title; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Play + /// + public Play L_Play + { + get + { + if (_L_Play == null) _L_Play = new Play(UiPanel, Instance.GetNode("Play")); + return _L_Play; + } + } + private Play _L_Play; + public Head(MapEditorPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Head Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } @@ -95,7 +161,7 @@ { get { - if (_L_ErrorCellAnimationPlayer == null) _L_ErrorCellAnimationPlayer = new ErrorCellAnimationPlayer(UiPanel, Instance.GetNodeOrNull("ErrorCellAnimationPlayer")); + if (_L_ErrorCellAnimationPlayer == null) _L_ErrorCellAnimationPlayer = new ErrorCellAnimationPlayer(UiPanel, Instance.GetNode("ErrorCellAnimationPlayer")); return _L_ErrorCellAnimationPlayer; } } @@ -126,7 +192,7 @@ { get { - if (_L_ErrorCell == null) _L_ErrorCell = new ErrorCell(UiPanel, Instance.GetNodeOrNull("ErrorCell")); + if (_L_ErrorCell == null) _L_ErrorCell = new ErrorCell(UiPanel, Instance.GetNode("ErrorCell")); return _L_ErrorCell; } } @@ -139,7 +205,7 @@ { get { - if (_L_Brush == null) _L_Brush = new Brush(UiPanel, Instance.GetNodeOrNull("Brush")); + if (_L_Brush == null) _L_Brush = new Brush(UiPanel, Instance.GetNode("Brush")); return _L_Brush; } } @@ -177,7 +243,7 @@ { get { - if (_L_MapEditorTools == null) _L_MapEditorTools = new MapEditorTools(UiPanel, Instance.GetNodeOrNull("MapEditorTools")); + if (_L_MapEditorTools == null) _L_MapEditorTools = new MapEditorTools(UiPanel, Instance.GetNode("MapEditorTools")); return _L_MapEditorTools; } } @@ -199,7 +265,7 @@ { get { - if (_L_TileMap == null) _L_TileMap = new TileMap(UiPanel, Instance.GetNodeOrNull("TileMap")); + if (_L_TileMap == null) _L_TileMap = new TileMap(UiPanel, Instance.GetNode("TileMap")); return _L_TileMap; } } @@ -212,7 +278,7 @@ { get { - if (_L_CanvasLayer == null) _L_CanvasLayer = new CanvasLayer(UiPanel, Instance.GetNodeOrNull("CanvasLayer")); + if (_L_CanvasLayer == null) _L_CanvasLayer = new CanvasLayer(UiPanel, Instance.GetNode("CanvasLayer")); return _L_CanvasLayer; } } @@ -234,7 +300,7 @@ { get { - if (_L_SubViewport == null) _L_SubViewport = new SubViewport(UiPanel, Instance.GetNodeOrNull("SubViewport")); + if (_L_SubViewport == null) _L_SubViewport = new SubViewport(UiPanel, Instance.GetNode("SubViewport")); return _L_SubViewport; } } @@ -256,7 +322,7 @@ { get { - if (_L_MapView == null) _L_MapView = new MapView(UiPanel, Instance.GetNodeOrNull("MapView")); + if (_L_MapView == null) _L_MapView = new MapView(UiPanel, Instance.GetNode("MapView")); return _L_MapView; } } @@ -278,7 +344,7 @@ { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNode("MarginContainer")); return _L_MarginContainer; } } @@ -316,7 +382,7 @@ { get { - if (_L_MapEditorMapLayer == null) _L_MapEditorMapLayer = new MapEditorMapLayer(UiPanel, Instance.GetNodeOrNull("MapEditorMapLayer")); + if (_L_MapEditorMapLayer == null) _L_MapEditorMapLayer = new MapEditorMapLayer(UiPanel, Instance.GetNode("MapEditorMapLayer")); return _L_MapEditorMapLayer; } } @@ -354,7 +420,7 @@ { get { - if (_L_MapEditorMapMark == null) _L_MapEditorMapMark = new MapEditorMapMark(UiPanel, Instance.GetNodeOrNull("MapEditorMapMark")); + if (_L_MapEditorMapMark == null) _L_MapEditorMapMark = new MapEditorMapMark(UiPanel, Instance.GetNode("MapEditorMapMark")); return _L_MapEditorMapMark; } } @@ -376,7 +442,7 @@ { get { - if (_L_MapLayer == null) _L_MapLayer = new MapLayer(UiPanel, Instance.GetNodeOrNull("MapLayer")); + if (_L_MapLayer == null) _L_MapLayer = new MapLayer(UiPanel, Instance.GetNode("MapLayer")); return _L_MapLayer; } } @@ -389,7 +455,7 @@ { get { - if (_L_MapMark == null) _L_MapMark = new MapMark(UiPanel, Instance.GetNodeOrNull("MapMark")); + if (_L_MapMark == null) _L_MapMark = new MapMark(UiPanel, Instance.GetNode("MapMark")); return _L_MapMark; } } @@ -411,7 +477,7 @@ { get { - if (_L_TabContainer == null) _L_TabContainer = new TabContainer(UiPanel, Instance.GetNodeOrNull("TabContainer")); + if (_L_TabContainer == null) _L_TabContainer = new TabContainer(UiPanel, Instance.GetNode("TabContainer")); return _L_TabContainer; } } @@ -433,7 +499,7 @@ { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNode("MarginContainer")); return _L_MarginContainer; } } @@ -455,7 +521,7 @@ { get { - if (_L_Left == null) _L_Left = new Left(UiPanel, Instance.GetNodeOrNull("Left")); + if (_L_Left == null) _L_Left = new Left(UiPanel, Instance.GetNode("Left")); return _L_Left; } } @@ -468,7 +534,7 @@ { get { - if (_L_Right == null) _L_Right = new Right(UiPanel, Instance.GetNodeOrNull("Right")); + if (_L_Right == null) _L_Right = new Right(UiPanel, Instance.GetNode("Right")); return _L_Right; } } @@ -490,7 +556,7 @@ { get { - if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNodeOrNull("Head")); + if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNode("Head")); return _L_Head; } } @@ -503,7 +569,7 @@ { get { - if (_L_HSplitContainer == null) _L_HSplitContainer = new HSplitContainer(UiPanel, Instance.GetNodeOrNull("HSplitContainer")); + if (_L_HSplitContainer == null) _L_HSplitContainer = new HSplitContainer(UiPanel, Instance.GetNode("HSplitContainer")); return _L_HSplitContainer; } } @@ -525,7 +591,7 @@ { get { - if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNodeOrNull("VBoxContainer")); + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNode("VBoxContainer")); return _L_VBoxContainer; } } @@ -542,6 +608,21 @@ public Back S_Back => L_Bg.L_VBoxContainer.L_Head.L_Back; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head.Save + /// + public Save S_Save => L_Bg.L_VBoxContainer.L_Head.L_Save; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head.Title + /// + public Title S_Title => L_Bg.L_VBoxContainer.L_Head.L_Title; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head.Play + /// + public Play S_Play => L_Bg.L_VBoxContainer.L_Head.L_Play; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head /// public Head S_Head => L_Bg.L_VBoxContainer.L_Head; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs index 5e3b5d6..58a3808 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -5,28 +5,28 @@ public partial class MapEditorPanel : MapEditor { private EditorTileMapBar _editorTileMapBar; + private string _title; + public override void OnCreateUi() { S_TabContainer.Instance.SetTabTitle(0, "地图"); S_TabContainer.Instance.SetTabTitle(1, "对象"); //S_MapLayer.Instance.Init(S_MapLayer); + S_Left.Instance.Resized += OnMapViewResized; + S_Back.Instance.Pressed += OnBackClick; + S_Save.Instance.Pressed += OnSave; _editorTileMapBar = new EditorTileMapBar(this, S_TileMap); } public override void OnShowUi() { - S_Left.Instance.Resized += OnMapViewResized; - S_Back.Instance.Pressed += OnBackClick; OnMapViewResized(); - _editorTileMapBar.OnShow(); } public override void OnHideUi() { - S_Left.Instance.Resized -= OnMapViewResized; - S_Back.Instance.Pressed -= OnBackClick; _editorTileMapBar.OnHide(); } @@ -41,10 +41,20 @@ } /// + /// 保存地图数据 + /// + public void OnSave() + { + S_TileMap.Instance.TriggerSave(); + } + + /// /// 加载地牢, 返回是否加载成功 /// public bool LoadMap(DungeonRoomSplit roomSplit) { + _title = "正在编辑:" + roomSplit.RoomInfo.RoomName; + S_Title.Instance.Text = _title; return S_TileMap.Instance.Load(roomSplit); } @@ -56,7 +66,13 @@ private void OnBackClick() { - //返回上一个Ui - OpenPrevUi(); + EditorWindowManager.ShowConfirm("提示", "是否退出编辑房间?", v => + { + if (v) + { + //返回上一个Ui + OpenPrevUi(); + } + }); } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index 6175254..abc86a4 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -400,14 +400,6 @@ } } } - else if (@event is InputEventKey eventKey) - { - if (eventKey.Pressed && eventKey.Keycode == Key.M) - { - GD.Print("保存地牢房间数据..."); - TriggerSave(); - } - } } //将指定层数据存入list中 @@ -440,9 +432,12 @@ } } - //保存地牢 - private void TriggerSave() + /// + /// 触发保存地图数据 + /// + public void TriggerSave() { + GD.Print("保存地牢房间数据..."); SaveRoomInfoConfig(); SaveTileInfoConfig(); SavePreinstallConfig(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs index a567119..527e5d4 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreatePreinstall/MapEditorCreatePreinstallPanel.cs @@ -6,6 +6,16 @@ public partial class MapEditorCreatePreinstallPanel : MapEditorCreatePreinstall { + private RoomPreinstall _roomPreinstall; + + public void InitData(RoomPreinstall preinstall) + { + _roomPreinstall = preinstall; + S_PreinstallNameInput.Instance.Text = preinstall.Name; + S_WeightInput.Instance.Value = preinstall.Weight; + S_RemarkInput.Instance.Text = preinstall.Remark; + } + /// /// 填完数据后创建数据进行验证并创建数据对象, 如果验证失败, 则返回null /// @@ -22,7 +32,7 @@ return null; } - var index = roomPreinstalls.FindIndex(preinstall => preinstall.Name == data.Name); + var index = roomPreinstalls.FindIndex(preinstall => preinstall.Name == data.Name && preinstall != _roomPreinstall); if (index >= 0) { EditorWindowManager.ShowTips("错误", "当前房间已经存在预设名称'" + data.Name + "', 请使用其他名称!"); @@ -32,7 +42,10 @@ data.Remark = S_RemarkInput.Instance.Text; data.WaveList = new List>(); data.Weight = (int)S_WeightInput.Instance.Value; + if (_roomPreinstall != null) + { + data.WaveList = _roomPreinstall.WaveList; + } return data; } - } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index 199d78c..a27c5e4 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -58,6 +58,8 @@ S_PreinstallOption.Instance.ItemSelected += OnItemSelected; S_AddPreinstall.Instance.Pressed += OnAddPreinstall; + S_EditPreinstall.Instance.Pressed += OnEditPreinstall; + S_DeletePreinstall.Instance.Pressed += OnDeletePreinstall; S_AddWaveButton.Instance.Pressed += OnAddWave; S_EditButton.Instance.Pressed += OnToolEditClick; @@ -135,7 +137,7 @@ { var preinstall = EditorTileMap.RoomSplit.Preinstall; var optionButton = S_PreinstallOption.Instance; - var selectIndex = index < 0 ? optionButton.Selected : index; + var selectIndex = index < 0 ? (preinstall.Count > 0 ? 0 : -1) : index; optionButton.Clear(); foreach (var item in preinstall) { @@ -146,15 +148,10 @@ optionButton.AddItem($"{item.Name} ({item.Weight})"); } - - if (selectIndex == -1 && preinstall.Count > 0) - { - OnItemSelected(0); - } - else - { - OnItemSelected(selectIndex); - } + + //下拉框选中项 + optionButton.Selected = selectIndex; + OnItemSelected(selectIndex); } /// @@ -252,12 +249,55 @@ var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; EditorWindowManager.ShowCreatePreinstall(roomSplitPreinstall, preinstall => { + //创建逻辑 roomSplitPreinstall.Add(preinstall); RefreshPreinstallSelect(roomSplitPreinstall.Count - 1); }); } /// + /// 编辑预设 + /// + public void OnEditPreinstall() + { + var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; + var selectPreinstall = GetSelectPreinstall(); + EditorWindowManager.ShowEditPreinstall(roomSplitPreinstall, selectPreinstall, preinstall => + { + //修改逻辑 + selectPreinstall.CloneFrom(preinstall); + //修改下拉菜单数据 + var optionButton = S_PreinstallOption.Instance; + optionButton.SetItemText(optionButton.Selected, $"{preinstall.Name} ({preinstall.Weight})"); + }); + } + + /// + /// 删除预设 + /// + public void OnDeletePreinstall() + { + var index = EditorTileMap.SelectPreinstallIndex; + if (index < 0) + { + return; + } + + EditorWindowManager.ShowConfirm("提示", "是否删除当前预设?", v => + { + if (v) + { + //先把选中项置为-1 + EditorTileMap.SelectPreinstallIndex = -1; + //移除预设数据 + EditorTileMap.RoomSplit.Preinstall.RemoveAt(index); + //刷新选项 + RefreshPreinstallSelect(EditorTileMap.RoomSplit.Preinstall.Count - 1); + } + }); + } + + /// /// 添加波数 /// public void OnAddWave() @@ -309,28 +349,28 @@ /// public void OnDeleteWave() { - EditorWindowManager.ShowConfirm("提示", "是否删除当前波?", v => + var index = EditorTileMap.SelectWaveIndex; + if (index < 0) + { + return; + } + + var selectPreinstall = GetSelectPreinstall(); + if (selectPreinstall == null) + { + return; + } + + var wave = selectPreinstall.WaveList[index]; + EditorWindowManager.ShowConfirm("提示", $"是否删除当前波?\n当前波数包含{wave.Count}个标记", v => { if (v) { - var index = EditorTileMap.SelectWaveIndex; - if (index < 0) - { - return; - } - - var selectPreinstall = GetSelectPreinstall(); - if (selectPreinstall == null) - { - return; - } - //隐藏工具 S_DynamicTool.Reparent(this); S_DynamicTool.Instance.Visible = false; //派发移除标记事件 - var list = selectPreinstall.WaveList[index]; - foreach (var markInfo in list) + foreach (var markInfo in wave) { EventManager.EmitEvent(EventEnum.OnDeleteMark, markInfo); } @@ -367,24 +407,24 @@ /// public void OnDeleteMark() { - EditorWindowManager.ShowConfirm("提示", "是否删除当前标记?", v => + if (SelectCell is EditorMarkCell markCell) { - if (v) + var index = EditorTileMap.SelectWaveIndex; + if (index < 0) { - if (SelectCell is EditorMarkCell markCell) - { - var index = EditorTileMap.SelectWaveIndex; - if (index < 0) - { - return; - } - - var selectPreinstall = GetSelectPreinstall(); - if (selectPreinstall == null) - { - return; - } + return; + } + var selectPreinstall = GetSelectPreinstall(); + if (selectPreinstall == null) + { + return; + } + + EditorWindowManager.ShowConfirm("提示", "是否删除当前标记?", v => + { + if (v) + { var waveCell = (EditorWaveCell)_grid.GetCell(index); //隐藏工具 S_DynamicTool.Reparent(this); @@ -396,7 +436,7 @@ waveCell.MarkGrid.RemoveByIndex(markCellIndex); waveCell.Data.RemoveAt(markCellIndex); } - } - }); + }); + } } }