diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn index 88a77b3..dd799df 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn @@ -103,19 +103,26 @@ [node name="IdTitle" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/HBoxContainer"] custom_minimum_size = Vector2(250, 0) layout_mode = 2 -text = "物体Id" +text = "Id" horizontal_alignment = 1 vertical_alignment = 1 [node name="NameTitle" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/HBoxContainer"] custom_minimum_size = Vector2(350, 0) layout_mode = 2 -text = "物体名称" +text = "名称" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="TypeTitle" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/HBoxContainer"] +custom_minimum_size = Vector2(150, 0) +layout_mode = 2 +text = "类型" horizontal_alignment = 1 vertical_alignment = 1 [node name="WeightTitle" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/HBoxContainer"] -custom_minimum_size = Vector2(250, 0) +custom_minimum_size = Vector2(150, 0) layout_mode = 2 text = "权重" horizontal_alignment = 1 @@ -134,12 +141,15 @@ layout_mode = 2 size_flags_vertical = 3 -[node name="MarkObject" type="HBoxContainer" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer"] -custom_minimum_size = Vector2(0, 100) +[node name="MarkObject" type="VBoxContainer" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer"] layout_mode = 2 size_flags_horizontal = 3 -[node name="ExpandButton" type="Button" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +[node name="HBoxContainer" type="HBoxContainer" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +custom_minimum_size = Vector2(0, 100) +layout_mode = 2 + +[node name="ExpandButton" type="Button" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] custom_minimum_size = Vector2(80, 80) layout_mode = 2 size_flags_vertical = 4 @@ -147,13 +157,13 @@ flat = true icon_alignment = 1 -[node name="Icon" type="TextureRect" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +[node name="Icon" type="TextureRect" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] material = ExtResource("2_xb40b") custom_minimum_size = Vector2(80, 80) layout_mode = 2 stretch_mode = 5 -[node name="IdLabel" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +[node name="IdLabel" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] custom_minimum_size = Vector2(250, 0) layout_mode = 2 size_flags_vertical = 1 @@ -162,7 +172,7 @@ vertical_alignment = 1 autowrap_mode = 3 -[node name="NameLabel" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +[node name="NameLabel" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] custom_minimum_size = Vector2(350, 0) layout_mode = 2 size_flags_vertical = 1 @@ -171,20 +181,61 @@ vertical_alignment = 1 autowrap_mode = 3 -[node name="LineEdit" type="SpinBox" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] -custom_minimum_size = Vector2(250, 43) +[node name="TypeLabel" type="Label" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] +custom_minimum_size = Vector2(150, 0) +layout_mode = 2 +size_flags_vertical = 1 +text = "武器" +horizontal_alignment = 1 +vertical_alignment = 1 +autowrap_mode = 3 + +[node name="LineEdit" type="SpinBox" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] +custom_minimum_size = Vector2(150, 43) layout_mode = 2 size_flags_vertical = 4 max_value = 1000.0 value = 100.0 custom_arrow_step = 1.0 -[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject"] +[node name="CenterContainer" type="CenterContainer" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer"] layout_mode = 2 size_flags_horizontal = 3 -[node name="DeleteButton" type="Button" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/CenterContainer"] +[node name="DeleteButton" type="Button" parent="MarginContainer/VBoxContainer/Panel/VBoxContainer/ScrollContainer/MarkObject/HBoxContainer/CenterContainer"] custom_minimum_size = Vector2(43, 43) layout_mode = 2 size_flags_vertical = 4 icon = ExtResource("3_7xihk") + +[node name="ExpandPanel" type="MarginContainer" parent="."] +layout_mode = 2 +offset_right = 264.0 +offset_bottom = 70.0 +theme_override_constants/margin_left = 80 +theme_override_constants/margin_right = 2 + +[node name="ExpandGrid" type="GridContainer" parent="ExpandPanel"] +layout_mode = 2 +columns = 3 + +[node name="NumberBar" type="HBoxContainer" parent="."] +custom_minimum_size = Vector2(0, 70) +layout_mode = 2 +offset_left = 80.0 +offset_right = 262.0 +offset_bottom = 70.0 +size_flags_horizontal = 3 + +[node name="AttName" type="Label" parent="NumberBar"] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_stretch_ratio = 35.0 +text = "属性:" + +[node name="NumInput" type="SpinBox" parent="NumberBar"] +custom_minimum_size = Vector2(0, 43) +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 4 +size_flags_stretch_ratio = 65.0 diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs index 5e56ca1..ddcd89e 100644 --- a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs +++ b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs @@ -30,4 +30,14 @@ /// 获取克隆的Ui实例 /// IUiCellNode CloneUiCell(); + + /// + /// 添加子级Ui节点 + /// + void AddChild(IUiNode uiNode); + + /// + /// 移除子级Ui节点 + /// + void RemoveChild(IUiNode uiNode); } diff --git a/DungeonShooting_Godot/src/framework/ui/UiNode.cs b/DungeonShooting_Godot/src/framework/ui/UiNode.cs index abeebb8..a4e8e6b 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiNode.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiNode.cs @@ -80,4 +80,14 @@ { return Clone(); } + + public void AddChild(IUiNode uiNode) + { + Instance.AddChild(uiNode.GetUiInstance()); + } + + public void RemoveChild(IUiNode uiNode) + { + Instance.RemoveChild(uiNode.GetUiInstance()); + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs index 9828ba5..6a6dbb0 100644 --- a/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs +++ b/DungeonShooting_Godot/src/framework/ui/grid/UiCell.cs @@ -163,7 +163,7 @@ OnDoubleClick(); } - _prevClickTime = -1; + _prevClickTime = now; } else { diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs index 43b6dc5..41df491 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs @@ -18,6 +18,32 @@ } private MarginContainer _L_MarginContainer; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.ExpandPanel + /// + public ExpandPanel L_ExpandPanel + { + get + { + if (_L_ExpandPanel == null) _L_ExpandPanel = new ExpandPanel((MapEditorCreateMarkPanel)this, GetNodeOrNull("ExpandPanel")); + return _L_ExpandPanel; + } + } + private ExpandPanel _L_ExpandPanel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar + /// + public NumberBar L_NumberBar + { + get + { + if (_L_NumberBar == null) _L_NumberBar = new NumberBar((MapEditorCreateMarkPanel)this, GetNodeOrNull("NumberBar")); + return _L_NumberBar; + } + } + private NumberBar _L_NumberBar; + public MapEditorCreateMark() : base(nameof(MapEditorCreateMark)) { @@ -214,6 +240,15 @@ } /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.HBoxContainer.TypeTitle + /// + public class TypeTitle : UiNode + { + public TypeTitle(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override TypeTitle Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.HBoxContainer.WeightTitle /// public class WeightTitle : UiNode @@ -289,6 +324,19 @@ private NameTitle _L_NameTitle; /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.TypeTitle + /// + public TypeTitle L_TypeTitle + { + get + { + if (_L_TypeTitle == null) _L_TypeTitle = new TypeTitle(UiPanel, Instance.GetNodeOrNull("TypeTitle")); + return _L_TypeTitle; + } + } + private TypeTitle _L_TypeTitle; + + /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.WeightTitle /// public WeightTitle L_WeightTitle @@ -319,7 +367,7 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.ExpandButton + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.ExpandButton /// public class ExpandButton : UiNode { @@ -328,7 +376,7 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.Icon + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.Icon /// public class Icon : UiNode { @@ -337,7 +385,7 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.IdLabel + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.IdLabel /// public class IdLabel : UiNode { @@ -346,7 +394,7 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.NameLabel + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.NameLabel /// public class NameLabel : UiNode { @@ -355,7 +403,16 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.LineEdit + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.TypeLabel + /// + public class TypeLabel : UiNode + { + public TypeLabel(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override TypeLabel Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.LineEdit /// public class LineEdit : UiNode { @@ -364,7 +421,7 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.CenterContainer.DeleteButton + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.CenterContainer.DeleteButton /// public class DeleteButton : UiNode { @@ -373,12 +430,12 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.CenterContainer + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.CenterContainer /// public class CenterContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.DeleteButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.DeleteButton /// public DeleteButton L_DeleteButton { @@ -395,12 +452,12 @@ } /// - /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer /// - public class MarkObject : UiNode + public class HBoxContainer_2 : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.ExpandButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.ExpandButton /// public ExpandButton L_ExpandButton { @@ -413,7 +470,7 @@ private ExpandButton _L_ExpandButton; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.Icon + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.Icon /// public Icon L_Icon { @@ -426,7 +483,7 @@ private Icon _L_Icon; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.IdLabel + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.IdLabel /// public IdLabel L_IdLabel { @@ -439,7 +496,7 @@ private IdLabel _L_IdLabel; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.NameLabel + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.NameLabel /// public NameLabel L_NameLabel { @@ -452,7 +509,20 @@ private NameLabel _L_NameLabel; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.LineEdit + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.TypeLabel + /// + public TypeLabel L_TypeLabel + { + get + { + if (_L_TypeLabel == null) _L_TypeLabel = new TypeLabel(UiPanel, Instance.GetNodeOrNull("TypeLabel")); + return _L_TypeLabel; + } + } + private TypeLabel _L_TypeLabel; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.LineEdit /// public LineEdit L_LineEdit { @@ -465,7 +535,7 @@ private LineEdit _L_LineEdit; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.CenterContainer + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.CenterContainer /// public CenterContainer L_CenterContainer { @@ -477,8 +547,30 @@ } private CenterContainer _L_CenterContainer; - public MarkObject(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } - public override MarkObject Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + public HBoxContainer_2(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override HBoxContainer_2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject + /// + public class MarkObject : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.HBoxContainer + /// + public HBoxContainer_2 L_HBoxContainer + { + get + { + if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_2(UiPanel, Instance.GetNodeOrNull("HBoxContainer")); + return _L_HBoxContainer; + } + } + private HBoxContainer_2 _L_HBoxContainer; + + public MarkObject(MapEditorCreateMarkPanel uiPanel, Godot.VBoxContainer node) : base(uiPanel, node) { } + public override MarkObject Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate()); } /// @@ -487,13 +579,13 @@ public class ScrollContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.MarkObject + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.MarkObject /// public MarkObject L_MarkObject { get { - if (_L_MarkObject == null) _L_MarkObject = new MarkObject(UiPanel, Instance.GetNodeOrNull("MarkObject")); + if (_L_MarkObject == null) _L_MarkObject = new MarkObject(UiPanel, Instance.GetNodeOrNull("MarkObject")); return _L_MarkObject; } } @@ -630,6 +722,90 @@ public override MarginContainer Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); } + /// + /// 类型: , 路径: MapEditorCreateMark.ExpandPanel.ExpandGrid + /// + public class ExpandGrid : UiNode + { + public ExpandGrid(MapEditorCreateMarkPanel uiPanel, Godot.GridContainer node) : base(uiPanel, node) { } + public override ExpandGrid Clone() => new (UiPanel, (Godot.GridContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.ExpandPanel + /// + public class ExpandPanel : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.ExpandGrid + /// + public ExpandGrid L_ExpandGrid + { + get + { + if (_L_ExpandGrid == null) _L_ExpandGrid = new ExpandGrid(UiPanel, Instance.GetNodeOrNull("ExpandGrid")); + return _L_ExpandGrid; + } + } + private ExpandGrid _L_ExpandGrid; + + public ExpandPanel(MapEditorCreateMarkPanel uiPanel, Godot.MarginContainer node) : base(uiPanel, node) { } + public override ExpandPanel Clone() => new (UiPanel, (Godot.MarginContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.NumberBar.AttName + /// + public class AttName : UiNode + { + public AttName(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override AttName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.NumberBar.NumInput + /// + public class NumInput : UiNode + { + public NumInput(MapEditorCreateMarkPanel uiPanel, Godot.SpinBox node) : base(uiPanel, node) { } + public override NumInput Clone() => new (UiPanel, (Godot.SpinBox)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: MapEditorCreateMark.NumberBar + /// + public class NumberBar : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.AttName + /// + public AttName L_AttName + { + get + { + if (_L_AttName == null) _L_AttName = new AttName(UiPanel, Instance.GetNodeOrNull("AttName")); + return _L_AttName; + } + } + private AttName _L_AttName; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.NumInput + /// + public NumInput L_NumInput + { + get + { + if (_L_NumInput == null) _L_NumInput = new NumInput(UiPanel, Instance.GetNodeOrNull("NumInput")); + return _L_NumInput; + } + } + private NumInput _L_NumInput; + + public NumberBar(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } + public override NumberBar Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); + } + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.HBoxContainer3.HBoxContainer2.WaveNameLabel @@ -687,6 +863,11 @@ public NameTitle S_NameTitle => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_HBoxContainer.L_NameTitle; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.HBoxContainer.TypeTitle + /// + public TypeTitle S_TypeTitle => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_HBoxContainer.L_TypeTitle; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.HBoxContainer.WeightTitle /// public WeightTitle S_WeightTitle => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_HBoxContainer.L_WeightTitle; @@ -697,42 +878,47 @@ public ExtraTitle S_ExtraTitle => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_HBoxContainer.L_ExtraTitle; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.ExpandButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.ExpandButton /// - public ExpandButton S_ExpandButton => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_ExpandButton; + public ExpandButton S_ExpandButton => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_ExpandButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.Icon + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.Icon /// - public Icon S_Icon => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_Icon; + public Icon S_Icon => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_Icon; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.IdLabel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.IdLabel /// - public IdLabel S_IdLabel => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_IdLabel; + public IdLabel S_IdLabel => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_IdLabel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.NameLabel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.NameLabel /// - public NameLabel S_NameLabel => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_NameLabel; + public NameLabel S_NameLabel => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_NameLabel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.LineEdit + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.TypeLabel /// - public LineEdit S_LineEdit => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_LineEdit; + public TypeLabel S_TypeLabel => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_TypeLabel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.CenterContainer.DeleteButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.LineEdit /// - public DeleteButton S_DeleteButton => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_CenterContainer.L_DeleteButton; + public LineEdit S_LineEdit => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_LineEdit; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.CenterContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.CenterContainer.DeleteButton /// - public CenterContainer S_CenterContainer => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_CenterContainer; + public DeleteButton S_DeleteButton => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_CenterContainer.L_DeleteButton; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject.HBoxContainer.CenterContainer + /// + public CenterContainer S_CenterContainer => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject.L_HBoxContainer.L_CenterContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.MarginContainer.VBoxContainer.Panel.VBoxContainer.ScrollContainer.MarkObject /// public MarkObject S_MarkObject => L_MarginContainer.L_VBoxContainer.L_Panel.L_VBoxContainer.L_ScrollContainer.L_MarkObject; @@ -751,4 +937,29 @@ /// public MarginContainer S_MarginContainer => L_MarginContainer; + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.ExpandPanel.ExpandGrid + /// + public ExpandGrid S_ExpandGrid => L_ExpandPanel.L_ExpandGrid; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.ExpandPanel + /// + public ExpandPanel S_ExpandPanel => L_ExpandPanel; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar.AttName + /// + public AttName S_AttName => L_NumberBar.L_AttName; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar.NumInput + /// + public NumInput S_NumInput => L_NumberBar.L_NumInput; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar + /// + public NumberBar S_NumberBar => L_NumberBar; + } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs index 1f5d47f..e1cea54 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs @@ -11,17 +11,22 @@ public override void OnCreateUi() { + //隐藏模板对象 + S_ExpandPanel.Instance.Visible = false; + S_NumberBar.Instance.Visible = false; + S_AddMark.Instance.Pressed += OnAddMark; _grid = new UiGrid(S_MarkObject, typeof(MarkObjectCell)); _grid.SetColumns(1); _grid.SetHorizontalExpand(true); _grid.SetCellOffset(new Vector2I(0, 5)); + } public override void OnDestroyUi() { - + _grid.Destroy(); } /// diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs index 2281d91..5447496 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs @@ -1,28 +1,56 @@ -using Config; +using System; +using Config; namespace UI.MapEditorCreateMark; public class MarkObjectCell : UiCell { + //是否展开 + private bool _isExpand = false; + + private MapEditorCreateMark.ExpandPanel _expandPanel; + public override void OnInit() { - CellNode.L_CenterContainer.L_DeleteButton.Instance.Pressed += OnDeleteClick; + CellNode.L_HBoxContainer.L_ExpandButton.Instance.Pressed += OnExpandClick; + CellNode.L_HBoxContainer.L_CenterContainer.L_DeleteButton.Instance.Pressed += OnDeleteClick; } public override void OnSetData(ExcelConfig.ActivityObject data) { if (string.IsNullOrEmpty(data.Icon)) { - CellNode.L_Icon.Instance.Visible = false; + CellNode.L_HBoxContainer.L_Icon.Instance.Visible = false; } else { - CellNode.L_Icon.Instance.Visible = true; - CellNode.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon); + CellNode.L_HBoxContainer.L_Icon.Instance.Visible = true; + CellNode.L_HBoxContainer.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon); + } + //物体Id + CellNode.L_HBoxContainer.L_IdLabel.Instance.Text = data.Id; + //物体名称 + CellNode.L_HBoxContainer.L_NameLabel.Instance.Text = data.Name; + + // 包含额外属性 + if (data.Type == 5) + { + if (_expandPanel == null) + { + CreateExpandPanel(data.Type); + } + } + } + + public override void OnDisable() + { + if (_expandPanel != null) + { + _expandPanel.Instance.QueueFree(); + _expandPanel = null; } - CellNode.L_IdLabel.Instance.Text = data.Id; - CellNode.L_NameLabel.Instance.Text = data.Name; + SetExpandState(false); } //点击删除按钮 @@ -30,4 +58,56 @@ { Grid.RemoveByIndex(Index); } + + //点击展开按钮 + private void OnExpandClick() + { + //展开图标 + SetExpandState(!_isExpand); + } + + //设置展开状态 + private void SetExpandState(bool flag) + { + _isExpand = flag; + if (_isExpand) + { + CellNode.L_HBoxContainer.L_ExpandButton.Instance.Icon = + ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Down_png); + } + else + { + CellNode.L_HBoxContainer.L_ExpandButton.Instance.Icon = + ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Right_png); + } + + if (_expandPanel != null) + { + _expandPanel.Instance.Visible = _isExpand; + } + } + + private void CreateExpandPanel(int type) + { + if (_expandPanel != null) + { + throw new Exception("已经创建过ExpandPanel, 不能重复创建!"); + } + + _expandPanel = CellNode.UiPanel.S_ExpandPanel.Clone(); + _expandPanel.Instance.Visible = _isExpand; + CellNode.AddChild(_expandPanel); + + if (type == 5) //武器类型 + { + var numberBar1 = CellNode.UiPanel.S_NumberBar.Clone(); + numberBar1.L_AttName.Instance.Text = "弹夹弹药量:"; + numberBar1.Instance.Visible = true; + var numberBar2 = CellNode.UiPanel.S_NumberBar.Clone(); + numberBar2.L_AttName.Instance.Text = "剩余弹药量:"; + numberBar2.Instance.Visible = true; + _expandPanel.L_ExpandGrid.AddChild(numberBar1); + _expandPanel.L_ExpandGrid.AddChild(numberBar2); + } + } } \ No newline at end of file