diff --git a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
index f283970..46a135f 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditor.tscn
@@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://src/game/ui/mapEditor/MapEditorPanel.cs" id="1_5s7a0"]
[ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_gkcw7"]
-[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileset/TileSet1.tres" id="2_vrg60"]
+[ext_resource type="TileSet" uid="uid://b00g22o1cqhe8" path="res://resource/map/tileSet/TileSet1.tres" id="2_vrg60"]
[ext_resource type="Texture2D" uid="uid://cat35d7ueu7gu" path="res://resource/sprite/ui/commonIcon/Save.png" id="3_qq8k4"]
[ext_resource type="Texture2D" uid="uid://7l7aqhsaexoh" path="res://resource/sprite/ui/commonIcon/Play.png" id="4_2imnr"]
[ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/mapEditor/ErrorCell.png" id="4_465u2"]
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
index 047a131..836925a 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/GroupConfig.json
@@ -3,7 +3,7 @@
"GroupName": "TestGroup1",
"BattleList": [
{
- "Ready": false,
+ "Ready": true,
"RoomPath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json",
"TilePath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json",
"PreinstallPath": "resource/map/tileMaps/TestGroup1/battle/Room1/Room1_preinstall.json"
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json
index a3b6b99..428ba80 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_roomInfo.json
@@ -1 +1 @@
-{"Position":{"X":-6,"Y":-11},"Size":{"X":15,"Y":20},"DoorAreaInfos":[{"Direction":3,"Start":0,"End":192},{"Direction":0,"Start":96,"End":224},{"Direction":2,"Start":96,"End":208},{"Direction":1,"Start":80,"End":224}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""}
\ No newline at end of file
+{"Position":{"X":-6,"Y":-12},"Size":{"X":15,"Y":21},"DoorAreaInfos":[{"Direction":0,"Start":144,"End":304},{"Direction":1,"Start":0,"End":256},{"Direction":3,"Start":0,"End":208},{"Direction":0,"Start":0,"End":80}],"GroupName":"TestGroup1","RoomType":0,"RoomName":"Room1","Weight":100,"Remark":""}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json
index 7a02202..f0924e5 100644
--- a/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json
+++ b/DungeonShooting_Godot/resource/map/tileMaps/TestGroup1/battle/Room1/Room1_tileInfo.json
@@ -1 +1 @@
-{"NavigationList":[{"Type":0,"Points":[-72,-152,104,-152,104,-96,56,-96,56,-80,40,-80,40,-8,104,-8,104,-56,120,-56,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,64,-72,64]},{"Type":1,"Points":[-40,-112,8,-112,8,-56,-40,-56]}],"Floor":[-5,-5,0,0,8,-5,-4,0,0,8,-5,-3,0,0,8,-5,-2,0,0,8,-5,-1,0,0,8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5,0,3,3,-6,-4,0,3,3,-6,-3,0,3,3,-6,-2,0,3,3,-6,-1,0,3,3,-6,0,0,3,3,-6,1,0,3,3,-6,2,0,3,3,-6,3,0,3,3,-6,4,0,11,2,-5,4,0,2,2,-4,4,0,2,2,-3,0,0,1,2,-3,1,0,1,3,-3,2,0,1,3,-3,3,0,1,3,-3,4,0,13,2,-2,-7,0,1,2,-2,-6,0,1,3,-2,0,0,2,2,-1,-7,0,3,2,-1,-6,0,3,3,-1,0,0,3,2,-1,1,0,3,3,-1,2,0,3,3,-1,3,0,3,3,-1,4,0,11,2,0,4,0,2,2,0,5,0,3,4,0,6,0,3,3,0,7,0,3,3,0,8,0,11,2,1,4,0,2,2,1,8,0,2,2,2,4,0,3,2,2,8,0,2,2,3,-5,0,1,2,3,-4,0,1,3,3,-3,0,1,3,3,8,0,2,2,4,-6,0,1,2,4,-5,0,13,2,4,8,0,2,2,5,-6,0,2,2,5,-5,0,3,4,5,-4,0,3,3,5,-3,0,3,3,5,4,0,1,2,5,8,0,2,2,6,-6,0,2,2,6,4,0,2,2,6,8,0,2,2,7,-11,0,1,4,7,-10,0,1,3,7,-9,0,1,3,7,-8,0,1,3,7,-7,0,1,3,7,-6,0,13,2,7,4,0,2,2,7,8,0,2,2,8,-5,0,1,4,8,-4,0,1,3,8,-3,0,1,3,8,-2,0,1,3,8,-1,0,1,3,8,0,0,1,3,8,1,0,1,3,8,2,0,1,3,8,3,0,1,3,8,4,0,13,2,8,5,0,1,4,8,6,0,1,3,8,7,0,1,3,8,8,0,13,2]}
\ No newline at end of file
+{"NavigationList":[{"Type":0,"Points":[-72,-168,120,-168,120,-96,56,-96,56,-80,40,-80,40,-8,104,-8,104,-56,120,-56,120,64,72,64,72,104,120,104,120,128,24,128,24,104,56,104,56,64,8,64,8,0,-56,0,-56,80,-72,80]},{"Type":1,"Points":[-40,-144,24,-144,24,-104,-40,-104]},{"Type":1,"Points":[-56,-64,8,-64,8,-24,-56,-24]}],"Floor":[7,3,0,0,8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,-1,0,1,3,8,0,0,1,3,8,1,0,1,3,8,2,0,1,3,8,3,0,1,3,8,4,0,13,2,8,5,0,1,4,8,6,0,1,3,8,7,0,1,3,8,8,0,13,2]}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
index b20c9a6..c36be94 100644
--- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001.png.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://chd2vtesap5cf"
-path="res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"
+path="res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://resource/sprite/role/enemy0001/enemy0001.png"
-dest_files=["res://.godot/imported/enemy0001.png-1247a3ddf8a1a163d812cad12c4340fd.ctex"]
+source_file="res://resource/sprite/role/enemy0001/Enemy0001.png"
+dest_files=["res://.godot/imported/Enemy0001.png-148a38dfa95953b26d890356e8875de4.ctex"]
[params]
diff --git a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
index 56388a2..d563acf 100644
--- a/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
+++ b/DungeonShooting_Godot/resource/sprite/role/enemy0001/enemy0001_Debris.png.import
@@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://d2f55lu60x64i"
-path="res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"
+path="res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"
metadata={
"vram_texture": false
}
[deps]
-source_file="res://resource/sprite/role/enemy0001/enemy0001_Debris.png"
-dest_files=["res://.godot/imported/enemy0001_Debris.png-297a2fb6680cb862a9a085cf58f8268c.ctex"]
+source_file="res://resource/sprite/role/enemy0001/Enemy0001_Debris.png"
+dest_files=["res://.godot/imported/Enemy0001_Debris.png-ac416dc79cd3c1217b27e1ef1fbe0d0b.ctex"]
[params]
diff --git a/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs b/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs
index 41eb232..e64516b 100644
--- a/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs
+++ b/DungeonShooting_Godot/src/framework/ui/IUiNodeScript.cs
@@ -9,4 +9,9 @@
/// 设置所属Ui节点对象, 该函数会在 _Ready() 之后调用
///
void SetUiNode(IUiNode uiNode);
+
+ ///
+ /// 当前Ui被销毁时调用
+ ///
+ void OnDestroy();
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs
index 26f048b..d0290b2 100644
--- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs
+++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs
@@ -46,6 +46,8 @@
private List _coroutineList;
//嵌套打开的Ui列表
private HashSet _nestedUiSet;
+ //当前Ui包含的 IUiNodeScript 接口, 关闭Ui是需要调用 IUiNodeScript.OnDestroy()
+ private HashSet _nodeScripts;
public UiBase(string uiName)
{
@@ -169,6 +171,15 @@
}
_nestedUiSet.Clear();
}
+
+ //销毁 IUiNodeScript
+ if (_nodeScripts != null)
+ {
+ foreach (var uiNodeScript in _nodeScripts)
+ {
+ uiNodeScript.OnDestroy();
+ }
+ }
//在父Ui中移除当前Ui
if (ParentUi != null)
@@ -267,6 +278,18 @@
}
///
+ /// 记录当前Ui包含的 IUiNodeScript 接口
+ ///
+ public void RecordUiNodeScript(IUiNodeScript nodeScript)
+ {
+ if (_nodeScripts == null)
+ {
+ _nodeScripts = new HashSet();
+ }
+ _nodeScripts.Add(nodeScript);
+ }
+
+ ///
/// 打开下一级Ui, 当前Ui会被隐藏
///
/// 下一级Ui的名称
diff --git a/DungeonShooting_Godot/src/framework/ui/UiNode.cs b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
index 6ed13ca..f6e49c0 100644
--- a/DungeonShooting_Godot/src/framework/ui/UiNode.cs
+++ b/DungeonShooting_Godot/src/framework/ui/UiNode.cs
@@ -33,6 +33,7 @@
Instance = node;
if (node is IUiNodeScript uiNodeScript)
{
+ uiPanel.RecordUiNodeScript(uiNodeScript);
uiNodeScript.SetUiNode(this);
}
}
diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs
index f59d2f6..9859034 100644
--- a/DungeonShooting_Godot/src/game/event/EventEnum.cs
+++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs
@@ -74,6 +74,14 @@
///
OnCreateRoomFinish,
///
+ /// 标记房间数据脏了, 也就是数据有修改
+ ///
+ OnEditorDirty,
+ ///
+ /// 编辑器触发保存
+ ///
+ OnEditorSave,
+ ///
/// 选中拖拽工具
///
OnSelectDragTool,
diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
index 426cd39..bfba87a 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
@@ -56,7 +56,7 @@
window.SetButtonList(
new EditorWindowPanel.ButtonData("确定", () =>
{
- window.CloseWindow();
+ window.CloseWindow(false);
onClose(true);
}),
new EditorWindowPanel.ButtonData("取消", () =>
@@ -67,6 +67,45 @@
var body = window.OpenBody(UiManager.UiName.EditorTips);
body.SetMessage(message);
}
+
+ ///
+ /// 弹出询问窗口, 包含3个按钮
+ ///
+ /// 标题
+ /// 显示内容
+ /// 按钮1文本
+ /// 按钮2文本
+ /// 按钮3文本
+ /// 关闭时的回调, 参数如果为点击按钮的索引表示点击了确定, -1表示点击了x
+ /// 所属父级Ui
+ public static void ShowConfirm(string title, string message, string btn1, string btn2, string btn3, Action onClose, UiBase parentUi = null)
+ {
+ var window = CreateWindowInstance(parentUi);
+ window.SetWindowTitle(title);
+ window.CloseEvent += () =>
+ {
+ onClose(-1);
+ };
+ window.SetButtonList(
+ new EditorWindowPanel.ButtonData(btn1, () =>
+ {
+ window.CloseWindow(false);
+ onClose(0);
+ }),
+ new EditorWindowPanel.ButtonData(btn2, () =>
+ {
+ window.CloseWindow(false);
+ onClose(1);
+ }),
+ new EditorWindowPanel.ButtonData(btn3, () =>
+ {
+ window.CloseWindow(false);
+ onClose(2);
+ })
+ );
+ var body = window.OpenBody(UiManager.UiName.EditorTips);
+ body.SetMessage(message);
+ }
///
/// 打开创建地牢组弹窗
diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
index fd6fbbf..d60d569 100644
--- a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs
@@ -29,7 +29,16 @@
_init = true;
#if TOOLS
CustomMapPath = GameConfig.RoomTileDir;
+#else
+ CustomMapPath = "";
#endif
+ EventManager.AddEventListener(EventEnum.OnEditorSave, OnRoomSave);
+ }
+
+ //房间保存时回调
+ private static void OnRoomSave(object obj)
+ {
+ SaveGroupMap();
}
///
@@ -37,7 +46,7 @@
///
public static void RefreshMapGroup()
{
- var configFile = CustomMapPath + "/" + GameConfig.RoomGroupConfigFile;
+ var configFile = CustomMapPath + GameConfig.RoomGroupConfigFile;
if (File.Exists(configFile))
{
var configText = File.ReadAllText(configFile);
@@ -134,13 +143,9 @@
GD.PrintErr($"已经存在相同的地牢组: {group.GroupName}");
return;
}
- var configFile = CustomMapPath + "/" + GameConfig.RoomGroupConfigFile;
GroupMap.Add(group.GroupName, group);
//将组数据保存为json
- var options = new JsonSerializerOptions();
- options.WriteIndented = true;
- var jsonText = JsonSerializer.Serialize(GroupMap, options);
- File.WriteAllText(configFile, jsonText);
+ SaveGroupMap();
//创建完成事件
EventManager.EmitEvent(EventEnum.OnCreateGroupFinish, group);
}
@@ -153,7 +158,7 @@
var groupName = roomSplit.RoomInfo.GroupName;
if (GroupMap.TryGetValue(groupName, out var group))
{
- var configFile = CustomMapPath + "/" + GameConfig.RoomGroupConfigFile;
+ var configFile = CustomMapPath + GameConfig.RoomGroupConfigFile;
var roomList = group.GetRoomList(roomSplit.RoomInfo.RoomType);
roomList.Add(roomSplit);
@@ -185,4 +190,16 @@
GD.PrintErr($"未找到地牢组: {groupName}");
}
}
+
+ ///
+ /// 保存所有组数据
+ ///
+ public static void SaveGroupMap()
+ {
+ var configFile = CustomMapPath + GameConfig.RoomGroupConfigFile;
+ var options = new JsonSerializerOptions();
+ options.WriteIndented = true;
+ var jsonText = JsonSerializer.Serialize(GroupMap, options);
+ File.WriteAllText(configFile, jsonText);
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
index d4e98d1..6e1761b 100644
--- a/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/editorWindow/EditorWindowPanel.cs
@@ -34,7 +34,7 @@
public override void OnCreateUi()
{
S_CustomButton.Instance.Visible = false;
- S_Window.Instance.CloseRequested += CloseWindow;
+ S_Window.Instance.CloseRequested += OnCloseWindow;
}
///
@@ -99,12 +99,18 @@
///
/// 关闭窗口
///
- public void CloseWindow()
+ /// 是否派发关闭窗口的事件
+ public void CloseWindow(bool triggerEvent = true)
{
- if (CloseEvent != null)
+ if (triggerEvent && CloseEvent != null)
{
CloseEvent();
}
Destroy();
}
+
+ private void OnCloseWindow()
+ {
+ CloseWindow();
+ }
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
index 6ff2ac1..7e17aa2 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs
@@ -25,6 +25,7 @@
public sealed override void OnInitNestedUi()
{
+ _ = L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_TileMap;
var inst1 = L_Bg.L_VBoxContainer.L_HSplitContainer.L_Left.L_MarginContainer.L_MapView.L_SubViewport.L_CanvasLayer;
RecordNestedUi(inst1.L_MapEditorTools.Instance, inst1, UiManager.RecordType.Open);
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
index 58a3808..1e9448e 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs
@@ -4,7 +4,6 @@
public partial class MapEditorPanel : MapEditor
{
- private EditorTileMapBar _editorTileMapBar;
private string _title;
public override void OnCreateUi()
@@ -15,37 +14,11 @@
S_Left.Instance.Resized += OnMapViewResized;
S_Back.Instance.Pressed += OnBackClick;
S_Save.Instance.Pressed += OnSave;
-
- _editorTileMapBar = new EditorTileMapBar(this, S_TileMap);
}
public override void OnShowUi()
{
OnMapViewResized();
- _editorTileMapBar.OnShow();
- }
-
- public override void OnHideUi()
- {
- _editorTileMapBar.OnHide();
- }
-
- public override void OnDestroyUi()
- {
- _editorTileMapBar.OnDestroy();
- }
-
- public override void Process(float delta)
- {
- _editorTileMapBar.Process(delta);
- }
-
- ///
- /// 保存地图数据
- ///
- public void OnSave()
- {
- S_TileMap.Instance.TriggerSave();
}
///
@@ -57,22 +30,110 @@
S_Title.Instance.Text = _title;
return S_TileMap.Instance.Load(roomSplit);
}
+
+ ///
+ /// 设置标题是否带 *
+ ///
+ public void SetTitleDirty(bool value)
+ {
+ if (value)
+ {
+ S_Title.Instance.Text = _title + "*";
+ }
+ else
+ {
+ S_Title.Instance.Text = _title;
+ }
+ }
//调整地图显示区域大小
private void OnMapViewResized()
{
S_SubViewport.Instance.Size = S_Left.Instance.Size.AsVector2I() - new Vector2I(4, 4);
}
+
+ //保存地图数据
+ private void OnSave()
+ {
+ S_TileMap.Instance.TryRunCheckHandler();
+ //有错误的数据
+ if (S_TileMap.Instance.HasError)
+ {
+ EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
+ {
+ if (v)
+ {
+ S_TileMap.Instance.TriggerSave();
+ }
+ });
+ }
+ else
+ {
+ S_TileMap.Instance.TriggerSave();
+ }
+ }
+ //点击返回
private void OnBackClick()
{
- EditorWindowManager.ShowConfirm("提示", "是否退出编辑房间?", v =>
+ S_TileMap.Instance.TryRunCheckHandler();
+ if (S_TileMap.Instance.IsDirty) //有修改的数据, 不能直接退出, 需要询问用户是否保存
{
- if (v)
+ EditorWindowManager.ShowConfirm("提示", "当前房间修改的数据还未保存,是否退出编辑房间?",
+ "保存并退出", "直接退出", "取消"
+ , index =>
+ {
+ if (index == 0) //保存并退出
+ {
+ if (S_TileMap.Instance.HasError) //有错误
+ {
+ EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果现在保存并退出,运行游戏将不会刷出该房间!\n是否仍要保存?", (v) =>
+ {
+ if (v)
+ {
+ S_TileMap.Instance.TriggerSave();
+ //返回上一个Ui
+ OpenPrevUi();
+ }
+ else
+ {
+ //返回上一个Ui
+ OpenPrevUi();
+ }
+ });
+ }
+ else //没有错误
+ {
+ S_TileMap.Instance.TriggerSave();
+ //返回上一个Ui
+ OpenPrevUi();
+ }
+ }
+ else if (index == 1)
+ {
+ //返回上一个Ui
+ OpenPrevUi();
+ }
+ });
+ }
+ else //没有修改数据
+ {
+ if (S_TileMap.Instance.HasError) //有错误
+ {
+ EditorWindowManager.ShowConfirm("提示", "当前房间地块存在绘制错误,如果不解决错误就退出,运行游戏将不会刷出该房间!\n是否仍要退出?", (v) =>
+ {
+ if (v)
+ {
+ //返回上一个Ui
+ OpenPrevUi();
+ }
+ });
+ }
+ else //没有错误
{
//返回上一个Ui
OpenPrevUi();
}
- });
+ }
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
index abc86a4..f8c5fd6 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
@@ -7,7 +7,7 @@
namespace UI.MapEditor;
-public partial class EditorTileMap : TileMap
+public partial class EditorTileMap : TileMap, IUiNodeScript
{
public enum MouseButtonType
@@ -110,7 +110,7 @@
//错误地形位置
private Vector2I _checkTerrainErrorPosition = Vector2I.Zero;
//是否执行生成地形成功
- private bool _isGenerateTerrain = false;
+ private bool _isGenerateTerrain = true;
private bool _initLayer = false;
//--------- 配置数据 -------------
@@ -123,6 +123,16 @@
/// 正在编辑的房间数据
///
public DungeonRoomSplit RoomSplit { get; private set; }
+
+ ///
+ /// 数据是否脏了, 也就是是否有修改
+ ///
+ public bool IsDirty { get; private set; }
+
+ ///
+ /// 地图是否有错误
+ ///
+ public bool HasError => !_isGenerateTerrain;
///
/// 波数网格选中的索引
@@ -189,6 +199,24 @@
private Vector2I _roomSize;
private List _doorConfigs = new List();
//-------------------------------
+ private MapEditor.TileMap _editorTileMap;
+ private EventFactory _eventFactory;
+
+ public void SetUiNode(IUiNode uiNode)
+ {
+ _editorTileMap = (MapEditor.TileMap)uiNode;
+ _editorTileMap.Instance.MapEditorPanel = _editorTileMap.UiPanel;
+ _editorTileMap.Instance.MapEditorToolsPanel = _editorTileMap.UiPanel.S_MapEditorTools.Instance;
+
+ _editorTileMap.L_Brush.Instance.Draw += DrawGuides;
+ _eventFactory = EventManager.CreateEventFactory();
+ _eventFactory.AddEventListener(EventEnum.OnSelectDragTool, _editorTileMap.Instance.OnSelectHandTool);
+ _eventFactory.AddEventListener(EventEnum.OnSelectPenTool, _editorTileMap.Instance.OnSelectPenTool);
+ _eventFactory.AddEventListener(EventEnum.OnSelectRectTool, _editorTileMap.Instance.OnSelectRectTool);
+ _eventFactory.AddEventListener(EventEnum.OnSelectEditTool, _editorTileMap.Instance.OnSelectEditTool);
+ _eventFactory.AddEventListener(EventEnum.OnClickCenterTool, _editorTileMap.Instance.OnClickCenterTool);
+ _eventFactory.AddEventListener(EventEnum.OnEditorDirty, _editorTileMap.Instance.OnEditorDirty);
+ }
public override void _Ready()
{
@@ -197,6 +225,9 @@
public override void _Process(double delta)
{
+ //触发绘制辅助线
+ _editorTileMap.L_Brush.Instance.QueueRedraw();
+
var newDelta = (float)delta;
_drawFullRect = false;
var position = GetLocalMousePosition();
@@ -262,23 +293,8 @@
_generateTimer -= newDelta;
if (_generateTimer <= 0)
{
- //计算区域
- CalcTileRect(false);
- GD.Print("开始检测是否可以生成地形...");
- if (CheckTerrain())
- {
- GD.Print("开始绘制导航网格...");
- if (GenerateNavigation())
- {
- GD.Print("开始绘制自动贴图...");
- GenerateTerrain();
- _isGenerateTerrain = true;
- }
- }
- else
- {
- SetErrorCell(_checkTerrainErrorPosition);
- }
+ //检测地形
+ RunCheckHandler();
}
}
}
@@ -286,8 +302,9 @@
///
/// 绘制辅助线
///
- public void DrawGuides(CanvasItem canvasItem)
+ public void DrawGuides()
{
+ CanvasItem canvasItem = _editorTileMap.L_Brush.Instance;
//轴线
canvasItem.DrawLine(new Vector2(0, 2000), new Vector2(0, -2000), Colors.Green);
canvasItem.DrawLine(new Vector2(2000, 0), new Vector2( -2000, 0), Colors.Red);
@@ -402,6 +419,41 @@
}
}
+ ///
+ /// 尝试运行检查, 如果已经运行过了, 则没有效果
+ ///
+ public void TryRunCheckHandler()
+ {
+ if (_generateTimer > 0)
+ {
+ _generateTimer = -1;
+ RunCheckHandler();
+ }
+ }
+
+ //执行检测地形操作
+ private void RunCheckHandler()
+ {
+ _isGenerateTerrain = false;
+ //计算区域
+ CalcTileRect(false);
+ GD.Print("开始检测是否可以生成地形...");
+ if (CheckTerrain())
+ {
+ GD.Print("开始绘制导航网格...");
+ if (GenerateNavigation())
+ {
+ GD.Print("开始绘制自动贴图...");
+ GenerateTerrain();
+ _isGenerateTerrain = true;
+ }
+ }
+ else
+ {
+ SetErrorCell(_checkTerrainErrorPosition);
+ }
+ }
+
//将指定层数据存入list中
private void PushLayerDataToList(int layer, int sourceId, List list)
{
@@ -438,9 +490,14 @@
public void TriggerSave()
{
GD.Print("保存地牢房间数据...");
+ RoomSplit.Ready = !HasError;
SaveRoomInfoConfig();
SaveTileInfoConfig();
SavePreinstallConfig();
+ IsDirty = false;
+ MapEditorPanel.SetTitleDirty(false);
+ //派发保存事件
+ EventManager.EmitEvent(EventEnum.OnEditorSave);
}
///
@@ -476,6 +533,11 @@
//导航网格数据
_dungeonTileMap.SetPolygonData(tileInfo.NavigationList);
+ //如果有错误, 则找出错误的点位
+ if (!roomSplit.Ready)
+ {
+ RunCheckHandler();
+ }
//聚焦
//MapEditorPanel.CallDelay(0.1f, OnClickCenterTool);
//CallDeferred(nameof(OnClickCenterTool), null);
@@ -637,6 +699,8 @@
_dungeonTileMap.ClearPolygonData();
ClearLayer(AutoTopLayer);
ClearLayer(AutoMiddleLayer);
+ //标记有修改数据
+ EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
//重新计算房间区域
@@ -800,7 +864,7 @@
///
/// 选中拖拽功能
///
- public void OnSelectHandTool(object arg)
+ private void OnSelectHandTool(object arg)
{
MouseType = MouseButtonType.Drag;
}
@@ -808,7 +872,7 @@
///
/// 选中画笔攻击
///
- public void OnSelectPenTool(object arg)
+ private void OnSelectPenTool(object arg)
{
MouseType = MouseButtonType.Pen;
}
@@ -816,7 +880,7 @@
///
/// 选中绘制区域功能
///
- public void OnSelectRectTool(object arg)
+ private void OnSelectRectTool(object arg)
{
MouseType = MouseButtonType.Area;
}
@@ -824,7 +888,7 @@
///
/// 选择编辑门区域
///
- public void OnSelectEditTool(object arg)
+ private void OnSelectEditTool(object arg)
{
MouseType = MouseButtonType.Edit;
}
@@ -832,7 +896,7 @@
///
/// 聚焦
///
- public void OnClickCenterTool(object arg)
+ private void OnClickCenterTool(object arg)
{
var pos = MapEditorPanel.S_SubViewport.Instance.Size / 2;
if (_roomSize.X == 0 && _roomSize.Y == 0) //聚焦原点
@@ -844,6 +908,13 @@
SetMapPosition(pos - (_roomPosition + _roomSize / 2) * TileSet.TileSize * Scale);
}
}
+
+ //房间数据有修改
+ private void OnEditorDirty(object obj)
+ {
+ IsDirty = true;
+ MapEditorPanel.SetTitleDirty(true);
+ }
///
/// 创建地牢房间门区域
@@ -932,8 +1003,17 @@
Directory.CreateDirectory(path);
}
- roomInfo.Position = new SerializeVector2(_roomPosition);
- roomInfo.Size = new SerializeVector2(_roomSize);
+ if (!HasError) //没有错误
+ {
+ roomInfo.Size = new SerializeVector2(_roomSize);
+ roomInfo.Position = new SerializeVector2(_roomPosition);
+ }
+ else
+ {
+ roomInfo.Position = new SerializeVector2(_roomPosition - Vector2I.One);
+ roomInfo.Size = new SerializeVector2(_roomSize + new Vector2I(2, 2));
+ }
+
roomInfo.DoorAreaInfos.Clear();
roomInfo.DoorAreaInfos.AddRange(_doorConfigs);
@@ -1005,4 +1085,9 @@
}
}
}
+
+ public void OnDestroy()
+ {
+ _eventFactory.RemoveAllEventListener();
+ }
}
\ No newline at end of file
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMapBar.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMapBar.cs
deleted file mode 100644
index 1c9826f..0000000
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMapBar.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Godot;
-
-namespace UI.MapEditor;
-
-public class EditorTileMapBar
-{
- private MapEditor.TileMap _editorTileMap;
- private EventFactory _eventFactory;
-
- public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.TileMap editorTileMap)
- {
- _editorTileMap = editorTileMap;
- _editorTileMap.Instance.MapEditorPanel = editorPanel;
- _editorTileMap.Instance.MapEditorToolsPanel = editorPanel.S_MapEditorTools.Instance;
-
- _editorTileMap.L_Brush.Instance.Draw += OnDrawGuides;
- _eventFactory = EventManager.CreateEventFactory();
- _eventFactory.AddEventListener(EventEnum.OnSelectDragTool, _editorTileMap.Instance.OnSelectHandTool);
- _eventFactory.AddEventListener(EventEnum.OnSelectPenTool, _editorTileMap.Instance.OnSelectPenTool);
- _eventFactory.AddEventListener(EventEnum.OnSelectRectTool, _editorTileMap.Instance.OnSelectRectTool);
- _eventFactory.AddEventListener(EventEnum.OnSelectEditTool, _editorTileMap.Instance.OnSelectEditTool);
- _eventFactory.AddEventListener(EventEnum.OnClickCenterTool, _editorTileMap.Instance.OnClickCenterTool);
- }
-
- public void OnShow()
- {
-
- }
-
- public void OnHide()
- {
-
- }
-
- public void Process(float delta)
- {
- _editorTileMap.L_Brush.Instance.QueueRedraw();
- }
-
- private void OnDrawGuides()
- {
- _editorTileMap.Instance.DrawGuides(_editorTileMap.L_Brush.Instance);
- }
-
- public void OnDestroy()
- {
- _editorTileMap.L_Brush.Instance.Draw -= OnDrawGuides;
- _eventFactory.RemoveAllEventListener();
- }
-}
\ 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
index e84e69c..e031006 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/AttributeBase.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/AttributeBase.cs
@@ -10,6 +10,7 @@
public string AttrName { get; set; }
public abstract void SetUiNode(IUiNode uiNode);
+ public abstract void OnDestroy();
///
/// 获取属性值
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs
index 6f0671f..c6aa845 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/NumberAttribute.cs
@@ -11,7 +11,12 @@
{
_numberBar = (MapEditorCreateMark.NumberBar)uiNode;
}
-
+
+ public override void OnDestroy()
+ {
+
+ }
+
public override string GetAttributeValue()
{
return _numberBar.L_NumInput.Instance.Value.ToString(CultureInfo.InvariantCulture);
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
index 0190aa5..0761a9a 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/attribute/ObjectAttribute.cs
@@ -22,6 +22,11 @@
_objectBar.L_HBoxContainer.L_DeleteButton.Instance.Pressed += OnClickDelete;
}
+ public override void OnDestroy()
+ {
+
+ }
+
public override string GetAttributeValue()
{
if (_selectWeapon == null)
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
index a988874..dbbafaf 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapMark/MapEditorMapMarkPanel.cs
@@ -215,6 +215,7 @@
else //显示编辑按钮
{
S_DynamicTool.L_EditButton.Instance.Visible = true;
+ S_DynamicTool.L_DeleteButton.Instance.Visible = true;
}
//显示工具
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs
index 6d2eac0..f75311b 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs
@@ -418,7 +418,9 @@
var doorAreaRange = GetDoorAreaRange();
DoorAreaInfo.Start = doorAreaRange.X;
DoorAreaInfo.End = doorAreaRange.Y;
- GD.Print("submit: " + doorAreaRange);
+ GD.Print("提交修改: " + doorAreaRange);
+ //派发修改数据修改事件
+ EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
index 2706b34..591fc21 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs
@@ -73,8 +73,10 @@
private void OnSubmitDoorArea(DoorDirection direction, int start, int end)
{
IsDrag = false;
- GD.Print("提交区域: " + direction + ", " + start + ", " + end);
+ GD.Print("提交创建: " + direction + ", " + start + ", " + end);
_currToolTemplate.Instance.DoorAreaInfo = MapEditorToolsPanel.EditorMap.Instance.CreateDoorArea(direction, start, end);
+ //派发修改数据修改事件
+ EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
//取消提交
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
index c142643..f4abecd 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
@@ -365,6 +365,8 @@
EditorMap.Instance.RemoveDoorArea(toolInstance.Instance.DoorAreaInfo);
}
toolInstance.Instance.QueueFree();
+ //派发修改数据修改事件
+ EventManager.EmitEvent(EventEnum.OnEditorDirty);
}
///
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs
index c95780e..9b3a803 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs
@@ -36,6 +36,10 @@
AddChild(_markAreaToolUp);
}
+ public void OnDestroy()
+ {
+ }
+
public override void _Process(double delta)
{
if (_toolNode != null && MarkInfo != null && _toolNode.UiPanel.S_ToolRoot.Instance.Visible)