diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn index 10dbbfe..4a5d838 100644 --- a/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn +++ b/DungeonShooting_Godot/prefab/ui/TileSetEditor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=7 format=3 uid="uid://dn5brsxa6w3l6"] +[gd_scene load_steps=8 format=3 uid="uid://dn5brsxa6w3l6"] [ext_resource type="Script" path="res://src/game/ui/tileSetEditor/TileSetEditorPanel.cs" id="1_rgx4n"] [ext_resource type="Texture2D" uid="uid://cajcnlimvoxk" path="res://resource/sprite/ui/commonIcon/Back.png" id="2_naycu"] @@ -6,6 +6,7 @@ [ext_resource type="Texture2D" uid="uid://bn47bmilcw4x0" path="res://resource/sprite/ui/commonIcon/Select2.png" id="4_t8bqb"] [ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="4_u8gg1"] [ext_resource type="Texture2D" uid="uid://c5778ntk2rdon" path="res://resource/sprite/ui/commonIcon/Delete.png" id="5_gepb1"] +[ext_resource type="Texture2D" uid="uid://c4ltpf5a3egu1" path="res://resource/sprite/ui/commonIcon/Error_mini.png" id="7_2tur5"] [node name="TileSetEditor" type="Control"] layout_mode = 3 @@ -15,6 +16,7 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_rgx4n") +Layer = null [node name="Bg" type="Panel" parent="."] layout_mode = 1 @@ -126,6 +128,22 @@ text = "页签" flat = true +[node name="ErrorIcon" type="TextureRect" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/ScrollContainer/Tab"] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -45.0 +offset_top = -20.0 +offset_right = -5.0 +offset_bottom = 20.0 +grow_horizontal = 0 +grow_vertical = 2 +mouse_filter = 2 +texture = ExtResource("7_2tur5") + [node name="Select" type="NinePatchRect" parent="Bg/VBoxContainer/HBoxContainer/LeftRoot/VBoxContainer/ScrollContainer/Tab"] layout_mode = 1 anchors_preset = 15 diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorProject.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorProject.tscn index 56ed921..f5a4f74 100644 --- a/DungeonShooting_Godot/prefab/ui/TileSetEditorProject.tscn +++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorProject.tscn @@ -141,6 +141,7 @@ offset_right = 54.0 offset_bottom = -6.0 grow_vertical = 2 +mouse_filter = 2 texture = ExtResource("5_d0rev") [node name="TileName" type="Label" parent="Bg/VBoxContainer/HBoxContainer/Panel/MarginContainer/HBoxContainer2/VBoxContainer/ScrollContainer/TileButton"] diff --git a/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn b/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn index d2cce9d..b343ece 100644 --- a/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn +++ b/DungeonShooting_Godot/prefab/ui/TileSetEditorTerrain.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://dfqb73y4br8yd"] +[gd_scene load_steps=16 format=3 uid="uid://dfqb73y4br8yd"] [ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs" id="1_6jjk7"] [ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="2_ns54l"] @@ -11,6 +11,7 @@ [ext_resource type="Texture2D" uid="uid://d2wslibovwv7w" path="res://resource/sprite/ui/commonIcon/CenterTool.png" id="5_08bc4"] [ext_resource type="Texture2D" uid="uid://bud6ah5xyey37" path="res://resource/sprite/map/TerrainMask2.png" id="5_xabgh"] [ext_resource type="Texture2D" uid="uid://dyshwhf3101em" path="res://resource/sprite/map/TerrainMask4.png" id="6_vbhca"] +[ext_resource type="Texture2D" uid="uid://c4ltpf5a3egu1" path="res://resource/sprite/ui/commonIcon/Error_mini.png" id="6_vh7rd"] [ext_resource type="Texture2D" uid="uid://chisfq2alcq16" path="res://resource/sprite/map/TerrainMask3.png" id="6_vmj5y"] [ext_resource type="Texture2D" uid="uid://cvjj6jnmxgprw" path="res://resource/sprite/map/TerrainMask.png" id="7_g8dxk"] [ext_resource type="Script" path="res://src/game/ui/tileSetEditorTerrain/up/TerrainBrush.cs" id="7_lmu64"] @@ -23,6 +24,7 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_6jjk7") +Layer = null [node name="VSplitContainer" type="VSplitContainer" parent="."] layout_mode = 1 @@ -96,8 +98,25 @@ layout_mode = 2 size_flags_horizontal = 3 text = "name" +alignment = 0 text_overrun_behavior = 3 +[node name="ErrorIcon" type="TextureRect" parent="VSplitContainer/PanelTop/HSplitContainer/TopTab/VBoxContainer/ScrollContainer/TerrainTab"] +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -45.0 +offset_top = -20.0 +offset_right = -5.0 +offset_bottom = 20.0 +grow_horizontal = 0 +grow_vertical = 2 +mouse_filter = 2 +texture = ExtResource("6_vh7rd") + [node name="SelectTexture" type="NinePatchRect" parent="VSplitContainer/PanelTop/HSplitContainer/TopTab/VBoxContainer/ScrollContainer/TerrainTab"] layout_mode = 1 anchors_preset = 15 diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json index 1e568c8..841aa19 100644 --- a/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json +++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet1/TileSet.json @@ -221,7 +221,8 @@ 16 ] }, - "TerrainType": 0 + "TerrainType": 0, + "Ready": true } ], "Combination": [] diff --git a/DungeonShooting_Godot/resource/map/tileSet/TileSet2/TileSet.json b/DungeonShooting_Godot/resource/map/tileSet/TileSet2/TileSet.json index a38594e..df41fcb 100644 --- a/DungeonShooting_Godot/resource/map/tileSet/TileSet2/TileSet.json +++ b/DungeonShooting_Godot/resource/map/tileSet/TileSet2/TileSet.json @@ -41,7 +41,7 @@ 48 ], "434": [ - 64, + 80, 96 ], "18": [ @@ -91,9 +91,138 @@ "26": [ 160, 64 + ], + "176": [ + 16, + 32 + ], + "178": [ + 32, + 32 + ], + "184": [ + 48, + 32 + ], + "186": [ + 32, + 48 + ], + "58": [ + 16, + 64 + ], + "152": [ + 32, + 64 + ], + "154": [ + 64, + 96 + ], + "182": [ + 16, + 48 + ], + "250": [ + 48, + 48 + ], + "187": [ + 48, + 64 + ], + "440": [ + 0, + 64 + ], + "510": [ + 0, + 80 + ], + "447": [ + 32, + 96 + ], + "62": [ + 16, + 96 + ], + "248": [ + 48, + 96 + ], + "507": [ + 0, + 16 + ], + "255": [ + 128, + 0 + ], + "59": [ + 144, + 0 + ], + "190": [ + 176, + 0 + ], + "218": [ + 192, + 0 + ], + "155": [ + 176, + 16 + ], + "442": [ + 144, + 16 + ], + "432": [ + 112, + 16 + ], + "446": [ + 80, + 16 + ], + "54": [ + 64, + 16 + ], + "511": [ + 80, + 0 + ], + "254": [ + 96, + 16 + ], + "443": [ + 112, + 32 + ], + "191": [ + 128, + 16 + ], + "251": [ + 160, + 16 + ], + "216": [ + 144, + 32 + ], + "27": [ + 160, + 32 ] }, - "TerrainType": 0 + "TerrainType": 0, + "Ready": true }, { "Name": "Test2", @@ -153,7 +282,8 @@ 0 ] }, - "TerrainType": 1 + "TerrainType": 1, + "Ready": true } ], "Combination": [ @@ -421,7 +551,8 @@ 16 ] }, - "TerrainType": 1 + "TerrainType": 1, + "Ready": true } ], "Combination": [ diff --git a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSplit.cs b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSplit.cs index c331777..d033c36 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSplit.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetSplit.cs @@ -100,6 +100,8 @@ { return null; } + + //检查是否有异常 _tileSet = new TileSet(); if (_tileSetInfo.Sources != null) { @@ -123,19 +125,21 @@ //纹理 var image = tileSetSourceInfo.GetSourceImage(); - tileSetAtlasSource.Texture = ImageTexture.CreateFromImage(image); - - var size = image.GetSize() / GameConfig.TileCellSize; - //创建cell - for (var i = 0; i < size.X; i++) + if (image != null) { - for (var j = 0; j < size.Y; j++) + tileSetAtlasSource.Texture = ImageTexture.CreateFromImage(image); + + var size = image.GetSize() / GameConfig.TileCellSize; + //创建cell + for (var i = 0; i < size.X; i++) { - tileSetAtlasSource.CreateTile(new Vector2I(i, j)); + for (var j = 0; j < size.Y; j++) + { + tileSetAtlasSource.CreateTile(new Vector2I(i, j)); + } } } - for (var i = 0; i < terrainList.Count; i++) { var terrainInfo = terrainList[i]; diff --git a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetTerrainInfo.cs b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetTerrainInfo.cs index 66adfac..1c067f5 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetTerrainInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/tileSet/TileSetTerrainInfo.cs @@ -41,6 +41,12 @@ [JsonInclude] public byte TerrainType; + /// + /// 地形是否准备好了, 调用 RefreshReady() 刷新 + /// + [JsonInclude] + public bool Ready; + public void InitData() { TerrainType = 0; @@ -54,6 +60,7 @@ var terrainInfo = new TileSetTerrainInfo(); terrainInfo.InitData(); terrainInfo.Name = Name; + terrainInfo.Ready = Ready; foreach (var pair in T) { terrainInfo.T.Add(pair.Key, new []{ pair.Value[0], pair.Value[1] }); @@ -71,27 +78,25 @@ } /// - /// 返回这个TileSet地形是否可以正常使用了 + /// 刷新这个TileSet地形是否可以正常使用了 /// - /// - public bool CanUse() + public void RefreshReady(int terrainIndex) { if (TerrainType == 0) { - if (T == null || T.Count != 47) + if (terrainIndex == 0) { - return false; + Ready = T != null && T.Count == 47 && M != null && M.Count == 4 && F != null && F.Count == 1; + } + else + { + Ready = M != null && M.Count == 4 && F != null && F.Count == 1; } } else { - if (T == null || T.Count != 13) - { - return false; - } + Ready = T != null && T.Count == 13; } - - return M != null && M.Count == 4 && F != null && F.Count == 1; } /// diff --git a/DungeonShooting_Godot/src/framework/map/tileSet/TerrainPeering.cs b/DungeonShooting_Godot/src/framework/map/tileSet/TerrainPeering.cs index 939dd8e..fc314ec 100644 --- a/DungeonShooting_Godot/src/framework/map/tileSet/TerrainPeering.cs +++ b/DungeonShooting_Godot/src/framework/map/tileSet/TerrainPeering.cs @@ -86,6 +86,10 @@ { var pos = terrainInfo.GetPosition(keyValuePair.Value); var tileData = atlasSource.GetTileData(pos, 0); + if (tileData == null) + { + continue; + } tileData.TerrainSet = terrainSet; tileData.Terrain = terrain; diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs index aea521a..eb9b76b 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditor.cs @@ -206,6 +206,15 @@ } /// + /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.ErrorIcon + /// + public class ErrorIcon : UiNode + { + public ErrorIcon(TileSetEditorPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override ErrorIcon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// /// 类型: , 路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab /// public class Tab : UiNode @@ -223,6 +232,19 @@ } private Select _L_Select; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.ErrorIcon + /// + public ErrorIcon L_ErrorIcon + { + get + { + if (_L_ErrorIcon == null) _L_ErrorIcon = new ErrorIcon(UiPanel, Instance.GetNode("ErrorIcon")); + return _L_ErrorIcon; + } + } + private ErrorIcon _L_ErrorIcon; + public Tab(TileSetEditorPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override Tab Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } @@ -485,6 +507,11 @@ public Select S_Select => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_Select; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab.ErrorIcon + /// + public ErrorIcon S_ErrorIcon => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab.L_ErrorIcon; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditor.Bg.VBoxContainer.HBoxContainer.LeftRoot.VBoxContainer.ScrollContainer.Tab /// public Tab S_Tab => L_Bg.L_VBoxContainer.L_HBoxContainer.L_LeftRoot.L_VBoxContainer.L_ScrollContainer.L_Tab; diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs index 1c705ef..d178561 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorPanel.cs @@ -119,6 +119,27 @@ } } + public override void Process(float delta) + { + if (TabGrid.Visible && TileSetSourceInfo != null) + { + //纹理红点 + ((TileSetEditorTabCell)TabGrid.GetCell(0)).CellNode.L_ErrorIcon.Instance.Visible = !InitTexture; + //地形红点 + var terrainTab = (TileSetEditorTabCell)TabGrid.GetCell(1); + var flag = true; + foreach (var terrainInfo in TileSetSourceInfo.Terrain) + { + if (!terrainInfo.Ready) + { + flag = false; + break; + } + } + terrainTab.CellNode.L_ErrorIcon.Instance.Visible = !flag; + } + } + /// /// 初始化数据 /// diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorTabCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorTabCell.cs index 1afe775..58cbd98 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorTabCell.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditor/TileSetEditorTabCell.cs @@ -7,6 +7,7 @@ public override void OnInit() { CellNode.L_Select.Instance.Visible = false; + CellNode.L_ErrorIcon.Instance.Visible = false; } public override void OnSetData(TileSetEditorTabData data) diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileButtonCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileButtonCell.cs index dc5d128..601f719 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorProject/TileButtonCell.cs @@ -14,6 +14,34 @@ public override void OnSetData(TileSetSplit data) { CellNode.L_TileName.Instance.Text = data.TileSetInfo.Name; + //检测是否有错误 + var hasError = false; + foreach (var sourceInfo in data.TileSetInfo.Sources) + { + if (string.IsNullOrEmpty(sourceInfo.SourcePath)) + { + hasError = true; + break; + } + + foreach (var terrainInfo in sourceInfo.Terrain) + { + if (!terrainInfo.Ready) + { + hasError = true; + break; + } + } + } + + if (hasError) + { + CellNode.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Error_mini_png); + } + else + { + CellNode.L_Icon.Instance.Texture = ResourceManager.LoadTexture2D(ResourcePath.resource_sprite_ui_commonIcon_Success_mini_png); + } } public override void OnDoubleClick() diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TerrainTabCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TerrainTabCell.cs index a8a4f46..af6a41e 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TerrainTabCell.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TerrainTabCell.cs @@ -5,6 +5,7 @@ public override void OnInit() { CellNode.L_SelectTexture.Instance.Visible = false; + CellNode.L_ErrorIcon.Instance.Visible = false; } public override void OnSetData(TileSetTerrainInfo data) @@ -12,6 +13,11 @@ RefreshData(); } + public override void Process(float delta) + { + CellNode.L_ErrorIcon.Instance.Visible = !Data.Ready; + } + /// /// 刷新数据 /// diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs index 9630fa4..e2618e5 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrain.cs @@ -151,6 +151,15 @@ } /// + /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.PanelTop.HSplitContainer.TopTab.VBoxContainer.ScrollContainer.TerrainTab.ErrorIcon + /// + public class ErrorIcon : UiNode + { + public ErrorIcon(TileSetEditorTerrainPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override ErrorIcon Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// /// 类型: , 路径: TileSetEditorTerrain.VSplitContainer.PanelTop.HSplitContainer.TopTab.VBoxContainer.ScrollContainer.TerrainTab /// public class TerrainTab : UiNode @@ -168,6 +177,19 @@ } private SelectTexture _L_SelectTexture; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.PanelTop.HSplitContainer.TopTab.VBoxContainer.ScrollContainer.ErrorIcon + /// + public ErrorIcon L_ErrorIcon + { + get + { + if (_L_ErrorIcon == null) _L_ErrorIcon = new ErrorIcon(UiPanel, Instance.GetNode("ErrorIcon")); + return _L_ErrorIcon; + } + } + private ErrorIcon _L_ErrorIcon; + public TerrainTab(TileSetEditorTerrainPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } public override TerrainTab Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); } @@ -881,6 +903,11 @@ public SelectTexture S_SelectTexture => L_VSplitContainer.L_PanelTop.L_HSplitContainer.L_TopTab.L_VBoxContainer.L_ScrollContainer.L_TerrainTab.L_SelectTexture; /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.PanelTop.HSplitContainer.TopTab.VBoxContainer.ScrollContainer.TerrainTab.ErrorIcon + /// + public ErrorIcon S_ErrorIcon => L_VSplitContainer.L_PanelTop.L_HSplitContainer.L_TopTab.L_VBoxContainer.L_ScrollContainer.L_TerrainTab.L_ErrorIcon; + + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: TileSetEditorTerrain.VSplitContainer.PanelTop.HSplitContainer.TopTab.VBoxContainer.ScrollContainer.TerrainTab /// public TerrainTab S_TerrainTab => L_VSplitContainer.L_PanelTop.L_HSplitContainer.L_TopTab.L_VBoxContainer.L_ScrollContainer.L_TerrainTab; diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs index 14d40f0..99f6455 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/TileSetEditorTerrainPanel.cs @@ -53,7 +53,14 @@ //改变选中的TileSet资源 AddEventListener(EventEnum.OnSelectTileSetSource, OnSelectTileSetSource); //改变纹理事件 - AddEventListener(EventEnum.OnSetTileTexture, OnSetTileTexture); + AddEventListener(EventEnum.OnSetTileTexture, (data) => + { + OnSetTileTexture(data); + if (TerrainTabGrid.SelectIndex >= 0) + { + OnChangeTerrain(TerrainTabGrid.SelectIndex); + } + }); //背景颜色改变 AddEventListener(EventEnum.OnSetTileSetBgColor, OnChangeTileSetBgColor); diff --git a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs index 14e6329..b78cd21 100644 --- a/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs +++ b/DungeonShooting_Godot/src/game/ui/tileSetEditorTerrain/up/TerrainCell.cs @@ -125,10 +125,12 @@ if (cellData == null) { _panel.CurrTerrain?.RemoveTerrainCell(Index, Data); + _panel.CurrTerrain?.RefreshReady(_panel.CurrTerrainIndex); } else { _panel.CurrTerrain?.SetTerrainCell(Index, Data, cellData); + _panel.CurrTerrain?.RefreshReady(_panel.CurrTerrainIndex); } EventManager.EmitEvent(EventEnum.OnTileSetDirty);