diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn index 84699f6..61097d1 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn @@ -15,6 +15,7 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_gtth6") +Layer = null [node name="VBoxContainer" type="VBoxContainer" parent="."] layout_mode = 1 @@ -97,9 +98,12 @@ centered = false [node name="Brush" type="Control" parent="VBoxContainer/Panel/MarginContainer/Tab1/TabRoot"] -anchors_preset = 0 -offset_right = 1.0 -offset_bottom = 1.0 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 mouse_filter = 2 [node name="Grid" type="ColorRect" parent="VBoxContainer/Panel/MarginContainer/Tab1"] diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn index ba185f0..6e0d75c 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn @@ -32,6 +32,7 @@ grow_vertical = 2 mouse_filter = 1 script = ExtResource("1_mqp1c") +Layer = null metadata/_edit_vertical_guides_ = [1900.0] [node name="ToolRoot" type="Control" parent="."] diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png index 9ae850f..c0adc9e 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/Preview.png Binary files differ diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json index 1abac37..42c5e3a 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/RoomInfo.json @@ -1 +1 @@ -{"Position":{"X":-4,"Y":-6},"Size":{"X":10,"Y":10},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""} \ No newline at end of file +{"Position":{"X":-6,"Y":-7},"Size":{"X":19,"Y":13},"DoorAreaInfos":[],"GroupName":"Test1","RoomType":1,"RoomName":"Start1","Weight":100,"Remark":""} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json index 62143da..189d173 100644 --- a/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json +++ b/DungeonShooting_Godot/resource/map/tileMaps/Test1/inlet/Start1/TileInfo.json @@ -1 +1 @@ -{"NavigationVertices":[{"X":58,"Y":34},{"X":-26,"Y":34},{"X":-26,"Y":-42},{"X":58,"Y":-42}],"NavigationPolygon":[[0,1,2,3]],"Floor":[3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3],"Middle":[-2,-5,63,1,-2,-4,2,2,-1,-5,63,1,-1,-4,2,2,0,-5,63,1,0,-4,2,2,1,-5,63,1,1,-4,2,2,2,-5,63,1,2,-4,2,2,3,-5,63,1,3,-4,2,2],"Top":[-4,-6,511,1,-4,-5,511,1,-4,-4,511,1,-4,-3,511,1,-4,-2,511,1,-4,-1,511,1,-4,0,511,1,-4,1,511,1,-4,2,511,1,-4,3,511,1,-3,-6,511,1,-3,-5,255,1,-3,-4,219,1,-3,-3,219,1,-3,-2,219,1,-3,-1,219,1,-3,0,219,1,-3,1,219,1,-3,2,507,1,-3,3,511,1,-2,-6,511,1,-2,2,504,1,-2,3,511,1,-1,-6,511,1,-1,2,504,1,-1,3,511,1,0,-6,511,1,0,2,504,1,0,3,511,1,1,-6,511,1,1,2,504,1,1,3,511,1,2,-6,511,1,2,2,504,1,2,3,511,1,3,-6,511,1,3,2,504,1,3,3,511,1,4,-6,511,1,4,-5,447,1,4,-4,438,1,4,-3,438,1,4,-2,438,1,4,-1,438,1,4,0,438,1,4,1,438,1,4,2,510,1,4,3,511,1,5,-6,511,1,5,-5,511,1,5,-4,511,1,5,-3,511,1,5,-2,511,1,5,-1,511,1,5,0,511,1,5,1,511,1,5,2,511,1,5,3,511,1],"CustomFloor1":[],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[]} \ No newline at end of file +{"NavigationVertices":[{"X":170,"Y":66},{"X":-58,"Y":66},{"X":-58,"Y":-58},{"X":170,"Y":-58}],"NavigationPolygon":[[0,1,2,3]],"Floor":[3,-2,0,3,2,-2,0,3,1,-2,0,3,0,-2,0,3,-1,-2,0,3,-2,-2,0,3,-2,-1,0,3,-1,-1,0,3,0,-1,0,3,1,-1,0,3,2,-1,0,3,3,-1,0,3,3,0,0,3,2,0,0,3,1,0,0,3,0,0,0,3,-1,0,0,3,-2,0,0,3,-2,1,0,3,-1,1,0,3,0,1,0,3,1,1,0,3,2,1,0,3,3,1,0,3,3,-3,0,3,2,-3,0,3,1,-3,0,3,0,-3,0,3,-1,-3,0,3,-2,-3,0,3,4,-3,0,3,5,-3,0,3,6,-3,0,3,7,-3,0,3,8,-2,0,3,9,-2,0,3,7,-2,0,3,6,-2,0,3,5,-2,0,3,4,-2,0,3,8,-3,0,3,9,-3,0,3,10,-3,0,3,9,-4,0,3,8,-4,0,3,7,-4,0,3,6,-4,0,3,5,-4,0,3,4,-4,0,3,3,-4,0,3,2,-4,0,3,1,-4,0,3,0,-4,0,3,-1,-4,0,3,-2,-4,0,3,-3,-4,0,3,-3,-3,0,3,-3,-2,0,3,-3,-1,0,3,-3,0,0,3,-3,1,0,3,-4,1,0,3,-4,2,0,3,-3,2,0,3,-2,2,0,3,-1,2,0,3,0,2,0,3,1,2,0,3,2,2,0,3,3,2,0,3,4,2,0,3,4,1,0,3,4,0,0,3,4,-1,0,3,5,-1,0,3,6,-1,0,3,7,-1,0,3,8,-1,0,3,9,-1,0,3,10,-1,0,3,10,-2,0,3,10,0,0,3,9,0,0,3,8,0,0,3,7,0,0,3,6,0,0,3,5,0,0,3,5,1,0,3,6,1,0,3,7,1,0,3,8,1,0,3,9,1,0,3,9,2,0,3,10,2,0,3,8,2,0,3,7,2,0,3,6,2,0,3,5,2,0,3,10,1,0,3,10,3,0,3,9,3,0,3,8,3,0,3,7,3,0,3,6,3,0,3,5,3,0,3,4,3,0,3,3,3,0,3,2,3,0,3,1,3,0,3,0,3,0,3,-1,3,0,3,-2,3,0,3,-3,3,0,3,-4,0,0,3,-4,-1,0,3,-4,-2,0,3,-4,-3,0,3,-4,-4,0,3,-4,3,0,3,10,-4,0,3],"Middle":[-4,-6,63,1,-4,-5,2,2,-3,-6,63,1,-3,-5,2,2,-2,-6,63,1,-2,-5,2,2,-1,-6,63,1,-1,-5,2,2,0,-6,63,1,0,-5,2,2,1,-6,63,1,1,-5,2,2,2,-6,63,1,2,-5,2,2,3,-6,63,1,3,-5,2,2,4,-6,63,1,4,-5,2,2,5,-6,63,1,5,-5,2,2,6,-6,63,1,6,-5,2,2,7,-6,63,1,7,-5,2,2,8,-6,63,1,8,-5,2,2,9,-6,63,1,9,-5,2,2,10,-6,63,1,10,-5,2,2],"Top":[-6,-7,511,1,-6,-6,511,1,-6,-5,511,1,-6,-4,511,1,-6,-3,511,1,-6,-2,511,1,-6,-1,511,1,-6,0,511,1,-6,1,511,1,-6,2,511,1,-6,3,511,1,-6,4,511,1,-6,5,511,1,-5,-7,511,1,-5,-6,255,1,-5,-5,219,1,-5,-4,219,1,-5,-3,219,1,-5,-2,219,1,-5,-1,219,1,-5,0,219,1,-5,1,219,1,-5,2,219,1,-5,3,219,1,-5,4,507,1,-5,5,511,1,-4,-7,511,1,-4,4,504,1,-4,5,511,1,-3,-7,511,1,-3,4,504,1,-3,5,511,1,-2,-7,511,1,-2,4,504,1,-2,5,511,1,-1,-7,511,1,-1,4,504,1,-1,5,511,1,0,-7,511,1,0,4,504,1,0,5,511,1,1,-7,511,1,1,4,504,1,1,5,511,1,2,-7,511,1,2,4,504,1,2,5,511,1,3,-7,511,1,3,4,504,1,3,5,511,1,4,-7,511,1,4,4,504,1,4,5,511,1,5,-7,511,1,5,4,504,1,5,5,511,1,6,-7,511,1,6,4,504,1,6,5,511,1,7,-7,511,1,7,4,504,1,7,5,511,1,8,-7,511,1,8,4,504,1,8,5,511,1,9,-7,511,1,9,4,504,1,9,5,511,1,10,-7,511,1,10,4,504,1,10,5,511,1,11,-7,511,1,11,-6,447,1,11,-5,438,1,11,-4,438,1,11,-3,438,1,11,-2,438,1,11,-1,438,1,11,0,438,1,11,1,438,1,11,2,438,1,11,3,438,1,11,4,510,1,11,5,511,1,12,-7,511,1,12,-6,511,1,12,-5,511,1,12,-4,511,1,12,-3,511,1,12,-2,511,1,12,-1,511,1,12,0,511,1,12,1,511,1,12,2,511,1,12,3,511,1,12,4,511,1,12,5,511,1],"CustomFloor1":[],"CustomFloor2":[],"CustomFloor3":[],"CustomMiddle1":[],"CustomMiddle2":[],"CustomTop":[]} \ No newline at end of file diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png new file mode 100644 index 0000000..45a766d --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png Binary files differ diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png.import b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png.import new file mode 100644 index 0000000..07c2242 --- /dev/null +++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/Test1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cq56j2rxoghq4" +path="res://.godot/imported/Test1.png-116dc7985045e1cdc2a9599a74b4b18e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/map/tileSet/TileSet1/Test1.png" +dest_files=["res://.godot/imported/Test1.png-116dc7985045e1cdc2a9599a74b4b18e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json index 702785d..c5b0615 100644 --- a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json +++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json @@ -239,6 +239,12 @@ } ], "Combination": [] + }, + { + "Name": "Test1", + "SourcePath": "resource/map/tileSet/TileSet1/Test1.png", + "Terrain": [], + "Combination": [] } ] } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 61a0b52..da9d36d 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -491,7 +491,7 @@ /// /// 返回鼠标所在的单元格位置, 相对于Ui节点左上角 /// - public static Vector2I GetMouseCellPosition(Control control) + public static Vector2I GetMouseCellPosition(CanvasItem control) { var pos = control.GetLocalMousePosition() / GameConfig.TileCellSize; return pos.AsVector2I(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index 7d40c8f..38a0517 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -150,11 +150,16 @@ public TileMapDrawMode CurrBrushType { get; private set; } /// - /// 当前笔刷使用的 AtlasCoords, key: pos, value: atlasCoords + /// 当前笔刷使用的 AtlasCoords, value: atlasCoords, 单位: 格 /// public List CurrBrush { get; } = new List(); + + /// + /// 当前笔刷使用的纹理 + /// + public Texture2D CurrBrushTexture { get; private set; } - //笔刷偏移, 单位: 像素 + //笔刷偏移, 单位: 格 private Vector2I _brushOffset = Vector2I.Zero; //--------------------------------------- 变动过的数据 --------------------------------------- @@ -171,6 +176,12 @@ /// 当前编辑的门数据 /// public List CurrDoorConfigs { get; } = new List(); + + /// + /// 是否绘制房间中的辅助标记 + /// + public bool IsDrawMark { get; set; } = true; + //------------------------------- private MapEditor.TileMap _editorTileMap; private EventFactory _eventFactory; @@ -297,28 +308,32 @@ //轴线 canvasItem.DrawLine(new Vector2(0, 2000), new Vector2(0, -2000), Colors.Green); canvasItem.DrawLine(new Vector2(2000, 0), new Vector2( -2000, 0), Colors.Red); - - //绘制房间区域 - if (CurrRoomSize.X != 0 && CurrRoomSize.Y != 0) - { - canvasItem.DrawRect( - new Rect2( - (CurrRoomPosition + new Vector2I(1, 2)) * GameConfig.TileCellSize, - (CurrRoomSize - new Vector2I(2, 3)) * GameConfig.TileCellSize - ), - Colors.Aqua, false, 5f / Scale.X - ); - } - //绘制导航网格 - if (_checkTerrainFlag && _isGenerateTerrain && _polygonData != null) + if (IsDrawMark) { - foreach (var vector2s in _polygonData) + //绘制房间区域 + if (CurrRoomSize.X != 0 && CurrRoomSize.Y != 0) { - canvasItem.DrawPolygon(vector2s, new Color(0,1,1, 0.3f).MakeArray(vector2s.Length)); + canvasItem.DrawRect( + new Rect2( + (CurrRoomPosition + new Vector2I(1, 2)) * GameConfig.TileCellSize, + (CurrRoomSize - new Vector2I(2, 3)) * GameConfig.TileCellSize + ), + Colors.Aqua, false, 5f / Scale.X + ); + } + + //绘制导航网格 + if (_checkTerrainFlag && _isGenerateTerrain && _polygonData != null) + { + foreach (var vector2s in _polygonData) + { + canvasItem.DrawPolygon(vector2s, new Color(0,1,1, 0.3f).MakeArray(vector2s.Length)); + } } } + //绘制笔刷 if (MouseType == MouseButtonType.Pen || MouseType == MouseButtonType.Area) { if (_drawFullRect) //绘制填充矩形 @@ -342,11 +357,38 @@ } else //绘制单格 { - canvasItem.DrawRect(new Rect2(_mousePosition, TileSet.TileSize), Colors.White, false, 2f / Scale.X); + if (CurrLayer.Layer == MapLayer.AutoFloorLayer) //选择自动地板层 + { + DrawCellOutline(canvasItem); + } + else //自定义层 + { + if (CurrBrushType == TileMapDrawMode.Free) + { + if (_isRightPressed) //按下了左键擦除 + { + DrawCellOutline(canvasItem); + } + else //正常绘制 + { + foreach (var item in CurrBrush) + { + var rect = new Rect2(_mousePosition + (item + _brushOffset) * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize); + var srcRect = new Rect2(item * GameConfig.TileCellSize, GameConfig.TileCellSize, GameConfig.TileCellSize); + canvasItem.DrawTextureRectRegion(CurrBrushTexture, rect, srcRect, new Color(1, 1, 1, 0.3f)); + } + } + } + } } } } + private void DrawCellOutline(CanvasItem canvasItem) + { + canvasItem.DrawRect(new Rect2(_mousePosition, TileSet.TileSize), Colors.White, false, 2f / Scale.X); + } + public override void _Input(InputEvent @event) { if (@event is InputEventMouseButton mouseButton) @@ -453,8 +495,8 @@ xEnd = Mathf.Max(cell.X, xEnd); yEnd = Mathf.Max(cell.Y, yEnd); } - - _brushOffset = new Vector2I(xEnd - xStart, yEnd - yStart); + + _brushOffset = new Vector2I(-(xStart + (xEnd - xStart) / 2), -(yStart + (yEnd - yStart) / 2)); } } @@ -463,6 +505,11 @@ CurrBrush.Clear(); } + public void SetCurrBrushTexture(Texture2D texture) + { + CurrBrushTexture = texture; + } + /// /// 尝试运行检查, 如果已经运行过了, 则没有效果 /// @@ -744,7 +791,7 @@ { foreach (var item in CurrBrush) { - SetCell(CurrLayer.Layer, position + item - _brushOffset, CurrSourceIndex, item); + SetCell(CurrLayer.Layer, position + item + _brushOffset, CurrSourceIndex, item); } } } @@ -1432,11 +1479,14 @@ MapEditorToolsPanel.Visible = true; //还原层级显示 SetLayerEnabled(MapLayer.AutoFloorLayer, _tempAutoFloorLayer); - //SetLayerEnabled(CustomFloorLayer, _tempCustomFloorLayer); SetLayerEnabled(MapLayer.AutoMiddleLayer, _tempAutoMiddleLayer); - //SetLayerEnabled(MapLayer.CustomMiddleLayer, _tempCustomMiddleLayer); SetLayerEnabled(MapLayer.AutoTopLayer, _tempAutoTopLayer); - //SetLayerEnabled(MapLayer.CustomTopLayer, _tempCustomTopLayer); + SetLayerEnabled(MapLayer.CustomFloorLayer1, _tempCustomFloorLayer1); + SetLayerEnabled(MapLayer.CustomFloorLayer2, _tempCustomFloorLayer2); + SetLayerEnabled(MapLayer.CustomFloorLayer3, _tempCustomFloorLayer3); + SetLayerEnabled(MapLayer.CustomMiddleLayer1, _tempCustomMiddleLayer1); + SetLayerEnabled(MapLayer.CustomMiddleLayer2, _tempCustomMiddleLayer2); + SetLayerEnabled(MapLayer.CustomTopLayer, _tempCustomTopLayer); //保存预览图 var subViewport = MapEditorPanel.S_SubViewport.Instance; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs index 537ea0a..28411cf 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs @@ -30,6 +30,7 @@ if (Data.Layer == MapLayer.MarkLayer) //标记层 { _visible = true; + CellNode.UiPanel.EditorTileMap.IsDrawMark = _visible; } else { @@ -47,6 +48,7 @@ _visible = !_visible; if (Data.Layer == MapLayer.MarkLayer) //隐藏标记层 { + CellNode.UiPanel.EditorTileMap.IsDrawMark = _visible; panel.S_MapEditorTools.Instance.S_ToolRoot.Instance.Visible = _visible; } else //隐藏地图层级 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/FreeTileTab.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/FreeTileTab.cs index 2ac7715..9165e15 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/FreeTileTab.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/FreeTileTab.cs @@ -25,6 +25,7 @@ base.SetUiNode(uiNode); InitNode(UiNode.L_TabRoot.Instance, UiNode.L_Grid.Instance); _texture = new ImageTexture(); + UiNode.UiPanel.EditorTileMap.SetCurrBrushTexture(_texture); _sprite = UiNode.L_TabRoot.L_TileSprite.Instance; _sprite.Texture = _texture; @@ -108,8 +109,10 @@ root.Size = new Vector2(_width, _height); } - //聚焦按钮点击 - private void OnFocusClick() + /// + /// 聚焦 + /// + public void OnFocusClick() { Utils.DoFocusNode(ContainerRoot, Size, new Vector2(_width, _height)); RefreshGridTrans(); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs index 47106d3..c42fea6 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs @@ -77,6 +77,8 @@ var sourceInfo = TileSetSourceInfo; //单格页签纹理 S_Tab1.Instance.SetImage(sourceInfo.GetSourceImage()); + //触发聚焦 + S_Tab1.Instance.OnFocusClick(); //地形页签 S_Tab2.Instance.RefreshTerrain(sourceInfo); } diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs index dbd6445..13c4d18 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorCombination/leftTop/TileEditCombination.cs @@ -231,12 +231,16 @@ private void EraseBrush() { var brushRoot = UiNode.L_CombinationRoot.L_BrushRoot.Instance; - var pos = brushRoot.Position.AsVector2I(); - if (_canvas.TryGetValue(pos, out var canvasCell)) + foreach (var keyValuePair in _brushData) { - canvasCell.QueueFree(); - _canvas.Remove(pos); - _canvasDirty = true; + var combinationCell = keyValuePair.Value; + var pos = (combinationCell.Position + brushRoot.Position).AsVector2I(); + if (_canvas.TryGetValue(pos, out var canvasCell)) + { + canvasCell.QueueFree(); + _canvas.Remove(pos); + _canvasDirty = true; + } } }