diff --git a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
index e134cdf..02923b0 100644
--- a/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/ActivityObject.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx
index 4b24975..1c12e9e 100644
--- a/DungeonShooting_Godot/excel/excelFile/Sound.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/Sound.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
index e5446ab..88d2d71 100644
--- a/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
+++ b/DungeonShooting_Godot/excel/excelFile/Weapon.xlsx
Binary files differ
diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
index dd799df..16ed1ab 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditorCreateMark.tscn
@@ -1,15 +1,18 @@
-[gd_scene load_steps=5 format=3 uid="uid://bt4xo2lb4h4rx"]
+[gd_scene load_steps=6 format=3 uid="uid://bt4xo2lb4h4rx"]
[ext_resource type="Script" path="res://src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs" id="1_cjivg"]
[ext_resource type="Material" uid="uid://cces3bhds7jyi" path="res://resource/material/Blend.tres" id="2_xb40b"]
[ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="3_7xihk"]
[ext_resource type="Texture2D" uid="uid://dligpyhp72sg7" path="res://resource/sprite/ui/commonIcon/Right.png" id="3_v5clf"]
+[ext_resource type="Script" path="res://src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs" id="6_1ym7l"]
[node name="MapEditorCreateMark" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
script = ExtResource("1_cjivg")
[node name="MarginContainer" type="MarginContainer" parent="."]
@@ -210,8 +213,10 @@
[node name="ExpandPanel" type="MarginContainer" parent="."]
layout_mode = 2
-offset_right = 264.0
-offset_bottom = 70.0
+offset_left = 68.0
+offset_top = -588.0
+offset_right = 332.0
+offset_bottom = -518.0
theme_override_constants/margin_left = 80
theme_override_constants/margin_right = 2
@@ -222,15 +227,17 @@
[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
+offset_left = 107.0
+offset_top = -362.0
+offset_right = 289.0
+offset_bottom = -292.0
size_flags_horizontal = 3
+script = ExtResource("6_1ym7l")
-[node name="AttName" type="Label" parent="NumberBar"]
+[node name="AttrName" type="Label" parent="NumberBar"]
layout_mode = 2
size_flags_horizontal = 3
-size_flags_stretch_ratio = 35.0
+size_flags_stretch_ratio = 40.0
text = "属性:"
[node name="NumInput" type="SpinBox" parent="NumberBar"]
@@ -238,4 +245,4 @@
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 4
-size_flags_stretch_ratio = 65.0
+size_flags_stretch_ratio = 60.0
diff --git a/DungeonShooting_Godot/resource/config/ActivityObject.json b/DungeonShooting_Godot/resource/config/ActivityObject.json
index b9c8b46..7f8ce7c 100644
--- a/DungeonShooting_Godot/resource/config/ActivityObject.json
+++ b/DungeonShooting_Godot/resource/config/ActivityObject.json
@@ -12,12 +12,12 @@
{
"Id": "enemy0001",
"Type": 4,
- "Name": "",
+ "Name": "\u654C\u4EBA",
"Intro": "\u654C\u4EBA",
"Details": "",
"Prefab": "res://prefab/role/Enemy0001.tscn",
- "Icon": "",
- "ShowInMapEditor": false
+ "Icon": "res://resource/sprite/role/enemy0001/Enemy0001_Icon.png",
+ "ShowInMapEditor": true
},
{
"Id": "weapon0001",
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json
index b37673f..245342f 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json
@@ -1 +1 @@
-[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":null}],[{"Position":null},{"Position":null}]]}]
\ No newline at end of file
+[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":0,"Y":0},"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"30","ResidueAmmo":"60"}},{"Id":"weapon0006","Weight":100,"Attr":{"CurrAmmon":"10","ResidueAmmo":"30"}}]}]]}]
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png
new file mode 100644
index 0000000..13ad67c
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png
Binary files differ
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png.import
new file mode 100644
index 0000000..e1b4639
--- /dev/null
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/Enemy0001_Icon.png.import
@@ -0,0 +1,34 @@
+[remap]
+
+importer="texture"
+type="CompressedTexture2D"
+uid="uid://qmc4grkf5at0"
+path="res://.godot/imported/Enemy0001_Icon.png-d471a4b79cc3353b9c770dc482e4deec.ctex"
+metadata={
+"vram_texture": false
+}
+
+[deps]
+
+source_file="res://resource/sprite/role/enemy0001/Enemy0001_Icon.png"
+dest_files=["res://.godot/imported/Enemy0001_Icon.png-d471a4b79cc3353b9c770dc482e4deec.ctex"]
+
+[params]
+
+compress/mode=0
+compress/high_quality=false
+compress/lossy_quality=0.7
+compress/hdr_compression=1
+compress/normal_map=0
+compress/channel_pack=0
+mipmaps/generate=false
+mipmaps/limit=-1
+roughness/mode=0
+roughness/src_normal=""
+process/fix_alpha_border=true
+process/premult_alpha=false
+process/normal_map_invert_y=false
+process/hdr_as_srgb=false
+process/hdr_clamp_exposure=false
+process/size_limit=0
+detect_3d/compress_to=1
diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
index 72e6d35..38650e0 100644
--- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
+++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Init.cs
@@ -12,162 +12,162 @@
{
///
/// 名称:
- /// 备注: 玩家
+ /// 简介: 玩家
///
public const string Id_role0001 = "role0001";
///
- /// 名称:
- /// 备注: 敌人
+ /// 名称: 敌人
+ /// 简介: 敌人
///
public const string Id_enemy0001 = "enemy0001";
///
/// 名称: 步枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0001 = "weapon0001";
///
/// 名称: 霰弹枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0002 = "weapon0002";
///
/// 名称: 手枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0003 = "weapon0003";
///
/// 名称: 刀
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0004 = "weapon0004";
///
/// 名称: 狙击枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0005 = "weapon0005";
///
/// 名称: 冲锋枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0006 = "weapon0006";
///
/// 名称: 汤姆逊冲锋枪
- /// 备注:
+ /// 简介:
///
public const string Id_weapon0007 = "weapon0007";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_bullet0001 = "bullet0001";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_bullet0002 = "bullet0002";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_bullet0003 = "bullet0003";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_shell0001 = "shell0001";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_shell0002 = "shell0002";
///
/// 名称:
- /// 备注:
+ /// 简介:
///
public const string Id_shell0003 = "shell0003";
///
/// 名称:
- /// 备注: 敌人死亡碎片
+ /// 简介: 敌人死亡碎片
///
public const string Id_effect0001 = "effect0001";
///
/// 名称: 鞋子
- /// 备注: 提高移动速度
+ /// 简介: 提高移动速度
///
public const string Id_prop0001 = "prop0001";
///
/// 名称: 心之容器
- /// 备注: 提高血量上限
+ /// 简介: 提高血量上限
///
public const string Id_prop0002 = "prop0002";
///
/// 名称: 护盾
- /// 备注: 可以抵挡子弹,随时间推移自动恢复
+ /// 简介: 可以抵挡子弹,随时间推移自动恢复
///
public const string Id_prop0003 = "prop0003";
///
/// 名称: 护盾计时器
- /// 备注: 提高护盾恢复速度
+ /// 简介: 提高护盾恢复速度
///
public const string Id_prop0004 = "prop0004";
///
/// 名称: 杀伤弹
- /// 备注: 提高子弹伤害
+ /// 简介: 提高子弹伤害
///
public const string Id_prop0005 = "prop0005";
///
/// 名称: 红宝石戒指
- /// 备注: 受伤后延长无敌时间
+ /// 简介: 受伤后延长无敌时间
///
public const string Id_prop0006 = "prop0006";
///
/// 名称: 备用护盾
- /// 备注: 受伤时有一定概率抵消伤害
+ /// 简介: 受伤时有一定概率抵消伤害
///
public const string Id_prop0007 = "prop0007";
///
/// 名称: 眼镜
- /// 备注: 提高武器精准度
+ /// 简介: 提高武器精准度
///
public const string Id_prop0008 = "prop0008";
///
/// 名称: 高速子弹
- /// 备注: 提高子弹速度和射程
+ /// 简介: 提高子弹速度和射程
///
public const string Id_prop0009 = "prop0009";
///
/// 名称: 分裂子弹
- /// 备注: 子弹数量翻倍, 但是精准度和伤害降低
+ /// 简介: 子弹数量翻倍, 但是精准度和伤害降低
///
public const string Id_prop0010 = "prop0010";
///
/// 名称: 医药箱
- /// 备注: 使用后回复一颗红心
+ /// 简介: 使用后回复一颗红心
///
public const string Id_prop5000 = "prop5000";
///
/// 名称: 弹药箱
- /// 备注: 使用后补充当前武器备用弹药
+ /// 简介: 使用后补充当前武器备用弹药
///
public const string Id_prop5001 = "prop5001";
///
/// 名称:
- /// 备注: 地牢房间的门(东侧)
+ /// 简介: 地牢房间的门(东侧)
///
public const string Id_other_door_e = "other_door_e";
///
/// 名称:
- /// 备注: 地牢房间的门(西侧)
+ /// 简介: 地牢房间的门(西侧)
///
public const string Id_other_door_w = "other_door_w";
///
/// 名称:
- /// 备注: 地牢房间的门(南侧)
+ /// 简介: 地牢房间的门(南侧)
///
public const string Id_other_door_s = "other_door_s";
///
/// 名称:
- /// 备注: 地牢房间的门(北侧)
+ /// 简介: 地牢房间的门(北侧)
///
public const string Id_other_door_n = "other_door_n";
}
diff --git a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs b/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs
index e184a37..70b71e9 100644
--- a/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs
+++ b/DungeonShooting_Godot/src/framework/map/data/MarkInfo.cs
@@ -1,4 +1,5 @@
+using System.Collections.Generic;
using System.Text.Json.Serialization;
///
@@ -6,6 +7,21 @@
///
public class MarkInfo
{
+ ///
+ /// 所在坐标
+ ///
[JsonInclude]
public SerializeVector2 Position;
+
+ ///
+ /// 延时时间
+ ///
+ [JsonInclude]
+ public float DelayTime;
+
+ ///
+ /// 标记列表数据
+ ///
+ [JsonInclude]
+ public List MarkList;
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs b/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs
new file mode 100644
index 0000000..f41d764
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/map/data/MarkInfoItem.cs
@@ -0,0 +1,27 @@
+
+using System.Collections.Generic;
+using System.Text.Json.Serialization;
+
+///
+/// 标记项数据
+///
+public class MarkInfoItem
+{
+ ///
+ /// 物体Id
+ ///
+ [JsonInclude]
+ public string Id;
+
+ ///
+ /// 权重
+ ///
+ [JsonInclude]
+ public int Weight;
+
+ ///
+ /// 额外属性
+ ///
+ [JsonInclude]
+ public Dictionary Attr;
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs
index ddcd89e..34350c4 100644
--- a/DungeonShooting_Godot/src/framework/ui/IUiNode.cs
+++ b/DungeonShooting_Godot/src/framework/ui/IUiNode.cs
@@ -35,9 +35,24 @@
/// 添加子级Ui节点
///
void AddChild(IUiNode uiNode);
+
+ ///
+ /// 添加子级Ui节点
+ ///
+ void AddChild(Node node);
///
/// 移除子级Ui节点
///
void RemoveChild(IUiNode uiNode);
+
+ ///
+ /// 移除子级Ui节点
+ ///
+ void RemoveChild(Node node);
+
+ ///
+ /// 销毁当前节点
+ ///
+ void QueueFree();
}
diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs b/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs
new file mode 100644
index 0000000..925a3e3
--- /dev/null
+++ b/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs
@@ -0,0 +1,11 @@
+
+///
+/// Ui节点脚本接口, 用于脚本便捷获取所属Ui节点对象
+///
+public interface IUiNodeScript
+{
+ ///
+ /// 设置所属Ui节点对象
+ ///
+ void SetUiNode(IUiNode uiNode);
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/ui/UiNode.cs b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
index a4e8e6b..9f2e473 100644
--- a/DungeonShooting_Godot/src/framework/ui/UiNode.cs
+++ b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
@@ -31,6 +31,10 @@
{
UiPanel = uiPanel;
Instance = node;
+ if (node is IUiNodeScript uiNodeScript)
+ {
+ uiNodeScript.SetUiNode(this);
+ }
}
public UiBase OpenNestedUi(string uiName, UiBase prevUi = null)
@@ -86,8 +90,23 @@
Instance.AddChild(uiNode.GetUiInstance());
}
+ public void AddChild(Node node)
+ {
+ Instance.AddChild(node);
+ }
+
public void RemoveChild(IUiNode uiNode)
{
Instance.RemoveChild(uiNode.GetUiInstance());
}
+
+ public void RemoveChild(Node node)
+ {
+ Instance.RemoveChild(node);
+ }
+
+ public void QueueFree()
+ {
+ Instance.QueueFree();
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs
index ddcfe39..989bd45 100644
--- a/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs
+++ b/DungeonShooting_Godot/src/framework/ui/grid/IUiGrid.cs
@@ -14,4 +14,9 @@
/// 设置网格组件是否可见
///
bool Visible { get; set; }
+
+ ///
+ /// 当前网格组件数据大小
+ ///
+ int Count { get; }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs
index ed18bc2..6df6551 100644
--- a/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs
+++ b/DungeonShooting_Godot/src/framework/ui/grid/UiGrid.cs
@@ -62,6 +62,8 @@
set => _gridContainer.Visible = value;
}
+ public int Count => _cellList.Count;
+
//模板对象
private TUiCellNode _template;
//模板大小
diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
index 5538db5..d14a97f 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
@@ -167,7 +167,8 @@
///
/// 房间预设信息
/// 当前波数据
- public static void ShowCreateMark(RoomPreinstall preinstall, int waveIndex)
+ /// 创建标记回调
+ public static void ShowCreateMark(RoomPreinstall preinstall, int waveIndex, Action onCreateMarkInfo)
{
var window = UiManager.Open_EditorWindow();
window.SetWindowTitle("创建标记");
@@ -177,12 +178,12 @@
window.SetButtonList(
new EditorWindowPanel.ButtonData("确定", () =>
{
- // var roomPreinstall = body.GetRoomPreinstall(list);
- // if (roomPreinstall != null)
- // {
- // window.CloseWindow();
- // onCreatePreinstall(roomPreinstall);
- // }
+ var markInfo = body.GetMarkInfo();
+ if (markInfo != null)
+ {
+ window.CloseWindow();
+ onCreateMarkInfo(markInfo);
+ }
}),
new EditorWindowPanel.ButtonData("取消", () =>
{
diff --git a/DungeonShooting_Godot/src/game/manager/NameManager.cs b/DungeonShooting_Godot/src/game/manager/NameManager.cs
new file mode 100644
index 0000000..e8256ba
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/manager/NameManager.cs
@@ -0,0 +1,36 @@
+
+public class NameManager
+{
+ ///
+ /// 获取物体属性名称字符串
+ ///
+ public static string GetActivityTypeName(int type)
+ {
+ switch ((ActivityIdPrefix.ActivityPrefixType)type)
+ {
+ case ActivityIdPrefix.ActivityPrefixType.NonePrefix:
+ return "";
+ case ActivityIdPrefix.ActivityPrefixType.Test:
+ return "测试";
+ case ActivityIdPrefix.ActivityPrefixType.Role:
+ case ActivityIdPrefix.ActivityPrefixType.Player:
+ return "角色";
+ case ActivityIdPrefix.ActivityPrefixType.Enemy:
+ return "敌人";
+ case ActivityIdPrefix.ActivityPrefixType.Weapon:
+ return "武器";
+ case ActivityIdPrefix.ActivityPrefixType.Bullet:
+ return "子弹";
+ case ActivityIdPrefix.ActivityPrefixType.Shell:
+ return "弹壳";
+ case ActivityIdPrefix.ActivityPrefixType.Effect:
+ return "特效";
+ case ActivityIdPrefix.ActivityPrefixType.Prop:
+ return "道具";
+ case ActivityIdPrefix.ActivityPrefixType.Other:
+ return "其他";
+ }
+
+ return "";
+ }
+}
\ 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 41df491..8c07f2c 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMark.cs
@@ -32,13 +32,13 @@
private ExpandPanel _L_ExpandPanel;
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar
///
public NumberBar L_NumberBar
{
get
{
- if (_L_NumberBar == null) _L_NumberBar = new NumberBar((MapEditorCreateMarkPanel)this, GetNodeOrNull("NumberBar"));
+ if (_L_NumberBar == null) _L_NumberBar = new NumberBar((MapEditorCreateMarkPanel)this, GetNodeOrNull("NumberBar"));
return _L_NumberBar;
}
}
@@ -754,12 +754,12 @@
}
///
- /// 类型: , 路径: MapEditorCreateMark.NumberBar.AttName
+ /// 类型: , 路径: MapEditorCreateMark.NumberBar.AttrName
///
- public class AttName : UiNode
+ public class AttrName : UiNode
{
- public AttName(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
- public override AttName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ public AttrName(MapEditorCreateMarkPanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override AttrName Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
}
///
@@ -772,22 +772,22 @@
}
///
- /// 类型: , 路径: MapEditorCreateMark.NumberBar
+ /// 类型: , 路径: MapEditorCreateMark.NumberBar
///
- public class NumberBar : UiNode
+ public class NumberBar : UiNode
{
///
- /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.AttName
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.AttrName
///
- public AttName L_AttName
+ public AttrName L_AttrName
{
get
{
- if (_L_AttName == null) _L_AttName = new AttName(UiPanel, Instance.GetNodeOrNull("AttName"));
- return _L_AttName;
+ if (_L_AttrName == null) _L_AttrName = new AttrName(UiPanel, Instance.GetNodeOrNull("AttrName"));
+ return _L_AttrName;
}
}
- private AttName _L_AttName;
+ private AttrName _L_AttrName;
///
/// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorCreateMark.NumInput
@@ -802,8 +802,8 @@
}
private NumInput _L_NumInput;
- public NumberBar(MapEditorCreateMarkPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
- public override NumberBar Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
+ public NumberBar(MapEditorCreateMarkPanel uiPanel, UI.MapEditorCreateMark.NumberAttribute node) : base(uiPanel, node) { }
+ public override NumberBar Clone() => new (UiPanel, (UI.MapEditorCreateMark.NumberAttribute)Instance.Duplicate());
}
@@ -948,9 +948,9 @@
public ExpandPanel S_ExpandPanel => L_ExpandPanel;
///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar.AttName
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar.AttrName
///
- public AttName S_AttName => L_NumberBar.L_AttName;
+ public AttrName S_AttrName => L_NumberBar.L_AttrName;
///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar.NumInput
@@ -958,7 +958,7 @@
public NumInput S_NumInput => L_NumberBar.L_NumInput;
///
- /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorCreateMark.NumberBar
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: 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 e1cea54..865ee2f 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs
@@ -7,7 +7,7 @@
public partial class MapEditorCreateMarkPanel : MapEditorCreateMark
{
- private UiGrid _grid;
+ private UiGrid _grid;
public override void OnCreateUi()
{
@@ -17,7 +17,7 @@
S_AddMark.Instance.Pressed += OnAddMark;
- _grid = new UiGrid(S_MarkObject, typeof(MarkObjectCell));
+ _grid = new UiGrid(S_MarkObject, typeof(MarkObjectCell));
_grid.SetColumns(1);
_grid.SetHorizontalExpand(true);
_grid.SetCellOffset(new Vector2I(0, 5));
@@ -43,6 +43,40 @@
optionButton.Selected = waveIndex;
}
+ ///
+ /// 获取填写的标记数据
+ ///
+ public MarkInfo GetMarkInfo()
+ {
+ var data = new MarkInfo();
+ data.Position = new SerializeVector2();
+ data.MarkList = new List();
+ data.DelayTime = (float)S_DelayInput.Instance.Value;
+ var gridCount = _grid.Count;
+ for (var i = 0; i < gridCount; i++)
+ {
+ var uiCell = (MarkObjectCell)_grid.GetCell(i);
+ var markInfoItem = uiCell.GetMarkInfoItem();
+ data.MarkList.Add(markInfoItem);
+ }
+
+ return data;
+ }
+
+ ///
+ /// 创建数值属性数据
+ ///
+ /// 属性字符串名称
+ /// 属性名称
+ public NumberAttribute CreateNumberBar(string attrName, string attrLabel)
+ {
+ var numberBar = S_NumberBar.Clone();
+ numberBar.Instance.AttrName = attrName;
+ numberBar.L_AttrName.Instance.Text = attrLabel;
+ numberBar.Instance.Visible = true;
+ return numberBar.Instance;
+ }
+
//点击添加标记按钮
private void OnAddMark()
{
@@ -52,6 +86,10 @@
//选中物体回调
private void OnSelectObject(ExcelConfig.ActivityObject activityObject)
{
- _grid.Add(activityObject);
+ _grid.Add(new MarkInfoItem()
+ {
+ Id = activityObject.Id,
+ Weight = 100
+ });
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
index 5447496..975fce2 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MarkObjectCell.cs
@@ -1,14 +1,16 @@
using System;
+using System.Collections.Generic;
using Config;
namespace UI.MapEditorCreateMark;
-public class MarkObjectCell : UiCell
+public class MarkObjectCell : UiCell
{
//是否展开
private bool _isExpand = false;
-
private MapEditorCreateMark.ExpandPanel _expandPanel;
+ private List _attributeBases;
+ private ExcelConfig.ActivityObject _activityObject;
public override void OnInit()
{
@@ -16,28 +18,34 @@
CellNode.L_HBoxContainer.L_CenterContainer.L_DeleteButton.Instance.Pressed += OnDeleteClick;
}
- public override void OnSetData(ExcelConfig.ActivityObject data)
+ public override void OnSetData(MarkInfoItem data)
{
- if (string.IsNullOrEmpty(data.Icon))
+ //记得判断随机对象, 后面在做
+
+
+ _activityObject = ExcelConfig.ActivityObject_Map[data.Id];
+ if (string.IsNullOrEmpty(_activityObject.Icon))
{
CellNode.L_HBoxContainer.L_Icon.Instance.Visible = false;
}
else
{
CellNode.L_HBoxContainer.L_Icon.Instance.Visible = true;
- CellNode.L_HBoxContainer.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(data.Icon);
+ CellNode.L_HBoxContainer.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(_activityObject.Icon);
}
//物体Id
CellNode.L_HBoxContainer.L_IdLabel.Instance.Text = data.Id;
//物体名称
- CellNode.L_HBoxContainer.L_NameLabel.Instance.Text = data.Name;
+ CellNode.L_HBoxContainer.L_NameLabel.Instance.Text = _activityObject.Name;
+ //物体类型
+ CellNode.L_HBoxContainer.L_TypeLabel.Instance.Text = NameManager.GetActivityTypeName(_activityObject.Type);
// 包含额外属性
- if (data.Type == 5)
+ if (_activityObject.Type == 5 || _activityObject.Type == 4)
{
if (_expandPanel == null)
{
- CreateExpandPanel(data.Type);
+ CreateExpandPanel(_activityObject, data);
}
}
}
@@ -46,13 +54,32 @@
{
if (_expandPanel != null)
{
- _expandPanel.Instance.QueueFree();
+ _attributeBases.Clear();
+ _attributeBases = null;
+ _expandPanel.QueueFree();
_expandPanel = null;
}
SetExpandState(false);
}
+ ///
+ /// 获取标记数据对象
+ ///
+ public MarkInfoItem GetMarkInfoItem()
+ {
+ var markInfoItem = Data;
+ if (_activityObject.Type == 5 || _activityObject.Type == 4)
+ {
+ markInfoItem.Attr = new Dictionary();
+ foreach (var attributeBase in _attributeBases)
+ {
+ markInfoItem.Attr.Add(attributeBase.AttrName, attributeBase.GetAttributeValue());
+ }
+ }
+ return markInfoItem;
+ }
+
//点击删除按钮
private void OnDeleteClick()
{
@@ -87,7 +114,7 @@
}
}
- private void CreateExpandPanel(int type)
+ private void CreateExpandPanel(ExcelConfig.ActivityObject activityObject, MarkInfoItem markInfoItem)
{
if (_expandPanel != null)
{
@@ -98,16 +125,38 @@
_expandPanel.Instance.Visible = _isExpand;
CellNode.AddChild(_expandPanel);
- if (type == 5) //武器类型
+ if (activityObject.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);
+ var numberBar = CellNode.UiPanel.CreateNumberBar("CurrAmmon", "弹夹弹药量:");
+ var numberBar2 = CellNode.UiPanel.CreateNumberBar("ResidueAmmo", "剩余弹药量:");
+ _expandPanel.L_ExpandGrid.AddChild(numberBar);
_expandPanel.L_ExpandGrid.AddChild(numberBar2);
+ _attributeBases = new List();
+ _attributeBases.Add(numberBar);
+ _attributeBases.Add(numberBar2);
+
+ if (markInfoItem != null) //初始化数据
+ {
+
+ }
+ }
+ else if (activityObject.Type == 4) //敌人
+ {
+ var numberBar = CellNode.UiPanel.CreateNumberBar("Weapon", "携带武器:");
+ var numberBar2 = CellNode.UiPanel.CreateNumberBar("CurrAmmon", "弹夹弹药量:");
+ var numberBar3 = CellNode.UiPanel.CreateNumberBar("ResidueAmmo", "剩余弹药量:");
+ _expandPanel.L_ExpandGrid.AddChild(numberBar);
+ _expandPanel.L_ExpandGrid.AddChild(numberBar2);
+ _expandPanel.L_ExpandGrid.AddChild(numberBar3);
+ _attributeBases = new List();
+ _attributeBases.Add(numberBar);
+ _attributeBases.Add(numberBar2);
+ _attributeBases.Add(numberBar3);
+
+ if (markInfoItem != null) //初始化数据
+ {
+
+ }
}
}
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/AttributeBase.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/AttributeBase.cs
new file mode 100644
index 0000000..cc47cd2
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/AttributeBase.cs
@@ -0,0 +1,23 @@
+using Godot;
+
+namespace UI.MapEditorCreateMark;
+
+public abstract partial class AttributeBase : HBoxContainer, IUiNodeScript
+{
+ ///
+ /// 属性名称
+ ///
+ public string AttrName { get; set; }
+
+ public abstract void SetUiNode(IUiNode uiNode);
+
+ ///
+ /// 设置属性显示名称
+ ///
+ public abstract void SetAttributeLabel(string text);
+
+ ///
+ /// 获取属性值
+ ///
+ public abstract string GetAttributeValue();
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs
new file mode 100644
index 0000000..9f8f366
--- /dev/null
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs
@@ -0,0 +1,24 @@
+using System.Globalization;
+using Godot;
+
+namespace UI.MapEditorCreateMark;
+
+public partial class NumberAttribute : AttributeBase
+{
+ private MapEditorCreateMark.NumberBar NumberBar;
+
+ public override void SetUiNode(IUiNode uiNode)
+ {
+ NumberBar = (MapEditorCreateMark.NumberBar)uiNode;
+ }
+
+ public override void SetAttributeLabel(string text)
+ {
+ NumberBar.L_AttrName.Instance.Text = text;
+ }
+
+ public override string GetAttributeValue()
+ {
+ return NumberBar.L_NumInput.Instance.Value.ToString(CultureInfo.InvariantCulture);
+ }
+}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
index 49af210..986060e 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/EditorWaveCell.cs
@@ -41,12 +41,17 @@
//当前选中的预设
var preinstall = CellNode.UiPanel.GetSelectPreinstall();
//打开添加标记页面
- EditorWindowManager.ShowCreateMark(preinstall, Index);
- // var info = new MarkInfo();
- // Data.Add(info);
- // _grid.Add(info);
+ EditorWindowManager.ShowCreateMark(preinstall, Index, OnCreateMarkInfo);
}
-
+
+ //创建的标记完成
+ private void OnCreateMarkInfo(MarkInfo markInfo)
+ {
+ var preinstall = CellNode.UiPanel.GetSelectPreinstall();
+ preinstall.WaveList[Index].Add(markInfo);
+ _grid.Add(markInfo);
+ }
+
//展开/收起按钮点击
private void OnExpandOrClose()
{
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs
index fa7b5b9..422250f 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorSelectObject/MapEditorSelectObjectPanel.cs
@@ -87,7 +87,7 @@
o =>
{
return (string.IsNullOrEmpty(name) || o.Name.Contains(name) || o.Id.Contains(name)) &&
- (type < 0 ? _typeArray.Contains(o.Type) : o.Type == type);
+ (type < 0 ? _typeArray.Contains(o.Type) : o.Type == type) && o.ShowInMapEditor;
}
).ToArray();
_objectGrid.SetDataList(arr);