diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn index ea7c698..2948f79 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapMark.tscn @@ -1,16 +1,19 @@ -[gd_scene load_steps=6 format=3 uid="uid://peo0n8bl15y5"] +[gd_scene load_steps=7 format=3 uid="uid://peo0n8bl15y5"] [ext_resource type="Script" path="res://src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs" id="1_dudey"] [ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="2_osya0"] [ext_resource type="Texture2D" uid="uid://dggb6p4sdmfry" path="res://resource/sprite/ui/commonIcon/Edit.png" id="3_wwaki"] [ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="4_urq7y"] [ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="5_3tml0"] +[ext_resource type="Texture2D" uid="uid://d4gduco55dqpk" path="res://resource/sprite/ui/commonIcon/Down.png" id="5_x5dpw"] [node name="MapEditorMapMark" 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_dudey") [node name="VBoxContainer" type="VBoxContainer" parent="."] @@ -81,8 +84,9 @@ layout_mode = 2 [node name="TextureButton" type="TextureButton" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/HBoxContainer"] +custom_minimum_size = Vector2(36, 36) layout_mode = 2 -texture_normal = ExtResource("2_osya0") +texture_normal = ExtResource("5_x5dpw") stretch_mode = 3 [node name="WaveButton" type="Button" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/HBoxContainer"] @@ -93,7 +97,7 @@ [node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate"] layout_mode = 2 -theme_override_constants/margin_left = 36 +theme_override_constants/margin_left = 40 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer/VBoxContainer/WaveTemplate/MarginContainer"] layout_mode = 2 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn index 7e76eee..9ce32d5 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn @@ -1,13 +1,16 @@ -[gd_scene load_steps=3 format=3 uid="uid://ie52mo5t6l2h"] +[gd_scene load_steps=4 format=3 uid="uid://ie52mo5t6l2h"] [ext_resource type="Script" path="res://src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs" id="1_hdfkd"] -[ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_b0yuv"] +[ext_resource type="Material" uid="uid://cces3bhds7jyi" path="res://resource/material/Blend.tres" id="2_j6gjm"] +[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="3_4nhjm"] [node name="MapEditorSelectObject" 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_hdfkd") [node name="ScrollContainer" type="ScrollContainer" parent="."] @@ -23,6 +26,7 @@ layout_mode = 2 [node name="PreviewImage" type="TextureRect" parent="ScrollContainer/ObjectButton"] +material = ExtResource("2_j6gjm") layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -34,7 +38,6 @@ grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 -texture = ExtResource("2_b0yuv") stretch_mode = 5 [node name="ObjectName" type="Label" parent="ScrollContainer/ObjectButton"] @@ -55,3 +58,17 @@ autowrap_mode = 3 clip_text = true text_overrun_behavior = 3 + +[node name="SelectImage" type="NinePatchRect" parent="ScrollContainer/ObjectButton"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_4nhjm") +region_rect = Rect2(0, 0, 36, 36) +patch_margin_left = 8 +patch_margin_top = 8 +patch_margin_right = 8 +patch_margin_bottom = 8 diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn index fc282cb..62eb295 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn @@ -6,7 +6,7 @@ [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorDragArea.cs" id="3_3w0w6"] [ext_resource type="Script" path="res://src/game/ui/mapEditorTools/DoorDragButton.cs" id="3_45muq"] [ext_resource type="Texture2D" uid="uid://4wupcp53rrpi" path="res://resource/sprite/ui/mapEditorTools/DoorDragButton.png" id="3_trbb5"] -[ext_resource type="Texture2D" uid="uid://cuntr7hec044f" path="res://resource/sprite/ui/mapEditorTools/ToolSelect.png" id="7_mqmd6"] +[ext_resource type="Texture2D" uid="uid://cuntr7hec044f" path="res://resource/sprite/ui/commonIcon/Select.png" id="7_mqmd6"] [node name="MapEditorTools" type="Control"] layout_mode = 3 @@ -163,7 +163,7 @@ layout_mode = 2 texture_normal = ExtResource("2_rwvbg") -[node name="Select" type="TextureRect" parent="HBoxContainer/ToolButton"] +[node name="Select" type="NinePatchRect" parent="HBoxContainer/ToolButton"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -171,3 +171,8 @@ grow_horizontal = 2 grow_vertical = 2 texture = ExtResource("7_mqmd6") +region_rect = Rect2(0, 0, 36, 36) +patch_margin_left = 12 +patch_margin_top = 12 +patch_margin_right = 12 +patch_margin_bottom = 12 diff --git a/DungeonShooting_Godot/resource/material/Blend.tres b/DungeonShooting_Godot/resource/material/Blend.tres index dbd0411..8d6f5b3 100644 --- a/DungeonShooting_Godot/resource/material/Blend.tres +++ b/DungeonShooting_Godot/resource/material/Blend.tres @@ -5,9 +5,9 @@ [resource] resource_local_to_scene = true shader = ExtResource("1") -shader_parameter/blend = Color(0, 0, 0, 1) +shader_parameter/blend = Color(1, 1, 1, 1) shader_parameter/schedule = 0.0 -shader_parameter/alpha = 1.0 +shader_parameter/modulate = Color(1, 1, 1, 1) shader_parameter/show_outline = true shader_parameter/outline_color = Color(0.941176, 0.941176, 0.941176, 1) shader_parameter/outline_rainbow = false 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/sprite/ui/commonIcon/Down.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Down.png new file mode 100644 index 0000000..8091007 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Down.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Down.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Down.png.import new file mode 100644 index 0000000..a3a4279 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Down.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://d4gduco55dqpk" +path="res://.godot/imported/Down.png-6e9f5947e59825e2421fd7267b950df8.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Down.png" +dest_files=["res://.godot/imported/Down.png-6e9f5947e59825e2421fd7267b950df8.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png new file mode 100644 index 0000000..da0ce73 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png.import new file mode 100644 index 0000000..4bfb312 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Left.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dligpyhp72sg7" +path="res://.godot/imported/Left.png-378d8dc69fe2734c1201d2a52875a630.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Left.png" +dest_files=["res://.godot/imported/Left.png-378d8dc69fe2734c1201d2a52875a630.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png new file mode 100644 index 0000000..18fb748 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png.import new file mode 100644 index 0000000..af79686 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cuntr7hec044f" +path="res://.godot/imported/Select.png-b7c80c0f382b99689eb2b14ec6358a05.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Select.png" +dest_files=["res://.godot/imported/Select.png-b7c80c0f382b99689eb2b14ec6358a05.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png new file mode 100644 index 0000000..b38861f --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png.import new file mode 100644 index 0000000..e26052e --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Select2.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bn47bmilcw4x0" +path="res://.godot/imported/Select2.png-a8daa3355fe22187f4edfdf2c1de4504.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Select2.png" +dest_files=["res://.godot/imported/Select2.png-a8daa3355fe22187f4edfdf2c1de4504.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png deleted file mode 100644 index 033354b..0000000 --- a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png +++ /dev/null Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import deleted file mode 100644 index 1d048bd..0000000 --- a/DungeonShooting_Godot/resource/sprite/ui/mapEditorTools/ToolSelect.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://cuntr7hec044f" -path="res://.godot/imported/ToolSelect.png-5b1837e456ff32d51515f4fadfb6daea.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://resource/sprite/ui/mapEditorTools/ToolSelect.png" -dest_files=["res://.godot/imported/ToolSelect.png-5b1837e456ff32d51515f4fadfb6daea.ctex"] - -[params] - -compress/mode=0 -compress/high_quality=false -compress/lossy_quality=0.7 -compress/hdr_compression=1 -compress/normal_map=0 -compress/channel_pack=0 -mipmaps/generate=false -mipmaps/limit=-1 -roughness/mode=0 -roughness/src_normal="" -process/fix_alpha_border=true -process/premult_alpha=false -process/normal_map_invert_y=false -process/hdr_as_srgb=false -process/hdr_clamp_exposure=false -process/size_limit=0 -detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs index c3097ad..656504b 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs @@ -1,4 +1,6 @@  +using Godot; + /// /// 网格组件中单个格子的数据处理类 /// @@ -45,6 +47,13 @@ } /// + /// 当当前Ui被点击时调用, 如果 Cell 的模板为 BaseButton 类型, 则 UiCell 会自动绑定点击事件 + /// + public virtual void OnClick() + { + } + + /// /// 当启用当前 Cell 时调用 /// public virtual void OnEnable() @@ -57,6 +66,14 @@ public virtual void OnDisable() { } + + /// + /// 当检测当前 Cell 是否可以被选中时调用 + /// + public virtual bool CanSelect() + { + return true; + } /// /// 当前 Cell 选中时调用, 设置 UiGrid.SelectIndex 时触发 @@ -100,6 +117,11 @@ _init = true; Grid = grid; CellNode = cellNode; + //绑定点击事件 + if (cellNode.GetUiInstance() is BaseButton button) + { + button.Pressed += Click; + } OnInit(); SetIndex(index); } @@ -124,6 +146,15 @@ OnRefreshIndex(); } } + + /// + /// 触发点击当前Ui, 如果 Cell 的模板为 BaseButton 类型, 则 UiCell 会自动绑定点击事件 + /// + public void Click() + { + Grid.SelectIndex = Index; + OnClick(); + } public void Destroy() { diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs index 90376e7..a13ca3b 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs @@ -24,6 +24,16 @@ var newIndex = Mathf.Clamp(value, -1, _cellList.Count - 1); if (_selectIndex != newIndex) { + //检测新的 Cell 是否可以被选中 + if (newIndex >= 0) + { + var uiCell = _cellList[newIndex]; + //不能被选中, 直接跳出 + if (!uiCell.CanSelect()) + { + return; + } + } var prevIndex = _selectIndex; _selectIndex = newIndex; diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index 4a3e127..3864f49 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -1,5 +1,6 @@  using System; +using Godot; using UI.EditorTips; using UI.EditorWindow; @@ -32,6 +33,7 @@ public static void ShowSelectObject(string title) { var window = UiManager.Open_EditorWindow(); + window.S_Window.Instance.Size = new Vector2I(900, 600); window.SetWindowTitle(title); window.OpenBody(UiManager.UiName.MapEditorSelectObject); } diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 5a99b16..8ebc3ab 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -178,12 +178,16 @@ public const string resource_sprite_ui_commonIcon_CenterTool_png = "res://resource/sprite/ui/commonIcon/CenterTool.png"; public const string resource_sprite_ui_commonIcon_Delete_png = "res://resource/sprite/ui/commonIcon/Delete.png"; public const string resource_sprite_ui_commonIcon_DoorTool_png = "res://resource/sprite/ui/commonIcon/DoorTool.png"; + public const string resource_sprite_ui_commonIcon_Down_png = "res://resource/sprite/ui/commonIcon/Down.png"; public const string resource_sprite_ui_commonIcon_DragTool_png = "res://resource/sprite/ui/commonIcon/DragTool.png"; public const string resource_sprite_ui_commonIcon_Edit_png = "res://resource/sprite/ui/commonIcon/Edit.png"; public const string resource_sprite_ui_commonIcon_Hide_png = "res://resource/sprite/ui/commonIcon/Hide.png"; + public const string resource_sprite_ui_commonIcon_Left_png = "res://resource/sprite/ui/commonIcon/Left.png"; public const string resource_sprite_ui_commonIcon_Lock_png = "res://resource/sprite/ui/commonIcon/Lock.png"; public const string resource_sprite_ui_commonIcon_PenTool_png = "res://resource/sprite/ui/commonIcon/PenTool.png"; public const string resource_sprite_ui_commonIcon_Search_png = "res://resource/sprite/ui/commonIcon/Search.png"; + public const string resource_sprite_ui_commonIcon_Select_png = "res://resource/sprite/ui/commonIcon/Select.png"; + public const string resource_sprite_ui_commonIcon_Select2_png = "res://resource/sprite/ui/commonIcon/Select2.png"; public const string resource_sprite_ui_commonIcon_Unlock_png = "res://resource/sprite/ui/commonIcon/Unlock.png"; public const string resource_sprite_ui_commonIcon_Visible_png = "res://resource/sprite/ui/commonIcon/Visible.png"; public const string resource_sprite_ui_keyboard_e_png = "res://resource/sprite/ui/keyboard/e.png"; @@ -192,7 +196,6 @@ public const string resource_sprite_ui_mapEditorTools_DoorDragButton_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton.png"; public const string resource_sprite_ui_mapEditorTools_DoorDragButton_down_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton_down.png"; public const string resource_sprite_ui_mapEditorTools_DoorDragButton_hover_png = "res://resource/sprite/ui/mapEditorTools/DoorDragButton_hover.png"; - public const string resource_sprite_ui_mapEditorTools_ToolSelect_png = "res://resource/sprite/ui/mapEditorTools/ToolSelect.png"; public const string resource_sprite_ui_roomUI_ChargeProgress_png = "res://resource/sprite/ui/roomUI/ChargeProgress.png"; public const string resource_sprite_ui_roomUI_ChargeProgressBar_png = "res://resource/sprite/ui/roomUI/ChargeProgressBar.png"; public const string resource_sprite_ui_roomUI_Cooldown_png = "res://resource/sprite/ui/roomUI/Cooldown.png"; diff --git a/DungeonShooting_Godot/src/game/ui/editorWindow/CustomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/editorWindow/CustomButtonCell.cs index 557d2e6..a03439e 100644 --- a/DungeonShooting_Godot/src/game/ui/editorWindow/CustomButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/editorWindow/CustomButtonCell.cs @@ -4,7 +4,7 @@ { public override void OnInit() { - CellNode.L_Button.Instance.Pressed += OnClick; + CellNode.L_Button.Instance.Pressed += Click; } public override void OnSetData(EditorWindowPanel.ButtonData data) @@ -17,7 +17,7 @@ CellNode.L_Button.Instance.Pressed -= OnClick; } - private void OnClick() + public override void OnClick() { if (Data.Callback != null) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs new file mode 100644 index 0000000..405b8dc --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorMarkWaveCell.cs @@ -0,0 +1,26 @@ +namespace UI.MapEditorMapMark; + +public class EditorMarkWaveCell : UiCell +{ + public override void OnInit() + { + CellNode.L_HBoxContainer.L_TextureButton.Instance.Pressed += OnExpandOrClose; + } + + //展开/收起按钮点击 + private void OnExpandOrClose() + { + var textureButton = CellNode.L_HBoxContainer.L_TextureButton.Instance; + var marginContainer = CellNode.L_MarginContainer.Instance; + var flag = !marginContainer.Visible; + marginContainer.Visible = flag; + if (flag) + { + textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Down_png); + } + else + { + textureButton.TextureNormal = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Left_png); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index 8e933b2..acda11a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -5,14 +5,20 @@ public partial class MapEditorMapMarkPanel : MapEditorMapMark { + private UiGrid _grid; + public override void OnCreateUi() { + _grid = new UiGrid(S_WaveTemplate, typeof(EditorMarkWaveCell)); + _grid.SetCellOffset(new Vector2I(0, 10)); + _grid.SetColumns(1); + _grid.SetDataList(new object[] { 1, 2, 3, 4}); } public override void OnDestroyUi() { - + _grid.Destroy(); } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs index 37fdd1b..bf75410 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs @@ -4,11 +4,6 @@ public class GroupButtonCell : UiCell { - public override void OnInit() - { - CellNode.Instance.Pressed += OnClick; - } - public override void OnSetData(DungeonRoomGroup info) { CellNode.Instance.Text = info.GroupName; @@ -21,9 +16,8 @@ } //选中工程 - private void OnClick() + public override void OnClick() { - Grid.SelectIndex = Index; ((MapEditorProjectPanel)CellNode.UiPanel).SelectGroup(Data); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs index 4700cad..c279ded 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs @@ -8,7 +8,6 @@ public override void OnInit() { - CellNode.Instance.Pressed += OnClick; CellNode.Instance.FocusExited += OnFocusExited; } @@ -23,11 +22,10 @@ public override void OnDestroy() { - CellNode.Instance.Pressed -= OnClick; CellNode.Instance.FocusExited -= OnFocusExited; } - private void OnClick() + public override void OnClick() { if (_focus) { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs index e7d24c9..2c4dfd9 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs @@ -46,6 +46,15 @@ } /// + /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton.SelectImage + /// + public class SelectImage : UiNode + { + public SelectImage(MapEditorSelectObject uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override SelectImage Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + } + + /// /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton /// public class ObjectButton : UiNode @@ -76,6 +85,19 @@ } private ObjectName _L_ObjectName; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.SelectImage + /// + public SelectImage L_SelectImage + { + get + { + if (_L_SelectImage == null) _L_SelectImage = new SelectImage(UiPanel, Instance.GetNodeOrNull("SelectImage")); + return _L_SelectImage; + } + } + private SelectImage _L_SelectImage; + public ObjectButton(MapEditorSelectObject uiPanel, Godot.Button node) : base(uiPanel, node) { } public override ObjectButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } @@ -114,6 +136,11 @@ public ObjectName S_ObjectName => L_ScrollContainer.L_ObjectButton.L_ObjectName; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton.SelectImage + /// + public SelectImage S_SelectImage => L_ScrollContainer.L_ObjectButton.L_SelectImage; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton /// public ObjectButton S_ObjectButton => L_ScrollContainer.L_ObjectButton; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs index 1be3681..acb7c74 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs @@ -14,6 +14,7 @@ _grid = new UiGrid(S_ObjectButton, typeof(ObjectButtonCell)); _grid.SetAutoColumns(true); _grid.SetHorizontalExpand(true); + _grid.SetCellOffset(new Vector2I(10, 10)); _grid.SetDataList(ExcelConfig.ActivityObject_List.Where(o => { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs index 62b4276..53f83ab 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs @@ -4,6 +4,11 @@ public class ObjectButtonCell : UiCell { + public override void OnInit() + { + CellNode.L_SelectImage.Instance.Visible = false; + } + public override void OnSetData(ExcelConfig.ActivityObject data) { CellNode.L_ObjectName.Instance.Text = data.Name; @@ -12,4 +17,14 @@ CellNode.L_PreviewImage.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon); } } + + public override void OnSelect() + { + CellNode.L_SelectImage.Instance.Visible = true; + } + + public override void OnUnSelect() + { + CellNode.L_SelectImage.Instance.Visible = false; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs index a792307..9f16ddb 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs @@ -358,12 +358,12 @@ } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.ToolButton.Select + /// 类型: , 路径: MapEditorTools.HBoxContainer.ToolButton.Select /// - public class Select : UiNode + public class Select : UiNode { - public Select(MapEditorTools uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override Select Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + public Select(MapEditorTools uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// @@ -372,13 +372,13 @@ public class ToolButton : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.Select + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.Select /// public Select L_Select { get { - if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNodeOrNull("Select")); + if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNodeOrNull("Select")); return _L_Select; } } @@ -487,7 +487,7 @@ public DoorToolRoot S_DoorToolRoot => L_DoorToolRoot; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.ToolButton.Select + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.ToolButton.Select /// public Select S_Select => L_HBoxContainer.L_ToolButton.L_Select; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs index 3f18bcb..6d84a6f 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/ToolButtonCell.cs @@ -4,7 +4,6 @@ { public override void OnInit() { - CellNode.Instance.Pressed += OnClick; CellNode.L_Select.Instance.Visible = false; } @@ -13,6 +12,11 @@ CellNode.Instance.TextureNormal = ResourceManager.LoadTexture2D(data.Icon); } + public override bool CanSelect() + { + return Data.CanSelect; + } + public override void OnSelect() { CellNode.L_Select.Instance.Visible = true; @@ -23,12 +27,9 @@ CellNode.L_Select.Instance.Visible = false; } - private void OnClick() + public override void OnClick() { - if (Data.CanSelect) - { - Grid.SelectIndex = Index; - } Data.OnClick(); } + } \ No newline at end of file