diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn
index 1ae0339..760796b 100644
--- a/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn
+++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorSegment.tscn
@@ -71,6 +71,7 @@
grow_horizontal = 2
grow_vertical = 2
scale = Vector2(2, 2)
+mouse_filter = 2
texture = ExtResource("2_wr143")
[node name="MaskRoot" type="Control" parent="HSplitContainer/Left/MarginContainer/LeftBg/TileTexture"]
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
index 6429b16..2188e8e 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs
@@ -4,11 +4,6 @@
public partial class TileSetEditorPanel : TileSetEditor
{
- // ///
- // /// 纹理路径
- // ///
- // public string TexturePath { get; private set; }
-
///
/// 纹理
///
@@ -120,6 +115,14 @@
{
return pos.Y * CellHorizontal + pos.X;
}
+
+ ///
+ /// 返回Cell的坐标是否在纹理区域内
+ ///
+ public bool IsCellPositionInTexture(Vector2I cell)
+ {
+ return cell.X >= 0 && cell.Y >= 0 && cell.X < CellHorizontal && cell.Y < CellVertical;
+ }
//返回上一级按钮点击
private void OnBackClick()
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
index a99ad59..752e662 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorImport/TileSetEditorImportPanel.cs
@@ -155,7 +155,7 @@
//拖拽文件进入区域
private void OnFilesDropped(string[] files)
{
- if (files.Length == 0)
+ if (files.Length == 0 || !IsOpen)
{
return;
}
diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs
index 7dd398a..907ed2a 100644
--- a/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs
+++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorSegment/TileEditArea.cs
@@ -22,9 +22,11 @@
_maskGrid = new UiGrid(_leftBg.L_TileTexture.L_MaskRoot.L_MaskRect, typeof(MaskRectCell));
_maskGrid.SetCellOffset(Vector2I.Zero);
+ _maskGrid.GridContainer.MouseFilter = MouseFilterEnum.Ignore;
_leftBg.UiPanel.AddEventListener(EventEnum.OnImportTileCell, OnImportCell);
_leftBg.UiPanel.AddEventListener(EventEnum.OnRemoveTileCell, OnRemoveCell);
+
}
public void OnDestroy()
@@ -83,10 +85,10 @@
if (Input.IsMouseButtonPressed(MouseButton.Left)) //左键导入
{
- if (_leftBg.L_TileTexture.Instance.IsMouseInRect() && this.IsMouseInRect())
+ if (this.IsMouseInRect())
{
var cellPosition = GetMouseCellPosition();
- if (!_useMask.Contains(cellPosition))
+ if (_leftBg.UiPanel.EditorPanel.IsCellPositionInTexture(cellPosition) && !_useMask.Contains(cellPosition))
{
EventManager.EmitEvent(EventEnum.OnImportTileCell, cellPosition);
}
@@ -94,10 +96,10 @@
}
else if (Input.IsMouseButtonPressed(MouseButton.Right)) //右键移除
{
- if (_leftBg.L_TileTexture.Instance.IsMouseInRect() && this.IsMouseInRect())
+ if (this.IsMouseInRect())
{
var cellPosition = GetMouseCellPosition();
- if (_useMask.Contains(cellPosition))
+ if (_leftBg.UiPanel.EditorPanel.IsCellPositionInTexture(cellPosition) && _useMask.Contains(cellPosition))
{
EventManager.EmitEvent(EventEnum.OnRemoveTileCell, cellPosition);
}