diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn new file mode 100644 index 0000000..dfde846 --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn @@ -0,0 +1,87 @@ +[gd_scene load_steps=2 format=3 uid="uid://dh7y03tq6v0a2"] + +[ext_resource type="Script" path="res://src/game/ui/mapEditorProject/MapEditorProjectPanel.cs" id="1_5aioo"] + +[node name="MapEditorProject" 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_5aioo") + +[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="VBoxContainer" type="VBoxContainer" parent="Bg"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/separation = 0 + +[node name="Panel" type="Panel" parent="Bg/VBoxContainer"] +custom_minimum_size = Vector2(0, 150) +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/Panel"] +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 + +[node name="HBoxContainer" type="HBoxContainer" parent="Bg/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme_override_constants/separation = 0 + +[node name="Panel" type="Panel" parent="Bg/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 3.0 + +[node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel"] +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 = 12 +theme_override_constants/margin_top = 12 +theme_override_constants/margin_right = 12 +theme_override_constants/margin_bottom = 12 + +[node name="ScrollContainer" type="ScrollContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel/MarginContainer"] +layout_mode = 2 +vertical_scroll_mode = 2 + +[node name="GroupButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/Panel/MarginContainer/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "testGroup1" +alignment = 0 +text_overrun_behavior = 3 + +[node name="Panel2" type="Panel" parent="Bg/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 7.0 + +[node name="Button" type="Button" parent="Bg/VBoxContainer/HBoxContainer/Panel2"] +layout_mode = 0 +offset_right = 12.0 +offset_bottom = 8.0 +text = "1231445461" diff --git a/DungeonShooting_Godot/resource/material/BleB865.tmp b/DungeonShooting_Godot/resource/material/BleB865.tmp new file mode 100644 index 0000000..a40db2f --- /dev/null +++ b/DungeonShooting_Godot/resource/material/BleB865.tmp @@ -0,0 +1,51 @@ +shader_type canvas_item; + +//混合颜色 +uniform vec4 blend : source_color = vec4(1.0, 1.0, 1.0, 1.0); +//混合度 +uniform float schedule : hint_range(0.0, 1.0) = 0.0; +//透明度 +//uniform float alpha : hint_range(0.0, 1.0) = 1.0; +uniform vec4 modulate : source_color = vec4(1.0, 1.0, 1.0, 1.0); + +//------------------ 轮廓相关 -------------- +uniform bool show_outline = true; +//轮廓颜色 +uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0); +//是否是彩虹轮廓 +uniform bool outline_rainbow = false; +//彩虹轮廓变化周期 +const float frequency = 0.25; +const float light_offset = 0.5; + +void fragment() { + //显示轮廓 + if (show_outline) { + vec2 size = TEXTURE_PIXEL_SIZE; + float outline; + outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, size.y)).a; + outline += texture(TEXTURE, UV + vec2(size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, -size.y)).a; + outline = min(outline, 1.0); + + vec4 animated_line_color = vec4( + light_offset + sin(2.0 * 3.14 * frequency * TIME), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(120.0)), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(240.0)), + 1.0 + ); + + vec4 color = texture(TEXTURE, UV); + if (outline_rainbow){ + COLOR = mix(color, animated_line_color, outline - color.a); + } else { + COLOR = mix(color, outline_color , outline - color.a); + } + } + + vec4 col = mix(COLOR, blend, schedule); + col = mix(vec4(0.0, 0.0, 0.0, 0.0), col, COLOR.a); + col *= modulate; + COLOR = col; +} diff --git a/DungeonShooting_Godot/resource/material/BleFA6E.tmp b/DungeonShooting_Godot/resource/material/BleFA6E.tmp new file mode 100644 index 0000000..a40db2f --- /dev/null +++ b/DungeonShooting_Godot/resource/material/BleFA6E.tmp @@ -0,0 +1,51 @@ +shader_type canvas_item; + +//混合颜色 +uniform vec4 blend : source_color = vec4(1.0, 1.0, 1.0, 1.0); +//混合度 +uniform float schedule : hint_range(0.0, 1.0) = 0.0; +//透明度 +//uniform float alpha : hint_range(0.0, 1.0) = 1.0; +uniform vec4 modulate : source_color = vec4(1.0, 1.0, 1.0, 1.0); + +//------------------ 轮廓相关 -------------- +uniform bool show_outline = true; +//轮廓颜色 +uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0); +//是否是彩虹轮廓 +uniform bool outline_rainbow = false; +//彩虹轮廓变化周期 +const float frequency = 0.25; +const float light_offset = 0.5; + +void fragment() { + //显示轮廓 + if (show_outline) { + vec2 size = TEXTURE_PIXEL_SIZE; + float outline; + outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, size.y)).a; + outline += texture(TEXTURE, UV + vec2(size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, -size.y)).a; + outline = min(outline, 1.0); + + vec4 animated_line_color = vec4( + light_offset + sin(2.0 * 3.14 * frequency * TIME), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(120.0)), + light_offset + sin(2.0 * 3.14 * frequency * TIME + radians(240.0)), + 1.0 + ); + + vec4 color = texture(TEXTURE, UV); + if (outline_rainbow){ + COLOR = mix(color, animated_line_color, outline - color.a); + } else { + COLOR = mix(color, outline_color , outline - color.a); + } + } + + vec4 col = mix(COLOR, blend, schedule); + col = mix(vec4(0.0, 0.0, 0.0, 0.0), col, COLOR.a); + col *= modulate; + COLOR = col; +} diff --git a/DungeonShooting_Godot/resource/theme/mainTheme.tres b/DungeonShooting_Godot/resource/theme/mainTheme.tres index 677bd36..bd97f2b 100644 --- a/DungeonShooting_Godot/resource/theme/mainTheme.tres +++ b/DungeonShooting_Godot/resource/theme/mainTheme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=78 format=3 uid="uid://ds668te2rph30"] +[gd_resource type="Theme" load_steps=59 format=3 uid="uid://ds668te2rph30"] [ext_resource type="FontFile" uid="uid://cad0in7dtweo5" path="res://resource/font/VonwaonBitmap-16px.ttf" id="1_1e6k7"] @@ -350,103 +350,13 @@ [sub_resource type="StyleBoxFlat" id="53"] bg_color = Color(0.260588, 0.156863, 0.724706, 0.8) -[sub_resource type="ImageTexture" id="58"] - -[sub_resource type="Image" id="Image_rybxe"] -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", -"height": 12, -"mipmaps": false, -"width": 12 -} - -[sub_resource type="ImageTexture" id="60"] -image = SubResource("Image_rybxe") - -[sub_resource type="StyleBoxTexture" id="61"] -content_margin_left = 2.0 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("60") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="Image" id="Image_pwkrg"] -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", -"height": 12, -"mipmaps": false, -"width": 12 -} - -[sub_resource type="ImageTexture" id="63"] -image = SubResource("Image_pwkrg") - -[sub_resource type="StyleBoxTexture" id="64"] -content_margin_left = 2.0 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("63") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="Image" id="Image_jyk1j"] -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", -"height": 12, -"mipmaps": false, -"width": 12 -} - -[sub_resource type="ImageTexture" id="66"] -image = SubResource("Image_jyk1j") - -[sub_resource type="StyleBoxTexture" id="67"] -content_margin_left = 2.0 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("66") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="Image" id="Image_yqjvw"] -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", -"height": 12, -"mipmaps": false, -"width": 12 -} - -[sub_resource type="ImageTexture" id="69"] -image = SubResource("Image_yqjvw") - -[sub_resource type="StyleBoxTexture" id="70"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -texture = SubResource("69") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="StyleBoxTexture" id="71"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -texture = SubResource("69") -region_rect = Rect2(0, 0, 12, 12) - [sub_resource type="StyleBoxEmpty" id="54"] content_margin_left = 4.0 content_margin_top = 4.0 content_margin_right = 4.0 content_margin_bottom = 4.0 -[sub_resource type="Image" id="Image_j28e6"] +[sub_resource type="Image" id="Image_qauv8"] 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,59 +366,19 @@ } [sub_resource type="ImageTexture" id="56"] -image = SubResource("Image_j28e6") +image = SubResource("Image_qauv8") [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, 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 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("60") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="StyleBoxTexture" id="74"] -content_margin_left = 2.0 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("63") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="StyleBoxTexture" id="75"] -content_margin_left = 2.0 -content_margin_top = 2.0 -content_margin_right = 2.0 -content_margin_bottom = 2.0 -texture = SubResource("66") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="StyleBoxTexture" id="76"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -texture = SubResource("69") -region_rect = Rect2(0, 0, 12, 12) - -[sub_resource type="StyleBoxTexture" id="77"] -content_margin_left = 0.0 -content_margin_top = 0.0 -content_margin_right = 0.0 -content_margin_bottom = 0.0 -texture = SubResource("69") -region_rect = Rect2(0, 0, 12, 12) +bg_color = Color(0.0745098, 0.0745098, 0.0745098, 1) +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.188235, 0.188235, 0.188235, 1) [resource] default_font = ExtResource("1_1e6k7") @@ -605,17 +475,6 @@ Editor/styles/sub_inspector_property_bg_selected7 = SubResource("51") Editor/styles/sub_inspector_property_bg_selected8 = SubResource("52") Editor/styles/sub_inspector_property_bg_selected9 = SubResource("53") -HScrollBar/icons/decrement = SubResource("58") -HScrollBar/icons/decrement_highlight = SubResource("58") -HScrollBar/icons/decrement_pressed = SubResource("58") -HScrollBar/icons/increment = SubResource("58") -HScrollBar/icons/increment_highlight = SubResource("58") -HScrollBar/icons/increment_pressed = SubResource("58") -HScrollBar/styles/grabber = SubResource("61") -HScrollBar/styles/grabber_highlight = SubResource("64") -HScrollBar/styles/grabber_pressed = SubResource("67") -HScrollBar/styles/scroll = SubResource("70") -HScrollBar/styles/scroll_focus = SubResource("71") Label/colors/font_color = Color(0.780392, 0.780392, 0.780392, 1) Label/colors/font_color_shadow = Color(0, 0, 0, 0) Label/colors/font_outline_modulate = Color(1, 1, 1, 1) @@ -640,14 +499,3 @@ LineEdit/styles/normal = SubResource("4") LineEdit/styles/read_only = SubResource("1") Panel/styles/panel = SubResource("57") -VScrollBar/icons/decrement = SubResource("58") -VScrollBar/icons/decrement_highlight = SubResource("58") -VScrollBar/icons/decrement_pressed = SubResource("58") -VScrollBar/icons/increment = SubResource("58") -VScrollBar/icons/increment_highlight = SubResource("58") -VScrollBar/icons/increment_pressed = SubResource("58") -VScrollBar/styles/grabber = SubResource("73") -VScrollBar/styles/grabber_highlight = SubResource("74") -VScrollBar/styles/grabber_pressed = SubResource("75") -VScrollBar/styles/scroll = SubResource("76") -VScrollBar/styles/scroll_focus = SubResource("77") diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 29b1596..16960a6 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -32,12 +32,12 @@ $"public partial class {uiName}Panel : {uiName}\n" + $"{{\n" + $"\n" + - $" public override void OnShowUi()\n" + + $" public override void OnCreateUi()\n" + $" {{\n" + $" \n" + $" }}\n" + $"\n" + - $" public override void OnHideUi()\n" + + $" public override void OnDisposeUi()\n" + $" {{\n" + $" \n" + $" }}\n" + @@ -277,12 +277,12 @@ if (_nodeNameMap.ContainsKey(originName)) //有同名图层, 为了防止类名冲突, 需要在 UiNode 后面加上索引 { var count = _nodeNameMap[originName]; - className = uiRootName + "_" + originName + "_" + count; + className = originName + "_" + count; _nodeNameMap[originName] = count + 1; } else { - className = uiRootName + "_" + originName; + className = originName; _nodeNameMap.Add(originName, 1); } @@ -324,12 +324,12 @@ if (_nodeNameMap.ContainsKey(originName)) //有同名图层, 为了防止类名冲突, 需要在 UiNode 后面加上索引 { var count = _nodeNameMap[originName]; - className = uiRootName + (count) + "_" + originName; + className = originName + "_" + count; _nodeNameMap[originName] = count + 1; } else { - className = uiRootName + "_" + originName; + className = originName; _nodeNameMap.Add(originName, 1); } diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 401fa06..b0ccf80 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -55,23 +55,27 @@ //记录ui打开 UiManager.RecordUi(this, UiManager.RecordType.Open); } - + /// /// 创建当前ui时调用 /// public virtual void OnCreateUi() { } - + /// /// 当前ui显示时调用 /// - public abstract void OnShowUi(); + public virtual void OnShowUi() + { + } /// /// 当前ui隐藏时调用 /// - public abstract void OnHideUi(); + public virtual void OnHideUi() + { + } /// /// 销毁当前ui时调用 diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs index f3de805..f9746fc 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs @@ -1,22 +1,76 @@  -using Godot; - +/// +/// 网格组件中单个格子的数据处理类 +/// +/// ui节点类型 +/// 数据类型 public abstract class UiCell : IDestroy where TUiCellNode : IUiCellNode { public bool IsDestroyed { get; private set; } - public UiGrid Grid { get; set; } - public TUiCellNode CellNode { get; set; } - public T Data { get; set; } + /// + /// 所在的网格对象 + /// + public UiGrid Grid { get; private set; } + + /// + /// 当前cell使用的Ui节点对象 + /// + public TUiCellNode CellNode { get; private set; } + + /// + /// 当前cell分配的数据 + /// + public T Data { get; private set; } - public virtual void OnInit() + private bool _init = false; + + /// + /// 当前cell初始化时调用 + /// + protected virtual void OnInit() { } - public virtual void OnSetData(T data) + /// + /// 当前cell被分配值时调用 + /// + protected virtual void OnSetData(T data) { } + /// + /// 销毁当前cell时调用 + /// + protected virtual void OnDestroy() + { + } + + /// + /// 初始化数据 + /// + public void Init(UiGrid grid, TUiCellNode cellNode) + { + if (_init) + { + return; + } + + _init = true; + Grid = grid; + CellNode = cellNode; + OnInit(); + } + + /// + /// 设置当前cell的值 + /// + public void SetData(T data) + { + Data = data; + OnSetData(data); + } + public void Destroy() { if (IsDestroyed) diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index d1398af..4e886bd 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -7,39 +7,53 @@ /// /// Ui网格组件 /// -/// 原生Godot类型 -/// Ui节点类型 +/// Ui节点类型 /// 传给Cell的数据类型 -public partial class UiGrid : GridContainer, IDestroy where TUiCellNode : IUiCellNode +public partial class UiGrid : IDestroy where TUiCellNode : IUiCellNode { public bool IsDestroyed { get; private set; } + private TUiCellNode _template; private Node _parent; private Type _cellType; private Stack> _cellPool = new Stack>(); private List> _cellList = new List>(); + private GridContainer _gridContainer; + public UiGrid(TUiCellNode template, Type cellType, int columns, int offsetX, int offsetY) { + _gridContainer = new GridContainer(); + _gridContainer.Ready += OnReady; _template = template; _cellType = cellType; var uiInstance = _template.GetUiInstance(); _parent = uiInstance.GetParent(); _parent.RemoveChild(uiInstance); - _parent.AddChild(this); - Columns = columns; - AddThemeConstantOverride("h_separation", offsetX); - AddThemeConstantOverride("v_separation", offsetY); + _parent.AddChild(_gridContainer); + _gridContainer.Columns = columns; + _gridContainer.AddThemeConstantOverride("h_separation", offsetX); + _gridContainer.AddThemeConstantOverride("v_separation", offsetY); } - public override void _Ready() + public void SetHorizontalExpand(bool flag) { - if (_template.GetUiInstance() is Control control) + if (_gridContainer != null) { - Position = control.Position; + if (flag) + { + _gridContainer.SizeFlagsHorizontal |= Control.SizeFlags.Expand; + } + else if ((_gridContainer.SizeFlagsHorizontal & Control.SizeFlags.Expand) != 0) + { + _gridContainer.SizeFlagsHorizontal ^= Control.SizeFlags.Expand; + } } } - + + /// + /// 设置当前网格组件中的所有数据 + /// public void SetDataList(TData[] array) { if (array.Length > _cellList.Count) @@ -48,7 +62,7 @@ { var cell = GetCellInstance(); _cellList.Add(cell); - AddChild(cell.CellNode.GetUiInstance()); + _gridContainer.AddChild(cell.CellNode.GetUiInstance()); } while (array.Length > _cellList.Count); } else if(array.Length < _cellList.Count) @@ -64,16 +78,20 @@ for (var i = 0; i < _cellList.Count; i++) { var data = array[i]; - _cellList[i].OnSetData(data); + _cellList[i].SetData(data); } } + /// + /// 添加单条数据 + /// + /// public void Add(TData data) { var cell = GetCellInstance(); _cellList.Add(cell); - AddChild(cell.CellNode.GetUiInstance()); - cell.OnSetData(data); + _gridContainer.AddChild(cell.CellNode.GetUiInstance()); + cell.SetData(data); } public void Destroy() @@ -95,8 +113,18 @@ } _cellList = null; _cellPool = null; + _gridContainer.QueueFree(); } + private void OnReady() + { + _gridContainer.Ready -= OnReady; + if (_template.GetUiInstance() is Control control) + { + _gridContainer.Position = control.Position; + } + } + private UiCell GetCellInstance() { if (_cellPool.Count > 0) @@ -109,15 +137,13 @@ { throw new Exception($"cellType 无法转为'{typeof(UiCell).FullName}'类型!"); } - uiCell.CellNode = (TUiCellNode)_template.CloneUiCell(); - uiCell.Grid = this; - uiCell.OnInit(); + uiCell.Init(this, (TUiCellNode)_template.CloneUiCell()); return uiCell; } private void ReclaimCellInstance(UiCell cell) { - RemoveChild(cell.CellNode.GetUiInstance()); + _gridContainer.RemoveChild(cell.CellNode.GetUiInstance()); _cellPool.Push(cell); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 00afea1..3761247 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -135,7 +135,8 @@ BottomTipsPanel.Init(); //打开主菜单Ui //UiManager.Open_Main(); - UiManager.Open_MapEditor(); + //UiManager.Open_MapEditor(); + UiManager.Open_MapEditorProject(); } public override void _Process(double delta) diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 475d109..42496d7 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -52,6 +52,7 @@ 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_MapEditorProject_tscn = "res://prefab/ui/MapEditorProject.tscn"; public const string prefab_ui_MapEditorTools_tscn = "res://prefab/ui/MapEditorTools.tscn"; public const string prefab_ui_RoomUI_tscn = "res://prefab/ui/RoomUI.tscn"; public const string prefab_ui_Settlement_tscn = "res://prefab/ui/Settlement.tscn"; @@ -74,8 +75,8 @@ public const string resource_font_VonwaonBitmap12px_ttf = "res://resource/font/VonwaonBitmap-12px.ttf"; public const string resource_font_VonwaonBitmap16px_ttf = "res://resource/font/VonwaonBitmap-16px.ttf"; public const string resource_map_RoomConfig_json = "res://resource/map/RoomConfig.json"; - public const string resource_map_tileset_TileSet1_tres = "res://resource/map/tileset/TileSet1.tres"; - public const string resource_map_tileset_TileSet_old_tres = "res://resource/map/tileset/TileSet_old.tres"; + public const string resource_map_tileSet_TileSet1_tres = "res://resource/map/tileSet/TileSet1.tres"; + public const string resource_map_tileSet_TileSet_old_tres = "res://resource/map/tileSet/TileSet_old.tres"; public const string resource_material_Blend_gdshader = "res://resource/material/Blend.gdshader"; public const string resource_material_Blend_tres = "res://resource/material/Blend.tres"; public const string resource_material_SmokeParticleMaterial_tres = "res://resource/material/SmokeParticleMaterial.tres"; @@ -159,8 +160,8 @@ public const string resource_sprite_role_role7_png = "res://resource/sprite/role/role7.png"; public const string resource_sprite_role_role8_png = "res://resource/sprite/role/role8.png"; public const string resource_sprite_role_role9_png = "res://resource/sprite/role/role9.png"; - public const string resource_sprite_role_enemy0001_enemy0001_png = "res://resource/sprite/role/enemy0001/enemy0001.png"; - public const string resource_sprite_role_enemy0001_enemy0001_Debris_png = "res://resource/sprite/role/enemy0001/enemy0001_Debris.png"; + public const string resource_sprite_role_enemy0001_Enemy0001_png = "res://resource/sprite/role/enemy0001/Enemy0001.png"; + public const string resource_sprite_role_enemy0001_Enemy0001_Debris_png = "res://resource/sprite/role/enemy0001/Enemy0001_Debris.png"; public const string resource_sprite_shell_Shell0001_png = "res://resource/sprite/shell/Shell0001.png"; public const string resource_sprite_shell_Shell0002_png = "res://resource/sprite/shell/Shell0002.png"; public const string resource_sprite_shell_Shell0003_png = "res://resource/sprite/shell/Shell0003.png"; diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index f67ed67..5144e3b 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -11,6 +11,7 @@ public const string Loading = "Loading"; public const string Main = "Main"; public const string MapEditor = "MapEditor"; + public const string MapEditorProject = "MapEditorProject"; public const string MapEditorTools = "MapEditorTools"; public const string RoomUI = "RoomUI"; public const string Settlement = "Settlement"; @@ -217,6 +218,46 @@ } /// + /// 打开 MapEditorProject, 并返回UI实例 + /// + public static UI.MapEditorProject.MapEditorProjectPanel Open_MapEditorProject() + { + return OpenUi(UiName.MapEditorProject); + } + + /// + /// 隐藏 MapEditorProject 的所有实例 + /// + public static void Hide_MapEditorProject() + { + var uiInstance = Get_MapEditorProject_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 MapEditorProject 的所有实例 + /// + public static void Dispose_MapEditorProject() + { + var uiInstance = Get_MapEditorProject_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.DisposeUi(); + } + } + + /// + /// 获取所有 MapEditorProject 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.MapEditorProject.MapEditorProjectPanel[] Get_MapEditorProject_Instance() + { + return GetUiInstance(nameof(UI.MapEditorProject.MapEditorProject)); + } + + /// /// 打开 MapEditorTools, 并返回UI实例 /// public static UI.MapEditorTools.MapEditorToolsPanel Open_MapEditorTools() diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs new file mode 100644 index 0000000..e0ffe60 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs @@ -0,0 +1,9 @@ +namespace UI.MapEditorProject; + +public class GroupButtonCell : UiCell +{ + protected override void OnSetData(string data) + { + CellNode.Instance.Text = 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 new file mode 100644 index 0000000..d0782d7 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs @@ -0,0 +1,291 @@ +namespace UI.MapEditorProject; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class MapEditorProject : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg + /// + public Bg L_Bg + { + get + { + if (_L_Bg == null) _L_Bg = new Bg(this, GetNodeOrNull("Bg")); + return _L_Bg; + } + } + private Bg _L_Bg; + + + public MapEditorProject() : base(nameof(MapEditorProject)) + { + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Panel.MarginContainer + /// + public class MarginContainer : UiNode + { + public MarginContainer(MapEditorProject uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.Panel + /// + public class Panel : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.MarginContainer + /// + public MarginContainer L_MarginContainer + { + get + { + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer _L_MarginContainer; + + public Panel(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.ScrollContainer.GroupButton + /// + public class GroupButton : UiNode + { + public GroupButton(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override GroupButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.ScrollContainer + /// + public class ScrollContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.GroupButton + /// + public GroupButton L_GroupButton + { + get + { + if (_L_GroupButton == null) _L_GroupButton = new GroupButton(UiPanel, Instance.GetNodeOrNull("GroupButton")); + return _L_GroupButton; + } + } + private GroupButton _L_GroupButton; + + public ScrollContainer(MapEditorProject uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer + /// + public class MarginContainer_1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.ScrollContainer + /// + public ScrollContainer L_ScrollContainer + { + get + { + if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNodeOrNull("ScrollContainer")); + return _L_ScrollContainer; + } + } + 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()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel + /// + public class Panel_1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.MarginContainer + /// + public MarginContainer_1 L_MarginContainer + { + get + { + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer_1 _L_MarginContainer; + + public Panel_1(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel_1 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.Button + /// + public class Button : UiNode + { + public Button(MapEditorProject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Button Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2 + /// + public class Panel2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Button + /// + public Button L_Button + { + get + { + if (_L_Button == null) _L_Button = new Button(UiPanel, Instance.GetNodeOrNull("Button")); + return _L_Button; + } + } + private Button _L_Button; + + public Panel2(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel2 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer + /// + public class HBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Panel + /// + public Panel_1 L_Panel + { + get + { + if (_L_Panel == null) _L_Panel = new Panel_1(UiPanel, Instance.GetNodeOrNull("Panel")); + return _L_Panel; + } + } + private Panel_1 _L_Panel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.Panel2 + /// + public Panel2 L_Panel2 + { + get + { + if (_L_Panel2 == null) _L_Panel2 = new Panel2(UiPanel, Instance.GetNodeOrNull("Panel2")); + return _L_Panel2; + } + } + private Panel2 _L_Panel2; + + public HBoxContainer(MapEditorProject uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.Panel + /// + public Panel L_Panel + { + get + { + if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNodeOrNull("Panel")); + return _L_Panel; + } + } + private Panel _L_Panel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.HBoxContainer + /// + public HBoxContainer L_HBoxContainer + { + get + { + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); + return _L_HBoxContainer; + } + } + private HBoxContainer _L_HBoxContainer; + + public VBoxContainer(MapEditorProject uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorProject.Bg + /// + public class Bg : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.VBoxContainer + /// + public VBoxContainer L_VBoxContainer + { + get + { + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNodeOrNull("VBoxContainer")); + return _L_VBoxContainer; + } + } + private VBoxContainer _L_VBoxContainer; + + public Bg(MapEditorProject uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Bg Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: 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.MarginContainer.ScrollContainer + /// + public ScrollContainer S_ScrollContainer => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel.L_MarginContainer.L_ScrollContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.Button + /// + public Button S_Button => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_Button; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2 + /// + public Panel2 S_Panel2 => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer + /// + public HBoxContainer S_HBoxContainer => L_Bg.L_VBoxContainer.L_HBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer + /// + public VBoxContainer S_VBoxContainer => L_Bg.L_VBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg + /// + public Bg S_Bg => L_Bg; + +} diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs new file mode 100644 index 0000000..24afc04 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs @@ -0,0 +1,32 @@ +using Godot; + +namespace UI.MapEditorProject; + +public partial class MapEditorProjectPanel : MapEditorProject +{ + + private UiGrid _groupGrid; + + public override void OnCreateUi() + { + _groupGrid = new UiGrid(S_GroupButton, typeof(GroupButtonCell), 1, 0, 10); + _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" }); + } + + public override void OnShowUi() + { + + } + + public override void OnHideUi() + { + + } + + public override void OnDisposeUi() + { + _groupGrid.Destroy(); + _groupGrid = null; + } +} diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs index 6076f4e..93b5465 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeCell.cs @@ -6,7 +6,7 @@ { private int _type = -1; - public override void OnSetData(LifeIconEnum data) + protected override void OnSetData(LifeIconEnum data) { if (_type == (int)data) {