diff --git a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn index e85f8cc..fc98fe2 100644 --- a/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn +++ b/DungeonShooting_Godot/prefab/ui/MapEditorTools.tscn @@ -10,6 +10,7 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 1 script = ExtResource("1_mqp1c") [node name="HBoxContainer" type="HBoxContainer" parent="."] @@ -22,27 +23,26 @@ offset_right = -20.0 offset_bottom = 83.0 grow_horizontal = 0 -mouse_filter = 0 -[node name="TextureButton" type="TextureButton" parent="HBoxContainer"] +[node name="HandTool" type="TextureButton" parent="HBoxContainer"] layout_mode = 2 texture_normal = ExtResource("2_rwvbg") texture_pressed = ExtResource("2_rwvbg") texture_hover = ExtResource("2_rwvbg") -[node name="TextureButton2" type="TextureButton" parent="HBoxContainer"] +[node name="PenTool" type="TextureButton" parent="HBoxContainer"] layout_mode = 2 texture_normal = ExtResource("2_rwvbg") texture_pressed = ExtResource("2_rwvbg") texture_hover = ExtResource("2_rwvbg") -[node name="TextureButton3" type="TextureButton" parent="HBoxContainer"] +[node name="RectTool" type="TextureButton" parent="HBoxContainer"] layout_mode = 2 texture_normal = ExtResource("2_rwvbg") texture_pressed = ExtResource("2_rwvbg") texture_hover = ExtResource("2_rwvbg") -[node name="TextureButton4" type="TextureButton" parent="HBoxContainer"] +[node name="CenterTool" type="TextureButton" parent="HBoxContainer"] layout_mode = 2 texture_normal = ExtResource("2_rwvbg") texture_pressed = ExtResource("2_rwvbg") diff --git a/DungeonShooting_Godot/src/framework/Grid.cs b/DungeonShooting_Godot/src/framework/Grid.cs index 2647d34..585eacf 100644 --- a/DungeonShooting_Godot/src/framework/Grid.cs +++ b/DungeonShooting_Godot/src/framework/Grid.cs @@ -1,5 +1,4 @@ -using System; using System.Collections.Generic; using Godot; @@ -52,11 +51,27 @@ { if (_map.TryGetValue(x, out var value)) { - return value[y]; + if (value.TryGetValue(y, out var v)) + { + return v; + } } return default; } + + /// + /// 移除指定xy位置存储的数据 + /// + public bool Remove(int x, int y) + { + if (_map.TryGetValue(x, out var value)) + { + return value.Remove(y); + } + + return false; + } /// /// 往一个区域中填充指定的数据 @@ -64,10 +79,10 @@ /// 起点位置 /// 区域大小 /// 数据 - public void AddRect(Vector2 pos, Vector2 size, T data) + public void SetRect(Vector2I pos, Vector2I size, T data) { - var x = (int)pos.X; - var y = (int)pos.Y; + var x = pos.X; + var y = pos.Y; for (var i = 0; i < size.X; i++) { for (var j = 0; j < size.Y; j++) @@ -91,10 +106,10 @@ /// /// 起点位置 /// 区域大小 - public void RemoveRect(Vector2 pos, Vector2 size) + public void RemoveRect(Vector2I pos, Vector2I size) { - var x = (int)pos.X; - var y = (int)pos.Y; + var x = pos.X; + var y = pos.Y; for (var i = 0; i < size.X; i++) { for (var j = 0; j < size.Y; j++) @@ -124,12 +139,12 @@ /// /// 起点位置 /// 区域大小 - public bool RectCollision(Vector2 pos, Vector2 size) + public bool RectCollision(Vector2I pos, Vector2I size) { - var x = (int)pos.X; - var y = (int)pos.Y; - var w = (int)size.X; - var h = (int)size.Y; + var x = pos.X; + var y = pos.Y; + var w = size.X; + var h = size.Y; //先判断四个角 if (Contains(x, y) || Contains(x + w - 1, y) || Contains(x, y + h - 1) || Contains(x + w - 1, y + h - 1)) { diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 0e722b6..3bf8354 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -98,4 +98,14 @@ { return new Vector2I((int)vector2.X, (int)vector2.Y); } + + /// + /// 返回指定坐标是否在UI节范围点内 + /// + public static bool IsPositionOver(this Control control, Vector2 position) + { + var rect = control.GetRect(); + return position.X >= rect.Position.X && position.X <= rect.End.X && + position.Y >= rect.Position.Y && position.Y <= rect.End.Y; + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 10f5671..29b1596 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -246,7 +246,7 @@ if (IsSoleNameNode(nodeInfo)) { str += $"{retraction}/// \n"; - str += $"{retraction}/// 场景中唯一名称的节点, 节点类型: , 节点路径: {path}\n"; + str += $"{retraction}/// 场景中唯一名称的节点, 节点类型: , 节点路径: {path}\n"; str += $"{retraction}/// \n"; str += $"{retraction}public {nodeInfo.ClassName} S_{nodeInfo.OriginName} => {layer};\n\n"; } diff --git a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs index e7ff185..44893c4 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs @@ -388,14 +388,14 @@ } //是否碰到其他房间或者过道 - if (_roomGrid.RectCollision(room.Position - new Vector2(GameConfig.RoomSpace, GameConfig.RoomSpace), room.Size + new Vector2(GameConfig.RoomSpace * 2, GameConfig.RoomSpace * 2))) + if (_roomGrid.RectCollision(room.Position - new Vector2I(GameConfig.RoomSpace, GameConfig.RoomSpace), room.Size + new Vector2I(GameConfig.RoomSpace * 2, GameConfig.RoomSpace * 2))) { //碰到其他墙壁, 再一次尝试 continue; //return GenerateRoomErrorCode.HasCollision; } - _roomGrid.AddRect(room.Position, room.Size, true); + _roomGrid.SetRect(room.Position, room.Size, true); //找门, 与上一个房间是否能连通 if (!ConnectDoor(prevRoomInfo, room)) @@ -418,7 +418,7 @@ else //第一个房间 { room.Layer = 0; - _roomGrid.AddRect(room.Position, room.Size, true); + _roomGrid.SetRect(room.Position, room.Size, true); } if (IsParticipateCounting(room)) @@ -1191,23 +1191,23 @@ { var point1 = door1.OriginPosition; var point2 = door2.OriginPosition; - var pos = new Vector2(Mathf.Min(point1.X, point2.X), Mathf.Min(point1.Y, point2.Y)); - var size = new Vector2( + var pos = new Vector2I(Mathf.Min(point1.X, point2.X), Mathf.Min(point1.Y, point2.Y)); + var size = new Vector2I( point1.X == point2.X ? GameConfig.CorridorWidth : Mathf.Abs(point1.X - point2.X), point1.Y == point2.Y ? GameConfig.CorridorWidth : Mathf.Abs(point1.Y - point2.Y) ); - Vector2 collPos; - Vector2 collSize; + Vector2I collPos; + Vector2I collSize; if (point1.X == point2.X) //纵向加宽, 防止贴到其它墙 { - collPos = new Vector2(pos.X - GameConfig.RoomSpace, pos.Y); - collSize = new Vector2(size.X + GameConfig.RoomSpace * 2, size.Y); + collPos = new Vector2I(pos.X - GameConfig.RoomSpace, pos.Y); + collSize = new Vector2I(size.X + GameConfig.RoomSpace * 2, size.Y); } else //横向加宽, 防止贴到其它墙 { - collPos = new Vector2(pos.X, pos.Y - GameConfig.RoomSpace); - collSize = new Vector2(size.X, size.Y + GameConfig.RoomSpace * 2); + collPos = new Vector2I(pos.X, pos.Y - GameConfig.RoomSpace); + collSize = new Vector2I(size.X, size.Y + GameConfig.RoomSpace * 2); } if (_roomGrid.RectCollision(collPos, collSize)) @@ -1215,38 +1215,38 @@ return false; } - door2.RoomInfo.AisleArea.Add(new Rect2(pos, size)); - _roomGrid.AddRect(pos, size, true); + door2.RoomInfo.AisleArea.Add(new Rect2I(pos, size)); + _roomGrid.SetRect(pos, size, true); return true; } //将两个门间的过道占用数据存入RoomGrid, 该重载加入拐角点 - private bool AddCorridorToGridRange(RoomDoorInfo door1, RoomDoorInfo door2, Vector2 cross) + private bool AddCorridorToGridRange(RoomDoorInfo door1, RoomDoorInfo door2, Vector2I cross) { var point1 = door1.OriginPosition; var point2 = door2.OriginPosition; - var pos1 = new Vector2(Mathf.Min(point1.X, cross.X), Mathf.Min(point1.Y, cross.Y)); - var size1 = new Vector2( + var pos1 = new Vector2I(Mathf.Min(point1.X, cross.X), Mathf.Min(point1.Y, cross.Y)); + var size1 = new Vector2I( point1.X == cross.X ? GameConfig.CorridorWidth : Mathf.Abs(point1.X - cross.X), point1.Y == cross.Y ? GameConfig.CorridorWidth : Mathf.Abs(point1.Y - cross.Y) ); - var pos2 = new Vector2(Mathf.Min(point2.X, cross.X), Mathf.Min(point2.Y, cross.Y)); - var size2 = new Vector2( + var pos2 = new Vector2I(Mathf.Min(point2.X, cross.X), Mathf.Min(point2.Y, cross.Y)); + var size2 = new Vector2I( point2.X == cross.X ? GameConfig.CorridorWidth : Mathf.Abs(point2.X - cross.X), point2.Y == cross.Y ? GameConfig.CorridorWidth : Mathf.Abs(point2.Y - cross.Y) ); - Vector2 collPos1; - Vector2 collSize1; + Vector2I collPos1; + Vector2I collSize1; if (point1.X == cross.X) //纵向加宽, 防止贴到其它墙 { - collPos1 = new Vector2(pos1.X - GameConfig.RoomSpace, pos1.Y); - collSize1 = new Vector2(size1.X + GameConfig.RoomSpace * 2, size1.Y); + collPos1 = new Vector2I(pos1.X - GameConfig.RoomSpace, pos1.Y); + collSize1 = new Vector2I(size1.X + GameConfig.RoomSpace * 2, size1.Y); } else //横向加宽, 防止贴到其它墙 { - collPos1 = new Vector2(pos1.X, pos1.Y - GameConfig.RoomSpace); - collSize1 = new Vector2(size1.X, size1.Y + GameConfig.RoomSpace * 2); + collPos1 = new Vector2I(pos1.X, pos1.Y - GameConfig.RoomSpace); + collSize1 = new Vector2I(size1.X, size1.Y + GameConfig.RoomSpace * 2); } if (_roomGrid.RectCollision(collPos1, collSize1)) @@ -1254,17 +1254,17 @@ return false; } - Vector2 collPos2; - Vector2 collSize2; + Vector2I collPos2; + Vector2I collSize2; if (point2.X == cross.X) //纵向加宽, 防止贴到其它墙 { - collPos2 = new Vector2(pos2.X - GameConfig.RoomSpace, pos2.Y); - collSize2 = new Vector2(size2.X + GameConfig.RoomSpace * 2, size2.Y); + collPos2 = new Vector2I(pos2.X - GameConfig.RoomSpace, pos2.Y); + collSize2 = new Vector2I(size2.X + GameConfig.RoomSpace * 2, size2.Y); } else //横向加宽, 防止贴到其它墙 { - collPos2 = new Vector2(pos2.X, pos2.Y - GameConfig.RoomSpace); - collSize2 = new Vector2(size2.X, size2.Y + GameConfig.RoomSpace * 2); + collPos2 = new Vector2I(pos2.X, pos2.Y - GameConfig.RoomSpace); + collSize2 = new Vector2I(size2.X, size2.Y + GameConfig.RoomSpace * 2); } if (_roomGrid.RectCollision(collPos2, collSize2)) @@ -1272,10 +1272,10 @@ return false; } - door2.RoomInfo.AisleArea.Add(new Rect2(pos1, size1)); - door2.RoomInfo.AisleArea.Add(new Rect2(pos2, size2)); - _roomGrid.AddRect(pos1, size1, true); - _roomGrid.AddRect(pos2, size2, true); + door2.RoomInfo.AisleArea.Add(new Rect2I(pos1, size1)); + door2.RoomInfo.AisleArea.Add(new Rect2I(pos2, size2)); + _roomGrid.SetRect(pos1, size1, true); + _roomGrid.SetRect(pos2, size2, true); return true; } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs index 16e45b0..70f37e4 100644 --- a/DungeonShooting_Godot/src/framework/map/RoomInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/RoomInfo.cs @@ -52,7 +52,7 @@ /// /// 连接该房间的过道占用区域信息 /// - public List AisleArea = new List(); + public List AisleArea = new List(); /// /// 下一个房间 diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 15115e6..614cbef 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -155,8 +155,16 @@ { foreach (var uiBase in _nestedUiSet) { + uiBase._targetUi = null; uiBase.DisposeUi(); } + _nestedUiSet.Clear(); + } + + //在父Ui中移除当前Ui + if (_targetUi != null) + { + _targetUi.RecordNestedUi(this, UiManager.RecordType.Close); } QueueFree(); diff --git a/DungeonShooting_Godot/src/framework/ui/UiNode.cs b/DungeonShooting_Godot/src/framework/ui/UiNode.cs index bfa30e2..78bd116 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiNode.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiNode.cs @@ -51,7 +51,11 @@ UiPanel.RecordNestedUi(uiBase, UiManager.RecordType.Open); uiBase.OnCreateUi(); - uiBase.ShowUi(); + if (UiPanel.IsOpen) + { + uiBase.ShowUi(); + } + return uiBase; } diff --git a/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTips.cs b/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTips.cs index 5900940..752e6af 100644 --- a/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTips.cs +++ b/DungeonShooting_Godot/src/game/ui/bottomTips/BottomTips.cs @@ -166,37 +166,37 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.AspectRatioContainer.TextureRect + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.AspectRatioContainer.TextureRect /// public BottomTips_TextureRect S_TextureRect => L_Panel.L_MarginContainer.L_CenterContainer.L_HBoxContainer.L_AspectRatioContainer.L_TextureRect; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.AspectRatioContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.AspectRatioContainer /// public BottomTips_AspectRatioContainer S_AspectRatioContainer => L_Panel.L_MarginContainer.L_CenterContainer.L_HBoxContainer.L_AspectRatioContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.Label + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer.Label /// public BottomTips_Label S_Label => L_Panel.L_MarginContainer.L_CenterContainer.L_HBoxContainer.L_Label; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer.HBoxContainer /// public BottomTips_HBoxContainer S_HBoxContainer => L_Panel.L_MarginContainer.L_CenterContainer.L_HBoxContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer.CenterContainer /// public BottomTips_CenterContainer S_CenterContainer => L_Panel.L_MarginContainer.L_CenterContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel.MarginContainer /// public BottomTips_MarginContainer S_MarginContainer => L_Panel.L_MarginContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: BottomTips.Panel /// public BottomTips_Panel S_Panel => L_Panel; diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs index d925d03..bf3436d 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorTools.cs @@ -716,92 +716,92 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer /// public EditorTools_HBoxContainer S_HBoxContainer => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.LineEdit + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3.LineEdit /// public EditorTools_LineEdit S_LineEdit => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer3.L_LineEdit; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer3 /// public EditorTools_HBoxContainer3 S_HBoxContainer3 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer3; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer4 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer4 /// public EditorTools_HBoxContainer4 S_HBoxContainer4 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer4; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer5 /// public EditorTools_HBoxContainer5 S_HBoxContainer5 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer5; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomNameInput + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomNameInput /// public EditorTools_RoomNameInput S_RoomNameInput => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_RoomNameInput; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label2 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label2 /// public EditorTools_Label2 S_Label2 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_Label2; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomGroupSelect + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomGroupSelect /// public EditorTools_RoomGroupSelect S_RoomGroupSelect => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_RoomGroupSelect; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label3 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.Label3 /// public EditorTools_Label3 S_Label3 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_Label3; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomTypeSelect + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6.RoomTypeSelect /// public EditorTools_RoomTypeSelect S_RoomTypeSelect => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6.L_RoomTypeSelect; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer6 /// public EditorTools_HBoxContainer6 S_HBoxContainer6 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer6; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer2 /// public EditorTools_HBoxContainer2 S_HBoxContainer2 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer2; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer.HBoxContainer7 /// public EditorTools_HBoxContainer7 S_HBoxContainer7 => L_ScrollContainer.L_MarginContainer.L_VBoxContainer.L_HBoxContainer7; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer.VBoxContainer /// public EditorTools_VBoxContainer S_VBoxContainer => L_ScrollContainer.L_MarginContainer.L_VBoxContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer.MarginContainer /// public EditorTools_MarginContainer S_MarginContainer => L_ScrollContainer.L_MarginContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.ScrollContainer /// public EditorTools_ScrollContainer S_ScrollContainer => L_ScrollContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.Confirm + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.Confirm /// public EditorTools_Confirm S_Confirm => L_Confirm; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.Tips + /// 场景中唯一名称的节点, 节点类型: , 节点路径: EditorTools.Tips /// public EditorTools_Tips S_Tips => L_Tips; diff --git a/DungeonShooting_Godot/src/game/ui/loading/Loading.cs b/DungeonShooting_Godot/src/game/ui/loading/Loading.cs index a30a2ef..8ac9098 100644 --- a/DungeonShooting_Godot/src/game/ui/loading/Loading.cs +++ b/DungeonShooting_Godot/src/game/ui/loading/Loading.cs @@ -56,12 +56,12 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Loading.ColorRect + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Loading.ColorRect /// public Loading_ColorRect S_ColorRect => L_ColorRect; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Loading.Label + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Loading.Label /// public Loading_Label S_Label => L_Label; diff --git a/DungeonShooting_Godot/src/game/ui/main/Main.cs b/DungeonShooting_Godot/src/game/ui/main/Main.cs index e27885a..523aa67 100644 --- a/DungeonShooting_Godot/src/game/ui/main/Main.cs +++ b/DungeonShooting_Godot/src/game/ui/main/Main.cs @@ -166,37 +166,37 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Title + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Title /// public Main_Title S_Title => L_Title; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Start + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Start /// public Main_Start S_Start => L_ButtonList.L_Start; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Tools + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Tools /// public Main_Tools S_Tools => L_ButtonList.L_Tools; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Setting + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Setting /// public Main_Setting S_Setting => L_ButtonList.L_Setting; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Exit + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList.Exit /// public Main_Exit S_Exit => L_ButtonList.L_Exit; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.ButtonList /// public Main_ButtonList S_ButtonList => L_ButtonList; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Version + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Main.Version /// public Main_Version S_Version => L_Version; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs index 6104242..31527c8 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditor.cs @@ -210,47 +210,47 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.Draw + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap.Draw /// public MapEditor_Draw S_Draw => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap.L_Draw; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.TileMap /// public MapEditor_TileMap S_TileMap => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_TileMap; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.CanvasLayer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport.CanvasLayer /// public MapEditor_CanvasLayer S_CanvasLayer => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport.L_CanvasLayer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView.SubViewport /// public MapEditor_SubViewport S_SubViewport => L_Bg.L_HSplitContainer.L_Left.L_MapView.L_SubViewport; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left.MapView /// public MapEditor_MapView S_MapView => L_Bg.L_HSplitContainer.L_Left.L_MapView; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Left /// public MapEditor_Left S_Left => L_Bg.L_HSplitContainer.L_Left; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Right + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer.Right /// public MapEditor_Right S_Right => L_Bg.L_HSplitContainer.L_Right; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg.HSplitContainer /// public MapEditor_HSplitContainer S_HSplitContainer => L_Bg.L_HSplitContainer; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditor.Bg /// public MapEditor_Bg S_Bg => L_Bg; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs index 97fb55e..afba1e4 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/MapEditorPanel.cs @@ -1,15 +1,21 @@ using Godot; +using UI.MapEditorTools; namespace UI.MapEditor; public partial class MapEditorPanel : MapEditor { - private EditorTileMapBar _editorTileMapBar; + /// + /// 左上角工具面板 + /// + public MapEditorToolsPanel ToolsPanel { get; private set; } + private EditorTileMapBar _editorTileMapBar; + public override void OnCreateUi() { - _editorTileMapBar = new EditorTileMapBar(S_TileMap); - S_CanvasLayer.OpenNestedUi(UiManager.UiName.MapEditorTools); + _editorTileMapBar = new EditorTileMapBar(this, S_TileMap); + ToolsPanel = S_CanvasLayer.OpenNestedUi(UiManager.UiName.MapEditorTools); } public override void OnShowUi() @@ -23,7 +29,6 @@ public override void OnHideUi() { S_Left.Instance.Resized -= OnMapViewResized; - _editorTileMapBar.OnHide(); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs index fa298d8..0780cb3 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMap.cs @@ -5,12 +5,19 @@ public partial class EditorTileMap : TileMap { + /// + /// 所属地图编辑器UI + /// + public MapEditorPanel MapEditorPanel { get; set; } + //鼠标坐标 private Vector2 _mousePosition; //鼠标所在的cell坐标 private Vector2I _mouseCellPosition; //上一帧鼠标所在的cell坐标 private Vector2I _prevMouseCellPosition = new Vector2I(-99999, -99999); + //单次绘制是否改变过tile数据 + private bool _changeFlag = false; //左键开始按下时鼠标所在的坐标 private Vector2I _mouseStartCellPosition; //鼠标中建是否按下 @@ -22,58 +29,56 @@ private bool _isRightPressed = false; //绘制填充区域 private bool _drawFullRect = false; - - public override void _Ready() - { - - } + //负责存储自动图块数据 + private Grid _autoCellLayerGrid = new Grid(); public override void _Process(double delta) { _drawFullRect = false; var position = GetLocalMousePosition(); - // _mouseCellPosition = new Vector2I( - // Mathf.FloorToInt(position.X / GameConfig.TileCellSize), - // Mathf.FloorToInt(position.Y / GameConfig.TileCellSize) - // ); _mouseCellPosition = LocalToMap(position); _mousePosition = new Vector2( _mouseCellPosition.X * GameConfig.TileCellSize, _mouseCellPosition.Y * GameConfig.TileCellSize ); - - //左键绘制 - if (_isLeftPressed) + + if (!MapEditorPanel.ToolsPanel.S_HBoxContainer.Instance.IsPositionOver(GetGlobalMousePosition())) //不在Ui节点上 { - if (Input.IsKeyPressed(Key.Shift)) //按住shift绘制矩形 + //左键绘制 + if (_isLeftPressed) { - _drawFullRect = true; + if (Input.IsKeyPressed(Key.Shift)) //按住shift绘制矩形 + { + _drawFullRect = true; + } + else if (_prevMouseCellPosition != _mouseCellPosition || !_changeFlag) //鼠标位置变过 + { + _changeFlag = true; + _prevMouseCellPosition = _mouseCellPosition; + //绘制单个图块 + //SetCell(GameConfig.FloorMapLayer, _mouseCellPosition, 0, new Vector2I(0,8)); + //绘制自动图块 + SetSingleAutoCell(_mouseCellPosition); + } } - else if (_prevMouseCellPosition != _mouseCellPosition) //鼠标位置变过 + else if (_isRightPressed) //右键擦除 { - _prevMouseCellPosition = _mouseCellPosition; - //绘制单个图块 - //SetCell(GameConfig.FloorMapLayer, _mouseCellPosition, 0, new Vector2I(0,8)); - //绘制自动图块 - SetSingleAutoCell(_mouseCellPosition); + if (Input.IsKeyPressed(Key.Shift)) //按住shift擦除矩形 + { + _drawFullRect = true; + } + else if (_prevMouseCellPosition != _mouseCellPosition || !_changeFlag) //鼠标位置变过 + { + _changeFlag = true; + _prevMouseCellPosition = _mouseCellPosition; + EraseSingleAutoCell(_mouseCellPosition); + } } - } - else if (_isRightPressed) //右键擦除 - { - if (Input.IsKeyPressed(Key.Shift)) //按住shift擦除矩形 + else if (_isMiddlePressed) //中建移动 { - _drawFullRect = true; + //GD.Print("移动..."); + Position = GetGlobalMousePosition() + _moveOffset; } - else if (_prevMouseCellPosition != _mouseCellPosition) - { - _prevMouseCellPosition = _mouseCellPosition; - EraseSingleAutoCell(_mouseCellPosition); - } - } - else if (_isMiddlePressed) //中建移动 - { - //GD.Print("移动..."); - Position = GetGlobalMousePosition() + _moveOffset; } } @@ -123,6 +128,7 @@ } else { + _changeFlag = false; if (_drawFullRect) //松开, 提交绘制的矩形区域 { SetRectAutoCell(_mouseStartCellPosition, _mouseCellPosition); @@ -140,6 +146,7 @@ } else { + _changeFlag = false; if (_drawFullRect) //松开, 提交擦除的矩形区域 { EraseRectAutoCell(_mouseStartCellPosition, _mouseCellPosition); @@ -208,6 +215,7 @@ //绘制自动图块 var arr = new Array(new [] { position }); SetCellsTerrainConnect(GameConfig.FloorMapLayer, arr, 0, 0, false); + _autoCellLayerGrid.Set(position.X, position.Y, true); } //绘制区域自动贴图 @@ -226,13 +234,13 @@ start.Y = temp; } - var x = end.X - start.X + 1; - var y = end.Y - start.Y + 1; + var width = end.X - start.X + 1; + var height = end.Y - start.Y + 1; var index = 0; - var array = new Vector2I[x * y]; - for (var i = 0; i < x; i++) + var array = new Vector2I[width * height]; + for (var i = 0; i < width; i++) { - for (var j = 0; j < y; j++) + for (var j = 0; j < height; j++) { array[index++] = new Vector2I(start.X + i, start.Y + j); } @@ -240,12 +248,27 @@ var arr = new Array(array); SetCellsTerrainConnect(GameConfig.FloorMapLayer, arr, 0, 0, false); + _autoCellLayerGrid.SetRect(start, new Vector2I(width, height), true); } //擦除单个自动图块 private void EraseSingleAutoCell(Vector2I position) { EraseCell(GameConfig.FloorMapLayer, position); + _autoCellLayerGrid.Remove(position.X, position.Y); + + //执行刷墙逻辑 + + //先检测对角是否有地板 + var left = _autoCellLayerGrid.Get(position.X - 1, position.Y); + var right = _autoCellLayerGrid.Get(position.X + 1, position.Y); + var top = _autoCellLayerGrid.Get(position.X, position.Y + 1); + var down = _autoCellLayerGrid.Get(position.X, position.Y - 1); + + if ((left && right) || (top && down)) + { + GD.Print("错误的地图块..."); + } } //擦除一个区域内的自动贴图 @@ -264,14 +287,35 @@ start.Y = temp; } - var x = end.X - start.X + 1; - var y = end.Y - start.Y + 1; - for (var i = 0; i < x; i++) + var width = end.X - start.X + 1; + var height = end.Y - start.Y + 1; + for (var i = 0; i < width; i++) { - for (var j = 0; j < y; j++) + for (var j = 0; j < height; j++) { EraseCell(GameConfig.FloorMapLayer, new Vector2I(start.X + i, start.Y + j)); } } + _autoCellLayerGrid.RemoveRect(start, new Vector2I(width, height)); + } + + public void OnSelectHandTool() + { + + } + + public void OnSelectPenTool() + { + GD.Print("...."); + } + + public void OnSelectRectTool() + { + + } + + public void OnClickCenterTool() + { + Position = MapEditorPanel.S_SubViewport.Instance.Size / 2; } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs index 5b31cdd..2865b79 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/TileView/EditorTileMapBar.cs @@ -1,22 +1,35 @@ -namespace UI.MapEditor; +using Godot; + +namespace UI.MapEditor; public class EditorTileMapBar { + private MapEditorPanel _editorPanel; private MapEditor.MapEditor_TileMap _editorTileMap; - public EditorTileMapBar(MapEditor.MapEditor_TileMap editorTileMap) + public EditorTileMapBar(MapEditorPanel editorPanel, MapEditor.MapEditor_TileMap editorTileMap) { _editorTileMap = editorTileMap; + _editorPanel = editorPanel; + _editorTileMap.Instance.MapEditorPanel = editorPanel; } public void OnShow() { _editorTileMap.L_Draw.Instance.Draw += OnDrawGuides; + _editorPanel.ToolsPanel.S_HandTool.Instance.Pressed += _editorTileMap.Instance.OnSelectHandTool; + _editorPanel.ToolsPanel.S_PenTool.Instance.Pressed += _editorTileMap.Instance.OnSelectPenTool; + _editorPanel.ToolsPanel.S_RectTool.Instance.Pressed += _editorTileMap.Instance.OnSelectRectTool; + _editorPanel.ToolsPanel.S_CenterTool.Instance.Pressed += _editorTileMap.Instance.OnClickCenterTool; } public void OnHide() { _editorTileMap.L_Draw.Instance.Draw -= OnDrawGuides; + _editorPanel.ToolsPanel.S_HandTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectHandTool; + _editorPanel.ToolsPanel.S_PenTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectPenTool; + _editorPanel.ToolsPanel.S_RectTool.Instance.Pressed -= _editorTileMap.Instance.OnSelectRectTool; + _editorPanel.ToolsPanel.S_CenterTool.Instance.Pressed -= _editorTileMap.Instance.OnClickCenterTool; } public void Process(float delta) diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs index 90d4527..0cac553 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorTools.cs @@ -24,39 +24,39 @@ } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.TextureButton + /// 类型: , 路径: MapEditorTools.HBoxContainer.HandTool /// - public class MapEditorTools_TextureButton : UiNode + public class MapEditorTools_HandTool : UiNode { - public MapEditorTools_TextureButton(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override MapEditorTools_TextureButton Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public MapEditorTools_HandTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public override MapEditorTools_HandTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.TextureButton2 + /// 类型: , 路径: MapEditorTools.HBoxContainer.PenTool /// - public class MapEditorTools_TextureButton2 : UiNode + public class MapEditorTools_PenTool : UiNode { - public MapEditorTools_TextureButton2(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override MapEditorTools_TextureButton2 Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public MapEditorTools_PenTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public override MapEditorTools_PenTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.TextureButton3 + /// 类型: , 路径: MapEditorTools.HBoxContainer.RectTool /// - public class MapEditorTools_TextureButton3 : UiNode + public class MapEditorTools_RectTool : UiNode { - public MapEditorTools_TextureButton3(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override MapEditorTools_TextureButton3 Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public MapEditorTools_RectTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public override MapEditorTools_RectTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// - /// 类型: , 路径: MapEditorTools.HBoxContainer.TextureButton4 + /// 类型: , 路径: MapEditorTools.HBoxContainer.CenterTool /// - public class MapEditorTools_TextureButton4 : UiNode + public class MapEditorTools_CenterTool : UiNode { - public MapEditorTools_TextureButton4(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } - public override MapEditorTools_TextureButton4 Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); + public MapEditorTools_CenterTool(MapEditorTools uiPanel, Godot.TextureButton node) : base(uiPanel, node) { } + public override MapEditorTools_CenterTool Clone() => new (UiPanel, (Godot.TextureButton)Instance.Duplicate()); } /// @@ -65,56 +65,56 @@ public class MapEditorTools_HBoxContainer : UiNode { /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.TextureButton + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.HandTool /// - public MapEditorTools_TextureButton L_TextureButton + public MapEditorTools_HandTool L_HandTool { get { - if (_L_TextureButton == null) _L_TextureButton = new MapEditorTools_TextureButton(UiPanel, Instance.GetNodeOrNull("TextureButton")); - return _L_TextureButton; + if (_L_HandTool == null) _L_HandTool = new MapEditorTools_HandTool(UiPanel, Instance.GetNodeOrNull("HandTool")); + return _L_HandTool; } } - private MapEditorTools_TextureButton _L_TextureButton; + private MapEditorTools_HandTool _L_HandTool; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.TextureButton2 + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.PenTool /// - public MapEditorTools_TextureButton2 L_TextureButton2 + public MapEditorTools_PenTool L_PenTool { get { - if (_L_TextureButton2 == null) _L_TextureButton2 = new MapEditorTools_TextureButton2(UiPanel, Instance.GetNodeOrNull("TextureButton2")); - return _L_TextureButton2; + if (_L_PenTool == null) _L_PenTool = new MapEditorTools_PenTool(UiPanel, Instance.GetNodeOrNull("PenTool")); + return _L_PenTool; } } - private MapEditorTools_TextureButton2 _L_TextureButton2; + private MapEditorTools_PenTool _L_PenTool; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.TextureButton3 + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.RectTool /// - public MapEditorTools_TextureButton3 L_TextureButton3 + public MapEditorTools_RectTool L_RectTool { get { - if (_L_TextureButton3 == null) _L_TextureButton3 = new MapEditorTools_TextureButton3(UiPanel, Instance.GetNodeOrNull("TextureButton3")); - return _L_TextureButton3; + if (_L_RectTool == null) _L_RectTool = new MapEditorTools_RectTool(UiPanel, Instance.GetNodeOrNull("RectTool")); + return _L_RectTool; } } - private MapEditorTools_TextureButton3 _L_TextureButton3; + private MapEditorTools_RectTool _L_RectTool; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.TextureButton4 + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: MapEditorTools.CenterTool /// - public MapEditorTools_TextureButton4 L_TextureButton4 + public MapEditorTools_CenterTool L_CenterTool { get { - if (_L_TextureButton4 == null) _L_TextureButton4 = new MapEditorTools_TextureButton4(UiPanel, Instance.GetNodeOrNull("TextureButton4")); - return _L_TextureButton4; + if (_L_CenterTool == null) _L_CenterTool = new MapEditorTools_CenterTool(UiPanel, Instance.GetNodeOrNull("CenterTool")); + return _L_CenterTool; } } - private MapEditorTools_TextureButton4 _L_TextureButton4; + private MapEditorTools_CenterTool _L_CenterTool; public MapEditorTools_HBoxContainer(MapEditorTools uiPanel, Godot.HBoxContainer node) : base(uiPanel, node) { } public override MapEditorTools_HBoxContainer Clone() => new (UiPanel, (Godot.HBoxContainer)Instance.Duplicate()); @@ -122,27 +122,27 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.TextureButton + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.HandTool /// - public MapEditorTools_TextureButton S_TextureButton => L_HBoxContainer.L_TextureButton; + public MapEditorTools_HandTool S_HandTool => L_HBoxContainer.L_HandTool; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.TextureButton2 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.PenTool /// - public MapEditorTools_TextureButton2 S_TextureButton2 => L_HBoxContainer.L_TextureButton2; + public MapEditorTools_PenTool S_PenTool => L_HBoxContainer.L_PenTool; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.TextureButton3 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.RectTool /// - public MapEditorTools_TextureButton3 S_TextureButton3 => L_HBoxContainer.L_TextureButton3; + public MapEditorTools_RectTool S_RectTool => L_HBoxContainer.L_RectTool; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.TextureButton4 + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer.CenterTool /// - public MapEditorTools_TextureButton4 S_TextureButton4 => L_HBoxContainer.L_TextureButton4; + public MapEditorTools_CenterTool S_CenterTool => L_HBoxContainer.L_CenterTool; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer + /// 场景中唯一名称的节点, 节点类型: , 节点路径: MapEditorTools.HBoxContainer /// public MapEditorTools_HBoxContainer S_HBoxContainer => L_HBoxContainer; diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs index 88497b7..71a65c0 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/MapEditorToolsPanel.cs @@ -7,7 +7,7 @@ public override void OnShowUi() { - + S_PenTool.Instance.EmitSignal(BaseButton.SignalName.Pressed); } public override void OnHideUi() diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs index 9123d37..6085846 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs @@ -540,47 +540,47 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Icon + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Icon /// public RoomUI_Icon S_Icon => L_InteractiveTipBar.L_Icon; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.InteractiveIcon + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.InteractiveIcon /// public RoomUI_InteractiveIcon S_InteractiveIcon => L_InteractiveTipBar.L_InteractiveIcon; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Line2D + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.Line2D /// public RoomUI_Line2D S_Line2D => L_InteractiveTipBar.L_Line2D; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.NameLabel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar.NameLabel /// public RoomUI_NameLabel S_NameLabel => L_InteractiveTipBar.L_NameLabel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.InteractiveTipBar /// public RoomUI_InteractiveTipBar S_InteractiveTipBar => L_InteractiveTipBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot.Block + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot.Block /// public RoomUI_Block S_Block => L_ReloadBar.L_Slot.L_Block; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar.Slot /// public RoomUI_Slot S_Slot => L_ReloadBar.L_Slot; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.ReloadBar /// public RoomUI_ReloadBar S_ReloadBar => L_ReloadBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.LifeBar.Life + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.LifeBar.Life /// public RoomUI_Life S_Life => L_Control.L_LifeBar.L_Life; @@ -590,42 +590,42 @@ public RoomUI_LifeBar S_LifeBar => L_Control.L_LifeBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.MapBar + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.MapBar /// public RoomUI_MapBar S_MapBar => L_Control.L_MapBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropBg + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropBg /// public RoomUI_ActivePropBg S_ActivePropBg => L_Control.L_ActivePropBar.L_ActivePropBg; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropSprite + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropSprite /// public RoomUI_ActivePropSprite S_ActivePropSprite => L_Control.L_ActivePropBar.L_ActivePropSprite; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.CooldownProgress + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.CooldownProgress /// public RoomUI_CooldownProgress S_CooldownProgress => L_Control.L_ActivePropBar.L_CooldownProgress; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropCount + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropCount /// public RoomUI_ActivePropCount S_ActivePropCount => L_Control.L_ActivePropBar.L_ActivePropCount; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropPanel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropPanel /// public RoomUI_ActivePropPanel S_ActivePropPanel => L_Control.L_ActivePropBar.L_ActivePropPanel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgressBar + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgressBar /// public RoomUI_ChargeProgressBar S_ChargeProgressBar => L_Control.L_ActivePropBar.L_ChargeProgressBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgress + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ChargeProgress /// public RoomUI_ChargeProgress S_ChargeProgress => L_Control.L_ActivePropBar.L_ChargeProgress; @@ -635,17 +635,17 @@ public RoomUI_ActivePropBar S_ActivePropBar => L_Control.L_ActivePropBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel.WeaponSprite + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel.WeaponSprite /// public RoomUI_WeaponSprite S_WeaponSprite => L_Control.L_WeaponBar.L_WeaponPanel.L_WeaponSprite; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.WeaponPanel /// public RoomUI_WeaponPanel S_WeaponPanel => L_Control.L_WeaponBar.L_WeaponPanel; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.AmmoCount + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.WeaponBar.AmmoCount /// public RoomUI_AmmoCount S_AmmoCount => L_Control.L_WeaponBar.L_AmmoCount; @@ -655,7 +655,7 @@ public RoomUI_WeaponBar S_WeaponBar => L_Control.L_WeaponBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control /// public RoomUI_Control S_Control => L_Control; diff --git a/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs b/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs index 3c7eca0..ba6da34 100644 --- a/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs +++ b/DungeonShooting_Godot/src/game/ui/settlement/Settlement.cs @@ -122,27 +122,27 @@ /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Bg + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Bg /// public Settlement_Bg S_Bg => L_Bg; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Title + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.Title /// public Settlement_Title S_Title => L_Title; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.Restart + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.Restart /// public Settlement_Restart S_Restart => L_ButtonList.L_Restart; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.ToMenu + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList.ToMenu /// public Settlement_ToMenu S_ToMenu => L_ButtonList.L_ToMenu; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Settlement.ButtonList /// public Settlement_ButtonList S_ButtonList => L_ButtonList;