diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn index 0d36e86..d1e555b 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=8 format=3 uid="uid://csbxfkdupsckv"] [ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"] -[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="2_vrg60"] +[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileSet/TileSet1.tres" id="2_vrg60"] [ext_resource type="Script" path="res://src/game/ui/mapEditor/TileView/EditorTileMap.cs" id="2_waq8f"] [ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/mapEditor/ErrorCell.png" id="4_465u2"] @@ -84,7 +84,7 @@ grow_horizontal = 2 grow_vertical = 2 -[node name="HSplitContainer" type="HSplitContainer" parent="Bg"] +[node name="VBoxContainer" type="VBoxContainer" parent="Bg"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -92,32 +92,58 @@ grow_horizontal = 2 grow_vertical = 2 -[node name="Left" type="Panel" parent="Bg/HSplitContainer"] -custom_minimum_size = Vector2(1000, 0) +[node name="Head" type="Panel" parent="Bg/VBoxContainer"] +custom_minimum_size = Vector2(0, 70) layout_mode = 2 -[node name="MapView" type="SubViewportContainer" parent="Bg/HSplitContainer/Left"] +[node name="Back" type="Button" parent="Bg/VBoxContainer/Head"] +layout_mode = 2 +offset_left = 12.0 +offset_top = 8.0 +offset_right = 88.0 +offset_bottom = 62.0 +size_flags_horizontal = 0 +text = "←" + +[node name="HSplitContainer" type="HSplitContainer" parent="Bg/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Left" type="Panel" parent="Bg/VBoxContainer/HSplitContainer"] +custom_minimum_size = Vector2(1000, 0) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 7.0 + +[node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/HSplitContainer/Left"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +theme_override_constants/margin_left = 2 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 2 +theme_override_constants/margin_bottom = 2 -[node name="SubViewport" type="SubViewport" parent="Bg/HSplitContainer/Left/MapView"] +[node name="MapView" type="SubViewportContainer" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer"] +layout_mode = 2 + +[node name="SubViewport" type="SubViewport" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView"] handle_input_locally = false canvas_item_default_texture_filter = 0 -size = Vector2i(1000, 1080) +size = Vector2i(1334, 1002) render_target_update_mode = 4 -[node name="TileMap" type="TileMap" parent="Bg/HSplitContainer/Left/MapView/SubViewport"] +[node name="TileMap" type="TileMap" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport"] position = Vector2(500, 540) scale = Vector2(4, 4) tile_set = ExtResource("2_vrg60") format = 2 script = ExtResource("2_waq8f") -[node name="ErrorCell" type="Sprite2D" parent="Bg/HSplitContainer/Left/MapView/SubViewport/TileMap"] +[node name="ErrorCell" type="Sprite2D" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport/TileMap"] visible = false modulate = Color(1, 0, 0, 0) z_index = 10 @@ -125,17 +151,19 @@ texture = ExtResource("4_465u2") centered = false -[node name="ErrorCellAnimationPlayer" type="AnimationPlayer" parent="Bg/HSplitContainer/Left/MapView/SubViewport/TileMap/ErrorCell"] +[node name="ErrorCellAnimationPlayer" type="AnimationPlayer" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport/TileMap/ErrorCell"] libraries = { "": SubResource("AnimationLibrary_371oi") } -[node name="Brush" type="Node2D" parent="Bg/HSplitContainer/Left/MapView/SubViewport/TileMap"] +[node name="Brush" type="Node2D" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport/TileMap"] z_index = 100 -[node name="CanvasLayer" type="CanvasLayer" parent="Bg/HSplitContainer/Left/MapView/SubViewport"] +[node name="CanvasLayer" type="CanvasLayer" parent="Bg/VBoxContainer/HSplitContainer/Left/MarginContainer/MapView/SubViewport"] layer = 2 -[node name="Right" type="Panel" parent="Bg/HSplitContainer"] +[node name="Right" type="Panel" parent="Bg/VBoxContainer/HSplitContainer"] custom_minimum_size = Vector2(300, 0) layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 3.0 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn index 7474df9..42c7728 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=4 format=3 uid="uid://dh7y03tq6v0a2"] +[gd_scene load_steps=3 format=3 uid="uid://dh7y03tq6v0a2"] [ext_resource type="Script" path="res://src/game/ui/mapEditorProject/MapEditorProjectPanel.cs" id="1_5aioo"] -[ext_resource type="Texture2D" uid="uid://chd1r5artktp" path="res://resource/sprite/ui/mapEditorProject/CellBg.png" id="2_6xs3a"] [ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_xh3iw"] [node name="MapEditorProject" type="Control"] @@ -31,19 +30,18 @@ grow_vertical = 2 theme_override_constants/separation = 0 -[node name="Panel" type="Panel" parent="Bg/VBoxContainer"] -custom_minimum_size = Vector2(0, 150) +[node name="Head" type="Panel" parent="Bg/VBoxContainer"] +custom_minimum_size = Vector2(0, 70) layout_mode = 2 -[node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/Panel"] +[node name="Back" type="Button" parent="Bg/VBoxContainer/Head"] layout_mode = 2 -offset_top = 4.0 -offset_right = 1920.0 -offset_bottom = 44.0 -theme_override_constants/margin_left = 20 -theme_override_constants/margin_top = 20 -theme_override_constants/margin_right = 20 -theme_override_constants/margin_bottom = 20 +offset_left = 12.0 +offset_top = 8.0 +offset_right = 88.0 +offset_bottom = 62.0 +size_flags_horizontal = 0 +text = "←" [node name="HBoxContainer" type="HBoxContainer" parent="Bg/VBoxContainer"] layout_mode = 2 @@ -53,7 +51,7 @@ [node name="Panel" type="Panel" parent="Bg/VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 -size_flags_stretch_ratio = 3.0 +size_flags_stretch_ratio = 2.0 [node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel"] layout_mode = 1 @@ -81,7 +79,7 @@ [node name="Panel2" type="Panel" parent="Bg/VBoxContainer/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 -size_flags_stretch_ratio = 7.0 +size_flags_stretch_ratio = 8.0 [node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel2"] layout_mode = 1 @@ -98,19 +96,18 @@ [node name="ScrollContainer" type="ScrollContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer"] layout_mode = 2 -[node name="RoomButton" type="TextureButton" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/ScrollContainer"] +[node name="RoomButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/ScrollContainer"] custom_minimum_size = Vector2(200, 285) layout_mode = 2 -texture_normal = ExtResource("2_6xs3a") -texture_pressed = ExtResource("2_6xs3a") -texture_hover = ExtResource("2_6xs3a") -stretch_mode = 0 [node name="PreviewImage" type="TextureRect" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/ScrollContainer/RoomButton"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +offset_left = 2.0 +offset_top = 2.0 +offset_right = -2.0 offset_bottom = -85.0 grow_horizontal = 2 grow_vertical = 2 diff --git a/DungeonShooting_Godot/resource/map/RoomConfig.json b/DungeonShooting_Godot/resource/map/RoomConfig.json index d761905..d3c7171 100644 --- a/DungeonShooting_Godot/resource/map/RoomConfig.json +++ b/DungeonShooting_Godot/resource/map/RoomConfig.json @@ -1,56 +1,56 @@ { "testGroup": { - "GroupName": "testGroup", - "BattleList": [ - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room1.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room1.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room2.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room2.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room3.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room3.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room4.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room4.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room5.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room5.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room6.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room6.json" - }, - { - "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room8.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room8.json" - } - ], - "InletList": [ - { - "ScenePath": "res://resource/map/tileMaps/testGroup/inlet/Room1.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/inlet/Room1.json" - } - ], - "OutletList": [ - { - "ScenePath": "res://resource/map/tileMaps/testGroup/outlet/Room1.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/outlet/Room1.json" - } - ], - "BossList": [ - { - "ScenePath": "res://resource/map/tileMaps/testGroup/boss/Room1.tscn", - "RoomPath": "res://resource/map/tiledata/testGroup/boss/Room1.json" - } - ], - "RewardList": [], - "ShopList": [], - "EventList": [] + "GroupName": "testGroup", + "BattleList": [ + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room1.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room1.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room2.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room2.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room3.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room3.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room4.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room4.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room5.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room5.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room6.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room6.json" + }, + { + "ScenePath": "res://resource/map/tileMaps/testGroup/battle/Room8.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/battle/Room8.json" + } + ], + "InletList": [ + { + "ScenePath": "res://resource/map/tileMaps/testGroup/inlet/Room1.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/inlet/Room1.json" + } + ], + "OutletList": [ + { + "ScenePath": "res://resource/map/tileMaps/testGroup/outlet/Room1.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/outlet/Room1.json" + } + ], + "BossList": [ + { + "ScenePath": "res://resource/map/tileMaps/testGroup/boss/Room1.tscn", + "RoomPath": "res://resource/map/tiledata/testGroup/boss/Room1.json" + } + ], + "RewardList": [], + "ShopList": [], + "EventList": [] } -} \ No newline at end of file +} diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_roomInfo.json index d961ca6..3ad1530 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_roomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_roomInfo.json @@ -1 +1 @@ -{"Position":{"X":-8,"Y":-6},"Size":{"X":18,"Y":16},"DoorAreaInfos":[],"GroupName":"testGroup2","RoomType":0,"FileName":"Room1","Weight":100} \ No newline at end of file +{"Position":{"X":-7,"Y":-5},"Size":{"X":16,"Y":14},"DoorAreaInfos":[],"GroupName":"testGroup2","RoomType":0,"FileName":"Room1","Weight":100} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_tileInfo.json index 155b1e9..dc5674d 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_tileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/testGroup2/battle/Room1/Room1_tileInfo.json @@ -1 +1 @@ -{"NavigationList":[{"Type":0,"Points":[-104,-72,136,-72,136,144,-104,144]},{"Type":1,"Points":[-72,-32,-8,-32,-8,24,-72,24]},{"Type":1,"Points":[40,-32,104,-32,104,24,40,24]},{"Type":1,"Points":[-72,48,-8,48,-8,104,-72,104]},{"Type":1,"Points":[40,48,104,48,104,104,40,104]}],"Floor":[-7,-5,0,0,8,-7,-4,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,-7,3,0,0,8,-7,4,0,0,8,-7,5,0,0,8,-7,6,0,0,8,-7,7,0,0,8,-7,8,0,0,8,8,8,0,0,8,8,7,0,0,8,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,8,-5,0,0,8,-5,8,0,0,8,-5,-5,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,-4,0,0,8,-5,5,0,0,8,-5,6,0,0,8,-5,7,0,0,8,-4,8,0,0,8,-4,-5,0,0,8,-4,-3,0,0,8,-4,1,0,0,8,-4,2,0,0,8,-4,-4,0,0,8,-4,7,0,0,8,-4,6,0,0,8,-3,8,0,0,8,-3,-5,0,0,8,-3,-3,0,0,8,-3,1,0,0,8,-3,2,0,0,8,-3,-4,0,0,8,-3,7,0,0,8,-3,6,0,0,8,-2,8,0,0,8,-2,-5,0,0,8,-2,-3,0,0,8,-2,1,0,0,8,-2,2,0,0,8,-2,-4,0,0,8,-2,7,0,0,8,-2,6,0,0,8,-1,8,0,0,8,-1,-5,0,0,8,-1,-3,0,0,8,-1,-2,0,0,8,-1,-1,0,0,8,-1,0,0,0,8,-1,1,0,0,8,-1,2,0,0,8,-1,3,0,0,8,-1,4,0,0,8,-1,-4,0,0,8,-1,5,0,0,8,-1,6,0,0,8,-1,7,0,0,8,0,8,0,0,8,0,-5,0,0,8,0,-3,0,0,8,0,-2,0,0,8,0,-1,0,0,8,0,0,0,0,8,0,1,0,0,8,0,2,0,0,8,0,3,0,0,8,0,4,0,0,8,0,-4,0,0,8,0,5,0,0,8,0,6,0,0,8,0,7,0,0,8,1,-5,0,0,8,1,-3,0,0,8,1,0,0,0,8,1,-1,0,0,8,1,-2,0,0,8,1,1,0,0,8,1,2,0,0,8,1,3,0,0,8,1,4,0,0,8,1,-4,0,0,8,1,5,0,0,8,1,6,0,0,8,1,7,0,0,8,1,8,0,0,8,2,-5,0,0,8,2,-3,0,0,8,2,-2,0,0,8,2,0,0,0,8,2,-1,0,0,8,2,1,0,0,8,2,2,0,0,8,2,3,0,0,8,2,4,0,0,8,2,-4,0,0,8,2,5,0,0,8,2,6,0,0,8,2,7,0,0,8,2,8,0,0,8,3,-5,0,0,8,3,-3,0,0,8,3,1,0,0,8,3,2,0,0,8,3,-4,0,0,8,3,7,0,0,8,3,6,0,0,8,3,8,0,0,8,4,-5,0,0,8,4,-3,0,0,8,4,1,0,0,8,4,2,0,0,8,4,-4,0,0,8,4,7,0,0,8,4,6,0,0,8,4,8,0,0,8,5,-5,0,0,8,5,-3,0,0,8,5,1,0,0,8,5,2,0,0,8,5,-4,0,0,8,5,7,0,0,8,5,6,0,0,8,5,8,0,0,8,-6,8,0,0,8,-6,-5,0,0,8,-6,-4,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,5,0,0,8,-6,6,0,0,8,-6,7,0,0,8,6,-5,0,0,8,6,-4,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,5,0,0,8,6,6,0,0,8,6,7,0,0,8,6,8,0,0,8,7,-5,0,0,8,7,-4,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,7,3,0,0,8,7,4,0,0,8,7,5,0,0,8,7,6,0,0,8,7,7,0,0,8,7,8,0,0,8],"Middle":[-7,-6,0,2,7,-6,-6,0,2,7,-5,-6,0,2,7,-4,-6,0,2,7,-4,0,0,1,7,-4,5,0,1,7,-3,-6,0,2,7,-3,0,0,2,7,-3,5,0,2,7,-2,-6,0,2,7,-2,0,0,3,7,-2,5,0,3,7,-1,-6,0,2,7,0,-6,0,2,7,1,-6,0,2,7,2,-6,0,2,7,3,-6,0,2,7,3,0,0,1,7,3,5,0,1,7,4,-6,0,2,7,4,0,0,2,7,4,5,0,2,7,5,-6,0,2,7,5,0,0,3,7,5,5,0,3,7,6,-6,0,2,7,7,-6,0,2,7,8,-6,0,2,7],"Top":[-8,-6,0,3,4,-8,-5,0,3,3,-8,-4,0,3,3,-8,-3,0,3,3,-8,-2,0,3,3,-8,-1,0,3,3,-8,0,0,3,3,-8,1,0,3,3,-8,2,0,3,3,-8,3,0,3,3,-8,4,0,3,3,-8,5,0,3,3,-8,6,0,3,3,-8,7,0,3,3,-8,8,0,3,3,-8,9,0,11,2,-7,9,0,2,2,-6,9,0,2,2,-5,9,0,2,2,-4,-2,0,1,2,-4,-1,0,1,3,-4,3,0,1,2,-4,4,0,1,3,-4,9,0,2,2,-3,-2,0,2,2,-3,3,0,2,2,-3,9,0,2,2,-2,-2,0,3,2,-2,-1,0,3,3,-2,3,0,3,2,-2,4,0,3,3,-2,9,0,2,2,-1,9,0,2,2,0,9,0,2,2,1,9,0,2,2,2,9,0,2,2,3,-2,0,1,2,3,-1,0,1,3,3,3,0,1,2,3,4,0,1,3,3,9,0,2,2,4,-2,0,2,2,4,3,0,2,2,4,9,0,2,2,5,-2,0,3,2,5,-1,0,3,3,5,3,0,3,2,5,4,0,3,3,5,9,0,2,2,6,9,0,2,2,7,9,0,2,2,8,9,0,2,2,9,-6,0,1,4,9,-5,0,1,3,9,-4,0,1,3,9,-3,0,1,3,9,-2,0,1,3,9,-1,0,1,3,9,0,0,1,3,9,1,0,1,3,9,2,0,1,3,9,3,0,1,3,9,4,0,1,3,9,5,0,1,3,9,6,0,1,3,9,7,0,1,3,9,8,0,1,3,9,9,0,13,2]} \ No newline at end of file +{"NavigationList":[{"Type":0,"Points":[-72,-72,104,-72,104,-56,120,-56,120,-40,136,-40,136,112,120,112,120,128,104,128,104,144,-72,144,-72,128,-88,128,-88,112,-104,112,-104,-40,-88,-40,-88,-56,-72,-56]},{"Type":1,"Points":[-72,-32,-8,-32,-8,24,-72,24]},{"Type":1,"Points":[40,-32,104,-32,104,24,40,24]},{"Type":1,"Points":[-72,48,-8,48,-8,104,-72,104]},{"Type":1,"Points":[40,48,104,48,104,104,40,104]}],"Floor":[7,6,0,0,8,7,5,0,0,8,7,4,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,7,-3,0,0,8,7,7,0,0,8,7,-4,0,0,8,6,8,0,0,8,6,7,0,0,8,6,6,0,0,8,6,5,0,0,8,6,4,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,-5,0,0,8,-6,-4,0,0,8,-6,6,0,0,8,-6,5,0,0,8,-6,4,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,7,0,0,8,5,8,0,0,8,5,6,0,0,8,5,7,0,0,8,5,-4,0,0,8,5,2,0,0,8,5,1,0,0,8,5,-3,0,0,8,5,-5,0,0,8,4,8,0,0,8,4,6,0,0,8,4,7,0,0,8,4,-4,0,0,8,4,2,0,0,8,4,1,0,0,8,4,-3,0,0,8,4,-5,0,0,8,3,8,0,0,8,3,6,0,0,8,3,7,0,0,8,3,-4,0,0,8,3,2,0,0,8,3,1,0,0,8,3,-3,0,0,8,3,-5,0,0,8,2,8,0,0,8,2,7,0,0,8,2,6,0,0,8,2,5,0,0,8,2,-4,0,0,8,2,4,0,0,8,2,3,0,0,8,2,2,0,0,8,2,1,0,0,8,2,-1,0,0,8,2,0,0,0,8,2,-2,0,0,8,2,-3,0,0,8,2,-5,0,0,8,1,8,0,0,8,1,7,0,0,8,1,6,0,0,8,1,5,0,0,8,1,-4,0,0,8,1,4,0,0,8,1,3,0,0,8,1,2,0,0,8,1,1,0,0,8,1,-2,0,0,8,1,-1,0,0,8,1,0,0,0,8,1,-3,0,0,8,1,-5,0,0,8,0,7,0,0,8,0,6,0,0,8,0,5,0,0,8,0,-4,0,0,8,0,4,0,0,8,0,3,0,0,8,0,2,0,0,8,0,1,0,0,8,0,0,0,0,8,0,-1,0,0,8,0,-2,0,0,8,0,-3,0,0,8,0,-5,0,0,8,0,8,0,0,8,-1,7,0,0,8,-1,6,0,0,8,-1,5,0,0,8,-1,-4,0,0,8,-1,4,0,0,8,-1,3,0,0,8,-1,2,0,0,8,-1,1,0,0,8,-1,0,0,0,8,-1,-1,0,0,8,-1,-2,0,0,8,-1,-3,0,0,8,-1,-5,0,0,8,-1,8,0,0,8,-2,6,0,0,8,-2,7,0,0,8,-2,-4,0,0,8,-2,2,0,0,8,-2,1,0,0,8,-2,-3,0,0,8,-2,-5,0,0,8,-2,8,0,0,8,-3,6,0,0,8,-3,7,0,0,8,-3,-4,0,0,8,-3,2,0,0,8,-3,1,0,0,8,-3,-3,0,0,8,-3,-5,0,0,8,-3,8,0,0,8,-4,6,0,0,8,-4,7,0,0,8,-4,-4,0,0,8,-4,2,0,0,8,-4,1,0,0,8,-4,-3,0,0,8,-4,-5,0,0,8,-4,8,0,0,8,-5,7,0,0,8,-5,6,0,0,8,-5,5,0,0,8,-5,-4,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,-5,-5,0,0,8,-5,8,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,8,5,0,0,8,8,6,0,0,8,-7,6,0,0,8,-7,5,0,0,8,-7,4,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,-7,-3,0,0,8,-8,-2,0,3,3,-8,-3,0,3,3,-8,-4,0,3,4,-8,-1,0,3,3,-8,0,0,3,3,-8,1,0,3,3,-8,2,0,3,3,-8,3,0,3,3,-8,4,0,3,3,-8,5,0,3,3,-8,6,0,3,3,-8,7,0,11,2,9,6,0,1,3,9,7,0,13,2,9,5,0,1,3,9,4,0,1,3,9,3,0,1,3,9,2,0,1,3,9,1,0,1,3,9,0,0,1,3,9,-1,0,1,3,9,-2,0,1,3,9,-3,0,1,3,9,-4,0,1,4,-4,9,0,2,2,-5,9,0,2,2,-6,9,0,11,2,-6,-6,0,3,4,-5,-6,0,2,7,-4,-6,0,2,7,-3,9,0,2,2,-3,-6,0,2,7,-2,9,0,2,2,-2,-6,0,2,7,-1,9,0,2,2,-1,-6,0,2,7,0,9,0,2,2,0,-6,0,2,7,1,9,0,2,2,1,-6,0,2,7,2,-6,0,2,7,2,9,0,2,2,3,-6,0,2,7,3,9,0,2,2,4,-6,0,2,7,4,9,0,2,2,5,-6,0,2,7,5,9,0,2,2,6,-6,0,2,7,6,9,0,2,2,7,-6,0,1,4,7,9,0,13,2],"Middle":[-7,-4,0,3,7,-6,-5,0,3,7,-4,0,0,1,7,-4,5,0,1,7,-3,0,0,2,7,-3,5,0,2,7,-2,0,0,3,7,-2,5,0,3,7,3,0,0,1,7,3,5,0,1,7,4,0,0,2,7,4,5,0,2,7,5,0,0,3,7,5,5,0,3,7,7,-5,0,1,7,8,-4,0,1,7],"Top":[-7,-5,0,3,4,-7,7,0,3,2,-7,8,0,11,2,-6,8,0,3,2,-4,-2,0,1,2,-4,-1,0,1,3,-4,3,0,1,2,-4,4,0,1,3,-3,-2,0,2,2,-3,3,0,2,2,-2,-2,0,3,2,-2,-1,0,3,3,-2,3,0,3,2,-2,4,0,3,3,3,-2,0,1,2,3,-1,0,1,3,3,3,0,1,2,3,4,0,1,3,4,-2,0,2,2,4,3,0,2,2,5,-2,0,3,2,5,-1,0,3,3,5,3,0,3,2,5,4,0,3,3,7,8,0,1,2,8,-5,0,1,4,8,7,0,1,2,8,8,0,13,2]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import index b20c9a6..c36be94 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://chd2vtesap5cf" -path="res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex" +path="res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001.png" -dest_files=["res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001.png" +dest_files=["res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"] [params] diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import index 56388a2..d563acf 100644 --- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import +++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import @@ -3,15 +3,15 @@ importer="texture" type="CompressedTexture2D" uid="uid://d2f55lu60x64i" -path="res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex" +path="res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex" metadata={ "vram_texture": false } [deps] -source_file="res://resource/sprite/role/enemy0001/enemy0001_Debris.png" -dest_files=["res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"] +source_file="res://resource/sprite/role/enemy0001/Enemy0001_Debris.png" +dest_files=["res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"] [params] diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 4002e35..26cd6c6 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -356,7 +356,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_j3aok"] +[sub_resource type="Image" id="Image_3ddck"] data = { "data": PackedByteArray(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 228, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 228, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 18, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 17, 255, 255, 255, 186, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 191, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 187, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 187, 255, 255, 255, 229, 255, 255, 255, 188, 255, 255, 255, 18, 255, 255, 255, 19, 255, 255, 255, 188, 255, 255, 255, 229, 255, 255, 255, 186, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 17, 255, 255, 255, 185, 255, 255, 255, 229, 255, 255, 255, 189, 255, 255, 255, 19, 255, 255, 255, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 189, 255, 255, 255, 229, 255, 255, 255, 185, 255, 255, 255, 17, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 76, 255, 255, 255, 229, 255, 255, 255, 190, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 190, 255, 255, 255, 229, 255, 255, 255, 76, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 77, 255, 255, 255, 19, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 19, 255, 255, 255, 77, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -366,7 +366,7 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_j3aok") +image = SubResource("Image_3ddck") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 @@ -499,3 +499,4 @@ LineEdit/styles/normal = SubResource("4") LineEdit/styles/read_only = SubResource("1") Panel/styles/panel = SubResource("57") +TooltipLabel/font_sizes/font_size = 32 diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index b0ccf80..574abd6 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -42,6 +42,11 @@ /// public bool IsDisposed { get; private set; } = false; + /// + /// 负责记录上一个Ui + /// + public UiBase PrevUi { get; set; } + //开启的协程 private List _coroutineList; //嵌套打开的Ui列表 diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index 4e886bd..aee534c 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -14,14 +14,19 @@ public bool IsDestroyed { get; private set; } private TUiCellNode _template; + private Vector2 _size = Vector2.Zero; private Node _parent; private Type _cellType; private Stack> _cellPool = new Stack>(); private List> _cellList = new List>(); + private GridContainer _gridContainer; + private Vector2I _cellOffset; + private int _columns; + private bool _autoColumns; - public UiGrid(TUiCellNode template, Type cellType, int columns, int offsetX, int offsetY) + public UiGrid(TUiCellNode template, Type cellType) { _gridContainer = new GridContainer(); _gridContainer.Ready += OnReady; @@ -31,11 +36,72 @@ _parent = uiInstance.GetParent(); _parent.RemoveChild(uiInstance); _parent.AddChild(_gridContainer); - _gridContainer.Columns = columns; - _gridContainer.AddThemeConstantOverride("h_separation", offsetX); - _gridContainer.AddThemeConstantOverride("v_separation", offsetY); + if (uiInstance is Control control) + { + _size = control.Size; + } + } + + public void SetCellOffset(Vector2I offset) + { + if (_gridContainer != null) + { + _cellOffset = offset; + _gridContainer.AddThemeConstantOverride("h_separation", offset.X); + _gridContainer.AddThemeConstantOverride("v_separation", offset.Y); + } } + public Vector2I GetCellOffset() + { + return _cellOffset; + } + + public void SetColumns(int columns) + { + _columns = columns; + if (_gridContainer != null) + { + _gridContainer.Columns = columns; + } + } + + public int GetColumns() + { + if (_gridContainer != null) + { + return _gridContainer.Columns; + } + + return _columns; + } + + public void SetAutoColumns(bool flag) + { + if (flag != _autoColumns) + { + _autoColumns = flag; + if (_gridContainer != null) + { + if (_autoColumns) + { + _gridContainer.Resized += OnGridResized; + OnGridResized(); + } + else + { + _gridContainer.Columns = _columns; + _gridContainer.Resized -= OnGridResized; + } + } + } + } + + public bool GetAutoColumns() + { + return _autoColumns; + } + public void SetHorizontalExpand(bool flag) { if (_gridContainer != null) @@ -50,6 +116,16 @@ } } } + + public bool GetHorizontalExpand() + { + if (_gridContainer != null) + { + return (_gridContainer.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0; + } + + return false; + } /// /// 设置当前网格组件中的所有数据 @@ -113,7 +189,10 @@ } _cellList = null; _cellPool = null; - _gridContainer.QueueFree(); + if (_gridContainer != null) + { + _gridContainer.QueueFree(); + } } private void OnReady() @@ -146,4 +225,20 @@ _gridContainer.RemoveChild(cell.CellNode.GetUiInstance()); _cellPool.Push(cell); } + + private void OnGridResized() + { + if (_autoColumns && _gridContainer != null) + { + var width = _gridContainer.Size.X; + if (width <= _size.X + _cellOffset.X) + { + _gridContainer.Columns = 1; + } + else + { + _gridContainer.Columns = Mathf.FloorToInt(width / (_size.X + _cellOffset.X)); + } + } + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 3761247..436426c 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -132,6 +132,7 @@ DungeonManager.Name = "DungeonManager"; SceneRoot.AddChild(DungeonManager); + MapProjectManager.Init(); BottomTipsPanel.Init(); //打开主菜单Ui //UiManager.Open_Main(); diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs new file mode 100644 index 0000000..9535143 --- /dev/null +++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs @@ -0,0 +1,151 @@ + +using System; +using System.Collections.Generic; +using System.IO; +using Godot; + +public static class MapProjectManager +{ + public class MapGroupInfo + { + /// + /// 组名称 + /// + public string Name; + /// + /// 组路径 + /// + public string FullPath; + /// + /// 当前组所在的文件夹 + /// + public string RootPath; + } + + public class MapRoomInfo + { + /// + /// 房间名称 + /// + public string Name; + /// + /// 组名称 + /// + public string Group; + /// + /// 房间类型 + /// + public DungeonRoomType RoomType; + /// + /// 文件夹路径 + /// + public string FullPath; + /// + /// 预览图片 + /// + public string PrevImage; + /// + /// 当前组所在的文件夹 + /// + public string RootPath; + } + + /// + /// 扫描路径 + /// + public static readonly List ScannerPaths = new List(); + /// + /// 组列表数据 + /// + public static readonly Dictionary GroupData = new Dictionary(); + + private static bool _init; + + public static void Init() + { + if (_init) + { + return; + } + + _init = true; +#if TOOLS + ScannerPaths.Add(GameConfig.RoomTileDir); +#endif + } + + /// + /// 刷新组数据 + /// + public static void RefreshMapGroup() + { + GroupData.Clear(); + foreach (var path in ScannerPaths) + { + if (Directory.Exists(path)) + { + var info = new DirectoryInfo(path); + var directoryInfos = info.GetDirectories(); + foreach (var directoryInfo in directoryInfos) + { + var projectInfo = new MapGroupInfo(); + projectInfo.Name = directoryInfo.Name; + projectInfo.FullPath = directoryInfo.FullName; + projectInfo.RootPath = info.FullName; + GroupData.TryAdd(projectInfo.FullPath, projectInfo); + } + } + else + { + GD.PrintErr("刷新地图组时发现不存在的路径: " + path); + } + } + } + + /// + /// 根据路径加载房间 + /// + public static MapRoomInfo[] LoadRoom(string rootPath, string groupName) + { + var path = rootPath + "\\" + groupName; + if (!Directory.Exists(path)) + { + GD.PrintErr("加载地牢房间时发现不存在的路径: " + path); + return new MapRoomInfo[0]; + } + + var list = new List(); + var dir = new DirectoryInfo(path); + var roomTypes = Enum.GetValues(); + foreach (var dungeonRoomType in roomTypes) + { + LoadRoomByType(list, dir, rootPath, groupName, dungeonRoomType); + } + + return list.ToArray(); + } + + private static void LoadRoomByType(List list, DirectoryInfo dir, string rootPath, string groupName, DungeonRoomType roomType) + { + var typeName = DungeonManager.DungeonRoomTypeToString(roomType); + var path = dir.FullName + "\\" + typeName; + if (Directory.Exists(path)) + { + var tempDir = new DirectoryInfo(path); + var directoryInfos = tempDir.GetDirectories(); + foreach (var directoryInfo in directoryInfos) + { + if (directoryInfo.GetFiles().Length > 0) + { + var room = new MapRoomInfo(); + room.Name = directoryInfo.Name; + room.FullPath = directoryInfo.FullName; + room.RoomType = roomType; + room.Group = groupName; + room.RootPath = rootPath; + list.Add(room); + } + } + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs index 078c07e..4a0c58f 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs @@ -8,15 +8,15 @@ /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg /// - public MapEditor_Bg L_Bg + public Bg L_Bg { get { - if (_L_Bg == null) _L_Bg = new MapEditor_Bg(this, GetNodeOrNull("Bg")); + if (_L_Bg == null) _L_Bg = new Bg(this, GetNodeOrNull("Bg")); return _L_Bg; } } - private MapEditor_Bg _L_Bg; + private Bg _L_Bg; public MapEditor() : base(nameof(MapEditor)) @@ -24,288 +24,396 @@ } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head.Back /// - public class MapEditor_ErrorCellAnimationPlayer : UiNode + public class Back : UiNode { - public MapEditor_ErrorCellAnimationPlayer(MapEditor uiPanel, Godot.AnimationPlayer node) : base(uiPanel, node) { } - public override MapEditor_ErrorCellAnimationPlayer Clone() => new (UiPanel, (Godot.AnimationPlayer)Instance.Duplicate()); + public Back(MapEditor uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Back Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.ErrorCell + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.Head /// - public class MapEditor_ErrorCell : UiNode + public class Head : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.ErrorCellAnimationPlayer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Back /// - public MapEditor_ErrorCellAnimationPlayer L_ErrorCellAnimationPlayer + public Back L_Back { get { - if (_L_ErrorCellAnimationPlayer == null) _L_ErrorCellAnimationPlayer = new MapEditor_ErrorCellAnimationPlayer(UiPanel, Instance.GetNodeOrNull("ErrorCellAnimationPlayer")); + if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNodeOrNull("Back")); + return _L_Back; + } + } + private Back _L_Back; + + public Head(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Head Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer + /// + public class ErrorCellAnimationPlayer : UiNode + { + public ErrorCellAnimationPlayer(MapEditor uiPanel, Godot.AnimationPlayer node) : base(uiPanel, node) { } + public override ErrorCellAnimationPlayer Clone() => new (UiPanel, (Godot.AnimationPlayer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell + /// + public class ErrorCell : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCellAnimationPlayer + /// + public ErrorCellAnimationPlayer L_ErrorCellAnimationPlayer + { + get + { + if (_L_ErrorCellAnimationPlayer == null) _L_ErrorCellAnimationPlayer = new ErrorCellAnimationPlayer(UiPanel, Instance.GetNodeOrNull("ErrorCellAnimationPlayer")); return _L_ErrorCellAnimationPlayer; } } - private MapEditor_ErrorCellAnimationPlayer _L_ErrorCellAnimationPlayer; + private ErrorCellAnimationPlayer _L_ErrorCellAnimationPlayer; - public MapEditor_ErrorCell(MapEditor uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } - public override MapEditor_ErrorCell Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); + public ErrorCell(MapEditor uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } + public override ErrorCell Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.Brush + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.Brush /// - public class MapEditor_Brush : UiNode + public class Brush : UiNode { - public MapEditor_Brush(MapEditor uiPanel, Godot.Node2D node) : base(uiPanel, node) { } - public override MapEditor_Brush Clone() => new (UiPanel, (Godot.Node2D)Instance.Duplicate()); + public Brush(MapEditor uiPanel, Godot.Node2D node) : base(uiPanel, node) { } + public override Brush Clone() => new (UiPanel, (Godot.Node2D)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap /// - public class MapEditor_TileMap : UiNode + public class TileMap : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.ErrorCell + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.ErrorCell /// - public MapEditor_ErrorCell L_ErrorCell + public ErrorCell L_ErrorCell { get { - if (_L_ErrorCell == null) _L_ErrorCell = new MapEditor_ErrorCell(UiPanel, Instance.GetNodeOrNull("ErrorCell")); + if (_L_ErrorCell == null) _L_ErrorCell = new ErrorCell(UiPanel, Instance.GetNodeOrNull("ErrorCell")); return _L_ErrorCell; } } - private MapEditor_ErrorCell _L_ErrorCell; + private ErrorCell _L_ErrorCell; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.Brush + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.Brush /// - public MapEditor_Brush L_Brush + public Brush L_Brush { get { - if (_L_Brush == null) _L_Brush = new MapEditor_Brush(UiPanel, Instance.GetNodeOrNull("Brush")); + if (_L_Brush == null) _L_Brush = new Brush(UiPanel, Instance.GetNodeOrNull("Brush")); return _L_Brush; } } - private MapEditor_Brush _L_Brush; + private Brush _L_Brush; - public MapEditor_TileMap(MapEditor uiPanel, UI.MapEditor.EditorTileMap node) : base(uiPanel, node) { } - public override MapEditor_TileMap Clone() => new (UiPanel, (UI.MapEditor.EditorTileMap)Instance.Duplicate()); + public TileMap(MapEditor uiPanel, UI.MapEditor.EditorTileMap node) : base(uiPanel, node) { } + public override TileMap Clone() => new (UiPanel, (UI.MapEditor.EditorTileMap)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.CanvasLayer + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.CanvasLayer /// - public class MapEditor_CanvasLayer : UiNode + public class CanvasLayer : UiNode { - public MapEditor_CanvasLayer(MapEditor uiPanel, Godot.CanvasLayer node) : base(uiPanel, node) { } - public override MapEditor_CanvasLayer Clone() => new (UiPanel, (Godot.CanvasLayer)Instance.Duplicate()); + public CanvasLayer(MapEditor uiPanel, Godot.CanvasLayer node) : base(uiPanel, node) { } + public override CanvasLayer Clone() => new (UiPanel, (Godot.CanvasLayer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport /// - public class MapEditor_SubViewport : UiNode + public class SubViewport : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.TileMap + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.TileMap /// - public MapEditor_TileMap L_TileMap + public TileMap L_TileMap { get { - if (_L_TileMap == null) _L_TileMap = new MapEditor_TileMap(UiPanel, Instance.GetNodeOrNull("TileMap")); + if (_L_TileMap == null) _L_TileMap = new TileMap(UiPanel, Instance.GetNodeOrNull("TileMap")); return _L_TileMap; } } - private MapEditor_TileMap _L_TileMap; + private TileMap _L_TileMap; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.CanvasLayer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.CanvasLayer /// - public MapEditor_CanvasLayer L_CanvasLayer + public CanvasLayer L_CanvasLayer { get { - if (_L_CanvasLayer == null) _L_CanvasLayer = new MapEditor_CanvasLayer(UiPanel, Instance.GetNodeOrNull("CanvasLayer")); + if (_L_CanvasLayer == null) _L_CanvasLayer = new CanvasLayer(UiPanel, Instance.GetNodeOrNull("CanvasLayer")); return _L_CanvasLayer; } } - private MapEditor_CanvasLayer _L_CanvasLayer; + private CanvasLayer _L_CanvasLayer; - public MapEditor_SubViewport(MapEditor uiPanel, Godot.SubViewport node) : base(uiPanel, node) { } - public override MapEditor_SubViewport Clone() => new (UiPanel, (Godot.SubViewport)Instance.Duplicate()); + public SubViewport(MapEditor uiPanel, Godot.SubViewport node) : base(uiPanel, node) { } + public override SubViewport Clone() => new (UiPanel, (Godot.SubViewport)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView /// - public class MapEditor_MapView : UiNode + public class MapView : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.SubViewport + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.SubViewport /// - public MapEditor_SubViewport L_SubViewport + public SubViewport L_SubViewport { get { - if (_L_SubViewport == null) _L_SubViewport = new MapEditor_SubViewport(UiPanel, Instance.GetNodeOrNull("SubViewport")); + if (_L_SubViewport == null) _L_SubViewport = new SubViewport(UiPanel, Instance.GetNodeOrNull("SubViewport")); return _L_SubViewport; } } - private MapEditor_SubViewport _L_SubViewport; + private SubViewport _L_SubViewport; - public MapEditor_MapView(MapEditor uiPanel, Godot.SubViewportContainer node) : base(uiPanel, node) { } - public override MapEditor_MapView Clone() => new (UiPanel, (Godot.SubViewportContainer)Instance.Duplicate()); + public MapView(MapEditor uiPanel, Godot.SubViewportContainer node) : base(uiPanel, node) { } + public override MapView Clone() => new (UiPanel, (Godot.SubViewportContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer /// - public class MapEditor_Left : UiNode + public class MarginContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.MapView + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MapView /// - public MapEditor_MapView L_MapView + public MapView L_MapView { get { - if (_L_MapView == null) _L_MapView = new MapEditor_MapView(UiPanel, Instance.GetNodeOrNull("MapView")); + if (_L_MapView == null) _L_MapView = new MapView(UiPanel, Instance.GetNodeOrNull("MapView")); return _L_MapView; } } - private MapEditor_MapView _L_MapView; + private MapView _L_MapView; - public MapEditor_Left(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override MapEditor_Left Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + public MarginContainer(MapEditor uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Right + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left /// - public class MapEditor_Right : UiNode - { - public MapEditor_Right(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override MapEditor_Right Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); - } - - /// - /// 类型: , 路径: MapEditor.Bg.HSplitContainer - /// - public class MapEditor_HSplitContainer : UiNode + public class Left : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.Left + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.MarginContainer /// - public MapEditor_Left L_Left + public MarginContainer L_MarginContainer { get { - if (_L_Left == null) _L_Left = new MapEditor_Left(UiPanel, Instance.GetNodeOrNull("Left")); + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer _L_MarginContainer; + + public Left(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Left Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right + /// + public class Right : UiNode + { + public Right(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Right Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer.HSplitContainer + /// + public class HSplitContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Left + /// + public Left L_Left + { + get + { + if (_L_Left == null) _L_Left = new Left(UiPanel, Instance.GetNodeOrNull("Left")); return _L_Left; } } - private MapEditor_Left _L_Left; + private Left _L_Left; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.Right + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Right /// - public MapEditor_Right L_Right + public Right L_Right { get { - if (_L_Right == null) _L_Right = new MapEditor_Right(UiPanel, Instance.GetNodeOrNull("Right")); + if (_L_Right == null) _L_Right = new Right(UiPanel, Instance.GetNodeOrNull("Right")); return _L_Right; } } - private MapEditor_Right _L_Right; + private Right _L_Right; - public MapEditor_HSplitContainer(MapEditor uiPanel, Godot.HSplitContainer node) : base(uiPanel, node) { } - public override MapEditor_HSplitContainer Clone() => new (UiPanel, (Godot.HSplitContainer)Instance.Duplicate()); + public HSplitContainer(MapEditor uiPanel, Godot.HSplitContainer node) : base(uiPanel, node) { } + public override HSplitContainer Clone() => new (UiPanel, (Godot.HSplitContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.Head + /// + public Head L_Head + { + get + { + if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNodeOrNull("Head")); + return _L_Head; + } + } + private Head _L_Head; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer + /// + public HSplitContainer L_HSplitContainer + { + get + { + if (_L_HSplitContainer == null) _L_HSplitContainer = new HSplitContainer(UiPanel, Instance.GetNodeOrNull("HSplitContainer")); + return _L_HSplitContainer; + } + } + private HSplitContainer _L_HSplitContainer; + + public VBoxContainer(MapEditor uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditor.Bg /// - public class MapEditor_Bg : UiNode + public class Bg : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.HSplitContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.VBoxContainer /// - public MapEditor_HSplitContainer L_HSplitContainer + public VBoxContainer L_VBoxContainer { get { - if (_L_HSplitContainer == null) _L_HSplitContainer = new MapEditor_HSplitContainer(UiPanel, Instance.GetNodeOrNull("HSplitContainer")); - return _L_HSplitContainer; + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNodeOrNull("VBoxContainer")); + return _L_VBoxContainer; } } - private MapEditor_HSplitContainer _L_HSplitContainer; + private VBoxContainer _L_VBoxContainer; - public MapEditor_Bg(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override MapEditor_Bg Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + public Bg(MapEditor uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Bg Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head.Back /// - public MapEditor_ErrorCellAnimationPlayer S_ErrorCellAnimationPlayer => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap.L_ErrorCell.L_ErrorCellAnimationPlayer; + public Back S_Back => L_Bg.L_VBoxContainer.L_Head.L_Back; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.ErrorCell + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.Head /// - public MapEditor_ErrorCell S_ErrorCell => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap.L_ErrorCell; + public Head S_Head => L_Bg.L_VBoxContainer.L_Head; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.Brush + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell.ErrorCellAnimationPlayer /// - public MapEditor_Brush S_Brush => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap.L_Brush; + public ErrorCellAnimationPlayer S_ErrorCellAnimationPlayer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap.L_ErrorCell.L_ErrorCellAnimationPlayer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.ErrorCell /// - public MapEditor_TileMap S_TileMap => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap; + public ErrorCell S_ErrorCell => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap.L_ErrorCell; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.CanvasLayer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap.Brush /// - public MapEditor_CanvasLayer S_CanvasLayer => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_CanvasLayer; + public Brush S_Brush => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap.L_Brush; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.TileMap /// - public MapEditor_SubViewport S_SubViewport => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport; + public TileMap S_TileMap => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport.CanvasLayer /// - public MapEditor_MapView S_MapView => L_Bg.L_HSplitContainer.L_Left.L_MapView; + public CanvasLayer S_CanvasLayer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_CanvasLayer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView.SubViewport /// - public MapEditor_Left S_Left => L_Bg.L_HSplitContainer.L_Left; + public SubViewport S_SubViewport => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Right + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer.MapView /// - public MapEditor_Right S_Right => L_Bg.L_HSplitContainer.L_Right; + public MapView S_MapView => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left.MarginContainer /// - public MapEditor_HSplitContainer S_HSplitContainer => L_Bg.L_HSplitContainer; + public MarginContainer S_MarginContainer => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Left + /// + public Left S_Left => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer.Right + /// + public Right S_Right => L_Bg.L_VBoxContainer.L_HSplitContainer.L_Right; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer.HSplitContainer + /// + public HSplitContainer S_HSplitContainer => L_Bg.L_VBoxContainer.L_HSplitContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.VBoxContainer + /// + public VBoxContainer S_VBoxContainer => L_Bg.L_VBoxContainer; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg /// - public MapEditor_Bg S_Bg => L_Bg; + public Bg S_Bg => L_Bg; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs index afba1e4..591863c 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -16,11 +16,14 @@ { _editorTileMapBar = new EditorTileMapBar(this, S_TileMap); ToolsPanel = S_CanvasLayer.OpenNestedUi(UiManager.UiName.MapEditorTools); + + //S_HSplitContainer.Instance.AnchorLeft } public override void OnShowUi() { S_Left.Instance.Resized += OnMapViewResized; + S_Back.Instance.Pressed += OnBackClick; OnMapViewResized(); _editorTileMapBar.OnShow(); @@ -29,6 +32,7 @@ public override void OnHideUi() { S_Left.Instance.Resized -= OnMapViewResized; + S_Back.Instance.Pressed -= OnBackClick; _editorTileMapBar.OnHide(); } @@ -37,9 +41,31 @@ _editorTileMapBar.Process(delta); } + /// + /// 加载地牢, 返回是否加载成功 + /// + /// 文件夹路径 + /// 房间组名 + /// 房间类型 + /// 房间名称 + public bool LoadMap(string dir, string groupName, DungeonRoomType roomType, string roomName) + { + return S_TileMap.Instance.Load(dir, groupName, roomType, roomName); + } + //调整地图显示区域大小 private void OnMapViewResized() { - S_SubViewport.Instance.Size = S_Left.Instance.Size.AsVector2I(); + S_SubViewport.Instance.Size = S_Left.Instance.Size.AsVector2I() - new Vector2I(4, 4); + } + + private void OnBackClick() + { + //返回上一个Ui + if (PrevUi != null) + { + DisposeUi(); + PrevUi.ShowUi(); + } } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index e8f20bd..bb4f154 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -383,6 +383,9 @@ //导航网格数据 _dungeonTileMap.SetPolygonData(tileInfo.NavigationList); + //聚焦 + //MapEditorPanel.CallDelay(0.1f, OnClickCenterTool); + CallDeferred(nameof(OnClickCenterTool)); return true; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs index bd37111..11590a2 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs @@ -5,15 +5,13 @@ public class EditorTileMapBar { private MapEditorPanel _editorPanel; - private MapEditor.MapEditor_TileMap _editorTileMap; + private MapEditor.TileMap _editorTileMap; - public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.MapEditor_TileMap editorTileMap) + public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.TileMap editorTileMap) { _editorTileMap = editorTileMap; _editorPanel = editorPanel; _editorTileMap.Instance.MapEditorPanel = editorPanel; - //测试加载地牢 - _editorTileMap.Instance.Load(GameConfig.RoomTileDir, "testGroup1", DungeonRoomType.Battle, "Room2"); } public void OnShow() diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs index e0ffe60..be53638 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs @@ -1,9 +1,26 @@ namespace UI.MapEditorProject; -public class GroupButtonCell : UiCell +public class GroupButtonCell : UiCell { - protected override void OnSetData(string data) + protected override void OnInit() { - CellNode.Instance.Text = data; + CellNode.Instance.Pressed += OnClick; + } + + protected override void OnSetData(MapProjectManager.MapGroupInfo data) + { + CellNode.Instance.Text = data.Name; + CellNode.Instance.TooltipText = "路径: " + data.FullPath; + } + + protected override void OnDestroy() + { + CellNode.Instance.Pressed -= OnClick; + } + + //选中工程 + private void OnClick() + { + ((MapEditorProjectPanel)CellNode.UiPanel).SelectGroup(Data); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs index 1130ce2..16ca36d 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs @@ -24,34 +24,34 @@ } /// - /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Panel.MarginContainer + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Head.Back /// - public class MarginContainer : UiNode + public class Back : UiNode { - public MarginContainer(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } - public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + public Back(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Back Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Panel + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Head /// - public class Panel : UiNode + public class Head : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.MarginContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Back /// - public MarginContainer L_MarginContainer + public Back L_Back { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer")); - return _L_MarginContainer; + if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNodeOrNull("Back")); + return _L_Back; } } - private MarginContainer _L_MarginContainer; + private Back _L_Back; - public Panel(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + public Head(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Head Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// @@ -88,7 +88,7 @@ /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer /// - public class MarginContainer_1 : UiNode + public class MarginContainer : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.ScrollContainer @@ -103,30 +103,30 @@ } private ScrollContainer _L_ScrollContainer; - public MarginContainer_1(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } - public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + public MarginContainer(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel /// - public class Panel_1 : UiNode + public class Panel : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.MarginContainer /// - public MarginContainer_1 L_MarginContainer + public MarginContainer L_MarginContainer { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer")); return _L_MarginContainer; } } - private MarginContainer_1 _L_MarginContainer; + private MarginContainer _L_MarginContainer; - public Panel_1(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } - public override Panel_1 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + public Panel(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); } /// @@ -157,9 +157,9 @@ } /// - /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.RoomButton + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.RoomButton /// - public class RoomButton : UiNode + public class RoomButton : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.PreviewImage @@ -200,8 +200,8 @@ } private RoomType _L_RoomType; - public RoomButton(MapEditorProject uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override RoomButton Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public RoomButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override RoomButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// @@ -210,13 +210,13 @@ public class ScrollContainer_1 : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.RoomButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.RoomButton /// public RoomButton L_RoomButton { get { - if (_L_RoomButton == null) _L_RoomButton = new RoomButton(UiPanel, Instance.GetNodeOrNull("RoomButton")); + if (_L_RoomButton == null) _L_RoomButton = new RoomButton(UiPanel, Instance.GetNodeOrNull("RoomButton")); return _L_RoomButton; } } @@ -229,7 +229,7 @@ /// /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer /// - public class MarginContainer_2 : UiNode + public class MarginContainer_1 : UiNode { /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.ScrollContainer @@ -244,8 +244,8 @@ } private ScrollContainer_1 _L_ScrollContainer; - public MarginContainer_2(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } - public override MarginContainer_2 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + public MarginContainer_1(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } /// @@ -256,15 +256,15 @@ /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.MarginContainer /// - public MarginContainer_2 L_MarginContainer + public MarginContainer_1 L_MarginContainer { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_2(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNodeOrNull("MarginContainer")); return _L_MarginContainer; } } - private MarginContainer_2 _L_MarginContainer; + private MarginContainer_1 _L_MarginContainer; public Panel2(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override Panel2 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); @@ -278,15 +278,15 @@ /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Panel /// - public Panel_1 L_Panel + public Panel L_Panel { get { - if (_L_Panel == null) _L_Panel = new Panel_1(UiPanel, Instance.GetNodeOrNull("Panel")); + if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNodeOrNull("Panel")); return _L_Panel; } } - private Panel_1 _L_Panel; + private Panel _L_Panel; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Panel2 @@ -311,17 +311,17 @@ public class VBoxContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.Panel + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.Head /// - public Panel L_Panel + public Head L_Head { get { - if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNodeOrNull("Panel")); - return _L_Panel; + if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNodeOrNull("Head")); + return _L_Head; } } - private Panel _L_Panel; + private Head _L_Head; /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.HBoxContainer @@ -364,11 +364,26 @@ /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Head.Back + /// + public Back S_Back => L_Bg.L_VBoxContainer.L_Head.L_Back; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Head + /// + public Head S_Head => L_Bg.L_VBoxContainer.L_Head; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.ScrollContainer.GroupButton /// public GroupButton S_GroupButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel.L_MarginContainer.L_ScrollContainer.L_GroupButton; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel + /// + public Panel S_Panel => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.RoomButton.PreviewImage /// public PreviewImage S_PreviewImage => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_ScrollContainer.L_RoomButton.L_PreviewImage; @@ -384,7 +399,7 @@ public RoomType S_RoomType => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_ScrollContainer.L_RoomButton.L_RoomType; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.RoomButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.ScrollContainer.RoomButton /// public RoomButton S_RoomButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_ScrollContainer.L_RoomButton; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs index 42ac33e..30823bd 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs @@ -1,32 +1,37 @@ +using System.Linq; using Godot; namespace UI.MapEditorProject; public partial class MapEditorProjectPanel : MapEditorProject { - - private UiGrid _groupGrid; - private UiGrid _roomGrid; + /// + /// 当前选中的组 + /// + public MapProjectManager.MapGroupInfo SelectGroupInfo; + /// + /// 选中的组所包含的房间数据 + /// + public MapProjectManager.MapRoomInfo[] SelectRoomInfo; + + private UiGrid _groupGrid; + private UiGrid _roomGrid; public override void OnCreateUi() { - _groupGrid = new UiGrid(S_GroupButton, typeof(GroupButtonCell), 1, 0, 2); + _groupGrid = new UiGrid(S_GroupButton, typeof(GroupButtonCell)); + _groupGrid.SetCellOffset(new Vector2I(0, 2)); _groupGrid.SetHorizontalExpand(true); - _groupGrid.SetDataList(new []{ "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5" }); - _roomGrid = new UiGrid(S_RoomButton, typeof(RoomButtonCell), 5, 5, 5); + _roomGrid = new UiGrid(S_RoomButton, typeof(RoomButtonCell)); + _roomGrid.SetAutoColumns(true); + _roomGrid.SetCellOffset(new Vector2I(10, 10)); _roomGrid.SetHorizontalExpand(true); - _roomGrid.SetDataList(new []{ "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5", "1", "2", "3", "4", "5" }); } public override void OnShowUi() { - - } - - public override void OnHideUi() - { - + RefreshGroup(); } public override void OnDisposeUi() @@ -37,4 +42,27 @@ _roomGrid.Destroy(); _roomGrid = null; } + + public void RefreshGroup() + { + MapProjectManager.RefreshMapGroup(); + _groupGrid.SetDataList(MapProjectManager.GroupData.Values.ToArray()); + } + + public void SelectGroup(MapProjectManager.MapGroupInfo group) + { + SelectGroupInfo = group; + SelectRoomInfo = MapProjectManager.LoadRoom(group.RootPath, group.Name); + _roomGrid.SetDataList(SelectRoomInfo); + } + + public void SelectRoom(MapProjectManager.MapRoomInfo room) + { + HideUi(); + //打开地牢Ui + var mapEditor = UiManager.Open_MapEditor(); + mapEditor.PrevUi = this; + //加载地牢 + mapEditor.LoadMap(room.RootPath, room.Group, room.RoomType, room.Name); + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs index 1c974a2..cc0a0ec 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs @@ -2,25 +2,47 @@ namespace UI.MapEditorProject; -public class RoomButtonCell : UiCell +public class RoomButtonCell : UiCell { + private bool _focus = false; + protected override void OnInit() { CellNode.Instance.Pressed += OnClick; + CellNode.Instance.FocusExited += OnFocusExited; } - protected override void OnSetData(string data) + protected override void OnSetData(MapProjectManager.MapRoomInfo data) { - CellNode.L_RoomName.Instance.Text = data; + _focus = false; + CellNode.L_RoomName.Instance.Text = data.Name; + CellNode.L_RoomType.Instance.Text = DungeonManager.DungeonRoomTypeToDescribeString(data.RoomType); + CellNode.Instance.TooltipText = "路径: " + data.FullPath; + CellNode.Instance.ReleaseFocus(); } protected override void OnDestroy() { CellNode.Instance.Pressed -= OnClick; + CellNode.Instance.FocusExited -= OnFocusExited; } private void OnClick() { - GD.Print("点击了按钮: " + Data); + if (_focus) + { + //打开房间编辑器 + ((MapEditorProjectPanel)CellNode.UiPanel).SelectRoom(Data); + CellNode.Instance.ReleaseFocus(); + } + else + { + _focus = true; + } + } + + private void OnFocusExited() + { + _focus = false; } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs index c6b28e7..d56440f 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs @@ -16,7 +16,9 @@ _bar = lifeBar; var uiNodeLife = lifeBar.L_Life; - _grid = new UiGrid(uiNodeLife, typeof(LifeCell), 20, 1, 2); + _grid = new UiGrid(uiNodeLife, typeof(LifeCell)); + _grid.SetColumns(20); + _grid.SetCellOffset(new Vector2I(1, 2)); } public void OnShow()