diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn
index 940f113..49c7fd0 100644
--- a/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn
+++ b/DungeonShooting_Godot/prefab/ui/MapEditorMapTile.tscn
@@ -264,3 +264,24 @@
patch_margin_top = 3
patch_margin_right = 3
patch_margin_bottom = 3
+
+[node name="MaskBg" type="ColorRect" parent="."]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+color = Color(0, 0, 0, 0.862745)
+
+[node name="Label" type="Label" parent="MaskBg"]
+layout_mode = 1
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+grow_horizontal = 2
+grow_vertical = 2
+text = "选中地板层时不能使用自定义图块"
+horizontal_alignment = 1
+vertical_alignment = 1
+autowrap_mode = 1
diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn
index 698f3f2..346e221 100644
--- a/DungeonShooting_Godot/scene/Main.tscn
+++ b/DungeonShooting_Godot/scene/Main.tscn
@@ -39,6 +39,5 @@
process_callback = 0
editor_draw_drag_margin = true
script = ExtResource("2_2j367")
-RecoveryCoefficient = null
[node name="GlobalNodeRoot" type="Node2D" parent="."]
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
index 51bd318..f1b3a66 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs
@@ -541,6 +541,7 @@
public void SetCurrentLayer(TileMapLayerData layerData)
{
CurrLayer = layerData;
+ EventManager.EmitEvent(EventEnum.OnSelectTileLayer, layerData.Layer);
MapEditorToolsPanel.S_CurrLayer.Instance.Text = "当前图层:" + layerData.Title;
SetLayerModulate(MapLayer.AutoFloorLayer, GetEditorLayerModulate(MapLayer.AutoFloorLayer));
SetLayerModulate(MapLayer.AutoMiddleLayer, GetEditorLayerModulate(MapLayer.AutoMiddleLayer));
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs
index 28411cf..d045c23 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/LayerButtonCell.cs
@@ -40,25 +40,33 @@
}
}
- private void OnVisibleButtonClick()
+ ///
+ /// 设置层级是否显示
+ ///
+ public void SetLayerVisible(bool visible)
{
var panel = CellNode.UiPanel.ParentUi as MapEditorPanel;
if (panel != null)
{
- _visible = !_visible;
+ _visible = visible;
if (Data.Layer == MapLayer.MarkLayer) //隐藏标记层
{
- CellNode.UiPanel.EditorTileMap.IsDrawMark = _visible;
- panel.S_MapEditorTools.Instance.S_ToolRoot.Instance.Visible = _visible;
+ CellNode.UiPanel.EditorTileMap.IsDrawMark = visible;
+ panel.S_MapEditorTools.Instance.S_ToolRoot.Instance.Visible = visible;
}
else //隐藏地图层级
{
- panel.S_TileMap.Instance.SetLayerEnabled(Data.Layer, _visible);
+ panel.S_TileMap.Instance.SetLayerEnabled(Data.Layer, visible);
}
- SetVisibleIcon(_visible);
+ SetVisibleIcon(visible);
}
}
+ private void OnVisibleButtonClick()
+ {
+ SetLayerVisible(!_visible);
+ }
+
private void SetVisibleIcon(bool visible)
{
if (visible)
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs
index 24599fd..3a64492 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapLayer/MapEditorMapLayerPanel.cs
@@ -6,7 +6,10 @@
public partial class MapEditorMapLayerPanel : MapEditorMapLayer
{
- private UiGrid _grid;
+ ///
+ /// 所有地图层级网格
+ ///
+ public UiGrid LayerGrid { get; private set; }
///
/// 编辑器Tile对象
@@ -18,9 +21,9 @@
var editorPanel = (MapEditorPanel)ParentUi;
EditorTileMap = editorPanel.S_TileMap.Instance;
- _grid = CreateUiGrid(S_LayerButton);
- _grid.SetCellOffset(new Vector2I(0, 2));
- _grid.SetHorizontalExpand(true);
+ LayerGrid = CreateUiGrid(S_LayerButton);
+ LayerGrid.SetCellOffset(new Vector2I(0, 2));
+ LayerGrid.SetHorizontalExpand(true);
S_CheckButton.Instance.Toggled += OnToggled;
}
@@ -30,17 +33,28 @@
///
public void InitData()
{
- _grid.Add(new TileMapLayerData("地板", MapLayer.AutoFloorLayer, false));
- _grid.Add(new TileMapLayerData("底层1", MapLayer.CustomFloorLayer1, false));
- _grid.Add(new TileMapLayerData("底层2", MapLayer.CustomFloorLayer2, false));
- _grid.Add(new TileMapLayerData("底层3", MapLayer.CustomFloorLayer3, false));
- _grid.Add(new TileMapLayerData("侧方墙壁", MapLayer.AutoMiddleLayer, true));
- _grid.Add(new TileMapLayerData("中层1", MapLayer.CustomMiddleLayer1, false));
- _grid.Add(new TileMapLayerData("中层2", MapLayer.CustomMiddleLayer2, false));
- _grid.Add(new TileMapLayerData("顶部墙壁", MapLayer.AutoTopLayer, true));
- _grid.Add(new TileMapLayerData("顶层", MapLayer.CustomTopLayer, false));
- _grid.Add(new TileMapLayerData("标记数据层", MapLayer.MarkLayer, true));
- _grid.SelectIndex = 0;
+ LayerGrid.Add(new TileMapLayerData("地板", MapLayer.AutoFloorLayer, false));
+ LayerGrid.Add(new TileMapLayerData("底层1", MapLayer.CustomFloorLayer1, false));
+ LayerGrid.Add(new TileMapLayerData("底层2", MapLayer.CustomFloorLayer2, false));
+ LayerGrid.Add(new TileMapLayerData("底层3", MapLayer.CustomFloorLayer3, false));
+ LayerGrid.Add(new TileMapLayerData("侧方墙壁", MapLayer.AutoMiddleLayer, true));
+ LayerGrid.Add(new TileMapLayerData("中层1", MapLayer.CustomMiddleLayer1, false));
+ LayerGrid.Add(new TileMapLayerData("中层2", MapLayer.CustomMiddleLayer2, false));
+ LayerGrid.Add(new TileMapLayerData("顶部墙壁", MapLayer.AutoTopLayer, true));
+ LayerGrid.Add(new TileMapLayerData("顶层", MapLayer.CustomTopLayer, false));
+ LayerGrid.Add(new TileMapLayerData("标记数据层", MapLayer.MarkLayer, true));
+ LayerGrid.SelectIndex = 0;
+ }
+
+ ///
+ /// 设置指定层级显示或者隐藏
+ ///
+ public void SetLayerVisible(int layer, bool visible)
+ {
+ LayerGrid.ForEach(cell =>
+ {
+ ((LayerButtonCell)cell).SetLayerVisible(visible);
+ });
}
private void OnToggled(bool toggledon)
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs
index bf07036..c538a1e 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTile.cs
@@ -18,6 +18,19 @@
}
private VBoxContainer _L_VBoxContainer;
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.MaskBg
+ ///
+ public MaskBg L_MaskBg
+ {
+ get
+ {
+ if (_L_MaskBg == null) _L_MaskBg = new MaskBg((MapEditorMapTilePanel)this, GetNode("MaskBg"));
+ return _L_MaskBg;
+ }
+ }
+ private MaskBg _L_MaskBg;
+
public MapEditorMapTile() : base(nameof(MapEditorMapTile))
{
@@ -634,6 +647,37 @@
public override VBoxContainer Clone() => new (UiPanel, (Godot.VBoxContainer)Instance.Duplicate());
}
+ ///
+ /// 类型: , 路径: MapEditorMapTile.MaskBg.Label
+ ///
+ public class Label_2 : UiNode
+ {
+ public Label_2(MapEditorMapTilePanel uiPanel, Godot.Label node) : base(uiPanel, node) { }
+ public override Label_2 Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate());
+ }
+
+ ///
+ /// 类型: , 路径: MapEditorMapTile.MaskBg
+ ///
+ public class MaskBg : UiNode
+ {
+ ///
+ /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorMapTile.Label
+ ///
+ public Label_2 L_Label
+ {
+ get
+ {
+ if (_L_Label == null) _L_Label = new Label_2(UiPanel, Instance.GetNode("Label"));
+ return _L_Label;
+ }
+ }
+ private Label_2 _L_Label;
+
+ public MaskBg(MapEditorMapTilePanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { }
+ public override MaskBg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate());
+ }
+
///
/// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.VBoxContainer.HBoxContainer.SourceOption
@@ -755,4 +799,9 @@
///
public VBoxContainer S_VBoxContainer => L_VBoxContainer;
+ ///
+ /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorMapTile.MaskBg
+ ///
+ public MaskBg S_MaskBg => L_MaskBg;
+
}
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs
index 42d90c6..e82ff5f 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorMapTile/MapEditorMapTilePanel.cs
@@ -44,6 +44,9 @@
//切换笔刷类型
S_HandleOption.Instance.ItemSelected += OnChangeBrush;
OnChangeBrush(0);
+ //选择层级
+ AddEventListener(EventEnum.OnSelectTileLayer, OnSelectTileLayer);
+ OnSelectTileLayer(0);
}
public override void OnDestroyUi()
@@ -68,6 +71,15 @@
OnChangeSource(0);
}
+ //选中层级
+ private void OnSelectTileLayer(object obj)
+ {
+ if (obj is int v)
+ {
+ S_MaskBg.Instance.Visible = v == 0;
+ }
+ }
+
// 切换选中的资源
private void OnChangeSource(long index)
{
diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
index 341d0b5..c85cf82 100644
--- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
+++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs
@@ -53,7 +53,8 @@
public override void OnCreateUi()
{
- EditorMap = ((MapEditorPanel)ParentUi).S_TileMap;
+ var mapEditorPanel = (MapEditorPanel)ParentUi;
+ EditorMap = mapEditorPanel.S_TileMap;
S_N_HoverArea.Instance.Init(this, DoorDirection.N);
S_S_HoverArea.Instance.Init(this, DoorDirection.S);
@@ -79,10 +80,11 @@
{
EventManager.EmitEvent(EventEnum.OnSelectRectTool);
}));
- //编辑攻击按钮
+ //编辑工具按钮
_toolGrid.Add(new ToolBtnData(true, ResourcePath.resource_sprite_ui_commonIcon_DoorTool_png, () =>
{
EventManager.EmitEvent(EventEnum.OnSelectEditTool);
+ mapEditorPanel.S_MapEditorMapLayer.Instance.SetLayerVisible(MapLayer.MarkLayer, true);
}));
_editToolIndex = _toolGrid.Count - 1;
//聚焦按钮