diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn index 664092a..fc282cb 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://b4u66mxndxbrg"] +[gd_scene load_steps=8 format=3 uid="uid://b4u66mxndxbrg"] [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/MapEditorToolsPanel.cs" id="1_mqp1c"] [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorHoverArea.cs" id="2_6qfy3"] @@ -6,6 +6,7 @@ [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorDragArea.cs" id="3_3w0w6"] [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorDragButton.cs" id="3_45muq"] [ext_resource type="Texture2D" uid="uid://4wupcp53rrpi" path="res://resource/sprite/ui/mapEditorTools/DoorDragButton.png" id="3_trbb5"] +[ext_resource type="Texture2D" uid="uid://cuntr7hec044f" path="res://resource/sprite/ui/mapEditorTools/ToolSelect.png" id="7_mqmd6"] [node name="MapEditorTools" type="Control"] layout_mode = 3 @@ -33,7 +34,7 @@ offset_top = -36.0 offset_right = 160.0 grow_vertical = 0 -color = Color(1, 1, 1, 0.313726) +color = Color(1, 1, 1, 0) script = ExtResource("2_6qfy3") [node name="E_HoverRoot" type="Control" parent="DoorToolRoot"] @@ -48,7 +49,7 @@ offset_top = -36.0 offset_right = 160.0 grow_vertical = 0 -color = Color(1, 1, 1, 0.313726) +color = Color(1, 1, 1, 0) script = ExtResource("2_6qfy3") [node name="S_HoverRoot" type="Control" parent="DoorToolRoot"] @@ -65,7 +66,7 @@ offset_top = -36.0 offset_right = 160.0 grow_vertical = 0 -color = Color(1, 1, 1, 0.313726) +color = Color(1, 1, 1, 0) script = ExtResource("2_6qfy3") [node name="W_HoverRoot" type="Control" parent="DoorToolRoot"] @@ -81,7 +82,7 @@ offset_top = -36.0 offset_right = 160.0 grow_vertical = 0 -color = Color(1, 1, 1, 0.313726) +color = Color(1, 1, 1, 0) script = ExtResource("2_6qfy3") [node name="HoverPreviewRoot" type="Control" parent="DoorToolRoot"] @@ -152,38 +153,21 @@ anchors_preset = 1 anchor_left = 1.0 anchor_right = 1.0 -offset_left = -288.0 +offset_left = -84.0 offset_top = 19.0 offset_right = -20.0 offset_bottom = 83.0 grow_horizontal = 0 -[node name="HandTool" type="TextureButton" parent="HBoxContainer"] +[node name="ToolButton" type="TextureButton" parent="HBoxContainer"] layout_mode = 2 texture_normal = ExtResource("2_rwvbg") -texture_pressed = ExtResource("2_rwvbg") -texture_hover = ExtResource("2_rwvbg") -[node name="PenTool" type="TextureButton" parent="HBoxContainer"] -layout_mode = 2 -texture_normal = ExtResource("2_rwvbg") -texture_pressed = ExtResource("2_rwvbg") -texture_hover = ExtResource("2_rwvbg") - -[node name="RectTool" type="TextureButton" parent="HBoxContainer"] -layout_mode = 2 -texture_normal = ExtResource("2_rwvbg") -texture_pressed = ExtResource("2_rwvbg") -texture_hover = ExtResource("2_rwvbg") - -[node name="DoorTool" type="TextureButton" parent="HBoxContainer"] -layout_mode = 2 -texture_normal = ExtResource("2_rwvbg") -texture_pressed = ExtResource("2_rwvbg") -texture_hover = ExtResource("2_rwvbg") - -[node name="CenterTool" type="TextureButton" parent="HBoxContainer"] -layout_mode = 2 -texture_normal = ExtResource("2_rwvbg") -texture_pressed = ExtResource("2_rwvbg") -texture_hover = ExtResource("2_rwvbg") +[node name="Select" type="TextureRect" parent="HBoxContainer/ToolButton"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("7_mqmd6") 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 8d68ef1..58824e2 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":-8,"Y":-5},"Size":{"X":22,"Y":20},"DoorAreaInfos":[{"Direction":1,"Start":48,"End":272},{"Direction":2,"Start":192,"End":320},{"Direction":0,"Start":64,"End":288},{"Direction":3,"Start":32,"End":240}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""} \ No newline at end of file +{"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 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 3b1bc6d..780e273 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,-56,120,-56,120,8,200,8,200,224,88,224,88,112,-40,112,-40,208,-104,208,-104,-8,-88,-8,-88,-24,-72,-24]},{"Type":1,"Points":[-40,-32,56,-32,56,72,-8,72,-8,40,-40,40]}],"Floor":[-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,-5,4,0,0,8,-5,5,0,0,8,-5,6,0,0,8,-5,7,0,0,8,-5,8,0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,-5,13,0,2,2,-4,13,0,2,2,-3,13,0,2,2,-2,-2,0,1,2,-2,-1,0,1,3,-2,0,0,1,3,-2,7,0,1,2,-2,8,0,1,3,-2,9,0,1,3,-2,10,0,1,3,-2,11,0,1,3,-2,12,0,1,3,-2,13,0,13,2,-1,-2,0,2,2,-1,7,0,2,2,0,-2,0,2,2,0,1,0,1,4,0,2,0,1,3,0,7,0,2,2,1,-2,0,2,2,1,7,0,2,2,2,-2,0,3,2,2,-1,0,3,3,2,0,0,3,3,2,1,0,3,3,2,2,0,3,3,2,7,0,2,2,3,7,0,2,2,4,7,0,3,2,4,8,0,3,3,4,9,0,3,3,4,10,0,3,3,4,11,0,3,3,4,12,0,3,3,4,13,0,3,3,4,14,0,11,2,5,14,0,2,2,6,14,0,2,2,7,14,0,2,2,8,-5,0,1,4,8,-4,0,1,3,8,-3,0,1,3,8,-2,0,1,3,8,14,0,2,2,9,14,0,2,2,10,14,0,2,2,11,14,0,2,2,12,14,0,2,2,13,-1,0,1,4,13,0,0,1,3,13,1,0,1,3,13,2,0,1,3,13,3,0,1,3,13,4,0,1,3,13,5,0,1,3,13,6,0,1,3,13,7,0,1,3,13,8,0,1,3,13,9,0,1,3,13,10,0,1,3,13,11,0,1,3,13,12,0,1,3,13,13,0,1,3,13,14,0,13,2]} \ No newline at end of file +{"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,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,-8,-3,0,0,8,-8,-4,0,0,8,-6,-3,0,0,8,-6,-4,0,0,8,-6,12,0,0,8,-6,11,0,0,8,-6,10,0,0,8,-6,9,0,0,8,-6,8,0,0,8,-6,7,0,0,8,-6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3,-9,5,0,3,3,-9,6,0,3,3,-9,7,0,11,2,-8,7,0,3,2,-8,8,0,3,3,-8,9,0,3,3,-8,10,0,3,3,-8,11,0,3,3,-8,12,0,3,3,-8,13,0,11,2,-7,13,0,2,2,-6,13,0,2,2,-5,13,0,2,2,-4,13,0,2,2,-3,13,0,2,2,-2,-2,0,1,2,-2,-1,0,1,3,-2,0,0,1,3,-2,7,0,1,2,-2,8,0,1,3,-2,9,0,1,3,-2,10,0,1,3,-2,11,0,1,3,-2,12,0,1,3,-2,13,0,13,2,-1,-2,0,2,2,-1,7,0,2,2,0,-2,0,2,2,0,1,0,1,4,0,2,0,1,3,0,7,0,2,2,1,-2,0,2,2,1,7,0,2,2,2,-2,0,3,2,2,-1,0,3,3,2,0,0,3,3,2,1,0,3,3,2,2,0,3,3,2,7,0,2,2,3,7,0,2,2,4,7,0,3,2,4,8,0,3,3,4,9,0,3,3,4,10,0,3,3,4,11,0,3,3,4,12,0,3,3,4,13,0,3,3,4,14,0,11,2,5,14,0,2,2,6,14,0,2,2,7,14,0,2,2,8,-5,0,1,4,8,-4,0,1,3,8,-3,0,1,3,8,-2,0,1,3,8,14,0,2,2,9,14,0,2,2,10,14,0,2,2,11,14,0,2,2,12,14,0,2,2,13,-1,0,1,4,13,0,0,1,3,13,1,0,1,3,13,2,0,1,3,13,3,0,1,3,13,4,0,1,3,13,5,0,1,3,13,6,0,1,3,13,7,0,1,3,13,8,0,1,3,13,9,0,1,3,13,10,0,1,3,13,11,0,1,3,13,12,0,1,3,13,13,0,1,3,13,14,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png new file mode 100644 index 0000000..b80b4ba --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png.import new file mode 100644 index 0000000..7410a6c --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/AreaTool.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://b7w6pbk7aucee" +path="res://.godot/imported/AreaTool.png-3c7e64e3d5aded201fb8eb7fce2fc4c0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/AreaTool.png" +dest_files=["res://.godot/imported/AreaTool.png-3c7e64e3d5aded201fb8eb7fce2fc4c0.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/mapEditorTools/CenterTool.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/CenterTool.png new file mode 100644 index 0000000..d980ce2 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/CenterTool.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/CenterTool.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/CenterTool.png.import new file mode 100644 index 0000000..94af517 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/CenterTool.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d2wslibovwv7w" +path="res://.godot/imported/CenterTool.png-79d25e576bc6161126fe504f63db716b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/CenterTool.png" +dest_files=["res://.godot/imported/CenterTool.png-79d25e576bc6161126fe504f63db716b.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/mapEditorTools/DoorTool.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DoorTool.png new file mode 100644 index 0000000..65fb793 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DoorTool.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DoorTool.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DoorTool.png.import new file mode 100644 index 0000000..aa23d3f --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DoorTool.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dxpdjj1abmejh" +path="res://.godot/imported/DoorTool.png-925b770373cff91f0d55e409d76d38c3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/DoorTool.png" +dest_files=["res://.godot/imported/DoorTool.png-925b770373cff91f0d55e409d76d38c3.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/mapEditorTools/Drag.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/Drag.png.import new file mode 100644 index 0000000..2a71a9a --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/Drag.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dnmjw2kwhcglk" +path="res://.godot/imported/Drag.png-409587e9ceac82665e6dd81c87944b46.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/Drag.png" +dest_files=["res://.godot/imported/Drag.png-409587e9ceac82665e6dd81c87944b46.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/mapEditorTools/DragTool.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DragTool.png new file mode 100644 index 0000000..7d3f566 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DragTool.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DragTool.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DragTool.png.import new file mode 100644 index 0000000..10dce0b --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/DragTool.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cf5jw35388hto" +path="res://.godot/imported/DragTool.png-75d0f0dea214f2697f192ec3abc85fff.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/DragTool.png" +dest_files=["res://.godot/imported/DragTool.png-75d0f0dea214f2697f192ec3abc85fff.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/mapEditorTools/PenTool.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/PenTool.png new file mode 100644 index 0000000..d3bca0b --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/PenTool.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/PenTool.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/PenTool.png.import new file mode 100644 index 0000000..3d50960 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/PenTool.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://c8yxnnif4j2ov" +path="res://.godot/imported/PenTool.png-ff76effc9da04ac9923ff0b95925a1ab.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/PenTool.png" +dest_files=["res://.godot/imported/PenTool.png-ff76effc9da04ac9923ff0b95925a1ab.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/mapEditorTools/ToolSelect.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png new file mode 100644 index 0000000..033354b --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import new file mode 100644 index 0000000..1d048bd --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cuntr7hec044f" +path="res://.godot/imported/ToolSelect.png-5b1837e456ff32d51515f4fadfb6daea.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/mapEditorTools/ToolSelect.png" +dest_files=["res://.godot/imported/ToolSelect.png-5b1837e456ff32d51515f4fadfb6daea.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/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index fe3dac2..2227e2f 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -353,7 +353,7 @@ throw new Exception($"cellType 无法转为'{typeof(UiCell).FullName}'类型!"); } _cellList.Add(uiCell); - uiCell.Init(this, (TUiCellNode)_template.CloneUiCell(), _cellList.Count); + uiCell.Init(this, (TUiCellNode)_template.CloneUiCell(), _cellList.Count - 1); uiCell.OnEnable(); return uiCell; } diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs index 5b532d2..e86f2df 100644 --- a/DungeonShooting_Godot/src/game/event/EventEnum.cs +++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs @@ -73,4 +73,24 @@ /// 创建地牢房间完成时调用, 参数为 /// OnCreateRoomFinish, + /// + /// 选中拖拽工具 + /// + OnSelectDragTool, + /// + /// 选中绘制工具 + /// + OnSelectPenTool, + /// + /// 选中绘制区域工具 + /// + OnSelectRectTool, + /// + /// 选中编辑门区域工具 + /// + OnSelectDoorTool, + /// + /// 点击跳转到地图中心点 + /// + OnClickCenterTool, } diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 92600c3..b8caa60 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -60,7 +60,6 @@ public const string prefab_ui_MapEditorTools_tscn = "res://prefab/ui/MapEditorTools.tscn"; public const string prefab_ui_RoomUI_tscn = "res://prefab/ui/RoomUI.tscn"; public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn"; - public const string prefab_ui_TesetUi_tscn = "res://prefab/ui/TesetUi.tscn"; public const string prefab_weapon_Weapon0001_tscn = "res://prefab/weapon/Weapon0001.tscn"; public const string prefab_weapon_Weapon0002_tscn = "res://prefab/weapon/Weapon0002.tscn"; public const string prefab_weapon_Weapon0003_tscn = "res://prefab/weapon/Weapon0003.tscn"; @@ -177,9 +176,14 @@ public const string resource_sprite_ui_mapEditorProject_Back_png = "res://resource/sprite/ui/mapEditorProject/Back.png"; public const string resource_sprite_ui_mapEditorProject_CellBg_png = "res://resource/sprite/ui/mapEditorProject/CellBg.png"; public const string resource_sprite_ui_mapEditorProject_Search_png = "res://resource/sprite/ui/mapEditorProject/Search.png"; + public const string resource_sprite_ui_mapEditorTools_AreaTool_png = "res://resource/sprite/ui/mapEditorTools/AreaTool.png"; + public const string resource_sprite_ui_mapEditorTools_CenterTool_png = "res://resource/sprite/ui/mapEditorTools/CenterTool.png"; public const string resource_sprite_ui_mapEditorTools_DoorDragButton_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton.png"; public const string resource_sprite_ui_mapEditorTools_DoorDragButton_down_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton_down.png"; public const string resource_sprite_ui_mapEditorTools_DoorDragButton_hover_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton_hover.png"; + public const string resource_sprite_ui_mapEditorTools_DoorTool_png = "res://resource/sprite/ui/mapEditorTools/DoorTool.png"; + public const string resource_sprite_ui_mapEditorTools_DragTool_png = "res://resource/sprite/ui/mapEditorTools/DragTool.png"; + public const string resource_sprite_ui_mapEditorTools_PenTool_png = "res://resource/sprite/ui/mapEditorTools/PenTool.png"; public const string resource_sprite_ui_roomUI_ChargeProgress_png = "res://resource/sprite/ui/roomUI/ChargeProgress.png"; public const string resource_sprite_ui_roomUI_ChargeProgressBar_png = "res://resource/sprite/ui/roomUI/ChargeProgressBar.png"; public const string resource_sprite_ui_roomUI_Cooldown_png = "res://resource/sprite/ui/roomUI/Cooldown.png"; diff --git a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs index 9661ce0..77bff0c 100644 --- a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs @@ -38,7 +38,7 @@ //点击开发者工具 private void OnToolsClick() { - UiManager.Open_MapEditor(); + UiManager.Open_MapEditorProject(); HideUi(); } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index 0544fcd..ffda939 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -74,7 +74,7 @@ /// /// 左键功能 /// - public MouseButtonType MouseType { get; set; } = MouseButtonType.Area; + public MouseButtonType MouseType { get; set; } = MouseButtonType.Pen; //鼠标坐标 private Vector2 _mousePosition; @@ -396,7 +396,7 @@ var tileInfo = roomSplit.TileInfo; _roomPosition = roomInfo.Position.AsVector2I(); - SetMapSize(roomInfo.Size.AsVector2I()); + SetMapSize(roomInfo.Size.AsVector2I(), true); _doorConfigs.Clear(); foreach (var doorAreaInfo in roomInfo.DoorAreaInfos) { @@ -416,7 +416,7 @@ //聚焦 //MapEditorPanel.CallDelay(0.1f, OnClickCenterTool); - CallDeferred(nameof(OnClickCenterTool)); + //CallDeferred(nameof(OnClickCenterTool), null); //加载门编辑区域 foreach (var doorAreaInfo in _doorConfigs) @@ -575,14 +575,11 @@ } //重新计算房间区域 - private void CalcTileRect(bool sendMessage) + private void CalcTileRect(bool refreshDoorTrans) { var rect = GetUsedRect(); _roomPosition = rect.Position; - if (sendMessage) - { - SetMapSize(rect.Size); - } + SetMapSize(rect.Size, refreshDoorTrans); } //检测是否有不合规的图块, 返回true表示图块正常 @@ -738,7 +735,7 @@ /// /// 选中拖拽功能 /// - public void OnSelectHandTool() + public void OnSelectHandTool(object arg) { MouseType = MouseButtonType.Drag; } @@ -746,7 +743,7 @@ /// /// 选中画笔攻击 /// - public void OnSelectPenTool() + public void OnSelectPenTool(object arg) { MouseType = MouseButtonType.Pen; } @@ -754,7 +751,7 @@ /// /// 选中绘制区域功能 /// - public void OnSelectRectTool() + public void OnSelectRectTool(object arg) { MouseType = MouseButtonType.Area; } @@ -762,7 +759,7 @@ /// /// 选择编辑门区域 /// - public void OnSelectDoorTool() + public void OnSelectDoorTool(object arg) { MouseType = MouseButtonType.Door; } @@ -770,7 +767,7 @@ /// /// 聚焦 /// - public void OnClickCenterTool() + public void OnClickCenterTool(object arg) { var pos = MapEditorPanel.S_SubViewport.Instance.Size / 2; if (_roomSize.X == 0 && _roomSize.Y == 0) //聚焦原点 @@ -915,12 +912,16 @@ } //设置地图大小 - private void SetMapSize(Vector2I size) + private void SetMapSize(Vector2I size, bool refreshDoorTrans) { if (_roomSize != size) { _roomSize = size; - MapEditorToolsPanel.SetDoorHoverToolTransform(_roomPosition, _roomSize); + + if (refreshDoorTrans) + { + MapEditorToolsPanel.SetDoorHoverToolTransform(_roomPosition, _roomSize); + } } } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs index a507e40..bc50836 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs @@ -6,6 +6,7 @@ { private MapEditorPanel _editorPanel; private MapEditor.TileMap _editorTileMap; + private EventFactory _eventFactory; public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.TileMap editorTileMap) { @@ -14,28 +15,24 @@ _editorTileMap.Instance.MapEditorPanel = editorPanel; _editorTileMap.Instance.MapEditorToolsPanel = editorPanel.S_MapEditorTools.Instance; _editorTileMap.Instance.MapEditorToolsPanel.EditorMap = _editorTileMap; + + _eventFactory = EventManager.CreateEventFactory(); } public void OnShow() { _editorTileMap.L_Brush.Instance.Draw += OnDrawGuides; - var mapEditorToolsPanel = _editorPanel.S_MapEditorTools.Instance; - mapEditorToolsPanel.S_HandTool.Instance.Pressed += _editorTileMap.Instance.OnSelectHandTool; - mapEditorToolsPanel.S_PenTool.Instance.Pressed += _editorTileMap.Instance.OnSelectPenTool; - mapEditorToolsPanel.S_RectTool.Instance.Pressed += _editorTileMap.Instance.OnSelectRectTool; - mapEditorToolsPanel.S_DoorTool.Instance.Pressed += _editorTileMap.Instance.OnSelectDoorTool; - mapEditorToolsPanel.S_CenterTool.Instance.Pressed += _editorTileMap.Instance.OnClickCenterTool; + _eventFactory.AddEventListener(EventEnum.OnSelectDragTool, _editorTileMap.Instance.OnSelectHandTool); + _eventFactory.AddEventListener(EventEnum.OnSelectPenTool, _editorTileMap.Instance.OnSelectPenTool); + _eventFactory.AddEventListener(EventEnum.OnSelectRectTool, _editorTileMap.Instance.OnSelectRectTool); + _eventFactory.AddEventListener(EventEnum.OnSelectDoorTool, _editorTileMap.Instance.OnSelectDoorTool); + _eventFactory.AddEventListener(EventEnum.OnClickCenterTool, _editorTileMap.Instance.OnClickCenterTool); } public void OnHide() { _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides; - var mapEditorToolsPanel = _editorPanel.S_MapEditorTools.Instance; - mapEditorToolsPanel.S_HandTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectHandTool; - mapEditorToolsPanel.S_PenTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectPenTool; - mapEditorToolsPanel.S_RectTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectRectTool; - mapEditorToolsPanel.S_DoorTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectDoorTool; - mapEditorToolsPanel.S_CenterTool.Instance.Pressed -= _editorTileMap.Instance.OnClickCenterTool; + _eventFactory.RemoveAllEventListener(); } public void Process(float delta) diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs index dba79c1..a792307 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs @@ -358,48 +358,34 @@ } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.HandTool + /// 类型: , 路径: MapEditorTools.HBoxContainer.ToolButton.Select /// - public class HandTool : UiNode + public class Select : UiNode { - public HandTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override HandTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public Select(MapEditorTools uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override Select Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.PenTool + /// 类型: , 路径: MapEditorTools.HBoxContainer.ToolButton /// - public class PenTool : UiNode + public class ToolButton : UiNode { - public PenTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override PenTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); - } + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.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; - /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.RectTool - /// - public class RectTool : UiNode - { - public RectTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override RectTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.DoorTool - /// - public class DoorTool : UiNode - { - public DoorTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override DoorTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.CenterTool - /// - public class CenterTool : UiNode - { - public CenterTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override CenterTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public ToolButton(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public override ToolButton Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// @@ -408,69 +394,17 @@ public class HBoxContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.HandTool + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.ToolButton /// - public HandTool L_HandTool + public ToolButton L_ToolButton { get { - if (_L_HandTool == null) _L_HandTool = new HandTool(UiPanel, Instance.GetNodeOrNull("HandTool")); - return _L_HandTool; + if (_L_ToolButton == null) _L_ToolButton = new ToolButton(UiPanel, Instance.GetNodeOrNull("ToolButton")); + return _L_ToolButton; } } - private HandTool _L_HandTool; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.PenTool - /// - public PenTool L_PenTool - { - get - { - if (_L_PenTool == null) _L_PenTool = new PenTool(UiPanel, Instance.GetNodeOrNull("PenTool")); - return _L_PenTool; - } - } - private PenTool _L_PenTool; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.RectTool - /// - public RectTool L_RectTool - { - get - { - if (_L_RectTool == null) _L_RectTool = new RectTool(UiPanel, Instance.GetNodeOrNull("RectTool")); - return _L_RectTool; - } - } - private RectTool _L_RectTool; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.DoorTool - /// - public DoorTool L_DoorTool - { - get - { - if (_L_DoorTool == null) _L_DoorTool = new DoorTool(UiPanel, Instance.GetNodeOrNull("DoorTool")); - return _L_DoorTool; - } - } - private DoorTool _L_DoorTool; - - /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.CenterTool - /// - public CenterTool L_CenterTool - { - get - { - if (_L_CenterTool == null) _L_CenterTool = new CenterTool(UiPanel, Instance.GetNodeOrNull("CenterTool")); - return _L_CenterTool; - } - } - private CenterTool _L_CenterTool; + private ToolButton _L_ToolButton; public HBoxContainer(MapEditorTools uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); @@ -553,29 +487,14 @@ public DoorToolRoot S_DoorToolRoot => L_DoorToolRoot; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.HandTool + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.ToolButton.Select /// - public HandTool S_HandTool => L_HBoxContainer.L_HandTool; + public Select S_Select => L_HBoxContainer.L_ToolButton.L_Select; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.PenTool + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.ToolButton /// - public PenTool S_PenTool => L_HBoxContainer.L_PenTool; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.RectTool - /// - public RectTool S_RectTool => L_HBoxContainer.L_RectTool; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.DoorTool - /// - public DoorTool S_DoorTool => L_HBoxContainer.L_DoorTool; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.CenterTool - /// - public CenterTool S_CenterTool => L_HBoxContainer.L_CenterTool; + public ToolButton S_ToolButton => L_HBoxContainer.L_ToolButton; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index dfa784d..36a21a3 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -7,6 +7,20 @@ public partial class MapEditorToolsPanel : MapEditorTools { + public class ToolBtnData + { + public bool CanSelect = false; + public string Icon; + public Action OnClick; + + public ToolBtnData(bool canSelect, string icon, Action onClick) + { + CanSelect = canSelect; + Icon = icon; + OnClick = onClick; + } + } + /// /// 鼠标悬停区域 /// @@ -18,6 +32,7 @@ public MapEditor.MapEditor.TileMap EditorMap { get; set; } private List _doorTools = new List(); + private UiGrid _toolGrid; public override void OnCreateUi() { @@ -26,16 +41,46 @@ S_W_HoverArea.Instance.Init(this, DoorDirection.W); S_E_HoverArea.Instance.Init(this, DoorDirection.E); S_DoorToolRoot.Instance.RemoveChild(S_DoorToolTemplate.Instance); + + _toolGrid = new UiGrid(S_ToolButton, typeof(ToolButtonCell)); + _toolGrid.SetColumns(10); + //拖拽按钮 + _toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_mapEditorTools_DragTool_png, () => + { + EventManager.EmitEvent(EventEnum.OnSelectDragTool); + })); + //画笔按钮 + _toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_mapEditorTools_PenTool_png, () => + { + EventManager.EmitEvent(EventEnum.OnSelectPenTool); + })); + //绘制区域按钮 + _toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_mapEditorTools_AreaTool_png, () => + { + EventManager.EmitEvent(EventEnum.OnSelectRectTool); + })); + //编辑门区域按钮 + _toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_mapEditorTools_DoorTool_png, () => + { + EventManager.EmitEvent(EventEnum.OnSelectDoorTool); + })); + //聚焦按钮 + _toolGrid.Add(new ToolBtnData(false, ResourcePath.resource_sprite_ui_mapEditorTools_CenterTool_png, () => + { + EventManager.EmitEvent(EventEnum.OnClickCenterTool); + })); + _toolGrid.SelectIndex = 1; } public override void OnShowUi() { - S_PenTool.Instance.EmitSignal(BaseButton.SignalName.Pressed); + EventManager.EmitEvent(EventEnum.OnClickCenterTool); } public override void OnDestroyUi() { S_DoorToolTemplate.Instance.QueueFree(); + _toolGrid.Destroy(); } public override void Process(float delta) diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs new file mode 100644 index 0000000..3f18bcb --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs @@ -0,0 +1,34 @@ +namespace UI.MapEditorTools; + +public class ToolButtonCell : UiCell +{ + public override void OnInit() + { + CellNode.Instance.Pressed += OnClick; + CellNode.L_Select.Instance.Visible = false; + } + + public override void OnSetData(MapEditorToolsPanel.ToolBtnData data) + { + CellNode.Instance.TextureNormal = ResourceManager.LoadTexture2D(data.Icon); + } + + public override void OnSelect() + { + CellNode.L_Select.Instance.Visible = true; + } + + public override void OnUnSelect() + { + CellNode.L_Select.Instance.Visible = false; + } + + private void OnClick() + { + if (Data.CanSelect) + { + Grid.SelectIndex = Index; + } + Data.OnClick(); + } +} \ No newline at end of file