diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn index 46a135f..2e6a5b1 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=14 format=3 uid="uid://csbxfkdupsckv"] +[gd_scene load_steps=15 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"] @@ -7,6 +7,7 @@ [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="Texture2D" uid="uid://bpbfjyj6258da" path="res://resource/sprite/ui/commonIcon/Setting.png" id="5_ubl8b"] [ext_resource type="PackedScene" uid="uid://b4u66mxndxbrg" path="res://prefab/ui/MapEditorTools.tscn" id="6_7pvgu"] [ext_resource type="PackedScene" uid="uid://bb2ekkpxifd7g" path="res://prefab/ui/MapEditorMapLayer.tscn" id="7_ychtn"] [ext_resource type="PackedScene" uid="uid://peo0n8bl15y5" path="res://prefab/ui/MapEditorMapMark.tscn" id="8_8tgeu"] @@ -138,15 +139,29 @@ anchors_preset = 5 anchor_left = 0.5 anchor_right = 0.5 -offset_left = -30.0 +offset_left = -61.0 offset_top = 2.0 -offset_right = 30.0 +offset_right = -1.0 offset_bottom = 68.0 grow_horizontal = 2 size_flags_horizontal = 0 icon = ExtResource("4_2imnr") icon_alignment = 1 +[node name="PlaySetting" type="Button" parent="Bg/VBoxContainer/Head"] +layout_mode = 1 +anchors_preset = 5 +anchor_left = 0.5 +anchor_right = 0.5 +offset_left = 1.0 +offset_top = 2.0 +offset_right = 61.0 +offset_bottom = 68.0 +grow_horizontal = 2 +size_flags_horizontal = 0 +icon = ExtResource("5_ubl8b") +icon_alignment = 1 + [node name="HSplitContainer" type="HSplitContainer" parent="Bg/VBoxContainer"] layout_mode = 2 size_flags_vertical = 3 diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json index d4787df..bd9e665 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json @@ -19,6 +19,12 @@ "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_roomInfo.json", "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_tileInfo.json", "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room3/Room3_preinstall.json" + }, + { + "Ready": true, + "RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json", + "TilePath": "resource/map/tileMaps/TestGroup1/battle/Room4/Room4_tileInfo.json", + "PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room4/Room4_preinstall.json" } ], "InletList": [ 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 601c1ff..8d9e528 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":62,"Y":9},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0005","CurrAmmon":"10","ResidueAmmo":"10"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"-1","Weapon":null},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":91,"Y":50},"Size":{"X":32,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"1","Weapon":null},"Altitude":0,"VerticalSpeed":0}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":18,"Y":-136},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0002","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":62,"Y":9},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0005","CurrAmmon":"10","ResidueAmmo":"10"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":24,"Y":47},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"-1","Weapon":null},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":91,"Y":50},"Size":{"X":32,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"1","Weapon":null},"Altitude":0,"VerticalSpeed":0}]}]]},{"Name":"test2","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":27,"Y":-143},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"prop0001","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":-21,"Y":-113},"Size":{"X":46,"Y":27},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0},{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"20","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0},{"Id":"weapon0003","Weight":100,"Attr":{"CurrAmmon":"12","ResidueAmmo":"90"},"Altitude":8,"VerticalSpeed":0}]}],[{"Position":{"X":70,"Y":29},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0007","CurrAmmon":"60","ResidueAmmo":"60"},"Altitude":0,"VerticalSpeed":0}]}]]}] \ 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 a4301a2..bd1d3bd 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":[-24,-184,88,-184,88,-168,120,-168,120,-96,56,-96,56,-64,40,-64,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,80,-72,80,-72,-168,-24,-168]},{"Type":1,"Points":[-8,-160,72,-160,72,-120,40,-120,40,-104,-40,-104,-40,-144,-8,-144]},{"Type":1,"Points":[-56,-64,8,-64,8,-24,-56,-24]}],"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,7,6,0,0,8,7,7,0,0,8,7,-11,0,0,8,7,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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":[-24,-184,88,-184,88,-168,120,-168,120,-96,56,-96,56,-64,40,-64,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,80,-72,80,-72,-168,-24,-168]},{"Type":1,"Points":[-56,-64,8,-64,8,-24,-56,-24]}],"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,7,6,0,0,8,7,7,0,0,8,7,-11,0,0,8,7,-10,0,0,8,7,-9,0,0,8,7,-8,0,0,8,7,-7,0,0,8,6,-10,0,0,8,6,-9,0,0,8,6,-8,0,0,8,6,3,0,0,8,6,2,0,0,8,6,1,0,0,8,6,0,0,0,8,6,-1,0,0,8,6,-2,0,0,8,6,-3,0,0,8,6,-4,0,0,8,6,-7,0,0,8,6,6,0,0,8,6,7,0,0,8,6,-11,0,0,8,5,-10,0,0,8,5,-9,0,0,8,5,-7,0,0,8,5,-8,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,6,0,0,8,5,7,0,0,8,5,-11,0,0,8,5,-12,0,0,8,4,-9,0,0,8,4,-10,0,0,8,4,-8,0,0,8,4,-7,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,6,0,0,8,4,7,0,0,8,4,5,0,0,8,4,4,0,0,8,4,-11,0,0,8,4,-12,0,0,8,3,-12,0,0,8,3,-6,0,0,8,3,-7,0,0,8,3,-8,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,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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,-4,0,1,2,3,-3,0,1,3,3,8,0,2,2,4,-6,0,1,2,4,-5,0,1,3,4,-4,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,-13,0,1,4,6,-6,0,2,2,6,4,0,2,2,6,8,0,2,2,7,-6,0,2,2,7,4,0,2,2,7,8,0,2,2,8,-12,0,1,4,8,-11,0,1,3,8,-10,0,1,3,8,-9,0,1,3,8,-8,0,1,3,8,-7,0,1,3,8,-6,0,13,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/map/tileMaps/TestGroup1/battle/Room4/Room4_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_preinstall.json new file mode 100644 index 0000000..86be653 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_preinstall.json @@ -0,0 +1 @@ +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":-54,"Y":-22},"Size":{"X":51,"Y":42},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0001","CurrAmmon":"30","ResidueAmmo":"30"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":131,"Y":18},"Size":{"X":56,"Y":51},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0002","CurrAmmon":"7","ResidueAmmo":"7"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":-48,"Y":87},"Size":{"X":66,"Y":33},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":null},"Altitude":0,"VerticalSpeed":0},{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0006","CurrAmmon":"20","ResidueAmmo":"20"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":94,"Y":79},"Size":{"X":19,"Y":37},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":null},"Altitude":0,"VerticalSpeed":0}]}],[{"Position":{"X":4,"Y":-58},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]},{"Position":{"X":19,"Y":110},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0007","CurrAmmon":"60","ResidueAmmo":"60"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":-94,"Y":23},"Size":{"X":26,"Y":47},"SpecialMarkType":0,"DelayTime":2.5,"MarkList":[{"Id":"enemy0001","Weight":100,"Attr":{"Face":"0","Weapon":"weapon0001","CurrAmmon":"30","ResidueAmmo":"30"},"Altitude":0,"VerticalSpeed":0}]},{"Position":{"X":86,"Y":-25},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":1.2,"MarkList":[{"Id":"prop0010","Weight":100,"Attr":null,"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json new file mode 100644 index 0000000..68df949 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json @@ -0,0 +1 @@ +{"Position":{"X":-9,"Y":-7},"Size":{"X":22,"Y":18},"DoorAreaInfos":[{"Direction":3,"Start":80,"End":176},{"Direction":0,"Start":64,"End":160},{"Direction":2,"Start":112,"End":176},{"Direction":1,"Start":64,"End":160}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room4","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_tileInfo.json new file mode 100644 index 0000000..e5ffdfc --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_tileInfo.json @@ -0,0 +1 @@ +{"NavigationList":[{"Type":0,"Points":[-40,-88,40,-88,40,-56,120,-56,120,-24,184,-24,184,64,120,64,120,112,40,112,40,160,-8,160,-8,112,-88,112,-88,64,-120,64,-120,-24,-88,-24,-88,-56,-40,-56]},{"Type":1,"Points":[-24,-32,56,-32,56,16,72,16,72,88,-8,88,-8,56,-72,56,-72,16,-24,16]}],"Floor":[11,3,0,0,8,11,2,0,0,8,11,1,0,0,8,11,0,0,0,8,11,-1,0,0,8,11,-2,0,0,8,10,3,0,0,8,10,2,0,0,8,10,1,0,0,8,10,0,0,0,8,10,-1,0,0,8,10,-2,0,0,8,9,3,0,0,8,9,2,0,0,8,9,1,0,0,8,9,0,0,0,8,9,-1,0,0,8,9,-2,0,0,8,8,3,0,0,8,8,2,0,0,8,8,1,0,0,8,8,0,0,0,8,8,-1,0,0,8,8,-2,0,0,8,-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,-8,3,0,0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,3,3,-7,4,0,3,2,-7,5,0,3,3,-7,6,0,3,3,-7,7,0,11,2,-6,7,0,2,2,-5,7,0,2,2,-4,-7,0,3,4,-4,-6,0,3,3,-4,1,0,1,2,-4,7,0,2,2,-3,1,0,2,2,-3,7,0,2,2,-2,1,0,2,2,-2,7,0,3,2,-2,8,0,3,3,-2,9,0,3,3,-2,10,0,11,2,-1,-2,0,1,2,-1,-1,0,1,3,-1,0,0,1,3,-1,1,0,13,2,-1,10,0,2,2,0,-2,0,2,2,0,2,0,1,4,0,3,0,1,3,0,10,0,2,2,1,-2,0,2,2,1,10,0,2,2,2,-2,0,3,2,2,-1,0,3,3,2,0,0,3,3,2,1,0,11,2,2,10,0,2,2,3,-7,0,1,4,3,-6,0,1,3,3,1,0,3,2,3,2,0,3,3,3,3,0,3,3,3,7,0,1,2,3,8,0,1,3,3,9,0,1,3,3,10,0,13,2,4,7,0,2,2,5,7,0,2,2,6,7,0,2,2,7,7,0,2,2,8,-5,0,1,4,8,-4,0,1,3,8,4,0,1,2,8,5,0,1,3,8,6,0,1,3,8,7,0,13,2,9,4,0,2,2,10,4,0,2,2,11,4,0,2,2,12,-3,0,1,4,12,-2,0,1,3,12,-1,0,1,3,12,0,0,1,3,12,1,0,1,3,12,2,0,1,3,12,3,0,1,3,12,4,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json index 78ec481..af06e7e 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/inlet/Start1/Start1_preinstall.json @@ -1 +1 @@ -[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":137,"Y":137},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]}],[{"Position":{"X":135,"Y":114},"Size":{"X":179,"Y":90},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":137,"Y":137},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]}],[{"Position":{"X":135,"Y":114},"Size":{"X":179,"Y":90},"SpecialMarkType":0,"DelayTime":2,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"210"},"Altitude":8,"VerticalSpeed":0}]}]]},{"Name":"test2","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":138,"Y":89},"Size":{"X":0,"Y":0},"SpecialMarkType":1,"DelayTime":0,"MarkList":[]},{"Position":{"X":194,"Y":136},"Size":{"X":16,"Y":16},"SpecialMarkType":0,"DelayTime":0,"MarkList":[{"Id":"weapon0007","Weight":100,"Attr":{"CurrAmmon":"60","ResidueAmmo":"300"},"Altitude":8,"VerticalSpeed":0}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png new file mode 100644 index 0000000..b5ef408 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png.import new file mode 100644 index 0000000..537caf6 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Setting.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bpbfjyj6258da" +path="res://.godot/imported/Setting.png-c6a170d14d8c06a87c462b6063f7e3fd.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Setting.png" +dest_files=["res://.godot/imported/Setting.png-c6a170d14d8c06a87c462b6063f7e3fd.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/src/framework/map/DungeonConfig.cs b/DungeonShooting_Godot/src/framework/map/DungeonConfig.cs index ea26823..92e1b0d 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonConfig.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonConfig.cs @@ -1,4 +1,6 @@  +using System.Collections.Generic; + /// /// 生成地牢的配置 /// @@ -13,4 +15,19 @@ /// 房间数量 /// public int RoomCount = 20; + + /// + /// 是否指定了房间 + /// + public bool HasDesignatedRoom => DesignatedRoom != null && DesignatedRoom.Count > 0; + + /// + /// 指定房间类型 + /// + public DungeonRoomType DesignatedType; + + /// + /// 指定房间列表 + /// + public List DesignatedRoom; } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs index 82fb447..1e5db3a 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs @@ -74,10 +74,6 @@ private DungeonConfig _config; private DungeonRoomGroup _roomGroup; - //指定只能生成的房间 - private static List _designatedRoom; - - private enum GenerateRoomErrorCode { NoError, @@ -91,14 +87,6 @@ // NoProperDoor, } - /// - /// 用于调试, 设置生成器只能生成哪些房间 - /// - public static void SetDesignatedRoom(List list) - { - _designatedRoom = new List(list); - } - public DungeonGenerator(DungeonConfig config) { _config = config; @@ -112,7 +100,7 @@ throw new Exception("当前组'" + config.GroupName + "'中没有可用的起始房间, 不能生成地牢!"); } //没有指定房间 - if (_designatedRoom == null || _designatedRoom.Count == 0) + if (config.HasDesignatedRoom) { if (_roomGroup.OutletList.Count == 0) { @@ -291,8 +279,11 @@ // } DungeonRoomSplit roomSplit; - //没有指定房间 - if (roomType == DungeonRoomType.Inlet || _designatedRoom == null || _designatedRoom.Count == 0) + if (_config.HasDesignatedRoom && _config.DesignatedType == roomType) //执行指定了房间 + { + roomSplit = Random.RandomChoose(_config.DesignatedRoom); + } + else //没有指定房间 { //随机选择一个房间 var list = _roomGroup.GetRoomList(roomType); @@ -305,10 +296,6 @@ roomSplit = _roomGroup.GetRandomRoom(roomType); } } - else //指定了房间 - { - roomSplit = Random.RandomChoose(_designatedRoom); - } var room = new RoomInfo(_id, roomType, roomSplit); diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs index ac86df0..ffdb00d 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs @@ -111,17 +111,25 @@ } //随机选择预设 RoomPreinstallInfo preinstallInfo; - if (roomInfo.RoomSplit.Preinstall.Count == 1) + if (EditorPlayManager.IsPlay && roomInfo.RoomType == GameApplication.Instance.DungeonManager.CurrConfig.DesignatedType) //编辑器模式, 指定预设 { - preinstallInfo = roomInfo.RoomSplit.Preinstall[0]; + preinstallInfo = EditorManager.SelectPreinstall; } - else + else //普通模式 { - var weights = roomInfo.RoomSplit.Preinstall.Select(info => info.Weight).ToArray(); - var index = random.RandomWeight(weights); - preinstallInfo = roomInfo.RoomSplit.Preinstall[index]; + if (roomInfo.RoomSplit.Preinstall.Count == 1) + { + preinstallInfo = roomInfo.RoomSplit.Preinstall[0]; + } + else + { + var weights = roomInfo.RoomSplit.Preinstall.Select(info => info.Weight).ToArray(); + var index = random.RandomWeight(weights); + preinstallInfo = roomInfo.RoomSplit.Preinstall[index]; + } } + var roomPreinstall = new RoomPreinstall(roomInfo, preinstallInfo); roomInfo.RoomPreinstall = roomPreinstall; //执行预处理操作 diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 34b1c6a..8a16a0c 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -103,6 +103,11 @@ /// public void ShowUi() { + if (IsDestroyed) + { + GD.PrintErr($"当前Ui: {UiName}已经被销毁!"); + return; + } if (IsOpen) { return; @@ -127,6 +132,11 @@ /// public void HideUi() { + if (IsDestroyed) + { + GD.PrintErr($"当前Ui: {UiName}已经被销毁!"); + return; + } if (!IsOpen) { return; diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs index 5ab4096..632b0cb 100644 --- a/DungeonShooting_Godot/src/game/event/EventEnum.cs +++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs @@ -1,4 +1,6 @@ +using System.Collections.Generic; + /// /// 事件类型枚举 /// @@ -102,11 +104,19 @@ /// OnClickCenterTool, /// - /// 选中预设, 参数 + /// 选中地牢组, 参数 + /// + OnSelectGroup, + /// + /// 选中房间, 参数 + /// + OnSelectRoom, + /// + /// 选中预设, 参数 /// OnSelectPreinstall, /// - /// 选中波数, 参数 + /// 选中波数, 参数 , T 为 /// OnSelectWave, /// diff --git a/DungeonShooting_Godot/src/game/manager/EditorManager.cs b/DungeonShooting_Godot/src/game/manager/EditorManager.cs new file mode 100644 index 0000000..34d2845 --- /dev/null +++ b/DungeonShooting_Godot/src/game/manager/EditorManager.cs @@ -0,0 +1,136 @@ + +using System.Collections.Generic; + +public static class EditorManager +{ + /// + /// 当前使用的地牢组 + /// + public static DungeonRoomGroup SelectDungeonGroup { get; private set; } + + /// + /// 当使用的地牢房间 + /// + public static DungeonRoomSplit SelectRoom { get; private set; } + + /// + /// 当前使用的预设索引 + /// + public static int SelectPreinstallIndex { get; private set; } = -1; + + /// + /// 当前使用的预设 + /// + public static RoomPreinstallInfo SelectPreinstall { get; private set; } + + /// + /// 当前选中的波索引 + /// + public static int SelectWaveIndex { get; private set; } = -1; + + /// + /// 当前选中的波 + /// + public static List SelectWave { get; private set; } + + /// + /// 当前选中的标记 + /// + public static MarkInfo SelectMark { get; private set; } + + public static void SetSelectDungeonGroup(DungeonRoomGroup roomGroup) + { + if (SelectDungeonGroup != roomGroup) + { + SelectDungeonGroup = roomGroup; + EventManager.EmitEvent(EventEnum.OnSelectGroup, SelectDungeonGroup); + } + } + + public static void SetSelectRoom(DungeonRoomSplit roomSplit) + { + if (SelectRoom != roomSplit) + { + SelectRoom = roomSplit; + EventManager.EmitEvent(EventEnum.OnSelectRoom, SelectRoom); + } + } + + public static void SetSelectPreinstallIndex(int index) + { + if (SelectRoom == null) + { + if (SelectPreinstallIndex != -1) + { + SelectPreinstallIndex = -1; + SelectPreinstall = null; + EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall); + } + } + else if (SelectPreinstallIndex != index) + { + if (index < 0 || SelectRoom.Preinstall == null || index >= SelectRoom.Preinstall.Count) + { + if (SelectPreinstallIndex != -1) + { + SelectPreinstallIndex = -1; + SelectPreinstall = null; + EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall); + } + } + else + { + if (SelectPreinstallIndex != index) + { + SelectPreinstallIndex = index; + SelectPreinstall = SelectRoom.Preinstall[index]; + EventManager.EmitEvent(EventEnum.OnSelectPreinstall, SelectPreinstall); + } + } + } + } + + public static void SetSelectWaveIndex(int index) + { + if (SelectPreinstall == null) + { + if (SelectWaveIndex != -1) + { + SelectWaveIndex = -1; + SelectWave = null; + EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave); + } + } + else if (SelectWaveIndex != index) + { + SelectWaveIndex = index; + if (index < 0 || SelectPreinstall.WaveList == null || index >= SelectPreinstall.WaveList.Count) + { + if (SelectWaveIndex != -1) + { + SelectWaveIndex = -1; + SelectWave = null; + EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave); + } + } + else + { + if (SelectWaveIndex != index) + { + SelectWaveIndex = index; + SelectWave = SelectPreinstall.WaveList[index]; + EventManager.EmitEvent(EventEnum.OnSelectWave, SelectWave); + } + } + } + } + + public static void SetSelectMark(MarkInfo markInfo) + { + if (SelectMark != markInfo) + { + SelectMark = markInfo; + EventManager.EmitEvent(EventEnum.OnSelectMark, markInfo); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs new file mode 100644 index 0000000..e9d9088 --- /dev/null +++ b/DungeonShooting_Godot/src/game/manager/EditorPlayManager.cs @@ -0,0 +1,52 @@ + +using System.Collections.Generic; + +public static class EditorPlayManager +{ + /// + /// 是否正在播放 + /// + public static bool IsPlay { get; private set; } + + private static DungeonConfig _config; + + public static void Play(UiBase prevUi) + { + if (IsPlay) + { + return; + } + + IsPlay = true; + _config = new DungeonConfig(); + _config.GroupName = EditorManager.SelectDungeonGroup.GroupName; + _config.DesignatedType = EditorManager.SelectRoom.RoomInfo.RoomType; + _config.DesignatedRoom = new List(); + _config.DesignatedRoom.Add(EditorManager.SelectRoom); + GameApplication.Instance.DungeonManager.EditorPlayDungeon(prevUi, _config); + } + + public static void Exit() + { + if (!IsPlay) + { + return; + } + + IsPlay = false; + GameApplication.Instance.DungeonManager.EditorExitDungeon(); + } + + public static void Restart() + { + if (!IsPlay) + { + return; + } + + GameApplication.Instance.DungeonManager.ExitDungeon(() => + { + GameApplication.Instance.DungeonManager.EditorPlayDungeon(_config); + }); + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index ab7680e..4c87c4b 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -2,8 +2,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; -using Config; using Godot; /// @@ -31,7 +29,17 @@ /// public bool IsInDungeon { get; private set; } - private DungeonConfig _config; + /// + /// 是否是编辑器模式 + /// + public bool IsEditorMode { get; private set; } + + /// + /// 当前使用的配置 + /// + public DungeonConfig CurrConfig { get; private set; } + + private UiBase _prevUi; private DungeonTileMap _dungeonTileMap; private AutoTileConfig _autoTileConfig; private DungeonGenerator _dungeonGenerator; @@ -55,9 +63,24 @@ /// public void LoadDungeon(DungeonConfig config, Action finish = null) { - _config = config; + IsEditorMode = false; + CurrConfig = config; GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(finish)); } + + + /// + /// 重启地牢 + /// + public void RestartDungeon(DungeonConfig config) + { + IsEditorMode = false; + CurrConfig = config; + ExitDungeon(() => + { + LoadDungeon(CurrConfig); + }); + } /// /// 退出地牢 @@ -67,6 +90,59 @@ IsInDungeon = false; GameApplication.Instance.StartCoroutine(RunExitDungeonCoroutine(finish)); } + + //------------------------------------------------------------------------------------- + + /// + /// 在编辑器模式下进入地牢 + /// + /// 地牢配置 + public void EditorPlayDungeon(DungeonConfig config) + { + IsEditorMode = true; + CurrConfig = config; + if (_prevUi != null) + { + _prevUi.HideUi(); + } + GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(null)); + } + + /// + /// 在编辑器模式下进入地牢 + /// + /// 记录上一个Ui + /// 地牢配置 + public void EditorPlayDungeon(UiBase prevUi, DungeonConfig config) + { + IsEditorMode = true; + CurrConfig = config; + _prevUi = prevUi; + if (_prevUi != null) + { + _prevUi.HideUi(); + } + GameApplication.Instance.StartCoroutine(RunLoadDungeonCoroutine(null)); + } + + /// + /// 在编辑器模式下退出地牢, 并且打开上一个Ui + /// + public void EditorExitDungeon() + { + IsInDungeon = false; + GameApplication.Instance.StartCoroutine(RunExitDungeonCoroutine(() => + { + IsEditorMode = false; + //显示上一个Ui + if (_prevUi != null) + { + _prevUi.ShowUi(); + } + })); + } + + //------------------------------------------------------------------------------------- public override void _Process(double delta) { @@ -99,7 +175,7 @@ _world = GameApplication.Instance.CreateNewWorld(); yield return new WaitForFixedProcess(10); //生成地牢房间 - _dungeonGenerator = new DungeonGenerator(_config); + _dungeonGenerator = new DungeonGenerator(CurrConfig); _dungeonGenerator.Generate(); yield return 0; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs index 7e17aa2..aaf67ac 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs @@ -81,6 +81,15 @@ } /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head.PlaySetting + /// + public class PlaySetting : UiNode + { + public PlaySetting(MapEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override PlaySetting Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head /// public class Head : UiNode @@ -137,6 +146,19 @@ } private Play _L_Play; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.PlaySetting + /// + public PlaySetting L_PlaySetting + { + get + { + if (_L_PlaySetting == null) _L_PlaySetting = new PlaySetting(UiPanel, Instance.GetNode("PlaySetting")); + return _L_PlaySetting; + } + } + private PlaySetting _L_PlaySetting; + public Head(MapEditorPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Head Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } @@ -624,6 +646,11 @@ public Play S_Play => L_Bg.L_VBoxContainer.L_Head.L_Play; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head.PlaySetting + /// + public PlaySetting S_PlaySetting => L_Bg.L_VBoxContainer.L_Head.L_PlaySetting; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: 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 1e9448e..4fdace8 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -4,6 +4,24 @@ public partial class MapEditorPanel : MapEditor { + private class CheckResult + { + /// + /// 是否存在错误 + /// + public bool HasError; + /// + /// 错误消息 + /// + public string Message; + + public CheckResult(bool hasError, string message) + { + HasError = hasError; + Message = message; + } + } + private string _title; public override void OnCreateUi() @@ -14,6 +32,7 @@ S_Left.Instance.Resized += OnMapViewResized; S_Back.Instance.Pressed += OnBackClick; S_Save.Instance.Pressed += OnSave; + S_Play.Instance.Pressed += OnPlay; } public override void OnShowUi() @@ -21,6 +40,33 @@ OnMapViewResized(); } + public override void OnDestroyUi() + { + //清除选中的预设 + EditorManager.SetSelectPreinstallIndex(-1); + //清除选中的波 + EditorManager.SetSelectWaveIndex(-1); + //清除选中的标记 + EditorManager.SetSelectMark(null); + } + + //点击播放按钮 + private void OnPlay() + { + S_TileMap.Instance.TryRunCheckHandler(); + var check = CheckError(); + //有错误数据 + if (check.HasError) + { + EditorWindowManager.ShowTips("提示", check.Message + ",不能运行房间!"); + return; + } + //保存数据 + S_TileMap.Instance.TriggerSave(); + //执行运行 + EditorPlayManager.Play(this); + } + /// /// 加载地牢, 返回是否加载成功 /// @@ -56,10 +102,11 @@ private void OnSave() { S_TileMap.Instance.TryRunCheckHandler(); + var check = CheckError(); //有错误的数据 - if (S_TileMap.Instance.HasError) + if (check.HasError) { - EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) => + EditorWindowManager.ShowConfirm("提示", check.Message + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) => { if (v) { @@ -85,9 +132,10 @@ { if (index == 0) //保存并退出 { - if (S_TileMap.Instance.HasError) //有错误 + var check = CheckError(); + if (check.HasError) //有错误 { - EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) => + EditorWindowManager.ShowConfirm("提示", check.Message + ",如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) => { if (v) { @@ -118,9 +166,10 @@ } else //没有修改数据 { - if (S_TileMap.Instance.HasError) //有错误 + var check = CheckError(); + if (check.HasError) //有错误 { - EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果不解决错误就退出,运行游戏将不会刷出该房间!\n是否仍要退出?", (v) => + EditorWindowManager.ShowConfirm("提示", check .Message + ",如果不解决错误就退出,运行游戏将不会刷出该房间!\n是否仍要退出?", (v) => { if (v) { @@ -136,4 +185,19 @@ } } } + + private CheckResult CheckError() + { + if (S_TileMap.Instance.HasError) //地图绘制错误 + { + return new CheckResult(true, "当前房间地块存在绘制错误"); + } + + if (EditorManager.SelectRoom.Preinstall == null || EditorManager.SelectRoom.Preinstall.Count == 0) + { + return new CheckResult(true, "当前房间没有预设"); + } + + return new CheckResult(false, null); + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index eeb6c40..6c8fb6a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -118,11 +118,11 @@ private int _terrainSet = 0; private int _terrain = 0; private AutoTileConfig _autoTileConfig = new AutoTileConfig(); - + /// /// 正在编辑的房间数据 /// - public DungeonRoomSplit RoomSplit { get; private set; } + private DungeonRoomSplit _roomSplit; /// /// 数据是否脏了, 也就是是否有修改 @@ -135,63 +135,6 @@ public bool HasError => !_isGenerateTerrain; /// - /// 波数网格选中的索引 - /// - public int SelectWaveIndex - { - get => _selectWaveIndex; - set - { - if (_selectWaveIndex != value) - { - _selectWaveIndex = value; - EventManager.EmitEvent(EventEnum.OnSelectWave, value); - } - } - } - - private int _selectWaveIndex = -1; - - /// - /// 选中的预设 - /// - public int SelectPreinstallIndex - { - get => _selectPreinstallIndex; - set - { - if (_selectPreinstallIndex != value) - { - _selectPreinstallIndex = value; - EventManager.EmitEvent(EventEnum.OnSelectPreinstall, value); - } - } - } - - private int _selectPreinstallIndex = -1; - - /// - /// 当前选中的预设 - /// - public RoomPreinstallInfo SelectPreinstallInfo - { - get - { - if (SelectPreinstallIndex == -1 || SelectPreinstallIndex >= RoomSplit.Preinstall.Count) - { - return null; - } - - return RoomSplit.Preinstall[SelectPreinstallIndex]; - } - } - - /// - /// 选中的标记 - /// - public MarkTool SelectMark => MapEditorToolsPanel.ActiveMark; - - /// /// 当前的房间大小 /// public Vector2I RoomSize => _roomSize; @@ -496,7 +439,7 @@ { GD.Print("保存地牢房间数据..."); //是否准备好 - RoomSplit.Ready = !HasError && RoomSplit.Preinstall != null && RoomSplit.Preinstall.Count > 0; + _roomSplit.Ready = !HasError && _roomSplit.Preinstall != null && _roomSplit.Preinstall.Count > 0; SaveRoomInfoConfig(); SaveTileInfoConfig(); SavePreinstallConfig(); @@ -516,7 +459,7 @@ roomSplit.ReloadTileInfo(); roomSplit.ReloadPreinstall(); - RoomSplit = roomSplit; + _roomSplit = roomSplit; var roomInfo = roomSplit.RoomInfo; var tileInfo = roomSplit.TileInfo; @@ -994,7 +937,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)) { @@ -1024,14 +967,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(); @@ -1051,7 +994,7 @@ public void SavePreinstallConfig() { //存入本地 - var roomInfo = RoomSplit.RoomInfo; + var roomInfo = _roomSplit.RoomInfo; var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName); if (!Directory.Exists(path)) { @@ -1059,7 +1002,7 @@ } path += "/" + MapProjectManager.GetRoomPreinstallConfigName(roomInfo.RoomName); - var jsonStr = JsonSerializer.Serialize(RoomSplit.Preinstall); + var jsonStr = JsonSerializer.Serialize(_roomSplit.Preinstall); File.WriteAllText(path, jsonStr); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs index 4a19ce5..b71017e 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkCell.cs @@ -56,13 +56,13 @@ public override void OnClick() { - CellNode.UiPanel.EditorTileMap.SelectWaveIndex = Data.ParentCell.Index; + EditorManager.SetSelectWaveIndex(Data.ParentCell.Index); CellNode.UiPanel.SetSelectCell(this, CellNode.Instance, MapEditorMapMarkPanel.SelectToolType.Mark); //需要切换回编辑工具 if (CellNode.UiPanel.EditorTileMap.MouseType != EditorTileMap.MouseButtonType.Edit) { //选中标记 - EventManager.EmitEvent(EventEnum.OnSelectMark, Data.MarkInfo); + EditorManager.SetSelectMark(Data.MarkInfo); } } @@ -70,7 +70,7 @@ { CellNode.L_MarkButton.L_Select.Instance.Visible = true; //选中标记 - EventManager.EmitEvent(EventEnum.OnSelectMark, Data.MarkInfo); + EditorManager.SetSelectMark(Data.MarkInfo); } public override void OnUnSelect() diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs index 739eefd..674ca15 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs @@ -105,7 +105,7 @@ public override void OnClick() { - CellNode.UiPanel.EditorTileMap.SelectWaveIndex = Index; + EditorManager.SetSelectWaveIndex(Index); CellNode.UiPanel.SetSelectCell(this, CellNode.L_WaveContainer.Instance, MapEditorMapMarkPanel.SelectToolType.Wave); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index 56379e0..2dd3ff2 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -75,23 +75,16 @@ S_EditButton.Instance.Pressed += OnToolEditClick; S_DeleteButton.Instance.Pressed += OnToolDeleteClick; - } - - public override void OnShowUi() - { + _eventFactory = EventManager.CreateEventFactory(); _eventFactory.AddEventListener(EventEnum.OnSelectMark, OnSelectMark); RefreshPreinstallSelect(); } - public override void OnHideUi() + public override void OnDestroyUi() { _eventFactory.RemoveAllEventListener(); _eventFactory = null; - } - - public override void OnDestroyUi() - { _grid.Destroy(); } @@ -134,7 +127,7 @@ public RoomPreinstallInfo GetSelectPreinstall() { var index = S_PreinstallOption.Instance.Selected; - var preinstall = EditorTileMap.RoomSplit.Preinstall; + var preinstall = EditorManager.SelectRoom.Preinstall; if (index >= preinstall.Count) { return null; @@ -147,7 +140,7 @@ /// public void RefreshPreinstallSelect(int index = -1) { - var preinstall = EditorTileMap.RoomSplit.Preinstall; + var preinstall = EditorManager.SelectRoom.Preinstall; var optionButton = S_PreinstallOption.Instance; var selectIndex = index < 0 ? (preinstall.Count > 0 ? 0 : -1) : index; optionButton.Clear(); @@ -173,10 +166,10 @@ { //清除选中项 RemoveSelectCell(); - EditorTileMap.SelectWaveIndex = -1; + EditorManager.SetSelectWaveIndex(-1); //记录选中波数 - EditorTileMap.SelectPreinstallIndex = (int)index; - var preinstall = EditorTileMap.RoomSplit.Preinstall; + EditorManager.SetSelectPreinstallIndex((int)index); + var preinstall = EditorManager.SelectRoom.Preinstall; if (index >= 0 && index <= preinstall.Count) { _grid.SetDataList(preinstall[(int)index].WaveList.ToArray()); @@ -272,8 +265,8 @@ /// public void OnAddPreinstall() { - var roomInfoRoomType = EditorTileMap.RoomSplit.RoomInfo.RoomType; - var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; + var roomInfoRoomType = EditorManager.SelectRoom.RoomInfo.RoomType; + var roomSplitPreinstall = EditorManager.SelectRoom.Preinstall; EditorWindowManager.ShowCreatePreinstall(roomInfoRoomType, roomSplitPreinstall, preinstall => { //创建逻辑 @@ -289,8 +282,8 @@ /// public void OnEditPreinstall() { - var roomInfoRoomType = EditorTileMap.RoomSplit.RoomInfo.RoomType; - var roomSplitPreinstall = EditorTileMap.RoomSplit.Preinstall; + var roomInfoRoomType = EditorManager.SelectRoom.RoomInfo.RoomType; + var roomSplitPreinstall = EditorManager.SelectRoom.Preinstall; var selectPreinstall = GetSelectPreinstall(); EditorWindowManager.ShowEditPreinstall(roomInfoRoomType, roomSplitPreinstall, selectPreinstall, preinstall => { @@ -309,7 +302,7 @@ /// public void OnDeletePreinstall() { - var index = EditorTileMap.SelectPreinstallIndex; + var index = EditorManager.SelectPreinstallIndex; if (index < 0) { return; @@ -320,11 +313,11 @@ if (v) { //先把选中项置为-1 - EditorTileMap.SelectPreinstallIndex = -1; + EditorManager.SetSelectPreinstallIndex(-1); //移除预设数据 - EditorTileMap.RoomSplit.Preinstall.RemoveAt(index); + EditorManager.SelectRoom.Preinstall.RemoveAt(index); //刷新选项 - RefreshPreinstallSelect(EditorTileMap.RoomSplit.Preinstall.Count - 1); + RefreshPreinstallSelect(EditorManager.SelectRoom.Preinstall.Count - 1); //派发数据修改事件 EventManager.EmitEvent(EventEnum.OnEditorDirty); } @@ -343,7 +336,7 @@ return; } - var preinstall = EditorTileMap.RoomSplit.Preinstall; + var preinstall = EditorManager.SelectRoom.Preinstall; if (index >= preinstall.Count) { EditorWindowManager.ShowTips("警告", "未知预设选项!"); @@ -385,7 +378,7 @@ /// public void OnDeleteWave() { - var index = EditorTileMap.SelectWaveIndex; + var index = EditorManager.SelectWaveIndex; if (index < 0) { return; @@ -413,7 +406,7 @@ //移除数据 selectPreinstall.WaveList.RemoveAt(index); _grid.RemoveByIndex(index); - EditorTileMap.SelectWaveIndex = -1; + EditorManager.SetSelectWaveIndex(-1); //派发数据修改事件 EventManager.EmitEvent(EventEnum.OnEditorDirty); } @@ -451,7 +444,7 @@ { if (SelectCell is EditorMarkCell markCell) { - var index = EditorTileMap.SelectWaveIndex; + var index = EditorManager.SelectWaveIndex; if (index < 0) { return; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs index e96558e..842e78c 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs @@ -7,11 +7,6 @@ public partial class MapEditorProjectPanel : MapEditorProject { - /// - /// 当前选中的组 - /// - public DungeonRoomGroup SelectGroupInfo; - //当前显示的组数据 private UiGrid _groupGrid; //当前显示的房间数据 @@ -53,23 +48,22 @@ 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); _eventFactory.AddEventListener(EventEnum.OnCreateRoomFinish, OnCreateRoomFinish); } - public override void OnHideUi() + public override void OnShowUi() { - _eventFactory.RemoveAllEventListener(); + RefreshGroup(); + } public override void OnDestroyUi() { + _eventFactory.RemoveAllEventListener(); + _eventFactory = null; _groupGrid.Destroy(); _groupGrid = null; @@ -91,7 +85,7 @@ /// public void SelectGroup(DungeonRoomGroup group) { - SelectGroupInfo = group; + EditorManager.SetSelectDungeonGroup(group); OnSearchRoomButtonClick(); } @@ -100,6 +94,7 @@ /// public void SelectRoom(DungeonRoomSplit room) { + EditorManager.SetSelectRoom(room); HideUi(); //创建地牢Ui var mapEditor = UiManager.Create_MapEditor(); @@ -140,14 +135,14 @@ //搜索房间按钮点击 private void OnSearchRoomButtonClick() { - if (SelectGroupInfo != null) + if (EditorManager.SelectDungeonGroup != null) { //输入文本 var text = S_RoomSearchInput.Instance.Text; //房间类型 var roomType = S_RoomTypeButton.Instance.GetSelectedId(); - IEnumerable result = SelectGroupInfo.GetAllRoomList(); + IEnumerable result = EditorManager.SelectDungeonGroup.GetAllRoomList(); //名称搜索 if (!string.IsNullOrEmpty(text)) @@ -183,7 +178,7 @@ //创建地牢房间按钮点击 private void OnCreateRoomClick() { - var groupName = SelectGroupInfo != null ? SelectGroupInfo.GroupName : null; + var groupName = EditorManager.SelectDungeonGroup != null ? EditorManager.SelectDungeonGroup.GroupName : null; EditorWindowManager.ShowCreateRoom(groupName, Mathf.Max(S_RoomTypeButton.Instance.Selected - 1, 0), CreateRoom); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index 85b79ee..b6e198c 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -91,10 +91,7 @@ EventManager.EmitEvent(EventEnum.OnClickCenterTool); })); _toolGrid.SelectIndex = 1; - } - - public override void OnShowUi() - { + _eventFactory = EventManager.CreateEventFactory(); _eventFactory.AddEventListener(EventEnum.OnSelectWave, OnSelectWaveTool); _eventFactory.AddEventListener(EventEnum.OnCreateMark, OnCreateMarkTool); @@ -104,14 +101,10 @@ _eventFactory.AddEventListener(EventEnum.OnSelectPreinstall, RefreshMark); } - public override void OnHideUi() + public override void OnDestroyUi() { _eventFactory.RemoveAllEventListener(); _eventFactory = null; - } - - public override void OnDestroyUi() - { S_DoorToolTemplate.Instance.QueueFree(); _toolGrid.Destroy(); } @@ -142,7 +135,7 @@ } _currMarkToolsMap.Clear(); //添加新的数据 - var selectPreinstall = EditorMap.Instance.SelectPreinstallInfo; + var selectPreinstall = EditorManager.SelectPreinstall; if (selectPreinstall != null) { foreach (var markInfos in selectPreinstall.WaveList) @@ -158,8 +151,8 @@ //选中波数 private void OnSelectWaveTool(object arg) { - var selectIndex = (int)arg; - var waveList = EditorMap.Instance.SelectPreinstallInfo.WaveList; + var selectIndex = EditorManager.SelectWaveIndex; + var waveList = EditorManager.SelectPreinstall.WaveList; for (var i = 0; i < waveList.Count; i++) { var wave = waveList[i]; @@ -311,11 +304,11 @@ if (markTool != null) //选中当前 { ActiveMark.OnSelect(); - EventManager.EmitEvent(EventEnum.OnSelectMark, markTool.MarkInfo); + EditorManager.SetSelectMark(markTool.MarkInfo); } else { - EventManager.EmitEvent(EventEnum.OnSelectMark); + EditorManager.SetSelectMark(null); } } diff --git a/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs b/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs index ba6da34..906106d 100644 --- a/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs +++ b/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs @@ -8,142 +8,147 @@ /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Settlement.Bg /// - public Settlement_Bg L_Bg + public Bg L_Bg { get { - if (_L_Bg == null) _L_Bg = new Settlement_Bg(this, GetNodeOrNull("Bg")); + if (_L_Bg == null) _L_Bg = new Bg((SettlementPanel)this, GetNode("Bg")); return _L_Bg; } } - private Settlement_Bg _L_Bg; + private Bg _L_Bg; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Settlement.Title /// - public Settlement_Title L_Title + public Title L_Title { get { - if (_L_Title == null) _L_Title = new Settlement_Title(this, GetNodeOrNull("Title")); + if (_L_Title == null) _L_Title = new Title((SettlementPanel)this, GetNode("Title")); return _L_Title; } } - private Settlement_Title _L_Title; + private Title _L_Title; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Settlement.ButtonList /// - public Settlement_ButtonList L_ButtonList + public ButtonList L_ButtonList { get { - if (_L_ButtonList == null) _L_ButtonList = new Settlement_ButtonList(this, GetNodeOrNull("ButtonList")); + if (_L_ButtonList == null) _L_ButtonList = new ButtonList((SettlementPanel)this, GetNode("ButtonList")); return _L_ButtonList; } } - private Settlement_ButtonList _L_ButtonList; + private ButtonList _L_ButtonList; public Settlement() : base(nameof(Settlement)) { } + public sealed override void OnInitNestedUi() + { + + } + /// /// 类型: , 路径: Settlement.Bg /// - public class Settlement_Bg : UiNode + public class Bg : UiNode { - public Settlement_Bg(Settlement uiPanel, Godot.ColorRect node) : base(uiPanel, node) { } - public override Settlement_Bg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); + public Bg(SettlementPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { } + public override Bg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); } /// /// 类型: , 路径: Settlement.Title /// - public class Settlement_Title : UiNode + public class Title : UiNode { - public Settlement_Title(Settlement uiPanel, Godot.Label node) : base(uiPanel, node) { } - public override Settlement_Title Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + public Title(SettlementPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Title Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// /// 类型: , 路径: Settlement.ButtonList.Restart /// - public class Settlement_Restart : UiNode + public class Restart : UiNode { - public Settlement_Restart(Settlement uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override Settlement_Restart Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + public Restart(SettlementPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Restart Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: Settlement.ButtonList.ToMenu /// - public class Settlement_ToMenu : UiNode + public class ToMenu : UiNode { - public Settlement_ToMenu(Settlement uiPanel, Godot.Button node) : base(uiPanel, node) { } - public override Settlement_ToMenu Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + public ToMenu(SettlementPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override ToMenu Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// /// 类型: , 路径: Settlement.ButtonList /// - public class Settlement_ButtonList : UiNode + public class ButtonList : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Settlement.Restart /// - public Settlement_Restart L_Restart + public Restart L_Restart { get { - if (_L_Restart == null) _L_Restart = new Settlement_Restart(UiPanel, Instance.GetNodeOrNull("Restart")); + if (_L_Restart == null) _L_Restart = new Restart(UiPanel, Instance.GetNode("Restart")); return _L_Restart; } } - private Settlement_Restart _L_Restart; + private Restart _L_Restart; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Settlement.ToMenu /// - public Settlement_ToMenu L_ToMenu + public ToMenu L_ToMenu { get { - if (_L_ToMenu == null) _L_ToMenu = new Settlement_ToMenu(UiPanel, Instance.GetNodeOrNull("ToMenu")); + if (_L_ToMenu == null) _L_ToMenu = new ToMenu(UiPanel, Instance.GetNode("ToMenu")); return _L_ToMenu; } } - private Settlement_ToMenu _L_ToMenu; + private ToMenu _L_ToMenu; - public Settlement_ButtonList(Settlement uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } - public override Settlement_ButtonList Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + public ButtonList(SettlementPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override ButtonList Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Bg /// - public Settlement_Bg S_Bg => L_Bg; + public Bg S_Bg => L_Bg; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Title /// - public Settlement_Title S_Title => L_Title; + public Title S_Title => L_Title; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.Restart /// - public Settlement_Restart S_Restart => L_ButtonList.L_Restart; + public Restart S_Restart => L_ButtonList.L_Restart; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.ToMenu /// - public Settlement_ToMenu S_ToMenu => L_ButtonList.L_ToMenu; + public ToMenu S_ToMenu => L_ButtonList.L_ToMenu; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList /// - public Settlement_ButtonList S_ButtonList => L_ButtonList; + public ButtonList S_ButtonList => L_ButtonList; } diff --git a/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs b/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs index a3a4a60..b0ac795 100644 --- a/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/settlement/SettlementPanel.cs @@ -7,37 +7,46 @@ /// public partial class SettlementPanel : Settlement { - - public override void OnShowUi() + public override void OnCreateUi() { - L_ButtonList.L_Restart.Instance.Pressed += OnRestartClick; - L_ButtonList.L_ToMenu.Instance.Pressed += OnToMenuClick; - } + S_Restart.Instance.Pressed += OnRestartClick; + S_ToMenu.Instance.Pressed += OnToMenuClick; - public override void OnHideUi() - { - L_ButtonList.L_Restart.Instance.Pressed -= OnRestartClick; - L_ButtonList.L_ToMenu.Instance.Pressed -= OnToMenuClick; + if (GameApplication.Instance.DungeonManager.IsEditorMode) //在编辑器模式下打开的Ui + { + S_ToMenu.Instance.Text = "返回编辑器"; + } } - + //重新开始 private void OnRestartClick() { - HideUi(); - GameApplication.Instance.DungeonManager.ExitDungeon(() => + Destroy(); + if (GameApplication.Instance.DungeonManager.IsEditorMode) //在编辑器模式下打开的Ui { - GameApplication.Instance.DungeonManager.LoadDungeon(GameApplication.Instance.DungeonConfig); - }); + EditorPlayManager.Restart(); + } + else //正常重新开始 + { + GameApplication.Instance.DungeonManager.RestartDungeon(GameApplication.Instance.DungeonConfig); + } } //回到主菜单 private void OnToMenuClick() { - HideUi(); - GameApplication.Instance.DungeonManager.ExitDungeon(() => + Destroy(); + if (GameApplication.Instance.DungeonManager.IsEditorMode) //在编辑器模式下打开的Ui { - UiManager.Open_Main(); - }); + EditorPlayManager.Exit(); + } + else //正常关闭Ui + { + GameApplication.Instance.DungeonManager.ExitDungeon(() => + { + UiManager.Open_Main(); + }); + } } }