diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index 0802f55..b7ee115 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -389,6 +389,8 @@ //聚焦 //MapEditorPanel.CallDelay(0.1f, OnClickCenterTool); CallDeferred(nameof(OnClickCenterTool)); + + MapEditorToolsPanel.S_DoorToolTemplate.Instance.SetDoorAreaPosition(_roomPosition * GameConfig.TileCellSize); return true; } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs index 6921006..daa9955 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs @@ -30,11 +30,14 @@ private Vector2I _startDragRange; //原始缩放 private Vector2 _originScale; + //原始坐标 + private Vector2 _originPosition; public void SetDoorDragAreaNode(MapEditorTools.DoorToolTemplate node) { _node = node; _originScale = Scale; + _originPosition = Position; _defaultColor = _node.L_DoorArea.Instance.Color; _node.L_StartBtn.Instance.DragEvent += OnStartAreaDrag; _node.L_EndBtn.Instance.DragEvent += OnEndAreaDrag; @@ -44,6 +47,14 @@ } /// + /// 设置门区域的位置 + /// + public void SetDoorAreaPosition(Vector2 position) + { + _originPosition = position; + } + + /// /// 设置门区域的方向 /// public void SetDoorAreaDirection(DoorDirection direction) @@ -76,7 +87,7 @@ /// public void SetDoorAreaTransform(Vector2 pos, Vector2 scale) { - Position = pos; + Position = _originPosition * scale + pos; Scale = _originScale * scale; }