diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn
index 6844475..1fa8114 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditorProject.tscn
@@ -1,10 +1,13 @@
-[gd_scene load_steps=6 format=3 uid="uid://dh7y03tq6v0a2"]
+[gd_scene load_steps=9 format=3 uid="uid://dh7y03tq6v0a2"]
[ext_resource type="Script" path="res://src/game/ui/mapEditorProject/MapEditorProjectPanel.cs" id="1_5aioo"]
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_v0ry0"]
[ext_resource type="Texture2D" uid="uid://uhhfgdhpk7i4" path="res://icon.png" id="2_xh3iw"]
[ext_resource type="Texture2D" uid="uid://blfvsup876agh" path="res://resource/sprite/ui/commonIcon/Search.png" id="3_f5h8c"]
[ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="4_okvq0"]
+[ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="5_rcbyx"]
+[ext_resource type="Texture2D" uid="uid://dggb6p4sdmfry" path="res://resource/sprite/ui/commonIcon/Edit.png" id="6_qalh0"]
+[ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="7_lnry3"]
[node name="MapEditorProject" type="Control"]
layout_mode = 3
@@ -101,6 +104,20 @@
alignment = 0
text_overrun_behavior = 3
+[node name="SelectTexture" type="NinePatchRect" parent="Bg/VBoxContainer/HBoxContainer/Panel/MarginContainer/VBoxContainer/ScrollContainer/GroupButton"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+texture = ExtResource("5_rcbyx")
+region_rect = Rect2(0, 0, 36, 36)
+patch_margin_left = 3
+patch_margin_top = 3
+patch_margin_right = 3
+patch_margin_bottom = 3
+
[node name="Panel2" type="Panel" parent="Bg/VBoxContainer/HBoxContainer"]
layout_mode = 2
size_flags_horizontal = 3
@@ -142,6 +159,14 @@
layout_mode = 2
icon = ExtResource("4_okvq0")
+[node name="RoomEditButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+icon = ExtResource("6_qalh0")
+
+[node name="RoomDeleteButton" type="Button" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/VBoxContainer/HBoxContainer"]
+layout_mode = 2
+icon = ExtResource("7_lnry3")
+
[node name="ScrollContainer" type="ScrollContainer" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
@@ -193,3 +218,17 @@
horizontal_alignment = 1
clip_text = true
text_overrun_behavior = 3
+
+[node name="SelectTexture" type="NinePatchRect" parent="Bg/VBoxContainer/HBoxContainer/Panel2/MarginContainer/VBoxContainer/ScrollContainer/RoomButton"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+texture = ExtResource("5_rcbyx")
+region_rect = Rect2(0, 0, 36, 36)
+patch_margin_left = 3
+patch_margin_top = 3
+patch_margin_right = 3
+patch_margin_bottom = 3
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json
index 68df949..5859a66 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room4/Room4_roomInfo.json
@@ -1 +1 @@
-{"Position":{"X":-9,"Y":-7},"Size":{"X":22,"Y":18},"DoorAreaInfos":[{"Direction":3,"Start":80,"End":176},{"Direction":0,"Start":64,"End":160},{"Direction":2,"Start":112,"End":176},{"Direction":1,"Start":64,"End":160}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room4","Weight":100,"Remark":""}
\ No newline at end of file
+{"Position":{"X":-9,"Y":-7},"Size":{"X":22,"Y":18},"DoorAreaInfos":[{"Direction":3,"Start":80,"End":176},{"Direction":1,"Start":64,"End":160}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room4","Weight":100,"Remark":""}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs
index 85c6774..003dee7 100644
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs
+++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs
@@ -103,6 +103,43 @@
}
///
+ /// 移除一个房间, 返回是否移除成功
+ ///
+ public bool RemoveRoom(DungeonRoomSplit roomSplit)
+ {
+ if (BattleList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (InletList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (OutletList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (BossList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (RewardList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (ShopList.Remove(roomSplit))
+ {
+ return true;
+ }
+ if (EventList.Remove(roomSplit))
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ ///
/// 初始化权重处理
///
public void InitWeight(SeedRandom random)
diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs
index ca45581..1a6dd9a 100644
--- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs
+++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomInfo.cs
@@ -83,7 +83,10 @@
///
public void ClearCompletionDoorArea()
{
- _completionDoorArea.Clear();
- _completionDoorArea = null;
+ if (_completionDoorArea != null)
+ {
+ _completionDoorArea.Clear();
+ _completionDoorArea = null;
+ }
}
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
index b2494cb..efd6583 100644
--- a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
@@ -210,4 +210,23 @@
}
GameApplication.Instance.SetRoomConfig(dic);
}
+
+ ///
+ /// 从指定组中删除房间, 返回是否删除成功
+ ///
+ public static bool DeleteRoom(DungeonRoomGroup group, DungeonRoomSplit roomSplit)
+ {
+ if (group.RemoveRoom(roomSplit))
+ {
+ var path = GetConfigPath(group.GroupName, roomSplit.RoomInfo.RoomType, roomSplit.RoomInfo.RoomName);
+ if (Directory.Exists(path))
+ {
+ Directory.Delete(path, true);
+ }
+
+ return true;
+ }
+
+ return false;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
index 4fdace8..9c2d482 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
@@ -188,16 +188,40 @@
private CheckResult CheckError()
{
- if (S_TileMap.Instance.HasError) //地图绘制错误
+ var editorTileMap = S_TileMap.Instance;
+ if (editorTileMap.HasError) //地图绘制错误
{
return new CheckResult(true, "当前房间地块存在绘制错误");
}
-
+
if (EditorManager.SelectRoom.Preinstall == null || EditorManager.SelectRoom.Preinstall.Count == 0)
{
return new CheckResult(true, "当前房间没有预设");
}
+ if (editorTileMap.CurrDoorConfigs.Count > 0)
+ {
+ var flag = false;
+ var dir = -1;
+ foreach (var roomInfoDoorAreaInfo in editorTileMap.CurrDoorConfigs)
+ {
+ if (dir == -1)
+ {
+ dir = (int)roomInfoDoorAreaInfo.Direction;
+ }
+ else if (dir != (int)roomInfoDoorAreaInfo.Direction)
+ {
+ flag = true;
+ break;
+ }
+ }
+
+ if (!flag)
+ {
+ return new CheckResult(true, "当前房间至少要有两个不同方向的门区域");
+ }
+ }
+
return new CheckResult(false, null);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
index b41c89d..1d6142c 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
@@ -122,7 +122,7 @@
///
/// 正在编辑的房间数据
///
- private DungeonRoomSplit _roomSplit;
+ public DungeonRoomSplit CurrRoomSplit;
///
/// 数据是否脏了, 也就是是否有修改
@@ -134,18 +134,20 @@
///
public bool HasError => !_isGenerateTerrain;
- ///
- /// 当前的房间大小
- ///
- public Vector2I RoomSize => _roomSize;
-
//变动过的数据
- //地图位置, 单位: 格
- private Vector2I _roomPosition;
- //地图大小, 单位: 格
- private Vector2I _roomSize;
- private List _doorConfigs = new List();
+ ///
+ /// 地图位置, 单位: 格
+ ///
+ public Vector2I CurrRoomPosition { get; private set; }
+ ///
+ /// 当前地图大小, 单位: 格
+ ///
+ public Vector2I CurrRoomSize { get; private set; }
+ ///
+ /// 当前编辑的门数据
+ ///
+ public List CurrDoorConfigs { get; } = new List();
//-------------------------------
private MapEditor.TileMap _editorTileMap;
private EventFactory _eventFactory;
@@ -258,10 +260,10 @@
canvasItem.DrawLine(new Vector2(2000, 0), new Vector2( -2000, 0), Colors.Red);
//绘制房间区域
- if (_roomSize.X != 0 && _roomSize.Y != 0)
+ if (CurrRoomSize.X != 0 && CurrRoomSize.Y != 0)
{
var size = TileSet.TileSize;
- canvasItem.DrawRect(new Rect2(_roomPosition * size, _roomSize * size),
+ canvasItem.DrawRect(new Rect2(CurrRoomPosition * size, CurrRoomSize * size),
Colors.Aqua, false, 5f / Scale.X);
}
@@ -439,7 +441,7 @@
{
GD.Print("保存地牢房间数据...");
//是否准备好
- _roomSplit.Ready = !HasError && _roomSplit.Preinstall != null && _roomSplit.Preinstall.Count > 0;
+ CurrRoomSplit.Ready = !HasError && CurrRoomSplit.Preinstall != null && CurrRoomSplit.Preinstall.Count > 0;
SaveRoomInfoConfig();
SaveTileInfoConfig();
SavePreinstallConfig();
@@ -459,16 +461,16 @@
roomSplit.ReloadTileInfo();
roomSplit.ReloadPreinstall();
- _roomSplit = roomSplit;
+ CurrRoomSplit = roomSplit;
var roomInfo = roomSplit.RoomInfo;
var tileInfo = roomSplit.TileInfo;
- _roomPosition = roomInfo.Position.AsVector2I();
+ CurrRoomPosition = roomInfo.Position.AsVector2I();
SetMapSize(roomInfo.Size.AsVector2I(), true);
- _doorConfigs.Clear();
+ CurrDoorConfigs.Clear();
foreach (var doorAreaInfo in roomInfo.DoorAreaInfos)
{
- _doorConfigs.Add(doorAreaInfo.Clone());
+ CurrDoorConfigs.Add(doorAreaInfo.Clone());
}
//初始化层级数据
@@ -492,7 +494,7 @@
//CallDeferred(nameof(OnClickCenterTool), null);
//加载门编辑区域
- foreach (var doorAreaInfo in _doorConfigs)
+ foreach (var doorAreaInfo in CurrDoorConfigs)
{
MapEditorToolsPanel.CreateDoorTool(doorAreaInfo);
}
@@ -648,17 +650,17 @@
private void CalcTileRect(bool refreshDoorTrans)
{
var rect = GetUsedRect();
- _roomPosition = rect.Position;
+ CurrRoomPosition = rect.Position;
SetMapSize(rect.Size, refreshDoorTrans);
}
//检测是否有不合规的图块, 返回true表示图块正常
private bool CheckTerrain()
{
- var x = _roomPosition.X;
- var y = _roomPosition.Y;
- var w = _roomSize.X;
- var h = _roomSize.Y;
+ var x = CurrRoomPosition.X;
+ var y = CurrRoomPosition.Y;
+ var w = CurrRoomSize.X;
+ var h = CurrRoomSize.Y;
for (var i = 0; i < w; i++)
{
@@ -723,10 +725,10 @@
ClearLayer(AutoTopLayer);
ClearLayer(AutoMiddleLayer);
- var x = _roomPosition.X;
- var y = _roomPosition.Y;
- var w = _roomSize.X;
- var h = _roomSize.Y;
+ var x = CurrRoomPosition.X;
+ var y = CurrRoomPosition.Y;
+ var w = CurrRoomSize.X;
+ var h = CurrRoomSize.Y;
for (var i = 0; i < w; i++)
{
@@ -840,13 +842,13 @@
private void OnClickCenterTool(object arg)
{
var pos = MapEditorPanel.S_SubViewport.Instance.Size / 2;
- if (_roomSize.X == 0 && _roomSize.Y == 0) //聚焦原点
+ if (CurrRoomSize.X == 0 && CurrRoomSize.Y == 0) //聚焦原点
{
SetMapPosition(pos);
}
else //聚焦地图中心点
{
- SetMapPosition(pos - (_roomPosition + _roomSize / 2) * TileSet.TileSize * Scale);
+ SetMapPosition(pos - (CurrRoomPosition + CurrRoomSize / 2) * TileSet.TileSize * Scale);
}
}
@@ -870,7 +872,7 @@
doorAreaInfo.Start = start;
doorAreaInfo.End = end;
//doorAreaInfo.CalcPosition(_roomPosition, _roomSize);
- _doorConfigs.Add(doorAreaInfo);
+ CurrDoorConfigs.Add(doorAreaInfo);
return doorAreaInfo;
}
@@ -883,7 +885,7 @@
///
public bool CheckDoorArea(DoorDirection direction, int start, int end)
{
- foreach (var item in _doorConfigs)
+ foreach (var item in CurrDoorConfigs)
{
if (item.Direction == direction)
{
@@ -905,7 +907,7 @@
/// 结束坐标, 单位: 像素
public bool CheckDoorArea(DoorAreaInfo target, int start, int end)
{
- foreach (var item in _doorConfigs)
+ foreach (var item in CurrDoorConfigs)
{
if (item.Direction == target.Direction && item != target)
{
@@ -930,14 +932,14 @@
///
public void RemoveDoorArea(DoorAreaInfo doorAreaInfo)
{
- _doorConfigs.Remove(doorAreaInfo);
+ CurrDoorConfigs.Remove(doorAreaInfo);
}
//保存房间配置
private void SaveRoomInfoConfig()
{
//存入本地
- var roomInfo = _roomSplit.RoomInfo;
+ var roomInfo = CurrRoomSplit.RoomInfo;
var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName);
if (!Directory.Exists(path))
{
@@ -946,17 +948,17 @@
if (!HasError) //没有错误
{
- roomInfo.Size = new SerializeVector2(_roomSize);
- roomInfo.Position = new SerializeVector2(_roomPosition);
+ roomInfo.Size = new SerializeVector2(CurrRoomSize);
+ roomInfo.Position = new SerializeVector2(CurrRoomPosition);
}
else
{
- roomInfo.Position = new SerializeVector2(_roomPosition - Vector2I.One);
- roomInfo.Size = new SerializeVector2(_roomSize + new Vector2I(2, 2));
+ roomInfo.Position = new SerializeVector2(CurrRoomPosition - Vector2I.One);
+ roomInfo.Size = new SerializeVector2(CurrRoomSize + new Vector2I(2, 2));
}
roomInfo.DoorAreaInfos.Clear();
- roomInfo.DoorAreaInfos.AddRange(_doorConfigs);
+ roomInfo.DoorAreaInfos.AddRange(CurrDoorConfigs);
roomInfo.ClearCompletionDoorArea();
path += "/" + MapProjectManager.GetRoomInfoConfigName(roomInfo.RoomName);
@@ -968,14 +970,14 @@
public void SaveTileInfoConfig()
{
//存入本地
- var roomInfo = _roomSplit.RoomInfo;
+ var roomInfo = CurrRoomSplit.RoomInfo;
var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName);
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
- var tileInfo = _roomSplit.TileInfo;
+ var tileInfo = CurrRoomSplit.TileInfo;
tileInfo.NavigationList.Clear();
tileInfo.NavigationList.AddRange(_dungeonTileMap.GetPolygonData());
tileInfo.Floor.Clear();
@@ -995,7 +997,7 @@
public void SavePreinstallConfig()
{
//存入本地
- var roomInfo = _roomSplit.RoomInfo;
+ var roomInfo = CurrRoomSplit.RoomInfo;
var path = MapProjectManager.GetConfigPath(roomInfo.GroupName,roomInfo.RoomType, roomInfo.RoomName);
if (!Directory.Exists(path))
{
@@ -1003,7 +1005,7 @@
}
path += "/" + MapProjectManager.GetRoomPreinstallConfigName(roomInfo.RoomName);
- var jsonStr = JsonSerializer.Serialize(_roomSplit.Preinstall);
+ var jsonStr = JsonSerializer.Serialize(CurrRoomSplit.Preinstall);
File.WriteAllText(path, jsonStr);
}
@@ -1017,13 +1019,13 @@
//设置地图大小
private void SetMapSize(Vector2I size, bool refreshDoorTrans)
{
- if (_roomSize != size)
+ if (CurrRoomSize != size)
{
- _roomSize = size;
+ CurrRoomSize = size;
if (refreshDoorTrans)
{
- MapEditorToolsPanel.SetDoorHoverToolTransform(_roomPosition, _roomSize);
+ MapEditorToolsPanel.SetDoorHoverToolTransform(CurrRoomPosition, CurrRoomSize);
}
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs
index 2a11404..1b4a803 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs
@@ -4,6 +4,11 @@
public class GroupButtonCell : UiCell
{
+ public override void OnInit()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ }
+
public override void OnSetData(DungeonRoomGroup info)
{
CellNode.Instance.Text = info.GroupName;
@@ -20,4 +25,14 @@
{
CellNode.UiPanel.SelectGroup(Data);
}
+
+ public override void OnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = true;
+ }
+
+ public override void OnUnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs
index 823ed06..38829e6 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProject.cs
@@ -12,7 +12,7 @@
{
get
{
- if (_L_Bg == null) _L_Bg = new Bg((MapEditorProjectPanel)this, GetNodeOrNull("Bg"));
+ if (_L_Bg == null) _L_Bg = new Bg((MapEditorProjectPanel)this, GetNode("Bg"));
return _L_Bg;
}
}
@@ -25,6 +25,7 @@
public sealed override void OnInitNestedUi()
{
+
}
///
@@ -48,7 +49,7 @@
{
get
{
- if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNodeOrNull("Back"));
+ if (_L_Back == null) _L_Back = new Back(UiPanel, Instance.GetNode("Back"));
return _L_Back;
}
}
@@ -97,7 +98,7 @@
{
get
{
- if (_L_GroupSearchInput == null) _L_GroupSearchInput = new GroupSearchInput(UiPanel, Instance.GetNodeOrNull("GroupSearchInput"));
+ if (_L_GroupSearchInput == null) _L_GroupSearchInput = new GroupSearchInput(UiPanel, Instance.GetNode("GroupSearchInput"));
return _L_GroupSearchInput;
}
}
@@ -110,7 +111,7 @@
{
get
{
- if (_L_GroupSearchButton == null) _L_GroupSearchButton = new GroupSearchButton(UiPanel, Instance.GetNodeOrNull("GroupSearchButton"));
+ if (_L_GroupSearchButton == null) _L_GroupSearchButton = new GroupSearchButton(UiPanel, Instance.GetNode("GroupSearchButton"));
return _L_GroupSearchButton;
}
}
@@ -123,7 +124,7 @@
{
get
{
- if (_L_GroupAddButton == null) _L_GroupAddButton = new GroupAddButton(UiPanel, Instance.GetNodeOrNull("GroupAddButton"));
+ if (_L_GroupAddButton == null) _L_GroupAddButton = new GroupAddButton(UiPanel, Instance.GetNode("GroupAddButton"));
return _L_GroupAddButton;
}
}
@@ -134,10 +135,32 @@
}
///
+ /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.GroupButton.SelectTexture
+ ///
+ public class SelectTexture : UiNode
+ {
+ public SelectTexture(MapEditorProjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
+ public override SelectTexture Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.GroupButton
///
public class GroupButton : UiNode
{
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel.MarginContainer.VBoxContainer.ScrollContainer.SelectTexture
+ ///
+ public SelectTexture L_SelectTexture
+ {
+ get
+ {
+ if (_L_SelectTexture == null) _L_SelectTexture = new SelectTexture(UiPanel, Instance.GetNode("SelectTexture"));
+ return _L_SelectTexture;
+ }
+ }
+ private SelectTexture _L_SelectTexture;
+
public GroupButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
public override GroupButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
}
@@ -154,7 +177,7 @@
{
get
{
- if (_L_GroupButton == null) _L_GroupButton = new GroupButton(UiPanel, Instance.GetNodeOrNull("GroupButton"));
+ if (_L_GroupButton == null) _L_GroupButton = new GroupButton(UiPanel, Instance.GetNode("GroupButton"));
return _L_GroupButton;
}
}
@@ -176,7 +199,7 @@
{
get
{
- if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_1(UiPanel, Instance.GetNodeOrNull("HBoxContainer"));
+ if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_1(UiPanel, Instance.GetNode("HBoxContainer"));
return _L_HBoxContainer;
}
}
@@ -189,7 +212,7 @@
{
get
{
- if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNodeOrNull("ScrollContainer"));
+ if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNode("ScrollContainer"));
return _L_ScrollContainer;
}
}
@@ -211,7 +234,7 @@
{
get
{
- if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer_1(UiPanel, Instance.GetNodeOrNull("VBoxContainer"));
+ if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer_1(UiPanel, Instance.GetNode("VBoxContainer"));
return _L_VBoxContainer;
}
}
@@ -233,7 +256,7 @@
{
get
{
- if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNodeOrNull("MarginContainer"));
+ if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer(UiPanel, Instance.GetNode("MarginContainer"));
return _L_MarginContainer;
}
}
@@ -280,6 +303,24 @@
}
///
+ /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomEditButton
+ ///
+ public class RoomEditButton : UiNode
+ {
+ public RoomEditButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
+ public override RoomEditButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomDeleteButton
+ ///
+ public class RoomDeleteButton : UiNode
+ {
+ public RoomDeleteButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
+ public override RoomDeleteButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer
///
public class HBoxContainer_2 : UiNode
@@ -291,7 +332,7 @@
{
get
{
- if (_L_RoomSearchInput == null) _L_RoomSearchInput = new RoomSearchInput(UiPanel, Instance.GetNodeOrNull("RoomSearchInput"));
+ if (_L_RoomSearchInput == null) _L_RoomSearchInput = new RoomSearchInput(UiPanel, Instance.GetNode("RoomSearchInput"));
return _L_RoomSearchInput;
}
}
@@ -304,7 +345,7 @@
{
get
{
- if (_L_RoomTypeButton == null) _L_RoomTypeButton = new RoomTypeButton(UiPanel, Instance.GetNodeOrNull("RoomTypeButton"));
+ if (_L_RoomTypeButton == null) _L_RoomTypeButton = new RoomTypeButton(UiPanel, Instance.GetNode("RoomTypeButton"));
return _L_RoomTypeButton;
}
}
@@ -317,7 +358,7 @@
{
get
{
- if (_L_RoomSearchButton == null) _L_RoomSearchButton = new RoomSearchButton(UiPanel, Instance.GetNodeOrNull("RoomSearchButton"));
+ if (_L_RoomSearchButton == null) _L_RoomSearchButton = new RoomSearchButton(UiPanel, Instance.GetNode("RoomSearchButton"));
return _L_RoomSearchButton;
}
}
@@ -330,12 +371,38 @@
{
get
{
- if (_L_RoomAddButton == null) _L_RoomAddButton = new RoomAddButton(UiPanel, Instance.GetNodeOrNull("RoomAddButton"));
+ if (_L_RoomAddButton == null) _L_RoomAddButton = new RoomAddButton(UiPanel, Instance.GetNode("RoomAddButton"));
return _L_RoomAddButton;
}
}
private RoomAddButton _L_RoomAddButton;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.RoomEditButton
+ ///
+ public RoomEditButton L_RoomEditButton
+ {
+ get
+ {
+ if (_L_RoomEditButton == null) _L_RoomEditButton = new RoomEditButton(UiPanel, Instance.GetNode("RoomEditButton"));
+ return _L_RoomEditButton;
+ }
+ }
+ private RoomEditButton _L_RoomEditButton;
+
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.RoomDeleteButton
+ ///
+ public RoomDeleteButton L_RoomDeleteButton
+ {
+ get
+ {
+ if (_L_RoomDeleteButton == null) _L_RoomDeleteButton = new RoomDeleteButton(UiPanel, Instance.GetNode("RoomDeleteButton"));
+ return _L_RoomDeleteButton;
+ }
+ }
+ private RoomDeleteButton _L_RoomDeleteButton;
+
public HBoxContainer_2(MapEditorProjectPanel uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { }
public override HBoxContainer_2 Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate());
}
@@ -368,6 +435,15 @@
}
///
+ /// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton.SelectTexture
+ ///
+ public class SelectTexture_1 : UiNode
+ {
+ public SelectTexture_1(MapEditorProjectPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { }
+ public override SelectTexture_1 Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate());
+ }
+
+ ///
/// 类型: , 路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton
///
public class RoomButton : UiNode
@@ -379,7 +455,7 @@
{
get
{
- if (_L_PreviewImage == null) _L_PreviewImage = new PreviewImage(UiPanel, Instance.GetNodeOrNull("PreviewImage"));
+ if (_L_PreviewImage == null) _L_PreviewImage = new PreviewImage(UiPanel, Instance.GetNode("PreviewImage"));
return _L_PreviewImage;
}
}
@@ -392,7 +468,7 @@
{
get
{
- if (_L_RoomName == null) _L_RoomName = new RoomName(UiPanel, Instance.GetNodeOrNull("RoomName"));
+ if (_L_RoomName == null) _L_RoomName = new RoomName(UiPanel, Instance.GetNode("RoomName"));
return _L_RoomName;
}
}
@@ -405,12 +481,25 @@
{
get
{
- if (_L_RoomType == null) _L_RoomType = new RoomType(UiPanel, Instance.GetNodeOrNull("RoomType"));
+ if (_L_RoomType == null) _L_RoomType = new RoomType(UiPanel, Instance.GetNode("RoomType"));
return _L_RoomType;
}
}
private RoomType _L_RoomType;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.SelectTexture
+ ///
+ public SelectTexture_1 L_SelectTexture
+ {
+ get
+ {
+ if (_L_SelectTexture == null) _L_SelectTexture = new SelectTexture_1(UiPanel, Instance.GetNode("SelectTexture"));
+ return _L_SelectTexture;
+ }
+ }
+ private SelectTexture_1 _L_SelectTexture;
+
public RoomButton(MapEditorProjectPanel uiPanel, Godot.Button node) : base(uiPanel, node) { }
public override RoomButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate());
}
@@ -427,7 +516,7 @@
{
get
{
- if (_L_RoomButton == null) _L_RoomButton = new RoomButton(UiPanel, Instance.GetNodeOrNull("RoomButton"));
+ if (_L_RoomButton == null) _L_RoomButton = new RoomButton(UiPanel, Instance.GetNode("RoomButton"));
return _L_RoomButton;
}
}
@@ -449,7 +538,7 @@
{
get
{
- if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_2(UiPanel, Instance.GetNodeOrNull("HBoxContainer"));
+ if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer_2(UiPanel, Instance.GetNode("HBoxContainer"));
return _L_HBoxContainer;
}
}
@@ -462,7 +551,7 @@
{
get
{
- if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer_1(UiPanel, Instance.GetNodeOrNull("ScrollContainer"));
+ if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer_1(UiPanel, Instance.GetNode("ScrollContainer"));
return _L_ScrollContainer;
}
}
@@ -484,7 +573,7 @@
{
get
{
- if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer_2(UiPanel, Instance.GetNodeOrNull("VBoxContainer"));
+ if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer_2(UiPanel, Instance.GetNode("VBoxContainer"));
return _L_VBoxContainer;
}
}
@@ -506,7 +595,7 @@
{
get
{
- if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNodeOrNull("MarginContainer"));
+ if (_L_MarginContainer == null) _L_MarginContainer = new MarginContainer_1(UiPanel, Instance.GetNode("MarginContainer"));
return _L_MarginContainer;
}
}
@@ -528,7 +617,7 @@
{
get
{
- if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNodeOrNull("Panel"));
+ if (_L_Panel == null) _L_Panel = new Panel(UiPanel, Instance.GetNode("Panel"));
return _L_Panel;
}
}
@@ -541,7 +630,7 @@
{
get
{
- if (_L_Panel2 == null) _L_Panel2 = new Panel2(UiPanel, Instance.GetNodeOrNull("Panel2"));
+ if (_L_Panel2 == null) _L_Panel2 = new Panel2(UiPanel, Instance.GetNode("Panel2"));
return _L_Panel2;
}
}
@@ -563,7 +652,7 @@
{
get
{
- if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNodeOrNull("Head"));
+ if (_L_Head == null) _L_Head = new Head(UiPanel, Instance.GetNode("Head"));
return _L_Head;
}
}
@@ -576,7 +665,7 @@
{
get
{
- if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNodeOrNull("HBoxContainer"));
+ if (_L_HBoxContainer == null) _L_HBoxContainer = new HBoxContainer(UiPanel, Instance.GetNode("HBoxContainer"));
return _L_HBoxContainer;
}
}
@@ -598,7 +687,7 @@
{
get
{
- if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNodeOrNull("VBoxContainer"));
+ if (_L_VBoxContainer == null) _L_VBoxContainer = new VBoxContainer(UiPanel, Instance.GetNode("VBoxContainer"));
return _L_VBoxContainer;
}
}
@@ -665,6 +754,16 @@
public RoomAddButton S_RoomAddButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_RoomAddButton;
///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomEditButton
+ ///
+ public RoomEditButton S_RoomEditButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_RoomEditButton;
+
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.HBoxContainer.RoomDeleteButton
+ ///
+ public RoomDeleteButton S_RoomDeleteButton => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer.L_HBoxContainer.L_RoomDeleteButton;
+
+ ///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorProject.Bg.VBoxContainer.HBoxContainer.Panel2.MarginContainer.VBoxContainer.ScrollContainer.RoomButton.PreviewImage
///
public PreviewImage S_PreviewImage => L_Bg.L_VBoxContainer.L_HBoxContainer.L_Panel2.L_MarginContainer.L_VBoxContainer.L_ScrollContainer.L_RoomButton.L_PreviewImage;
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
index 842e78c..ad7abf4 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/MapEditorProjectPanel.cs
@@ -25,11 +25,11 @@
optionButton.AddItem(DungeonManager.DungeonRoomTypeToDescribeString(dungeonRoomType), (int)dungeonRoomType + 1);
}
- _groupGrid = new UiGrid(S_GroupButton, typeof(GroupButtonCell));
+ _groupGrid = new UiGrid(S_GroupButton, typeof(GroupButtonCell));
_groupGrid.SetCellOffset(new Vector2I(0, 2));
_groupGrid.SetHorizontalExpand(true);
- _roomGrid = new UiGrid(S_RoomButton, typeof(RoomButtonCell));
+ _roomGrid = new UiGrid(S_RoomButton, typeof(RoomButtonCell));
_roomGrid.SetAutoColumns(true);
_roomGrid.SetCellOffset(new Vector2I(10, 10));
_roomGrid.SetHorizontalExpand(true);
@@ -47,6 +47,8 @@
S_GroupSearchButton.Instance.Pressed += OnSearchGroupButtonClick;
S_RoomSearchButton.Instance.Pressed += OnSearchRoomButtonClick;
S_RoomAddButton.Instance.Pressed += OnCreateRoomClick;
+ S_RoomEditButton.Instance.Pressed += OnEditRoom;
+ S_RoomDeleteButton.Instance.Pressed += OnDeleteRoom;
S_GroupAddButton.Instance.Pressed += OnCreateGroupClick;
_eventFactory = EventManager.CreateEventFactory();
@@ -181,6 +183,38 @@
var groupName = EditorManager.SelectDungeonGroup != null ? EditorManager.SelectDungeonGroup.GroupName : null;
EditorWindowManager.ShowCreateRoom(groupName, Mathf.Max(S_RoomTypeButton.Instance.Selected - 1, 0), CreateRoom);
}
+
+
+ //编辑房间
+ private void OnEditRoom()
+ {
+
+ }
+
+ //删除房间
+ private void OnDeleteRoom()
+ {
+ var selectRoom = _roomGrid.SelectData;
+ if (selectRoom == null)
+ {
+ EditorWindowManager.ShowTips("提示", "请选择需要删除的房间!");
+ }
+ else
+ {
+ EditorWindowManager.ShowConfirm("提示", $"是否删除房间: {selectRoom.RoomInfo.RoomName}, 该操作无法撤销!", result =>
+ {
+ if (result)
+ {
+ //删除房间
+ if (MapProjectManager.DeleteRoom(EditorManager.SelectDungeonGroup, selectRoom))
+ {
+ MapProjectManager.SaveGroupMap();
+ OnSearchRoomButtonClick();
+ }
+ }
+ });
+ }
+ }
//创建地牢组
private void CreateGroup(DungeonRoomGroup group)
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
index 551f33a..4eb153b 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/RoomButtonCell.cs
@@ -4,6 +4,11 @@
public class RoomButtonCell : UiCell
{
+ public override void OnInit()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ }
+
public override void OnSetData(DungeonRoomSplit data)
{
CellNode.L_RoomName.Instance.Text = data.RoomInfo.RoomName;
@@ -16,4 +21,14 @@
//打开房间编辑器
CellNode.UiPanel.SelectRoom(Data);
}
+
+ public override void OnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = true;
+ }
+
+ public override void OnUnSelect()
+ {
+ CellNode.L_SelectTexture.Instance.Visible = false;
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
index 0489882..21bca90 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
@@ -94,7 +94,7 @@
}
if (MapEditorToolsPanel.ActiveHoverArea == null || !IsDrag)
{
- var roomSize = MapEditorToolsPanel.EditorMap.Instance.RoomSize;
+ var roomSize = MapEditorToolsPanel.EditorMap.Instance.CurrRoomSize;
//房间大小为0, 不能放置门区域
if (roomSize.X == 0 && roomSize.Y == 0)
{