diff --git a/DungeonShooting_Godot/prefab/Cursor.tscn b/DungeonShooting_Godot/prefab/Cursor.tscn index 728e892..f68f834 100644 --- a/DungeonShooting_Godot/prefab/Cursor.tscn +++ b/DungeonShooting_Godot/prefab/Cursor.tscn @@ -43,7 +43,7 @@ [node name="Finger" type="Sprite2D" parent="."] visible = false -position = Vector2(8, 6) +position = Vector2(8, 12) scale = Vector2(4, 4) texture = ExtResource("3_ni3bs") region_enabled = true diff --git a/DungeonShooting_Godot/prefab/ui/Main.tscn b/DungeonShooting_Godot/prefab/ui/Main.tscn index 860fe85..3138727 100644 --- a/DungeonShooting_Godot/prefab/ui/Main.tscn +++ b/DungeonShooting_Godot/prefab/ui/Main.tscn @@ -47,6 +47,15 @@ text = "开始游戏 " +[node name="Tools" type="Button" parent="ButtonList"] +custom_minimum_size = Vector2(0, 50) +layout_mode = 2 +focus_neighbor_top = NodePath("../Start") +focus_neighbor_bottom = NodePath("../Exit") +theme = ExtResource("2_bbd6i") +theme_override_font_sizes/font_size = 32 +text = "开发者工具" + [node name="Setting" type="Button" parent="ButtonList"] custom_minimum_size = Vector2(0, 50) layout_mode = 2 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn new file mode 100644 index 0000000..d2448dc --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn @@ -0,0 +1,55 @@ +[gd_scene load_steps=3 format=3 uid="uid://csbxfkdupsckv"] + +[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"] +[ext_resource type="Script" path="res://src/game/ui/mapEditor/TileView/EditorTileMap.cs" id="2_waq8f"] + +[node name="MapEditor" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_5s7a0") + +[node name="Bg" type="Panel" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="HSplitContainer" type="HSplitContainer" parent="Bg"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Left" type="Panel" parent="Bg/HSplitContainer"] +custom_minimum_size = Vector2(1000, 0) +layout_mode = 2 + +[node name="MapView" type="SubViewportContainer" parent="Bg/HSplitContainer/Left"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="SubViewport" type="SubViewport" parent="Bg/HSplitContainer/Left/MapView"] +handle_input_locally = false +size = Vector2i(1000, 1080) +render_target_update_mode = 4 + +[node name="TileMap" type="TileMap" parent="Bg/HSplitContainer/Left/MapView/SubViewport"] +scale = Vector2(4, 4) +format = 2 +script = ExtResource("2_waq8f") + +[node name="Right" type="Panel" parent="Bg/HSplitContainer"] +custom_minimum_size = Vector2(300, 0) +layout_mode = 2 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 54b921f..0464a5e 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -352,7 +352,7 @@ [sub_resource type="ImageTexture" id="58"] -[sub_resource type="Image" id="Image_b6nkn"] +[sub_resource type="Image" id="Image_3y7qf"] 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, 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, 255, 255, 255, 0, 255, 255, 255, 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, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 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, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 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, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 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, 66, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 66, 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, 39, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 75, 255, 255, 255, 39, 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, 1, 255, 255, 255, 39, 255, 255, 255, 67, 255, 255, 255, 67, 255, 255, 255, 39, 255, 255, 255, 1, 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, 255, 255, 255, 0, 255, 255, 255, 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, 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", @@ -362,7 +362,7 @@ } [sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_b6nkn") +image = SubResource("Image_3y7qf") [sub_resource type="StyleBoxTexture" id="61"] content_margin_left = 2.0 @@ -372,7 +372,7 @@ texture = SubResource("60") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_j48uy"] +[sub_resource type="Image" id="Image_sd25q"] 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, 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, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 248, 248, 248, 0, 248, 248, 248, 164, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 164, 248, 248, 248, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 247, 247, 0, 247, 247, 247, 97, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 248, 248, 248, 186, 247, 247, 247, 97, 247, 247, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 191, 191, 191, 4, 247, 247, 247, 98, 248, 248, 248, 167, 248, 248, 248, 167, 247, 247, 247, 98, 191, 191, 191, 4, 191, 191, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 191, 191, 191, 0, 247, 247, 247, 0, 248, 248, 248, 0, 248, 248, 248, 0, 247, 247, 247, 0, 191, 191, 191, 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, 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", @@ -382,7 +382,7 @@ } [sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_j48uy") +image = SubResource("Image_sd25q") [sub_resource type="StyleBoxTexture" id="64"] content_margin_left = 2.0 @@ -392,7 +392,7 @@ texture = SubResource("63") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_nhoc6"] +[sub_resource type="Image" id="Image_mkcpu"] 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, 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, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 173, 173, 173, 0, 173, 173, 173, 163, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 163, 173, 173, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 172, 172, 172, 0, 172, 172, 172, 96, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 173, 173, 173, 185, 172, 172, 172, 96, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 127, 127, 127, 4, 173, 173, 173, 97, 173, 173, 173, 166, 173, 173, 173, 166, 173, 173, 173, 97, 127, 127, 127, 4, 127, 127, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 127, 127, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 173, 173, 173, 0, 127, 127, 127, 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, 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", @@ -402,7 +402,7 @@ } [sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_nhoc6") +image = SubResource("Image_mkcpu") [sub_resource type="StyleBoxTexture" id="67"] content_margin_left = 2.0 @@ -412,7 +412,7 @@ texture = SubResource("66") region_rect = Rect2(0, 0, 12, 12) -[sub_resource type="Image" id="Image_1wmhk"] +[sub_resource type="Image" id="Image_qiptm"] 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, 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, 0, 0, 0, 0, 0, 0, 0, 255, 255, 255, 0, 255, 255, 255, 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, 255, 255, 255, 0, 255, 255, 255, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 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, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 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, 16, 255, 255, 255, 21, 255, 255, 255, 21, 255, 255, 255, 16, 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, 4, 255, 255, 255, 16, 255, 255, 255, 16, 255, 255, 255, 4, 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, 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, 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, 0, 0, 0, 0, 0, 0, 0), "format": "RGBA8", @@ -422,7 +422,7 @@ } [sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_1wmhk") +image = SubResource("Image_qiptm") [sub_resource type="StyleBoxTexture" id="70"] content_margin_left = 0.0 @@ -446,7 +446,7 @@ content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_1ypfp"] +[sub_resource type="Image" id="Image_acigi"] 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", @@ -456,14 +456,19 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_1ypfp") +image = SubResource("Image_acigi") [sub_resource type="StyleBoxFlat" id="57"] content_margin_left = 6.0 content_margin_top = 4.0 content_margin_right = 6.0 content_margin_bottom = 4.0 -bg_color = Color(0.0705882, 0.0705882, 0.0705882, 1) +bg_color = Color(0.0705882, 0.0705882, 0.0705882, 0.423529) +border_width_left = 1 +border_width_top = 1 +border_width_right = 1 +border_width_bottom = 1 +border_color = Color(0.152941, 0.152941, 0.152941, 1) [sub_resource type="StyleBoxTexture" id="73"] content_margin_left = 2.0 diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 1968085..0e722b6 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -90,4 +90,12 @@ { return str.Substring(0, 1).ToUpper() + str.Substring(1); } + + /// + /// 将 Vector2 类型转为 Vector2I 类型 + /// + public static Vector2I AsVector2I(this Vector2 vector2) + { + return new Vector2I((int)vector2.X, (int)vector2.Y); + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 5b806ca..ed8f5f4 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -98,7 +98,7 @@ public static void GenerateUiCode(Node control, string path) { _nodeNameMap.Clear(); - var uiNode = EachNode(control); + var uiNode = EachNode(control.Name, control); var code = GenerateClassCode(uiNode); File.WriteAllText(path, code); } @@ -116,7 +116,7 @@ var path = GameConfig.UiCodeDir + uiName.FirstToLower() + "/" + uiName + ".cs"; GD.Print("重新生成ui代码: " + path); - var uiNode = EachNodeFromEditor(control); + var uiNode = EachNodeFromEditor(control.Name, control); var code = GenerateClassCode(uiNode); File.WriteAllText(path, code); } @@ -132,9 +132,9 @@ private static string GenerateClassCode(UiNodeInfo uiNodeInfo) { return $"namespace UI.{uiNodeInfo.OriginName};\n\n" + - $"/// \n" + - $"/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失\n" + - $"/// \n" + + $"/// \n" + + $"/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失\n" + + $"/// \n" + $"public abstract partial class {uiNodeInfo.OriginName} : UiBase\n" + $"{{\n" + GeneratePropertyListClassCode("", uiNodeInfo.OriginName + ".", uiNodeInfo, " ") + @@ -144,9 +144,11 @@ $" }}\n" + $"\n" + GenerateAllChildrenClassCode(uiNodeInfo.OriginName + ".", uiNodeInfo, " ") + + $"\n" + + GenerateSoleLayerCode(uiNodeInfo, uiNodeInfo, "", uiNodeInfo.OriginName, " ") + $"}}\n"; } - + private static string GenerateAllChildrenClassCode(string parent, UiNodeInfo uiNodeInfo, string retraction) { var str = ""; @@ -166,13 +168,13 @@ private static string GenerateChildrenClassCode(string parent, UiNodeInfo uiNodeInfo, string retraction) { return retraction + $"/// \n" + - retraction + $"/// 类型: , 路径: {parent}{uiNodeInfo.OriginName}\n" + + retraction + $"/// 类型: , 路径: {parent}{uiNodeInfo.OriginName}\n" + retraction + $"/// \n" + - retraction + $"public class {uiNodeInfo.ClassName} : IUiNode<{uiNodeInfo.TypeName}, {uiNodeInfo.ClassName}>\n" + + retraction + $"public class {uiNodeInfo.ClassName} : IUiNode<{uiNodeInfo.NodeTypeName}, {uiNodeInfo.ClassName}>\n" + retraction + $"{{\n" + GeneratePropertyListClassCode("Instance.", parent, uiNodeInfo, retraction + " ") + - retraction + $" public {uiNodeInfo.ClassName}({uiNodeInfo.TypeName} node) : base(node) {{ }}\n" + - retraction + $" public override {uiNodeInfo.ClassName} Clone() => new (({uiNodeInfo.TypeName})Instance.Duplicate());\n" + + retraction + $" public {uiNodeInfo.ClassName}({uiNodeInfo.NodeTypeName} node) : base(node) {{ }}\n" + + retraction + $" public override {uiNodeInfo.ClassName} Clone() => new (({uiNodeInfo.NodeTypeName})Instance.Duplicate());\n" + retraction + $"}}\n\n"; } @@ -194,23 +196,73 @@ private static string GeneratePropertyCode(string target, string parent, UiNodeInfo uiNodeInfo, string retraction) { return retraction + $"/// \n" + - retraction + $"/// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: {parent}{uiNodeInfo.OriginName}\n" + + retraction + $"/// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: {parent}{uiNodeInfo.OriginName}\n" + retraction + $"/// \n" + retraction + $"public {uiNodeInfo.ClassName} {uiNodeInfo.Name}\n" + retraction + $"{{\n" + retraction + $" get\n" + retraction + $" {{\n" + - retraction + $" if (_{uiNodeInfo.Name} == null) _{uiNodeInfo.Name} = new {uiNodeInfo.ClassName}({target}GetNodeOrNull<{uiNodeInfo.TypeName}>(\"{uiNodeInfo.OriginName}\"));\n" + + retraction + $" if (_{uiNodeInfo.Name} == null) _{uiNodeInfo.Name} = new {uiNodeInfo.ClassName}({target}GetNodeOrNull<{uiNodeInfo.NodeTypeName}>(\"{uiNodeInfo.OriginName}\"));\n" + retraction + $" return _{uiNodeInfo.Name};\n" + retraction + $" }}\n" + retraction + $"}}\n" + retraction + $"private {uiNodeInfo.ClassName} _{uiNodeInfo.Name};\n\n"; } + + private static string GenerateSoleLayerCode(UiNodeInfo rootNode, UiNodeInfo uiNodeInfo, string layerName, string parent, string retraction) + { + var str = ""; + if (uiNodeInfo.Children != null) + { + foreach (var nodeInfo in uiNodeInfo.Children) + { + var layer = layerName; + if (layerName.Length > 0) + { + layer += "."; + } + + layer += nodeInfo.Name; + var path = parent + "." + nodeInfo.OriginName; + str += GenerateSoleLayerCode(rootNode, nodeInfo, layer, path, retraction); + if (IsSoleNameNode(rootNode, nodeInfo)) + { + str += $"{retraction}/// \n"; + str += $"{retraction}/// 场景中唯一名称的节点, 节点类型: , 节点路径: {path}\n"; + str += $"{retraction}/// \n"; + str += $"{retraction}public {nodeInfo.ClassName} S_{nodeInfo.OriginName} => {layer};\n\n"; + } + } + } + return str; + } + + //返回指定节点在当前场景中是否是唯一名称的节点 + private static bool IsSoleNameNode(UiNodeInfo parentNodeInfo, UiNodeInfo uiNodeInfo) + { + if (parentNodeInfo.Children != null) + { + foreach (var nodeInfo in parentNodeInfo.Children) + { + if (nodeInfo != uiNodeInfo && nodeInfo.OriginName == uiNodeInfo.OriginName) + { + return false; + } + + if (!IsSoleNameNode(nodeInfo, uiNodeInfo)) + { + return false; + } + } + } + + return true; + } /// /// 递归解析节点, 并生成 UiNodeInfo 数据 /// - private static UiNodeInfo EachNode(Node node) + private static UiNodeInfo EachNode(string uiRootName, Node node) { var originName = Regex.Replace(node.Name, "[^\\w]", ""); //类定义该图层的类名 @@ -218,16 +270,16 @@ if (_nodeNameMap.ContainsKey(originName)) //有同名图层, 为了防止类名冲突, 需要在 UiNode 后面加上索引 { var count = _nodeNameMap[originName]; - className = "UiNode" + (count) + "_" + originName; + className = uiRootName + (count) + "_" + originName; _nodeNameMap[originName] = count + 1; } else { - className = "UiNode" + "_" + originName; + className = uiRootName + "_" + originName; _nodeNameMap.Add(originName, 1); } - var uiNode = new UiNodeInfo("L_" + originName, originName, className, node.GetType().FullName); + var uiNode = new UiNodeInfo(uiRootName, "L_" + originName, originName, className, node.GetType().FullName); var childCount = node.GetChildCount(); if (childCount > 0) @@ -242,7 +294,7 @@ uiNode.Children = new List(); } - uiNode.Children.Add(EachNode(children)); + uiNode.Children.Add(EachNode(uiRootName, children)); } } } @@ -253,7 +305,7 @@ /// /// 在编辑器下递归解析节点, 由于编辑器下绑定用户脚本的节点无法直接判断节点类型, 那么就只能获取节点的脚本然后解析名称和命名空间 /// - private static UiNodeInfo EachNodeFromEditor(Node node) + private static UiNodeInfo EachNodeFromEditor(string uiRootName, Node node) { UiNodeInfo uiNode; //原名称 @@ -265,19 +317,19 @@ if (_nodeNameMap.ContainsKey(originName)) //有同名图层, 为了防止类名冲突, 需要在 UiNode 后面加上索引 { var count = _nodeNameMap[originName]; - className = "UiNode" + (count) + "_" + originName; + className = uiRootName + (count) + "_" + originName; _nodeNameMap[originName] = count + 1; } else { - className = "UiNode" + "_" + originName; + className = uiRootName + "_" + originName; _nodeNameMap.Add(originName, 1); } var script = node.GetScript().As(); if (script == null) //无脚本, 说明是内置节点 { - uiNode = new UiNodeInfo(fieldName, originName, className, node.GetType().FullName); + uiNode = new UiNodeInfo(uiRootName, fieldName, originName, className, node.GetType().FullName); } else //存在脚本 { @@ -288,11 +340,11 @@ var match = Regex.Match(script.SourceCode, "(?<=namespace\\s+)[\\w\\.]+"); if (match.Success) //存在命名空间 { - uiNode = new UiNodeInfo(fieldName, originName, className, match.Value + "." + fileName); + uiNode = new UiNodeInfo(uiRootName, fieldName, originName, className, match.Value + "." + fileName); } else //不存在命名空间 { - uiNode = new UiNodeInfo(fieldName, originName, className, fileName); + uiNode = new UiNodeInfo(uiRootName, fieldName, originName, className, fileName); } } @@ -309,7 +361,7 @@ uiNode.Children = new List(); } - uiNode.Children.Add(EachNodeFromEditor(children)); + uiNode.Children.Add(EachNodeFromEditor(uiRootName, children)); } } } @@ -319,18 +371,38 @@ private class UiNodeInfo { + /// + /// 层级名称 + /// public string Name; + /// + /// 层级原名称 + /// public string OriginName; + /// + /// 层级类名 + /// public string ClassName; - public string TypeName; + /// + /// Godot节点类型名称 + /// + public string NodeTypeName; + /// + /// 子节点 + /// public List Children; - - public UiNodeInfo(string name, string originName, string className, string typeName) + /// + /// Ui根节点名称 + /// + public string UiRootName; + + public UiNodeInfo(string uiRootName, string name, string originName, string className, string nodeTypeName) { + UiRootName = uiRootName; Name = name; OriginName = originName; ClassName = className; - TypeName = typeName; + NodeTypeName = nodeTypeName; } } diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index ebc986e..f0c3b89 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -12,6 +12,7 @@ public const string prefab_FanCollisionShape_tscn = "res://prefab/FanCollisionShape.tscn"; public const string prefab_bullet_Bullet0001_tscn = "res://prefab/bullet/Bullet0001.tscn"; public const string prefab_bullet_Bullet0002_tscn = "res://prefab/bullet/Bullet0002.tscn"; + public const string prefab_bullet_Bullet0003_tscn = "res://prefab/bullet/Bullet0003.tscn"; public const string prefab_effect_Blood_tscn = "res://prefab/effect/Blood.tscn"; public const string prefab_effect_BulletDisappear_tscn = "res://prefab/effect/BulletDisappear.tscn"; public const string prefab_effect_BulletSmoke_tscn = "res://prefab/effect/BulletSmoke.tscn"; @@ -50,6 +51,7 @@ public const string prefab_ui_EditorTools_tscn = "res://prefab/ui/EditorTools.tscn"; public const string prefab_ui_Loading_tscn = "res://prefab/ui/Loading.tscn"; public const string prefab_ui_Main_tscn = "res://prefab/ui/Main.tscn"; + public const string prefab_ui_MapEditor_tscn = "res://prefab/ui/MapEditor.tscn"; public const string prefab_ui_RoomUI_tscn = "res://prefab/ui/RoomUI.tscn"; public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn"; public const string prefab_weapon_Weapon0001_tscn = "res://prefab/weapon/Weapon0001.tscn"; @@ -58,6 +60,7 @@ public const string prefab_weapon_Weapon0004_tscn = "res://prefab/weapon/Weapon0004.tscn"; public const string prefab_weapon_Weapon0005_tscn = "res://prefab/weapon/Weapon0005.tscn"; public const string prefab_weapon_Weapon0006_tscn = "res://prefab/weapon/Weapon0006.tscn"; + public const string prefab_weapon_Weapon0007_tscn = "res://prefab/weapon/Weapon0007.tscn"; public const string prefab_weapon_WeaponTemplate_tscn = "res://prefab/weapon/WeaponTemplate.tscn"; public const string resource_Enviromenent_tres = "res://resource/Enviromenent.tres"; public const string resource_config_ActivityObject_json = "res://resource/config/ActivityObject.json"; @@ -92,6 +95,7 @@ public const string resource_sound_sfx_beLoaded_BeLoaded0014_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0014.ogg"; public const string resource_sound_sfx_beLoaded_BeLoaded0015_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0015.ogg"; public const string resource_sound_sfx_beLoaded_BeLoaded0016_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0016.ogg"; + public const string resource_sound_sfx_beLoaded_BeLoaded0017_ogg = "res://resource/sound/sfx/beLoaded/BeLoaded0017.ogg"; public const string resource_sound_sfx_explosion_Explosion0001_ogg = "res://resource/sound/sfx/explosion/Explosion0001.ogg"; public const string resource_sound_sfx_explosion_Explosion0002_ogg = "res://resource/sound/sfx/explosion/Explosion0002.ogg"; public const string resource_sound_sfx_explosion_Explosion0003_ogg = "res://resource/sound/sfx/explosion/Explosion0003.ogg"; @@ -106,6 +110,7 @@ public const string resource_sound_sfx_reloading_Reloading_begin0007_ogg = "res://resource/sound/sfx/reloading/Reloading_begin0007.ogg"; public const string resource_sound_sfx_reloading_Reloading_begin0008_ogg = "res://resource/sound/sfx/reloading/Reloading_begin0008.ogg"; public const string resource_sound_sfx_reloading_Reloading_begin0009_ogg = "res://resource/sound/sfx/reloading/Reloading_begin0009.ogg"; + public const string resource_sound_sfx_reloading_Reloading_begin0010_ogg = "res://resource/sound/sfx/reloading/Reloading_begin0010.ogg"; public const string resource_sound_sfx_reloading_Reloading_finish0001_ogg = "res://resource/sound/sfx/reloading/Reloading_finish0001.ogg"; public const string resource_sound_sfx_reloading_Reloading_finish0002_ogg = "res://resource/sound/sfx/reloading/Reloading_finish0002.ogg"; public const string resource_sound_sfx_shooting_Shooting0001_ogg = "res://resource/sound/sfx/shooting/Shooting0001.ogg"; @@ -117,9 +122,10 @@ public const string resource_sound_sfx_shooting_Shooting0007_ogg = "res://resource/sound/sfx/shooting/Shooting0007.ogg"; public const string resource_sound_sfx_shooting_Shooting0008_ogg = "res://resource/sound/sfx/shooting/Shooting0008.ogg"; public const string resource_sprite_bullet_arrow_png = "res://resource/sprite/bullet/arrow.png"; - public const string resource_sprite_bullet_bullet_png = "res://resource/sprite/bullet/bullet.png"; + public const string resource_sprite_bullet_bullet0001_png = "res://resource/sprite/bullet/bullet0001.png"; + public const string resource_sprite_bullet_bullet0002_png = "res://resource/sprite/bullet/bullet0002.png"; + public const string resource_sprite_bullet_bullet0003_png = "res://resource/sprite/bullet/bullet0003.png"; public const string resource_sprite_bullet_bullet2_png = "res://resource/sprite/bullet/bullet2.png"; - public const string resource_sprite_bullet_bullet3_png = "res://resource/sprite/bullet/bullet3.png"; public const string resource_sprite_effects_Circle_png = "res://resource/sprite/effects/Circle.png"; public const string resource_sprite_effects_Collision_png = "res://resource/sprite/effects/Collision.png"; public const string resource_sprite_effects_debug_arrows_png = "res://resource/sprite/effects/debug_arrows.png"; @@ -194,8 +200,10 @@ public const string resource_sprite_weapon_weapon0003_Weapon0003_png = "res://resource/sprite/weapon/weapon0003/Weapon0003.png"; public const string resource_sprite_weapon_weapon0005_Weapon0005_png = "res://resource/sprite/weapon/weapon0005/Weapon0005.png"; public const string resource_sprite_weapon_weapon0006_Weapon0006_png = "res://resource/sprite/weapon/weapon0006/Weapon0006.png"; + public const string resource_sprite_weapon_weapon0007_Weapon0007_png = "res://resource/sprite/weapon/weapon0007/Weapon0007.png"; public const string resource_spriteFrames_bullet_Bullet0001_tres = "res://resource/spriteFrames/bullet/Bullet0001.tres"; public const string resource_spriteFrames_bullet_Bullet0002_tres = "res://resource/spriteFrames/bullet/Bullet0002.tres"; + public const string resource_spriteFrames_bullet_Bullet0003_tres = "res://resource/spriteFrames/bullet/Bullet0003.tres"; public const string resource_spriteFrames_effect_KnifeHit1_tres = "res://resource/spriteFrames/effect/KnifeHit1.tres"; public const string resource_spriteFrames_other_RoomDoor_EW_tres = "res://resource/spriteFrames/other/RoomDoor_EW.tres"; public const string resource_spriteFrames_other_RoomDoor_NS_tres = "res://resource/spriteFrames/other/RoomDoor_NS.tres"; @@ -222,6 +230,7 @@ public const string resource_spriteFrames_weapon_Weapon0004_tres = "res://resource/spriteFrames/weapon/Weapon0004.tres"; public const string resource_spriteFrames_weapon_Weapon0005_tres = "res://resource/spriteFrames/weapon/Weapon0005.tres"; public const string resource_spriteFrames_weapon_Weapon0006_tres = "res://resource/spriteFrames/weapon/Weapon0006.tres"; + public const string resource_spriteFrames_weapon_Weapon0007_tres = "res://resource/spriteFrames/weapon/Weapon0007.tres"; public const string resource_theme_mainTheme_tres = "res://resource/theme/mainTheme.tres"; public const string resource_theme_theme1_tres = "res://resource/theme/theme1.tres"; public const string scene_EditorDemo_tscn = "res://scene/EditorDemo.tscn"; diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index 2576d6a..2a86882 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -10,6 +10,7 @@ public const string EditorTools = "EditorTools"; public const string Loading = "Loading"; public const string Main = "Main"; + public const string MapEditor = "MapEditor"; public const string RoomUI = "RoomUI"; public const string Settlement = "Settlement"; } @@ -175,6 +176,46 @@ } /// + /// 打开 MapEditor, 并返回UI实例 + /// + public static UI.MapEditor.MapEditorPanel Open_MapEditor() + { + return OpenUi(UiName.MapEditor); + } + + /// + /// 隐藏 MapEditor 的所有实例 + /// + public static void Hide_MapEditor() + { + var uiInstance = Get_MapEditor_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 MapEditor 的所有实例 + /// + public static void Dispose_MapEditor() + { + var uiInstance = Get_MapEditor_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.DisposeUi(); + } + } + + /// + /// 获取所有 MapEditor 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.MapEditor.MapEditorPanel[] Get_MapEditor_Instance() + { + return GetUiInstance(nameof(UI.MapEditor.MapEditor)); + } + + /// /// 打开 RoomUI, 并返回UI实例 /// public static UI.RoomUI.RoomUIPanel Open_RoomUI() diff --git a/DungeonShooting_Godot/src/game/ui/main/Main.cs b/DungeonShooting_Godot/src/game/ui/main/Main.cs index 0c77b81..bb101d7 100644 --- a/DungeonShooting_Godot/src/game/ui/main/Main.cs +++ b/DungeonShooting_Godot/src/game/ui/main/Main.cs @@ -68,6 +68,15 @@ } /// + /// 类型: , 路径: Main.ButtonList.Tools + /// + public class UiNode_Tools : IUiNode + { + public UiNode_Tools(Godot.Button node) : base(node) { } + public override UiNode_Tools Clone() => new ((Godot.Button)Instance.Duplicate()); + } + + /// /// 类型: , 路径: Main.ButtonList.Setting /// public class UiNode_Setting : IUiNode @@ -104,6 +113,19 @@ private UiNode_Start _L_Start; /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Main.Tools + /// + public UiNode_Tools L_Tools + { + get + { + if (_L_Tools == null) _L_Tools = new UiNode_Tools(Instance.GetNodeOrNull("Tools")); + return _L_Tools; + } + } + private UiNode_Tools _L_Tools; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Main.Setting /// public UiNode_Setting L_Setting @@ -142,4 +164,40 @@ public override UiNode_Version Clone() => new ((Godot.Label)Instance.Duplicate()); } + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Title + /// + public UiNode_Title S_Title => L_Title; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Start + /// + public UiNode_Start S_Start => L_ButtonList.L_Start; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Tools + /// + public UiNode_Tools S_Tools => L_ButtonList.L_Tools; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Setting + /// + public UiNode_Setting S_Setting => L_ButtonList.L_Setting; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Exit + /// + public UiNode_Exit S_Exit => L_ButtonList.L_Exit; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList + /// + public UiNode_ButtonList S_ButtonList => L_ButtonList; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Version + /// + public UiNode_Version S_Version => L_Version; + } diff --git a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs index fd5222f..4b03178 100644 --- a/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/main/MainPanel.cs @@ -10,14 +10,16 @@ public override void OnShowUi() { - L_ButtonList.L_Start.Instance.Pressed += OnStartGameClick; - L_ButtonList.L_Exit.Instance.Pressed += OnExitClick; + S_Start.Instance.Pressed += OnStartGameClick; + S_Exit.Instance.Pressed += OnExitClick; + S_Tools.Instance.Pressed += OnToolsClick; } public override void OnHideUi() { - L_ButtonList.L_Start.Instance.Pressed -= OnStartGameClick; - L_ButtonList.L_Exit.Instance.Pressed -= OnExitClick; + S_Start.Instance.Pressed -= OnStartGameClick; + S_Exit.Instance.Pressed -= OnExitClick; + S_Tools.Instance.Pressed -= OnToolsClick; } @@ -33,4 +35,11 @@ { GetTree().Quit(); } + + //点击开发者工具 + private void OnToolsClick() + { + UiManager.Open_MapEditor(); + HideUi(); + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs new file mode 100644 index 0000000..8e2dc67 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs @@ -0,0 +1,203 @@ +namespace UI.MapEditor; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class MapEditor : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg + /// + public MapEditor_Bg L_Bg + { + get + { + if (_L_Bg == null) _L_Bg = new MapEditor_Bg(GetNodeOrNull("Bg")); + return _L_Bg; + } + } + private MapEditor_Bg _L_Bg; + + + public MapEditor() : base(nameof(MapEditor)) + { + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap + /// + public class MapEditor_TileMap : IUiNode + { + public MapEditor_TileMap(UI.MapEditor.EditorTileMap node) : base(node) { } + public override MapEditor_TileMap Clone() => new ((UI.MapEditor.EditorTileMap)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport + /// + public class MapEditor_SubViewport : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.TileMap + /// + public MapEditor_TileMap L_TileMap + { + get + { + if (_L_TileMap == null) _L_TileMap = new MapEditor_TileMap(Instance.GetNodeOrNull("TileMap")); + return _L_TileMap; + } + } + private MapEditor_TileMap _L_TileMap; + + public MapEditor_SubViewport(Godot.SubViewport node) : base(node) { } + public override MapEditor_SubViewport Clone() => new ((Godot.SubViewport)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left.MapView + /// + public class MapEditor_MapView : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.SubViewport + /// + public MapEditor_SubViewport L_SubViewport + { + get + { + if (_L_SubViewport == null) _L_SubViewport = new MapEditor_SubViewport(Instance.GetNodeOrNull("SubViewport")); + return _L_SubViewport; + } + } + private MapEditor_SubViewport _L_SubViewport; + + public MapEditor_MapView(Godot.SubViewportContainer node) : base(node) { } + public override MapEditor_MapView Clone() => new ((Godot.SubViewportContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Left + /// + public class MapEditor_Left : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.MapView + /// + public MapEditor_MapView L_MapView + { + get + { + if (_L_MapView == null) _L_MapView = new MapEditor_MapView(Instance.GetNodeOrNull("MapView")); + return _L_MapView; + } + } + private MapEditor_MapView _L_MapView; + + public MapEditor_Left(Godot.Panel node) : base(node) { } + public override MapEditor_Left Clone() => new ((Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer.Right + /// + public class MapEditor_Right : IUiNode + { + public MapEditor_Right(Godot.Panel node) : base(node) { } + public override MapEditor_Right Clone() => new ((Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg.HSplitContainer + /// + public class MapEditor_HSplitContainer : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.Left + /// + public MapEditor_Left L_Left + { + get + { + if (_L_Left == null) _L_Left = new MapEditor_Left(Instance.GetNodeOrNull("Left")); + return _L_Left; + } + } + private MapEditor_Left _L_Left; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.Bg.Right + /// + public MapEditor_Right L_Right + { + get + { + if (_L_Right == null) _L_Right = new MapEditor_Right(Instance.GetNodeOrNull("Right")); + return _L_Right; + } + } + private MapEditor_Right _L_Right; + + public MapEditor_HSplitContainer(Godot.HSplitContainer node) : base(node) { } + public override MapEditor_HSplitContainer Clone() => new ((Godot.HSplitContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditor.Bg + /// + public class MapEditor_Bg : IUiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditor.HSplitContainer + /// + public MapEditor_HSplitContainer L_HSplitContainer + { + get + { + if (_L_HSplitContainer == null) _L_HSplitContainer = new MapEditor_HSplitContainer(Instance.GetNodeOrNull("HSplitContainer")); + return _L_HSplitContainer; + } + } + private MapEditor_HSplitContainer _L_HSplitContainer; + + public MapEditor_Bg(Godot.Panel node) : base(node) { } + public override MapEditor_Bg Clone() => new ((Godot.Panel)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap + /// + public MapEditor_TileMap S_TileMap => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport + /// + public MapEditor_SubViewport S_SubViewport => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView + /// + public MapEditor_MapView S_MapView => L_Bg.L_HSplitContainer.L_Left.L_MapView; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left + /// + public MapEditor_Left S_Left => L_Bg.L_HSplitContainer.L_Left; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Right + /// + public MapEditor_Right S_Right => L_Bg.L_HSplitContainer.L_Right; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer + /// + public MapEditor_HSplitContainer S_HSplitContainer => L_Bg.L_HSplitContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg + /// + public MapEditor_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 new file mode 100644 index 0000000..4620dde --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -0,0 +1,40 @@ +using Godot; + +namespace UI.MapEditor; + +public partial class MapEditorPanel : MapEditor +{ + private EditorTileMapBar _editorTileMapBar; + + public override void OnCreateUi() + { + _editorTileMapBar = new EditorTileMapBar(S_TileMap); + } + + public override void OnShowUi() + { + S_Left.Instance.Resized += OnMapViewResized; + OnMapViewResized(); + + _editorTileMapBar.OnShow(); + } + + public override void OnHideUi() + { + S_Left.Instance.Resized -= OnMapViewResized; + + _editorTileMapBar.OnHide(); + } + + public override void Process(float delta) + { + _editorTileMapBar.Process(delta); + } + + //调整地图显示区域大小 + private void OnMapViewResized() + { + GD.Print(S_Left.Instance.Size); + S_SubViewport.Instance.Size = S_Left.Instance.Size.AsVector2I(); + } +} diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs new file mode 100644 index 0000000..5a7860a --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -0,0 +1,46 @@ +using Godot; + +namespace UI.MapEditor; + +public partial class EditorTileMap : TileMap +{ + public override void _Draw() + { + var mosePos = GetLocalMousePosition(); + mosePos = new Vector2((int)(mosePos.X / 16) * 16, (int)(mosePos.Y / 16) * 16); + DrawRect(new Rect2(mosePos, 16, 16), Colors.Wheat, false); + } + + public override void _Input(InputEvent @event) + { + if (@event is InputEventMouseButton mouseButton) + { + if (mouseButton.ButtonIndex == MouseButton.WheelDown) + { + //缩小 + var scale = Scale / 1.1f; + if (scale.LengthSquared() >= 0.5f) + { + Scale = scale; + } + else + { + GD.Print("太小了"); + } + } + else if (mouseButton.ButtonIndex == MouseButton.WheelUp) + { + //放大 + var scale = Scale * 1.1f; + if (scale.LengthSquared() <= 2000) + { + Scale = scale; + } + else + { + GD.Print("太大了"); + } + } + } + } +} \ 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 new file mode 100644 index 0000000..5125952 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs @@ -0,0 +1,28 @@ +namespace UI.MapEditor; + +public class EditorTileMapBar +{ + private MapEditor.MapEditor_TileMap _editorTileMap; + + public EditorTileMapBar(MapEditor.MapEditor_TileMap editorTileMap) + { + _editorTileMap = editorTileMap; + } + + public void OnShow() + { + + } + + public void OnHide() + { + + } + + public void Process(float delta) + { + _editorTileMap.Instance.QueueRedraw(); + } + + +} \ No newline at end of file