diff --git a/DungeonShooting_Godot/prefab/ui/EditorWindow.tscn b/DungeonShooting_Godot/prefab/ui/EditorWindow.tscn
index 11b5e23..6a7aa6a 100644
--- a/DungeonShooting_Godot/prefab/ui/EditorWindow.tscn
+++ b/DungeonShooting_Godot/prefab/ui/EditorWindow.tscn
@@ -27,6 +27,7 @@
initial_position = 1
size = Vector2i(500, 350)
visible = false
+exclusive = true
min_size = Vector2i(500, 350)
theme_override_constants/title_height = 33
diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
index 0cbeb8b..2680a5b 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
@@ -64,3 +64,20 @@
layout_mode = 2
size_flags_horizontal = 4
text = "添加物体"
+
+[node name="Panel" type="Panel" parent="MarginContainer/VBoxContainer"]
+layout_mode = 2
+size_flags_vertical = 3
+
+[node name="MarkObject" type="HBoxContainer" parent="MarginContainer/VBoxContainer/Panel"]
+layout_mode = 1
+anchors_preset = 10
+anchor_right = 1.0
+offset_bottom = 43.0
+grow_horizontal = 2
+
+[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/Panel/MarkObject"]
+layout_mode = 2
+size_flags_horizontal = 3
+text = "123456"
+horizontal_alignment = 2
diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs
new file mode 100644
index 0000000..12f5c8f
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs
@@ -0,0 +1,33 @@
+
+using Godot;
+
+///
+/// Ui节点接口
+///
+public interface IUiNode
+{
+ ///
+ /// 嵌套打开子ui
+ ///
+ public UiBase OpenNestedUi(string uiName, UiBase prevUi = null);
+
+ ///
+ /// 嵌套打开子ui
+ ///
+ public T OpenNestedUi(string uiName, UiBase prevUi = null) where T : UiBase;
+
+ ///
+ /// 获取所属Ui面板
+ ///
+ public UiBase GetUiPanel();
+
+ ///
+ /// 获取Ui实例
+ ///
+ public Node GetUiInstance();
+
+ ///
+ /// 获取克隆的Ui实例
+ ///
+ public IUiCellNode CloneUiCell();
+}
diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs
index 0960821..26f048b 100644
--- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs
+++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs
@@ -40,7 +40,7 @@
/// 所属父级节点, 仅当通过 UiNode.OpenNestedUi() 打开时才会赋值
/// 注意: 如果是在预制体中放置的子 Ui, 那么子 Ui 的该属性会在 父 Ui 的 OnCreateUi() 之后赋值
///
- public UiNode ParentNode { get; private set; }
+ public IUiNode ParentNode { get; private set; }
//开启的协程
private List _coroutineList;
@@ -227,7 +227,7 @@
///
/// 记录嵌套打开/关闭的UI
///
- public void RecordNestedUi(UiBase uiBase, UiNode node, UiManager.RecordType type)
+ public void RecordNestedUi(UiBase uiBase, IUiNode node, UiManager.RecordType type)
{
if (type == UiManager.RecordType.Open)
{
diff --git a/DungeonShooting_Godot/src/framework/ui/UiNode.cs b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
index 82eb479..abeebb8 100644
--- a/DungeonShooting_Godot/src/framework/ui/UiNode.cs
+++ b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
@@ -2,44 +2,13 @@
using Godot;
///
-/// Ui节点父类, 无泛型无属性
-///
-public abstract class UiNode
-{
- ///
- /// 嵌套打开子ui
- ///
- public abstract UiBase OpenNestedUi(string uiName, UiBase prevUi = null);
-
- ///
- /// 嵌套打开子ui
- ///
- public abstract T OpenNestedUi(string uiName, UiBase prevUi = null) where T : UiBase;
-
- ///
- /// 获取所属Ui面板
- ///
- public abstract UiBase GetUiPanel();
-
- ///
- /// 获取Ui实例
- ///
- public abstract Node GetUiInstance();
-
- ///
- /// 获取克隆的Ui实例
- ///
- public abstract IUiCellNode CloneUiCell();
-}
-
-///
/// Ui节点父类
///
/// 所属Ui面板类型
/// Godot中的节点类型
/// 克隆该对象返回的类型
public abstract class UiNode
- : UiNode, IUiCellNode, IClone
+ : IUiNode, IUiCellNode, IClone
where TUi : UiBase
where TNodeType : Node
where TCloneType : IUiCellNode
@@ -64,7 +33,7 @@
Instance = node;
}
- public override UiBase OpenNestedUi(string uiName, UiBase prevUi = null)
+ public UiBase OpenNestedUi(string uiName, UiBase prevUi = null)
{
var packedScene = ResourceManager.Load("res://" + GameConfig.UiPrefabDir + uiName + ".tscn");
var uiBase = packedScene.Instantiate();
@@ -81,8 +50,8 @@
return uiBase;
}
-
- public override T OpenNestedUi(string uiName, UiBase prevUi = null)
+
+ public T OpenNestedUi(string uiName, UiBase prevUi = null) where T : UiBase
{
return (T)OpenNestedUi(uiName, prevUi);
}
@@ -97,17 +66,17 @@
return inst;
}
- public override UiBase GetUiPanel()
+ public UiBase GetUiPanel()
{
return UiPanel;
}
- public override Node GetUiInstance()
+ public Node GetUiInstance()
{
return Instance;
}
- public override IUiCellNode CloneUiCell()
+ public IUiCellNode CloneUiCell()
{
return Clone();
}
diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
index 13b5c5f..0378d43 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
@@ -180,9 +180,18 @@
);
}
- public static void ShowSelectObject(string title)
+ public static void ShowSelectObject(string title, UiBase parentUi = null)
{
- var window = UiManager.Open_EditorWindow();
+ EditorWindowPanel window;
+ if (parentUi != null)
+ {
+ window = parentUi.OpenNestedUi(UiManager.UiName.EditorWindow);
+ }
+ else
+ {
+ window = UiManager.Open_EditorWindow();
+ }
+
window.S_Window.Instance.Size = new Vector2I(1000, 700);
window.SetWindowTitle(title);
window.OpenBody(UiManager.UiName.MapEditorSelectObject);
diff --git a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
index 993e6ce..d4e98d1 100644
--- a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
@@ -29,7 +29,7 @@
///
public event Action CloseEvent;
- private UiGrid _uiGrid;
+ private UiGrid _uiGrid;
public override void OnCreateUi()
{
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs
index fc49e0b..ddfacca 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs
@@ -143,6 +143,59 @@
}
///
+ /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.MarkObject.Label
+ ///
+ public class Label : UiNode
+ {
+ public Label(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.MarkObject
+ ///
+ public class MarkObject : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.Label
+ ///
+ public Label L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNodeOrNull("Label"));
+ return _L_Label;
+ }
+ }
+ private Label _L_Label;
+
+ public MarkObject(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
+ public override MarkObject Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel
+ ///
+ public class Panel : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.MarkObject
+ ///
+ public MarkObject L_MarkObject
+ {
+ get
+ {
+ if (_L_MarkObject == null) _L_MarkObject = new MarkObject(UiPanel, Instance.GetNodeOrNull("MarkObject"));
+ return _L_MarkObject;
+ }
+ }
+ private MarkObject _L_MarkObject;
+
+ public Panel(MapEditorCreateMarkPanel uiPanel, Godot.Panel node) : base(uiPanel, node) { }
+ public override Panel Clone() => new (UiPanel, (Godot.Panel)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer
///
public class VBoxContainer : UiNode
@@ -186,6 +239,19 @@
}
private AddMark _L_AddMark;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.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;
+
public VBoxContainer(MapEditorCreateMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { }
public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
}
@@ -249,6 +315,21 @@
public AddMark S_AddMark => L_MarginContainer.L_VBoxContainer.L_AddMark;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.MarkObject.Label
+ ///
+ public Label S_Label => L_MarginContainer.L_VBoxContainer.L_Panel.L_MarkObject.L_Label;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.MarkObject
+ ///
+ public MarkObject S_MarkObject => L_MarginContainer.L_VBoxContainer.L_Panel.L_MarkObject;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel
+ ///
+ public Panel S_Panel => L_MarginContainer.L_VBoxContainer.L_Panel;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer
///
public VBoxContainer S_VBoxContainer => L_MarginContainer.L_VBoxContainer;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs
index cae31d0..fbaaf66 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs
@@ -17,6 +17,6 @@
private void OnAddMark()
{
- EditorWindowManager.ShowSelectObject("选择物体");
+ EditorWindowManager.ShowSelectObject("选择物体", this);
}
}