diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn index da3e9b7..0cbeb8b 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn @@ -4,7 +4,63 @@ [node name="MapEditorCreateMark" type="Control"] layout_mode = 3 -anchors_preset = 0 +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 script = ExtResource("1_cjivg") + +[node name="MarginContainer" type="MarginContainer" parent="."] +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 = 20 +theme_override_constants/margin_top = 50 +theme_override_constants/margin_right = 20 +theme_override_constants/margin_bottom = 20 + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +layout_mode = 2 +theme_override_constants/separation = 20 + +[node name="HBoxContainer2" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="WaveNameLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 20.0 +text = "所属波数:" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="WaveOption" type="OptionButton" parent="MarginContainer/VBoxContainer/HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 80.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="DelayNameLabel" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 20.0 +text = "延时时间:" +horizontal_alignment = 2 +vertical_alignment = 1 + +[node name="DelayInput" type="SpinBox" parent="MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 80.0 +max_value = 30.0 +step = 0.01 +custom_arrow_step = 0.1 + +[node name="AddMark" type="Button" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 4 +text = "添加物体" diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn index 9ce32d5..e56477f 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorSelectObject.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://ie52mo5t6l2h"] +[gd_scene load_steps=5 format=3 uid="uid://ie52mo5t6l2h"] [ext_resource type="Script" path="res://src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs" id="1_hdfkd"] [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"] +[ext_resource type="Texture2D" uid="uid://blfvsup876agh" path="res://resource/sprite/ui/commonIcon/Search.png" id="3_laasd"] [node name="MapEditorSelectObject" type="Control"] layout_mode = 3 @@ -13,7 +14,7 @@ grow_vertical = 2 script = ExtResource("1_hdfkd") -[node name="ScrollContainer" type="ScrollContainer" parent="."] +[node name="HBoxContainer" type="HSplitContainer" parent="."] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -21,11 +22,106 @@ grow_horizontal = 2 grow_vertical = 2 -[node name="ObjectButton" type="Button" parent="ScrollContainer"] -custom_minimum_size = Vector2(150, 192) +[node name="Panel" type="Panel" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 25.0 + +[node name="MarginContainer" type="MarginContainer" parent="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 = 2 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 2 +theme_override_constants/margin_bottom = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer/Panel/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="TypeButton" type="Button" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer/ScrollContainer"] +custom_minimum_size = Vector2(0, 80) +layout_mode = 2 +size_flags_horizontal = 3 +text = "所有类型" + +[node name="Select" type="NinePatchRect" parent="HBoxContainer/Panel/MarginContainer/VBoxContainer/ScrollContainer/TypeButton"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_4nhjm") +patch_margin_left = 3 +patch_margin_top = 3 +patch_margin_right = 3 +patch_margin_bottom = 3 + +[node name="Panel2" type="Panel" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 75.0 + +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/Panel2"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +theme_override_constants/margin_left = 2 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 2 +theme_override_constants/margin_bottom = 2 + +[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer/Panel2/MarginContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2"] +layout_mode = 2 +theme_override_constants/margin_left = 2 +theme_override_constants/margin_top = 2 +theme_override_constants/margin_right = 2 +theme_override_constants/margin_bottom = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/MarginContainer"] +custom_minimum_size = Vector2(0, 100) +layout_mode = 2 +size_flags_vertical = 3 + +[node name="LineEdit" type="LineEdit" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/MarginContainer/HBoxContainer"] +custom_minimum_size = Vector2(500, 44) +layout_mode = 2 +size_flags_vertical = 4 +placeholder_text = "搜索名称/id" + +[node name="Search" type="Button" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/MarginContainer/HBoxContainer"] +custom_minimum_size = Vector2(44, 44) +layout_mode = 2 +size_flags_vertical = 4 +icon = ExtResource("3_laasd") + +[node name="ScrollContainer" type="ScrollContainer" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 +size_flags_stretch_ratio = 75.0 + +[node name="ObjectButton" type="Button" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/ScrollContainer"] +custom_minimum_size = Vector2(124, 160) layout_mode = 2 -[node name="PreviewImage" type="TextureRect" parent="ScrollContainer/ObjectButton"] +[node name="PreviewImage" type="TextureRect" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/ScrollContainer/ObjectButton"] material = ExtResource("2_j6gjm") layout_mode = 1 anchors_preset = 15 @@ -34,20 +130,20 @@ offset_left = 2.0 offset_top = 2.0 offset_right = -2.0 -offset_bottom = -44.0 +offset_bottom = -38.0 grow_horizontal = 2 grow_vertical = 2 mouse_filter = 2 stretch_mode = 5 -[node name="ObjectName" type="Label" parent="ScrollContainer/ObjectButton"] +[node name="ObjectName" type="Label" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/ScrollContainer/ObjectButton"] layout_mode = 1 anchors_preset = 12 anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 offset_top = -43.0 -offset_right = 150.0 +offset_right = 124.0 offset_bottom = 43.0 grow_horizontal = 2 grow_vertical = 0 @@ -59,7 +155,7 @@ clip_text = true text_overrun_behavior = 3 -[node name="SelectImage" type="NinePatchRect" parent="ScrollContainer/ObjectButton"] +[node name="Select" type="NinePatchRect" parent="HBoxContainer/Panel2/MarginContainer/VBoxContainer2/ScrollContainer/ObjectButton"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index a0777bc..13b5c5f 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -161,7 +161,7 @@ { var window = UiManager.Open_EditorWindow(); window.SetWindowTitle("创建标记"); - window.SetWindowSize(new Vector2I(700, 600)); + window.SetWindowSize(new Vector2I(1200, 900)); var body = window.OpenBody(UiManager.UiName.MapEditorCreateMark); window.SetButtonList( new EditorWindowPanel.ButtonData("确定", () => @@ -183,8 +183,18 @@ public static void ShowSelectObject(string title) { var window = UiManager.Open_EditorWindow(); - window.S_Window.Instance.Size = new Vector2I(900, 600); + window.S_Window.Instance.Size = new Vector2I(1000, 700); window.SetWindowTitle(title); window.OpenBody(UiManager.UiName.MapEditorSelectObject); + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + window.CloseWindow(); + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs index eadfbed..fc49e0b 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs @@ -5,6 +5,19 @@ /// public abstract partial class MapEditorCreateMark : UiBase { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer + /// + public MarginContainer L_MarginContainer + { + get + { + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer((MapEditorCreateMarkPanel)this, GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer _L_MarginContainer; + public MapEditorCreateMark() : base(nameof(MapEditorCreateMark)) { @@ -14,5 +27,235 @@ { } + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2.WaveNameLabel + /// + public class WaveNameLabel : UiNode + { + public WaveNameLabel(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override WaveNameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2.WaveOption + /// + public class WaveOption : UiNode + { + public WaveOption(MapEditorCreateMarkPanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } + public override WaveOption Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2 + /// + public class HBoxContainer2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.WaveNameLabel + /// + public WaveNameLabel L_WaveNameLabel + { + get + { + if (_L_WaveNameLabel == null) _L_WaveNameLabel = new WaveNameLabel(UiPanel, Instance.GetNodeOrNull("WaveNameLabel")); + return _L_WaveNameLabel; + } + } + private WaveNameLabel _L_WaveNameLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.WaveOption + /// + public WaveOption L_WaveOption + { + get + { + if (_L_WaveOption == null) _L_WaveOption = new WaveOption(UiPanel, Instance.GetNodeOrNull("WaveOption")); + return _L_WaveOption; + } + } + private WaveOption _L_WaveOption; + + public HBoxContainer2(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer.DelayNameLabel + /// + public class DelayNameLabel : UiNode + { + public DelayNameLabel(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override DelayNameLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer.DelayInput + /// + public class DelayInput : UiNode + { + public DelayInput(MapEditorCreateMarkPanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { } + public override DelayInput Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer + /// + public class HBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.DelayNameLabel + /// + public DelayNameLabel L_DelayNameLabel + { + get + { + if (_L_DelayNameLabel == null) _L_DelayNameLabel = new DelayNameLabel(UiPanel, Instance.GetNodeOrNull("DelayNameLabel")); + return _L_DelayNameLabel; + } + } + private DelayNameLabel _L_DelayNameLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.DelayInput + /// + public DelayInput L_DelayInput + { + get + { + if (_L_DelayInput == null) _L_DelayInput = new DelayInput(UiPanel, Instance.GetNodeOrNull("DelayInput")); + return _L_DelayInput; + } + } + private DelayInput _L_DelayInput; + + public HBoxContainer(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.AddMark + /// + public class AddMark : UiNode + { + public AddMark(MapEditorCreateMarkPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override AddMark Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.HBoxContainer2 + /// + public HBoxContainer2 L_HBoxContainer2 + { + get + { + if (_L_HBoxContainer2 == null) _L_HBoxContainer2 = new HBoxContainer2(UiPanel, Instance.GetNodeOrNull("HBoxContainer2")); + return _L_HBoxContainer2; + } + } + private HBoxContainer2 _L_HBoxContainer2; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.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; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.AddMark + /// + public AddMark L_AddMark + { + get + { + if (_L_AddMark == null) _L_AddMark = new AddMark(UiPanel, Instance.GetNodeOrNull("AddMark")); + return _L_AddMark; + } + } + private AddMark _L_AddMark; + + public VBoxContainer(MapEditorCreateMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer + /// + public class MarginContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.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 MarginContainer(MapEditorCreateMarkPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2.WaveNameLabel + /// + public WaveNameLabel S_WaveNameLabel => L_MarginContainer.L_VBoxContainer.L_HBoxContainer2.L_WaveNameLabel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2.WaveOption + /// + public WaveOption S_WaveOption => L_MarginContainer.L_VBoxContainer.L_HBoxContainer2.L_WaveOption; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer2 + /// + public HBoxContainer2 S_HBoxContainer2 => L_MarginContainer.L_VBoxContainer.L_HBoxContainer2; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer.DelayNameLabel + /// + public DelayNameLabel S_DelayNameLabel => L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_DelayNameLabel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer.DelayInput + /// + public DelayInput S_DelayInput => L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_DelayInput; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer + /// + public HBoxContainer S_HBoxContainer => L_MarginContainer.L_VBoxContainer.L_HBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.AddMark + /// + public AddMark S_AddMark => L_MarginContainer.L_VBoxContainer.L_AddMark; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer + /// + public VBoxContainer S_VBoxContainer => L_MarginContainer.L_VBoxContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer + /// + public MarginContainer S_MarginContainer => L_MarginContainer; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs index 868a2d8..cae31d0 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs @@ -7,7 +7,7 @@ public override void OnCreateUi() { - + S_AddMark.Instance.Pressed += OnAddMark; } public override void OnDestroyUi() @@ -15,4 +15,8 @@ } + private void OnAddMark() + { + EditorWindowManager.ShowSelectObject("选择物体"); + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs index 2449ccc..ed3a59e 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs @@ -78,7 +78,14 @@ optionButton.AddItem($"{item.Name} ({item.Weight})"); } - optionButton.Selected = selectIndex; + if (selectIndex == -1 && preinstall.Count > 0) + { + OnItemSelected(0); + } + else + { + OnItemSelected(selectIndex); + } } /// diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs index 95ca976..3cb597a 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs @@ -41,6 +41,16 @@ _roomGrid.SetAutoColumns(true); _roomGrid.SetCellOffset(new Vector2I(10, 10)); _roomGrid.SetHorizontalExpand(true); + + if (PrevUi != null) + { + S_Back.Instance.Visible = true; + S_Back.Instance.Pressed += OpenPrevUi; + } + else + { + S_Back.Instance.Visible = false; + } S_GroupSearchButton.Instance.Pressed += OnSearchGroupButtonClick; S_RoomSearchButton.Instance.Pressed += OnSearchRoomButtonClick; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs index 2c4dfd9..6cfc7e8 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObject.cs @@ -6,17 +6,17 @@ public abstract partial class MapEditorSelectObject : UiBase { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer /// - public ScrollContainer L_ScrollContainer + public HBoxContainer L_HBoxContainer { get { - if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(this, GetNodeOrNull("ScrollContainer")); - return _L_ScrollContainer; + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer((MapEditorSelectObjectPanel)this, GetNodeOrNull("HBoxContainer")); + return _L_HBoxContainer; } } - private ScrollContainer _L_ScrollContainer; + private HBoxContainer _L_HBoxContainer; public MapEditorSelectObject() : base(nameof(MapEditorSelectObject)) @@ -28,39 +28,233 @@ } /// - /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton.PreviewImage + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.TypeButton.Select /// - public class PreviewImage : UiNode + public class Select : UiNode { - public PreviewImage(MapEditorSelectObject uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public Select(MapEditorSelectObjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override Select Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.TypeButton + /// + public class TypeButton : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.Select + /// + public Select L_Select + { + get + { + if (_L_Select == null) _L_Select = new Select(UiPanel, Instance.GetNodeOrNull("Select")); + return _L_Select; + } + } + private Select _L_Select; + + public TypeButton(MapEditorSelectObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override TypeButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer + /// + public class ScrollContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.TypeButton + /// + public TypeButton L_TypeButton + { + get + { + if (_L_TypeButton == null) _L_TypeButton = new TypeButton(UiPanel, Instance.GetNodeOrNull("TypeButton")); + return _L_TypeButton; + } + } + private TypeButton _L_TypeButton; + + public ScrollContainer(MapEditorSelectObjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.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 VBoxContainer(MapEditorSelectObjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer + /// + public class MarginContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.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 MarginContainer(MapEditorSelectObjectPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel + /// + public class Panel : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.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(MapEditorSelectObjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.HBoxContainer.LineEdit + /// + public class LineEdit : UiNode + { + public LineEdit(MapEditorSelectObjectPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } + public override LineEdit Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.HBoxContainer.Search + /// + public class Search : UiNode + { + public Search(MapEditorSelectObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Search Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.HBoxContainer + /// + public class HBoxContainer_1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.LineEdit + /// + public LineEdit L_LineEdit + { + get + { + if (_L_LineEdit == null) _L_LineEdit = new LineEdit(UiPanel, Instance.GetNodeOrNull("LineEdit")); + return _L_LineEdit; + } + } + private LineEdit _L_LineEdit; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.Search + /// + public Search L_Search + { + get + { + if (_L_Search == null) _L_Search = new Search(UiPanel, Instance.GetNodeOrNull("Search")); + return _L_Search; + } + } + private Search _L_Search; + + public HBoxContainer_1(MapEditorSelectObjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer_1 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer + /// + public class MarginContainer_2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.HBoxContainer + /// + public HBoxContainer_1 L_HBoxContainer + { + get + { + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_1(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); + return _L_HBoxContainer; + } + } + private HBoxContainer_1 _L_HBoxContainer; + + public MarginContainer_2(MapEditorSelectObjectPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer_2 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton.PreviewImage + /// + public class PreviewImage : UiNode + { + public PreviewImage(MapEditorSelectObjectPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } public override PreviewImage Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton.ObjectName + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton.ObjectName /// - public class ObjectName : UiNode + public class ObjectName : UiNode { - public ObjectName(MapEditorSelectObject uiPanel, Godot.Label node) : base(uiPanel, node) { } + public ObjectName(MapEditorSelectObjectPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } public override ObjectName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton.SelectImage + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton.Select /// - public class SelectImage : UiNode + public class Select_1 : UiNode { - public SelectImage(MapEditorSelectObject uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } - public override SelectImage Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + public Select_1(MapEditorSelectObjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override Select_1 Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorSelectObject.ScrollContainer.ObjectButton + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton /// - public class ObjectButton : UiNode + public class ObjectButton : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.PreviewImage + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.PreviewImage /// public PreviewImage L_PreviewImage { @@ -73,7 +267,7 @@ private PreviewImage _L_PreviewImage; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectName + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectName /// public ObjectName L_ObjectName { @@ -86,29 +280,29 @@ private ObjectName _L_ObjectName; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.SelectImage + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.Select /// - public SelectImage L_SelectImage + public Select_1 L_Select { get { - if (_L_SelectImage == null) _L_SelectImage = new SelectImage(UiPanel, Instance.GetNodeOrNull("SelectImage")); - return _L_SelectImage; + if (_L_Select == null) _L_Select = new Select_1(UiPanel, Instance.GetNodeOrNull("Select")); + return _L_Select; } } - private SelectImage _L_SelectImage; + private Select_1 _L_Select; - public ObjectButton(MapEditorSelectObject uiPanel, Godot.Button node) : base(uiPanel, node) { } + public ObjectButton(MapEditorSelectObjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override ObjectButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorSelectObject.ScrollContainer + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer /// - public class ScrollContainer : UiNode + public class ScrollContainer_1 : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.ObjectButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ObjectButton /// public ObjectButton L_ObjectButton { @@ -120,34 +314,173 @@ } private ObjectButton _L_ObjectButton; - public ScrollContainer(MapEditorSelectObject uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } - public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); + public ScrollContainer_1(MapEditorSelectObjectPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public override ScrollContainer_1 Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2 + /// + public class VBoxContainer2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.MarginContainer + /// + public MarginContainer_2 L_MarginContainer + { + get + { + if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_2(UiPanel, Instance.GetNodeOrNull("MarginContainer")); + return _L_MarginContainer; + } + } + private MarginContainer_2 _L_MarginContainer; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.ScrollContainer + /// + public ScrollContainer_1 L_ScrollContainer + { + get + { + if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer_1(UiPanel, Instance.GetNodeOrNull("ScrollContainer")); + return _L_ScrollContainer; + } + } + private ScrollContainer_1 _L_ScrollContainer; + + public VBoxContainer2(MapEditorSelectObjectPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer2 Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer + /// + public class MarginContainer_1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.VBoxContainer2 + /// + public VBoxContainer2 L_VBoxContainer2 + { + get + { + if (_L_VBoxContainer2 == null) _L_VBoxContainer2 = new VBoxContainer2(UiPanel, Instance.GetNodeOrNull("VBoxContainer2")); + return _L_VBoxContainer2; + } + } + private VBoxContainer2 _L_VBoxContainer2; + + public MarginContainer_1(MapEditorSelectObjectPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override MarginContainer_1 Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer.Panel2 + /// + public class Panel2 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.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 Panel2(MapEditorSelectObjectPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } + public override Panel2 Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorSelectObject.HBoxContainer + /// + public class HBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.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 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorSelectObject.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(MapEditorSelectObjectPanel uiPanel, Godot.HSplitContainer node) : base(uiPanel, node) { } + public override HBoxContainer Clone() => new (UiPanel, (Godot.HSplitContainer)Instance.Duplicate()); } /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton.PreviewImage + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.TypeButton /// - public PreviewImage S_PreviewImage => L_ScrollContainer.L_ObjectButton.L_PreviewImage; + public TypeButton S_TypeButton => L_HBoxContainer.L_Panel.L_MarginContainer.L_VBoxContainer.L_ScrollContainer.L_TypeButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton.ObjectName + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel.MarginContainer.VBoxContainer /// - public ObjectName S_ObjectName => L_ScrollContainer.L_ObjectButton.L_ObjectName; + public VBoxContainer S_VBoxContainer => L_HBoxContainer.L_Panel.L_MarginContainer.L_VBoxContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton.SelectImage + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel /// - public SelectImage S_SelectImage => L_ScrollContainer.L_ObjectButton.L_SelectImage; + public Panel S_Panel => L_HBoxContainer.L_Panel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer.ObjectButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.HBoxContainer.LineEdit /// - public ObjectButton S_ObjectButton => L_ScrollContainer.L_ObjectButton; + public LineEdit S_LineEdit => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2.L_MarginContainer.L_HBoxContainer.L_LineEdit; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.ScrollContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.MarginContainer.HBoxContainer.Search /// - public ScrollContainer S_ScrollContainer => L_ScrollContainer; + public Search S_Search => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2.L_MarginContainer.L_HBoxContainer.L_Search; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton.PreviewImage + /// + public PreviewImage S_PreviewImage => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2.L_ScrollContainer.L_ObjectButton.L_PreviewImage; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton.ObjectName + /// + public ObjectName S_ObjectName => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2.L_ScrollContainer.L_ObjectButton.L_ObjectName; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2.ScrollContainer.ObjectButton + /// + public ObjectButton S_ObjectButton => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2.L_ScrollContainer.L_ObjectButton; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2.MarginContainer.VBoxContainer2 + /// + public VBoxContainer2 S_VBoxContainer2 => L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer2; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorSelectObject.HBoxContainer.Panel2 + /// + public Panel2 S_Panel2 => L_HBoxContainer.L_Panel2; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs index acb7c74..718b5e0 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs @@ -6,25 +6,84 @@ public partial class MapEditorSelectObjectPanel : MapEditorSelectObject { + public class TypeButtonData + { + /// + /// 类型名称 + /// + public string Name; + /// + /// 类型值 + /// + public int Type; - private UiGrid _grid; - + public TypeButtonData(string name, int type) + { + Name = name; + Type = type; + } + } + //类型网格组件 + private UiGrid _typeGrid; + //物体网格组件 + private UiGrid _objectGrid; + //允许出现在该面板中的物体类型 + private int[] _typeArray = new[] { 4, 5, 9 }; + public override void OnCreateUi() { - _grid = new UiGrid(S_ObjectButton, typeof(ObjectButtonCell)); - _grid.SetAutoColumns(true); - _grid.SetHorizontalExpand(true); - _grid.SetCellOffset(new Vector2I(10, 10)); + S_Search.Instance.Pressed += OnSearch; - _grid.SetDataList(ExcelConfig.ActivityObject_List.Where(o => - { - return o.Type == (int)ActivityIdPrefix.ActivityPrefixType.Weapon; - }).ToArray()); + _typeGrid = new UiGrid(S_TypeButton, typeof(TypeButtonCell)); + _typeGrid.SetColumns(1); + _typeGrid.SetHorizontalExpand(true); + _typeGrid.SetCellOffset(new Vector2I(0, 5)); + _typeGrid.Add(new TypeButtonData("所有", -1)); + _typeGrid.Add(new TypeButtonData("武器", 5)); + _typeGrid.Add(new TypeButtonData("道具", 9)); + _typeGrid.Add(new TypeButtonData("敌人", 4)); + + _objectGrid = new UiGrid(S_ObjectButton, typeof(ObjectButtonCell)); + _objectGrid.SetAutoColumns(true); + _objectGrid.SetHorizontalExpand(true); + _objectGrid.SetCellOffset(new Vector2I(10, 10)); + + _typeGrid.SelectIndex = 0; } public override void OnDestroyUi() { - + _typeGrid.Destroy(); + _objectGrid.Destroy(); } + /// + /// 搜索对象 + /// + public void OnSearch() + { + //类型 + int type; + //名称 + var name = S_LineEdit.Instance.Text; + var buttonData = _typeGrid.GetData(_typeGrid.SelectIndex); + if (buttonData != null) + { + type = buttonData.Type; + } + else + { + type = -1; + } + + //搜索结果 + var arr = ExcelConfig.ActivityObject_List.Where( + o => + { + return (string.IsNullOrEmpty(name) || o.Name.Contains(name) || o.Id.Contains(name)) && + (type < 0 ? _typeArray.Contains(o.Type) : o.Type == type); + } + ).ToArray(); + _objectGrid.SetDataList(arr); + } } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs index 53f83ab..989d9a9 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/ObjectButtonCell.cs @@ -6,7 +6,7 @@ { public override void OnInit() { - CellNode.L_SelectImage.Instance.Visible = false; + CellNode.L_Select.Instance.Visible = false; } public override void OnSetData(ExcelConfig.ActivityObject data) @@ -14,17 +14,22 @@ CellNode.L_ObjectName.Instance.Text = data.Name; if (!string.IsNullOrEmpty(data.Icon)) { + CellNode.L_PreviewImage.Instance.Visible = true; CellNode.L_PreviewImage.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon); } + else + { + CellNode.L_PreviewImage.Instance.Visible = false; + } } public override void OnSelect() { - CellNode.L_SelectImage.Instance.Visible = true; + CellNode.L_Select.Instance.Visible = true; } public override void OnUnSelect() { - CellNode.L_SelectImage.Instance.Visible = false; + CellNode.L_Select.Instance.Visible = false; } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/TypeButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/TypeButtonCell.cs new file mode 100644 index 0000000..9a8efc4 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/TypeButtonCell.cs @@ -0,0 +1,25 @@ +namespace UI.MapEditorSelectObject; + +public class TypeButtonCell : UiCell +{ + public override void OnInit() + { + CellNode.L_Select.Instance.Visible = false; + } + + public override void OnSetData(MapEditorSelectObjectPanel.TypeButtonData data) + { + CellNode.Instance.Text = data.Name; + } + + public override void OnSelect() + { + CellNode.L_Select.Instance.Visible = true; + CellNode.UiPanel.OnSearch(); + } + + public override void OnUnSelect() + { + CellNode.L_Select.Instance.Visible = false; + } +} \ No newline at end of file