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 5b48806..16ba545 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":{"X":-7,"Y":-7},"Size":{"X":0,"Y":0},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]}]]}] \ No newline at end of file +[{"Name":"test1","Weight":100,"Remark":"","WaveList":[[{"Position":{"X":4,"Y":-3},"Size":{"X":0,"Y":0},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]},{"Position":{"X":4,"Y":4},"Size":{"X":0,"Y":0},"DelayTime":0,"MarkList":[{"Id":"weapon0001","Weight":100,"Attr":{"CurrAmmon":"0","ResidueAmmo":"0"}}]}]]}] \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index de3e2cb..f0090e4 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -933,7 +933,7 @@ private void SetMapPosition(Vector2 pos) { Position = pos; - MapEditorToolsPanel.SetDoorToolTransform(pos, Scale); + MapEditorToolsPanel.SetToolTransform(pos, Scale); } //设置地图大小 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs index a958bc5..4709a66 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorCreateMark/MapEditorCreateMarkPanel.cs @@ -34,6 +34,12 @@ /// public MarkInfo GetMarkInfo() { + if (_grid.Count == 0) + { + EditorWindowManager.ShowTips("警告", "必须添加一个物体!"); + return null; + } + var data = new MarkInfo(); data.Position = new SerializeVector2(); data.MarkList = new List(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index 47733ec..8c317a5 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -25,11 +25,17 @@ /// 鼠标悬停区域 /// public DoorHoverArea ActiveHoverArea { get; private set; } + + /// + /// 鼠标选中的标记对象 + /// + public MarkTool ActiveMark { get; private set; } /// /// 所属编辑器Tile对象 /// public MapEditor.MapEditor.TileMap EditorMap { get; set; } + private List _doorTools = new List(); private UiGrid _toolGrid; @@ -98,7 +104,6 @@ var cloneAndPut = S_MarkTemplate.CloneAndPut(); _markToolsMap.Add(markInfo, cloneAndPut); cloneAndPut.Instance.Visible = true; - cloneAndPut.Instance.Position = markInfo.Position.AsVector2(); cloneAndPut.Instance.InitData(markInfo); } @@ -149,6 +154,14 @@ } /// + /// 设置当前活动的标记 + /// + public void SetActiveMark(MarkTool markTool) + { + ActiveMark = markTool; + } + + /// /// 创建门区域设置工具 /// /// 门区域数据 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs index 0493a70..e8f1e80 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MarkTool.cs @@ -32,6 +32,10 @@ if (!Input.IsMouseButtonPressed(MouseButton.Left)) { _isMOve = false; + if (_toolNode.UiPanel.ActiveMark == this) + { + _toolNode.UiPanel.SetActiveMark(null); + } } } else if (!_isMOve) @@ -40,15 +44,19 @@ { _isMOve = true; _offset = GlobalPosition - GetGlobalMousePosition(); + if (_toolNode.UiPanel.ActiveMark == null) + { + _toolNode.UiPanel.SetActiveMark(this); + } } } } //移动中 - if (_isMOve) + if (_isMOve && _toolNode.UiPanel.ActiveMark == this) { GlobalPosition = _offset + GetGlobalMousePosition().Round(); - _markInfo.Position = new SerializeVector2(Position.Round()); + _markInfo.Position = new SerializeVector2((Position + (Size / 2).Ceil()).Round()); } //QueueRedraw(); @@ -58,6 +66,7 @@ public void InitData(MarkInfo markInfo) { _markInfo = markInfo; + Position = markInfo.Position.AsVector2() - (Size / 2).Ceil(); } private void OnMouseEntered()