diff --git "a/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/TileSet.json" "b/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/TileSet.json"
index ede5c66..666373a 100644
--- "a/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/TileSet.json"
+++ "b/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/TileSet.json"
@@ -5,14 +5,8 @@
"Name": "Test",
"SourcePath": "resource/map/tileSet/\u6D4B\u8BD5\u6570\u636E/Test.png",
"Terrain": {
- "_f": [
- 0,
- 64
- ],
- "_vl": [
- 16,
- 48
- ],
+ "_f": null,
+ "_vl": null,
"_vc": null,
"_vr": null,
"_vs": null,
diff --git "a/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/test.png" "b/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/test.png"
deleted file mode 100644
index cb64efb..0000000
--- "a/DungeonShooting_Godot/resource/map/tileSet/\346\265\213\350\257\225\346\225\260\346\215\256/test.png"
+++ /dev/null
Binary files differ
diff --git a/DungeonShooting_Godot/src/game/event/EventEnum.cs b/DungeonShooting_Godot/src/game/event/EventEnum.cs
index 30ca385..fa848a4 100644
--- a/DungeonShooting_Godot/src/game/event/EventEnum.cs
+++ b/DungeonShooting_Godot/src/game/event/EventEnum.cs
@@ -153,7 +153,7 @@
///
OnTileSetSave,
///
- /// 标记TileSet脏了, 参数为
+ /// 标记TileSet脏了, 无参数
///
OnTileSetDirty,
///
diff --git a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
index 44af508..aa6c018 100644
--- a/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
+++ b/DungeonShooting_Godot/src/game/manager/EditorWindowManager.cs
@@ -177,6 +177,7 @@
{
var window = CreateWindowInstance(parentUi);
window.SetWindowTitle(title);
+ window.SetWindowSize(new Vector2I(550, 350));
window.CloseEvent += () =>
{
onClose(-1);
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
index a970df2..9bf03c5 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
@@ -6,6 +6,11 @@
public partial class TileSetEditorPanel : TileSetEditor
{
///
+ /// 数据是否脏了
+ ///
+ public bool IsDirty { get; private set; }
+
+ ///
/// 编辑使用的 tileSetInfo 数据
///
public TileSetInfo TileSetInfo { get; private set; }
@@ -88,6 +93,7 @@
S_AddButton.Instance.Pressed += OnAddSourceClick;
S_OptionButton.Instance.ItemSelected += OnOptionChange;
S_Save.Instance.Pressed += OnSaveClick;
+ AddEventListener(EventEnum.OnTileSetDirty, OnTileSetDirty);
}
public override void OnDestroyUi()
@@ -112,9 +118,10 @@
///
public void InitData(TileSetInfo tileSetInfo)
{
+ IsDirty = false;
OriginTileSetInfo = tileSetInfo;
TileSetInfo = tileSetInfo.Clone();
- S_Title.Instance.Text = "正在编辑:" + TileSetInfo.Name;
+ RefreshTitle();
//初始化下拉框
if (TileSetInfo.Sources.Count > 0)
@@ -130,8 +137,21 @@
}
}
+ //设置标题显示内容
+ private void RefreshTitle()
+ {
+ if (IsDirty)
+ {
+ S_Title.Instance.Text = "正在编辑:" + TileSetInfo.Name + "*";
+ }
+ else
+ {
+ S_Title.Instance.Text = "正在编辑:" + TileSetInfo.Name;
+ }
+ }
+
///
- /// 设置纹理
+ /// 设置纹理使用的纹理
///
public void SetTextureData(Image image)
{
@@ -190,7 +210,28 @@
//返回上一级按钮点击
private void OnBackClick()
{
- OpenPrevUi();
+ if (IsDirty)
+ {
+ EditorWindowManager.ShowConfirm("提示", "当前TileSet修改的数据还未保存,是否退出编辑?",
+ "保存并退出", "直接退出", "取消"
+ , index =>
+ {
+ if (index == 0) //保存并退出
+ {
+ OnSaveClick();
+ OpenPrevUi();
+ }
+ else if (index == 1) //直接退出
+ {
+ OpenPrevUi();
+ }
+ }
+ );
+ }
+ else
+ {
+ OpenPrevUi();
+ }
}
//删除资源
@@ -281,5 +322,14 @@
private void OnSaveClick()
{
EventManager.EmitEvent(EventEnum.OnTileSetSave, TileSetInfo);
+ IsDirty = false;
+ RefreshTitle();
+ }
+
+ //数据脏了
+ private void OnTileSetDirty(object obj)
+ {
+ IsDirty = true;
+ RefreshTitle();
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs
index 93bf1d7..32a028d 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/right/TileSelected.cs
@@ -35,6 +35,7 @@
_rightBg.UiPanel.EditorPanel.TileSetSourceInfo.Combination.Add(data.CombinationInfo);
Grid.Add(data);
Grid.Sort();
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
}
}
@@ -51,6 +52,7 @@
{
Grid.RemoveByIndex(uiCell.Index);
}
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
}
}
@@ -66,6 +68,7 @@
{
uiCell.SetData(data);
}
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
index ce0f1e5..6cda361 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
@@ -184,5 +184,6 @@
tileSetSourceInfo.SourcePath = GameConfig.RoomTileSetDir + _tileSetEditor.TileSetInfo.Name + "/" + tileSetSourceInfo.Name + ".png";
tileSetSourceInfo.SetSourceImage(image);
_tileSetEditor.SetTextureData(image);
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
}
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs
index 28a8d9f..68bfe41 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCellDropHandler.cs
@@ -41,8 +41,12 @@
if (@event is InputEventMouseButton mouseEvent && mouseEvent.ButtonIndex == MouseButton.Right && mouseEvent.Pressed)
{
AcceptEvent();
+ var flag = IsPutDownTexture;
ClearCell();
- SetTerrainBitData(null);
+ if (flag)
+ {
+ SetTerrainBitData(null);
+ }
}
}
@@ -71,5 +75,6 @@
private void SetTerrainBitData(int[] cellData)
{
EditorTileSetManager.SetTileSetTerrainBit(_panel.EditorPanel.TileSetSourceInfo.Terrain, _cell.Index, _cell.Data, cellData);
+ EventManager.EmitEvent(EventEnum.OnTileSetDirty);
}
}
\ No newline at end of file