diff --git a/DungeonShooting_Godot/prefab/ui/EditorInput.tscn b/DungeonShooting_Godot/prefab/ui/EditorInput.tscn new file mode 100644 index 0000000..50dda1e --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/EditorInput.tscn @@ -0,0 +1,30 @@ +[gd_scene load_steps=2 format=3 uid="uid://cewbs487ebu2w"] + +[ext_resource type="Script" path="res://src/game/ui/editorInput/EditorInputPanel.cs" id="1_n62mt"] + +[node name="EditorInput" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +script = ExtResource("1_n62mt") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="Label" type="Label" parent="VBoxContainer"] +custom_minimum_size = Vector2(0, 50) +layout_mode = 2 +size_flags_vertical = 10 +text = "描述:" +vertical_alignment = 1 + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] +custom_minimum_size = Vector2(0, 50) +layout_mode = 2 +size_flags_vertical = 2 diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn index 89d816c..f5e017b 100644 --- a/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=5 format=3 uid="uid://dn5brsxa6w3l6"] +[gd_scene load_steps=7 format=3 uid="uid://dn5brsxa6w3l6"] [ext_resource type="Script" path="res://src/game/ui/tileSetEditor/TileSetEditorPanel.cs" id="1_rgx4n"] [ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_naycu"] [ext_resource type="Texture2D" uid="uid://cat35d7ueu7gu" path="res://resource/sprite/ui/commonIcon/Save.png" id="3_bcuxk"] [ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="4_t8bqb"] +[ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="4_u8gg1"] +[ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="5_gepb1"] [node name="TileSetEditor" type="Control"] layout_mode = 3 @@ -13,7 +15,6 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_rgx4n") -Layer = null [node name="Bg" type="Panel" parent="."] layout_mode = 1 @@ -75,30 +76,52 @@ layout_mode = 2 size_flags_horizontal = 3 -[node name="MarginContainer" type="MarginContainer" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 -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="Bg/VBoxContainer/HBoxContainer/LeftRoot"] +layout_mode = 2 +offset_left = 2.0 +offset_top = 5.0 +offset_right = 272.0 +offset_bottom = 1008.0 -[node name="ScrollContainer" type="ScrollContainer" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/MarginContainer"] +[node name="HBoxContainer" type="HBoxContainer" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer"] +custom_minimum_size = Vector2(0, 50) layout_mode = 2 -[node name="Tab" type="Button" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/MarginContainer/ScrollContainer"] +[node name="Label" type="Label" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +text = "资源:" + +[node name="AddButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/HBoxContainer"] +layout_mode = 2 +icon = ExtResource("4_u8gg1") + +[node name="DeleteButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/HBoxContainer"] +layout_mode = 2 +icon = ExtResource("5_gepb1") + +[node name="OptionButton" type="OptionButton" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer"] +custom_minimum_size = Vector2(0, 50) +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="ColorRect" type="ColorRect" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer"] +custom_minimum_size = Vector2(0, 3) +layout_mode = 2 +color = Color(0.188235, 0.188235, 0.188235, 1) + +[node name="ScrollContainer" type="ScrollContainer" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 + +[node name="Tab" type="Button" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/ScrollContainer"] custom_minimum_size = Vector2(0, 60) layout_mode = 2 size_flags_horizontal = 3 text = "页签" flat = true -[node name="Select" type="NinePatchRect" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/MarginContainer/ScrollContainer/Tab"] +[node name="Select" type="NinePatchRect" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/ScrollContainer/Tab"] layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -116,4 +139,4 @@ clip_children = 2 layout_mode = 2 size_flags_horizontal = 3 -size_flags_stretch_ratio = 8.0 +size_flags_stretch_ratio = 6.0 diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs index c349bf0..471b802 100644 --- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs +++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs @@ -5,6 +5,7 @@ using Godot; using UI.EditorColorPicker; using UI.EditorImportCombination; +using UI.EditorInput; using UI.EditorTips; using UI.EditorWindow; using UI.MapEditorCreateGroup; @@ -127,6 +128,39 @@ var body = window.OpenBody(UiManager.UiNames.EditorTips); body.SetMessage(message); } + + /// + /// 弹出通用输入框 + /// + /// 标题 + /// 显示内容 + /// 输入框默认值 + /// 关闭时回调,参数1为输入框内容,参数2为 true 表示点击了确定,如果点击了确定但是回调函数返回 false 则不会关闭窗口 + /// 所属父级Ui + public static void ShowInput(string title, string message, string value, Func onClose, UiBase parentUi = null) + { + var window = CreateWindowInstance(parentUi); + window.SetWindowTitle(title); + var body = window.OpenBody(UiManager.UiNames.EditorInput); + window.CloseEvent += () => + { + onClose(body.GetValue(), false); + }; + window.SetButtonList( + new EditorWindowPanel.ButtonData("确定", () => + { + if (onClose(body.GetValue(), true)) + { + window.CloseWindow(false); + } + }), + new EditorWindowPanel.ButtonData("取消", () => + { + window.CloseWindow(); + }) + ); + body.Init(message, value); + } /// /// 弹出询问窗口, 包含3个按钮 diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 436223c..0e3e43f 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -71,6 +71,7 @@ public const string prefab_ui_Debugger_tscn = "res://prefab/ui/Debugger.tscn"; public const string prefab_ui_EditorColorPicker_tscn = "res://prefab/ui/EditorColorPicker.tscn"; public const string prefab_ui_EditorImportCombination_tscn = "res://prefab/ui/EditorImportCombination.tscn"; + public const string prefab_ui_EditorInput_tscn = "res://prefab/ui/EditorInput.tscn"; public const string prefab_ui_EditorTips_tscn = "res://prefab/ui/EditorTips.tscn"; public const string prefab_ui_EditorTools_tscn = "res://prefab/ui/EditorTools.tscn"; public const string prefab_ui_EditorWindow_tscn = "res://prefab/ui/EditorWindow.tscn"; diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index d110658..db4c6e4 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -9,6 +9,7 @@ public const string Debugger = "Debugger"; public const string EditorColorPicker = "EditorColorPicker"; public const string EditorImportCombination = "EditorImportCombination"; + public const string EditorInput = "EditorInput"; public const string EditorTips = "EditorTips"; public const string EditorTools = "EditorTools"; public const string EditorWindow = "EditorWindow"; @@ -229,6 +230,54 @@ } /// + /// 创建 EditorInput, 并返回UI实例, 该函数不会打开 Ui + /// + public static UI.EditorInput.EditorInputPanel Create_EditorInput() + { + return CreateUi(UiNames.EditorInput); + } + + /// + /// 打开 EditorInput, 并返回UI实例 + /// + public static UI.EditorInput.EditorInputPanel Open_EditorInput() + { + return OpenUi(UiNames.EditorInput); + } + + /// + /// 隐藏 EditorInput 的所有实例 + /// + public static void Hide_EditorInput() + { + var uiInstance = Get_EditorInput_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 EditorInput 的所有实例 + /// + public static void Destroy_EditorInput() + { + var uiInstance = Get_EditorInput_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.Destroy(); + } + } + + /// + /// 获取所有 EditorInput 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.EditorInput.EditorInputPanel[] Get_EditorInput_Instance() + { + return GetUiInstance(nameof(UI.EditorInput.EditorInput)); + } + + /// /// 创建 EditorTips, 并返回UI实例, 该函数不会打开 Ui /// public static UI.EditorTips.EditorTipsPanel Create_EditorTips() diff --git a/DungeonShooting_Godot/src/game/ui/editorInput/EditorInput.cs b/DungeonShooting_Godot/src/game/ui/editorInput/EditorInput.cs new file mode 100644 index 0000000..43d0256 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/editorInput/EditorInput.cs @@ -0,0 +1,100 @@ +namespace UI.EditorInput; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class EditorInput : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorInput.VBoxContainer + /// + public VBoxContainer L_VBoxContainer + { + get + { + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer((EditorInputPanel)this, GetNode("VBoxContainer")); + return _L_VBoxContainer; + } + } + private VBoxContainer _L_VBoxContainer; + + + public EditorInput() : base(nameof(EditorInput)) + { + } + + public sealed override void OnInitNestedUi() + { + + } + + /// + /// 类型: , 路径: EditorInput.VBoxContainer.Label + /// + public class Label : UiNode + { + public Label(EditorInputPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorInput.VBoxContainer.LineEdit + /// + public class LineEdit : UiNode + { + public LineEdit(EditorInputPanel uiPanel, Godot.LineEdit node) : base(uiPanel, node) { } + public override LineEdit Clone() => new (UiPanel, (Godot.LineEdit)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: EditorInput.VBoxContainer + /// + public class VBoxContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorInput.Label + /// + public Label L_Label + { + get + { + if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode("Label")); + return _L_Label; + } + } + private Label _L_Label; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: EditorInput.LineEdit + /// + public LineEdit L_LineEdit + { + get + { + if (_L_LineEdit == null) _L_LineEdit = new LineEdit(UiPanel, Instance.GetNode("LineEdit")); + return _L_LineEdit; + } + } + private LineEdit _L_LineEdit; + + public VBoxContainer(EditorInputPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorInput.VBoxContainer.Label + /// + public Label S_Label => L_VBoxContainer.L_Label; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorInput.VBoxContainer.LineEdit + /// + public LineEdit S_LineEdit => L_VBoxContainer.L_LineEdit; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorInput.VBoxContainer + /// + public VBoxContainer S_VBoxContainer => L_VBoxContainer; + +} diff --git a/DungeonShooting_Godot/src/game/ui/editorInput/EditorInputPanel.cs b/DungeonShooting_Godot/src/game/ui/editorInput/EditorInputPanel.cs new file mode 100644 index 0000000..f503c89 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/editorInput/EditorInputPanel.cs @@ -0,0 +1,32 @@ +using Godot; + +namespace UI.EditorInput; + +public partial class EditorInputPanel : EditorInput +{ + + public override void OnCreateUi() + { + + } + + public override void OnDestroyUi() + { + + } + + public void Init(string labelText, string value = null) + { + S_Label.Instance.Text = labelText; + if (value != null) + { + S_LineEdit.Instance.Text = value; + } + } + + public string GetValue() + { + return S_LineEdit.Instance.Text; + } + +} diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs index cf59b45..aea521a 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs @@ -104,7 +104,100 @@ } /// - /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer.Tab.Select + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.Label + /// + public class Label : UiNode + { + public Label(TileSetEditorPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.AddButton + /// + public class AddButton : UiNode + { + public AddButton(TileSetEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override AddButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.DeleteButton + /// + public class DeleteButton : UiNode + { + public DeleteButton(TileSetEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override DeleteButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer + /// + public class HBoxContainer_1 : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.Label + /// + public Label L_Label + { + get + { + if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode("Label")); + return _L_Label; + } + } + private Label _L_Label; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.AddButton + /// + public AddButton L_AddButton + { + get + { + if (_L_AddButton == null) _L_AddButton = new AddButton(UiPanel, Instance.GetNode("AddButton")); + return _L_AddButton; + } + } + private AddButton _L_AddButton; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.DeleteButton + /// + public DeleteButton L_DeleteButton + { + get + { + if (_L_DeleteButton == null) _L_DeleteButton = new DeleteButton(UiPanel, Instance.GetNode("DeleteButton")); + return _L_DeleteButton; + } + } + private DeleteButton _L_DeleteButton; + + public HBoxContainer_1(TileSetEditorPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer_1 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.OptionButton + /// + public class OptionButton : UiNode + { + public OptionButton(TileSetEditorPanel uiPanel, Godot.OptionButton node) : base(uiPanel, node) { } + public override OptionButton Clone() => new (UiPanel, (Godot.OptionButton)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ColorRect + /// + public class ColorRect : UiNode + { + public ColorRect(TileSetEditorPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { } + public override ColorRect Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select /// public class Select : UiNode { @@ -113,12 +206,12 @@ } /// - /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer.Tab + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab /// public class Tab : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer.Select + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Select /// public Select L_Select { @@ -135,12 +228,12 @@ } /// - /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer /// public class ScrollContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.Tab + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.Tab /// public Tab L_Tab { @@ -157,11 +250,50 @@ } /// - /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer /// - public class MarginContainer : UiNode + public class VBoxContainer_1 : UiNode { /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.HBoxContainer + /// + public HBoxContainer_1 L_HBoxContainer + { + get + { + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_1(UiPanel, Instance.GetNode("HBoxContainer")); + return _L_HBoxContainer; + } + } + private HBoxContainer_1 _L_HBoxContainer; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.OptionButton + /// + public OptionButton L_OptionButton + { + get + { + if (_L_OptionButton == null) _L_OptionButton = new OptionButton(UiPanel, Instance.GetNode("OptionButton")); + return _L_OptionButton; + } + } + private OptionButton _L_OptionButton; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.ColorRect + /// + public ColorRect L_ColorRect + { + get + { + if (_L_ColorRect == null) _L_ColorRect = new ColorRect(UiPanel, Instance.GetNode("ColorRect")); + return _L_ColorRect; + } + } + private ColorRect _L_ColorRect; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.ScrollContainer /// public ScrollContainer L_ScrollContainer @@ -174,8 +306,8 @@ } private ScrollContainer _L_ScrollContainer; - public MarginContainer(TileSetEditorPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } - public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + public VBoxContainer_1(TileSetEditorPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override VBoxContainer_1 Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// @@ -184,17 +316,17 @@ public class LeftRoot : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.MarginContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.VBoxContainer /// - public MarginContainer L_MarginContainer + public VBoxContainer_1 L_VBoxContainer { get { - if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNode("MarginContainer")); - return _L_MarginContainer; + if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer_1(UiPanel, Instance.GetNode("VBoxContainer")); + return _L_VBoxContainer; } } - private MarginContainer _L_MarginContainer; + private VBoxContainer_1 _L_VBoxContainer; public LeftRoot(TileSetEditorPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { } public override LeftRoot Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate()); @@ -323,24 +455,44 @@ public Head S_Head => L_Bg.L_VBoxContainer.L_Head; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer.Tab.Select + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.Label /// - public Select S_Select => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_MarginContainer.L_ScrollContainer.L_Tab.L_Select; + public Label S_Label => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_HBoxContainer.L_Label; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer.Tab + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.AddButton /// - public Tab S_Tab => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_MarginContainer.L_ScrollContainer.L_Tab; + public AddButton S_AddButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_HBoxContainer.L_AddButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer.ScrollContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.HBoxContainer.DeleteButton /// - public ScrollContainer S_ScrollContainer => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_MarginContainer.L_ScrollContainer; + public DeleteButton S_DeleteButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_HBoxContainer.L_DeleteButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.MarginContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.OptionButton /// - public MarginContainer S_MarginContainer => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_MarginContainer; + public OptionButton S_OptionButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_OptionButton; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ColorRect + /// + public ColorRect S_ColorRect => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ColorRect; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.Select + /// + public Select S_Select => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_Select; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab + /// + public Tab S_Tab => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer + /// + public ScrollContainer S_ScrollContainer => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer; /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot @@ -353,16 +505,6 @@ public RightRoot S_RightRoot => L_Bg.L_VBoxContainer.L_HBoxContainer.L_RightRoot; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer - /// - public HBoxContainer S_HBoxContainer => L_Bg.L_VBoxContainer.L_HBoxContainer; - - /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer - /// - public VBoxContainer S_VBoxContainer => L_Bg.L_VBoxContainer; - - /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg /// public Bg S_Bg => L_Bg; diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs index fbd5409..05b28e9 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs @@ -63,6 +63,11 @@ Text = "组合", UiName = UiManager.UiNames.TileSetEditorCombination, }); + TabGrid.Visible = false; + + S_DeleteButton.Instance.Pressed += OnDeleteSourceClick; + S_AddButton.Instance.Pressed += OnAddSourceClick; + S_OptionButton.Instance.ItemSelected += OnOptionChange; } public override void OnDestroyUi() @@ -87,7 +92,7 @@ S_Title.Instance.Text = "正在编辑:" + tileSetInfo.Name; //SetTextureData(Image.LoadFromFile("resource/tileSprite/map1/16x16 dungeon ii wall reconfig v04 spritesheet.png")); - TabGrid.SelectIndex = 0; + //TabGrid.SelectIndex = 0; } /// @@ -141,4 +146,39 @@ { OpenPrevUi(); } + + private void OnDeleteSourceClick() + { + var optionButton = S_OptionButton.Instance; + if (optionButton.Selected >= 0) + { + EditorWindowManager.ShowConfirm("提示", "是否需要删除该资源!", v => + { + if (v) + { + Debug.Log("删除资源: "); + } + }); + } + else + { + EditorWindowManager.ShowTips("提示", "请选择需要删除的资源!"); + } + } + + private void OnAddSourceClick() + { + EditorWindowManager.ShowInput("创建资源", "资源名称:", null, (value, isClose) => + { + var optionButton = S_OptionButton.Instance; + optionButton.AddItem(value); + optionButton.Selected = optionButton.ItemCount - 1; + return true; + }); + } + + private void OnOptionChange(long index) + { + + } }