diff --git a/DungeonShooting_Godot/prefab/ui/RoomMap.tscn b/DungeonShooting_Godot/prefab/ui/RoomMap.tscn index 64719f8..8e35f8c 100644 --- a/DungeonShooting_Godot/prefab/ui/RoomMap.tscn +++ b/DungeonShooting_Godot/prefab/ui/RoomMap.tscn @@ -1,15 +1,21 @@ -[gd_scene load_steps=2 format=3 uid="uid://dqajn31a4b0f8"] +[gd_scene load_steps=5 format=3 uid="uid://bmj3p25gwpqpn"] [ext_resource type="Script" path="res://src/game/ui/roomMap/RoomMapPanel.cs" id="1_ng7b3"] +[ext_resource type="Texture2D" uid="uid://k621mhhkg65f" path="res://resource/sprite/ui/roomUI/MapBar.png" id="2_m52os"] +[ext_resource type="Texture2D" uid="uid://0878uloew5jo" path="res://resource/sprite/ui/commonIcon/Block.png" id="3_el2ne"] +[ext_resource type="Texture2D" uid="uid://n4atvj5fkcpg" path="res://resource/sprite/ui/commonIcon/Add.png" id="5_4sud2"] [node name="RoomMap" type="Control"] layout_mode = 3 anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 script = ExtResource("1_ng7b3") [node name="Bg" type="ColorRect" parent="."] +visible = false layout_mode = 1 anchors_preset = 15 anchor_right = 1.0 @@ -17,3 +23,44 @@ grow_horizontal = 2 grow_vertical = 2 color = Color(0, 0, 0, 0.196078) + +[node name="MapBar" type="NinePatchRect" parent="."] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -257.0 +offset_top = 20.0 +offset_right = -198.0 +offset_bottom = 79.0 +grow_horizontal = 0 +scale = Vector2(4, 4) +texture = ExtResource("2_m52os") +patch_margin_left = 2 +patch_margin_top = 2 +patch_margin_right = 2 +patch_margin_bottom = 2 + +[node name="DrawContainer" type="TextureRect" parent="MapBar"] +clip_children = 1 +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 1.0 +offset_top = 1.0 +offset_right = -1.0 +offset_bottom = -1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_el2ne") +expand_mode = 1 + +[node name="Root" type="Node2D" parent="MapBar/DrawContainer"] +scale = Vector2(0.083, 0.083) + +[node name="Mark" type="Sprite2D" parent="MapBar/DrawContainer"] +modulate = Color(0.219608, 1, 0, 1) +position = Vector2(28, 28) +scale = Vector2(0.1, 0.1) +texture = ExtResource("5_4sud2") diff --git a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn index 029dad3..6718a80 100644 --- a/DungeonShooting_Godot/prefab/ui/RoomUI.tscn +++ b/DungeonShooting_Godot/prefab/ui/RoomUI.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=3 uid="uid://bvpmtfupny8iu"] +[gd_scene load_steps=20 format=3 uid="uid://bvpmtfupny8iu"] [ext_resource type="Script" path="res://src/game/ui/roomUI/RoomUIPanel.cs" id="1_tfcrp"] [ext_resource type="Texture2D" uid="uid://b67i86mtqrn32" path="res://resource/sprite/ui/roomUI/icon_bullet.png" id="2_ruc0p"] @@ -6,7 +6,6 @@ [ext_resource type="Texture2D" uid="uid://cukrx5yyqw86o" path="res://resource/sprite/ui/roomUI/ReloadBar.png" id="4_hy44s"] [ext_resource type="Texture2D" uid="uid://cx3i1nkcc4307" path="res://resource/sprite/ui/roomUI/ReloadBarBlock.png" id="5_w3lq2"] [ext_resource type="Texture2D" uid="uid://blywnftxn1cfd" path="res://resource/sprite/ui/roomUI/Life_full.png" id="6_ggviq"] -[ext_resource type="Texture2D" uid="uid://k621mhhkg65f" path="res://resource/sprite/ui/roomUI/MapBar.png" id="7_p6pvs"] [ext_resource type="Texture2D" uid="uid://cu0wlvrbntvyd" path="res://resource/sprite/prop/active/ActiveProp5000.png" id="10_5d4np"] [ext_resource type="Texture2D" uid="uid://b8u6s5n37157" path="res://resource/sprite/ui/roomUI/Panel2.png" id="10_eokvx"] [ext_resource type="Texture2D" uid="uid://0swkya4hn82c" path="res://resource/sprite/ui/roomUI/Panel.png" id="10_q3fs8"] @@ -15,7 +14,7 @@ [ext_resource type="Shader" path="res://resource/material/Blend.gdshader" id="12_fgyob"] [ext_resource type="Texture2D" uid="uid://dwysndc5ffski" path="res://resource/sprite/ui/roomUI/ChargeProgressBar.png" id="13_6w7qi"] [ext_resource type="Texture2D" uid="uid://ck0w7at3oat5" path="res://resource/sprite/ui/roomUI/ChargeProgress.png" id="13_vuglj"] -[ext_resource type="PackedScene" uid="uid://dqajn31a4b0f8" path="res://prefab/ui/RoomMap.tscn" id="16_rp3sg"] +[ext_resource type="PackedScene" uid="uid://bmj3p25gwpqpn" path="res://prefab/ui/RoomMap.tscn" id="16_rp3sg"] [sub_resource type="Gradient" id="1"] colors = PackedColorArray(0.4, 0.498039, 1, 1, 0.4, 0.498039, 1, 0.313726) @@ -172,18 +171,6 @@ offset_bottom = 10.0 texture = ExtResource("6_ggviq") -[node name="MapBar" type="TextureRect" parent="Control"] -layout_mode = 1 -anchors_preset = 1 -anchor_left = 1.0 -anchor_right = 1.0 -offset_left = -176.0 -offset_right = -132.0 -offset_bottom = 44.0 -grow_horizontal = 0 -scale = Vector2(4, 4) -texture = ExtResource("7_p6pvs") - [node name="ActivePropBar" type="Control" parent="Control"] layout_mode = 1 anchors_preset = 2 @@ -340,5 +327,4 @@ [node name="RoomMap" parent="." instance=ExtResource("16_rp3sg")] layout_mode = 1 -grow_horizontal = 2 -grow_vertical = 2 +metadata/_edit_lock_ = true diff --git a/DungeonShooting_Godot/resource/material/Outline.gdshader b/DungeonShooting_Godot/resource/material/Outline.gdshader new file mode 100644 index 0000000..bb3072e --- /dev/null +++ b/DungeonShooting_Godot/resource/material/Outline.gdshader @@ -0,0 +1,22 @@ +shader_type canvas_item; + +//轮廓颜色 +uniform vec4 outline_color : source_color = vec4(0.0, 0.0, 0.0, 1.0); + +void fragment() { + float a = COLOR.a; + //显示轮廓 + if (a == 0.0) { + vec2 size = TEXTURE_PIXEL_SIZE; + float outline; + outline = texture(TEXTURE, UV + vec2(-size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, size.y)).a; + outline += texture(TEXTURE, UV + vec2(size.x, 0)).a; + outline += texture(TEXTURE, UV + vec2(0, -size.y)).a; + outline = min(outline, 1.0); + if (outline > 0.0) { + COLOR = mix(COLOR, outline_color , 1); + COLOR.a = outline_color.a; + } + } +} diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png new file mode 100644 index 0000000..e8b825e --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png.import b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png.import new file mode 100644 index 0000000..e90e860 --- /dev/null +++ b/DungeonShooting_Godot/resource/sprite/ui/commonIcon/Block.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://0878uloew5jo" +path="res://.godot/imported/Block.png-4258899b4697128b8bd3fbca1e9d2093.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://resource/sprite/ui/commonIcon/Block.png" +dest_files=["res://.godot/imported/Block.png-4258899b4697128b8bd3fbca1e9d2093.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/sprite/ui/mapEditor/ErrorCell.png b/DungeonShooting_Godot/resource/sprite/ui/mapEditor/ErrorCell.png deleted file mode 100644 index e8b825e..0000000 --- a/DungeonShooting_Godot/resource/sprite/ui/mapEditor/ErrorCell.png +++ /dev/null Binary files differ diff --git a/DungeonShooting_Godot/resource/sprite/ui/mapEditor/ErrorCell.png.import b/DungeonShooting_Godot/resource/sprite/ui/mapEditor/ErrorCell.png.import deleted file mode 100644 index a2f26be..0000000 --- a/DungeonShooting_Godot/resource/sprite/ui/mapEditor/ErrorCell.png.import +++ /dev/null @@ -1,34 +0,0 @@ -[remap] - -importer="texture" -type="CompressedTexture2D" -uid="uid://0878uloew5jo" -path="res://.godot/imported/ErrorCell.png-adb91a4f9cc859a7b631f14ff0f58d18.ctex" -metadata={ -"vram_texture": false -} - -[deps] - -source_file="res://resource/sprite/ui/mapEditor/ErrorCell.png" -dest_files=["res://.godot/imported/ErrorCell.png-adb91a4f9cc859a7b631f14ff0f58d18.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/sprite/ui/roomUI/MapBar.png b/DungeonShooting_Godot/resource/sprite/ui/roomUI/MapBar.png index be17bb5..fba3dac 100644 --- a/DungeonShooting_Godot/resource/sprite/ui/roomUI/MapBar.png +++ b/DungeonShooting_Godot/resource/sprite/ui/roomUI/MapBar.png Binary files differ diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs index 9e73a1d..057fb53 100644 --- a/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/room/RoomDoorInfo.cs @@ -55,6 +55,11 @@ public DoorNavigationInfo Navigation; /// + /// 连接的过使用的导航网格 + /// + public NavigationPolygonData AisleNavigation; + + /// /// 门实例 /// public RoomDoor Door; diff --git a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs index 7929376..1266033 100644 --- a/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs +++ b/DungeonShooting_Godot/src/framework/map/room/RoomInfo.cs @@ -491,4 +491,19 @@ } } } + + /// + /// 遍历房间以及后面的房间 + /// + public void EachRoom(Action callback) + { + callback(this); + if (Next != null) + { + foreach (var room in Next) + { + room.EachRoom(callback); + } + } + } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs b/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs index bc142da..460e2b2 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/NavigationPolygonData.cs @@ -44,7 +44,7 @@ } /// - /// 读取所有的坐标点 + /// 读取所有的坐标点, 单位: 像素 /// public Vector2[] GetPoints() { diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index c2014f7..396fd8c 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -108,7 +108,7 @@ //固定帧率 //Engine.MaxFps = TargetFps; //调试绘制开关 - ActivityObject.IsDebug = false; + ActivityObject.IsDebug = true; //Engine.TimeScale = 0.2f; //调整窗口分辨率 OnWindowSizeChanged(); diff --git a/DungeonShooting_Godot/src/game/activity/role/player/PlayerRoleState.cs b/DungeonShooting_Godot/src/game/activity/role/player/PlayerRoleState.cs index e5ca3d5..ba70cce 100644 --- a/DungeonShooting_Godot/src/game/activity/role/player/PlayerRoleState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/player/PlayerRoleState.cs @@ -4,7 +4,7 @@ /// /// 翻滚速度 /// - public float RollSpeed = 180f; + public float RollSpeed = 170f; /// /// 翻滚持续时间 diff --git a/DungeonShooting_Godot/src/game/camera/GameCamera.cs b/DungeonShooting_Godot/src/game/camera/GameCamera.cs index b35d63a..1c0ea3b 100644 --- a/DungeonShooting_Godot/src/game/camera/GameCamera.cs +++ b/DungeonShooting_Godot/src/game/camera/GameCamera.cs @@ -27,7 +27,7 @@ public static GameCamera Main { get; private set; } /// - /// 相机坐标更新完成事件 + /// 相机坐标更新完成事件, 参数为 delta /// public event Action OnPositionUpdateEvent; diff --git a/DungeonShooting_Godot/src/game/manager/InputManager.cs b/DungeonShooting_Godot/src/game/manager/InputManager.cs index f492a66..0541530 100644 --- a/DungeonShooting_Godot/src/game/manager/InputManager.cs +++ b/DungeonShooting_Godot/src/game/manager/InputManager.cs @@ -98,6 +98,6 @@ UseActiveProp = Input.IsActionJustPressed("useActiveProp"); RemoveProp = Input.IsActionJustPressed("removeProp"); ExchangeProp = Input.IsActionJustPressed("exchangeProp"); - Map = Input.IsActionJustPressed("map"); + Map = Input.IsActionPressed("map"); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index 62e4256..34190dc 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -2,6 +2,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Linq; using Godot; /// @@ -214,6 +215,9 @@ //生成寻路网格, 这一步操作只生成过道的导航 _dungeonTileMap.GenerateNavigationPolygon(GameConfig.AisleFloorMapLayer); yield return 0; + //将导航网格绑定到 DoorInfo 上 + BindAisleNavigation(StartRoomInfo, _dungeonTileMap.GetPolygonData()); + yield return 0; //挂载过道导航区域 _dungeonTileMap.MountNavigationPolygon(World.TileRoot); yield return 0; @@ -313,6 +317,44 @@ finish(); } } + + //将导航网格绑定到 DoorInfo 上 + private void BindAisleNavigation(RoomInfo startRoom, NavigationPolygonData[] polygonDatas) + { + var list = polygonDatas.ToList(); + startRoom.EachRoom(roomInfo => + { + if (roomInfo.Doors != null) + { + foreach (var roomInfoDoor in roomInfo.Doors) + { + if (roomInfoDoor.IsForward) + { + var flag = false; + var doorPosition = roomInfoDoor.GetWorldOriginPosition(); + for (var i = 0; i < list.Count; i++) + { + var data = list[i]; + var points = data.GetPoints(); + foreach (var point in points) + { + if (point.DistanceSquaredTo(doorPosition) <= 32 * 32) + { + roomInfoDoor.AisleNavigation = data; + roomInfoDoor.ConnectDoor.AisleNavigation = data; + + flag = true; + list.RemoveAt(i); + } + } + } + + Debug.Log(roomInfo.Id + ", 是否找到连接过道: " + flag); + } + } + } + }); + } // 初始化房间 private void InitRoom(RoomInfo roomInfo) @@ -640,6 +682,16 @@ //绘制ai寻路区域 Utils.DrawNavigationPolygon(this, _roomStaticNavigationList.ToArray()); } + StartRoomInfo?.EachRoom(info => + { + foreach (var roomDoorInfo in info.Doors) + { + if (roomDoorInfo.IsForward) + { + DrawLine(roomDoorInfo.GetWorldOriginPosition(), roomDoorInfo.AisleNavigation.GetPoints()[0], Colors.Red, 2f); + } + } + }); //绘制房间区域 // if (_dungeonGenerator != null) // { diff --git a/DungeonShooting_Godot/src/game/ui/roomMap/PolygonOutline.cs b/DungeonShooting_Godot/src/game/ui/roomMap/PolygonOutline.cs new file mode 100644 index 0000000..1cde296 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/roomMap/PolygonOutline.cs @@ -0,0 +1,27 @@ +using Godot; + +namespace UI.RoomMap; + +public partial class PolygonOutline : Polygon2D +{ + private Vector2[] _points; + + public override void _Ready() + { + Color = new Color(0, 0, 0, 0.5882353F); + } + + public void SetPoints(Vector2[] points) + { + _points = points; + Polygon = points; + } + + public override void _Draw() + { + for (var i = 0; i < _points.Length; i++) + { + DrawLine(_points[i], _points[(i + 1) % _points.Length], Colors.Red, 6f); + } + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs index a48ca30..f1deb43 100644 --- a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs +++ b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMap.cs @@ -18,6 +18,19 @@ } private Bg _L_Bg; + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomMap.MapBar + /// + public MapBar L_MapBar + { + get + { + if (_L_MapBar == null) _L_MapBar = new MapBar((RoomMapPanel)this, GetNode("MapBar")); + return _L_MapBar; + } + } + private MapBar _L_MapBar; + public RoomMap() : base(nameof(RoomMap)) { @@ -37,10 +50,105 @@ public override Bg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); } + /// + /// 类型: , 路径: RoomMap.MapBar.DrawContainer.Root + /// + public class Root : UiNode + { + public Root(RoomMapPanel uiPanel, Godot.Node2D node) : base(uiPanel, node) { } + public override Root Clone() => new (UiPanel, (Godot.Node2D)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: RoomMap.MapBar.DrawContainer.Mark + /// + public class Mark : UiNode + { + public Mark(RoomMapPanel uiPanel, Godot.Sprite2D node) : base(uiPanel, node) { } + public override Mark Clone() => new (UiPanel, (Godot.Sprite2D)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: RoomMap.MapBar.DrawContainer + /// + public class DrawContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomMap.MapBar.Root + /// + public Root L_Root + { + get + { + if (_L_Root == null) _L_Root = new Root(UiPanel, Instance.GetNode("Root")); + return _L_Root; + } + } + private Root _L_Root; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomMap.MapBar.Mark + /// + public Mark L_Mark + { + get + { + if (_L_Mark == null) _L_Mark = new Mark(UiPanel, Instance.GetNode("Mark")); + return _L_Mark; + } + } + private Mark _L_Mark; + + public DrawContainer(RoomMapPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } + public override DrawContainer Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: RoomMap.MapBar + /// + public class MapBar : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomMap.DrawContainer + /// + public DrawContainer L_DrawContainer + { + get + { + if (_L_DrawContainer == null) _L_DrawContainer = new DrawContainer(UiPanel, Instance.GetNode("DrawContainer")); + return _L_DrawContainer; + } + } + private DrawContainer _L_DrawContainer; + + public MapBar(RoomMapPanel uiPanel, Godot.NinePatchRect node) : base(uiPanel, node) { } + public override MapBar Clone() => new (UiPanel, (Godot.NinePatchRect)Instance.Duplicate()); + } + /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.Bg /// public Bg S_Bg => L_Bg; + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.MapBar.DrawContainer.Root + /// + public Root S_Root => L_MapBar.L_DrawContainer.L_Root; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.MapBar.DrawContainer.Mark + /// + public Mark S_Mark => L_MapBar.L_DrawContainer.L_Mark; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.MapBar.DrawContainer + /// + public DrawContainer S_DrawContainer => L_MapBar.L_DrawContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomMap.MapBar + /// + public MapBar S_MapBar => L_MapBar; + } diff --git a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs index 5e06dad..62afa94 100644 --- a/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/roomMap/RoomMapPanel.cs @@ -1,3 +1,4 @@ +using System.Linq; using Godot; namespace UI.RoomMap; @@ -7,12 +8,68 @@ public override void OnCreateUi() { - + DrawRoom(); } public override void OnDestroyUi() { - } + public override void Process(float delta) + { + // //按下地图按键 + // if (InputManager.Map && !S_RoomMap.Instance.IsOpen) + // { + // World.Current.Pause = true; + // S_RoomMap.Instance.ShowUi(); + // } + // else if (!InputManager.Map && S_RoomMap.Instance.IsOpen) + // { + // S_RoomMap.Instance.HideUi(); + // World.Current.Pause = false; + // } + + S_Root.Instance.Position = S_DrawContainer.Instance.Size / 2 - Player.Current.Position / 12; + } + + private void DrawRoom() + { + var startRoom = GameApplication.Instance.DungeonManager.StartRoomInfo; + startRoom.EachRoom(roomInfo => + { + var navigationPolygonData = roomInfo.RoomSplit.TileInfo.NavigationList[0]; + var points = navigationPolygonData.GetPoints(); + var newPoints = new Vector2[points.Length]; + for (var i = 0; i < points.Length; i++) + { + newPoints[i] = roomInfo.ToGlobalPosition(points[i]); + } + + var outline = new PolygonOutline(); + outline.SetPoints(newPoints); + S_Root.AddChild(outline); + + if (roomInfo.Doors != null) + { + foreach (var doorInfo in roomInfo.Doors) + { + if (doorInfo.IsForward) + { + var aislePoints = doorInfo.Navigation.CloseNavigationData.GetPoints(); + var newAislePoints = new Vector2[aislePoints.Length]; + for (var i = 0; i < aislePoints.Length; i++) + { + newAislePoints[i] = roomInfo.ToGlobalPosition(aislePoints[i]); + } + + var aisleOutline = new PolygonOutline(); + aisleOutline.SetPoints(newAislePoints); + S_Root.AddChild(aisleOutline); + } + } + } + //roomInfo.Doors[0].Navigation.OpenNavigationData + }); + + } } diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs index 2aa8ce3..1f8e5af 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/RoomUI.cs @@ -254,15 +254,6 @@ } /// - /// 类型: , 路径: RoomUI.Control.MapBar - /// - public class MapBar : UiNode - { - public MapBar(RoomUIPanel uiPanel, Godot.TextureRect node) : base(uiPanel, node) { } - public override MapBar Clone() => new (UiPanel, (Godot.TextureRect)Instance.Duplicate()); - } - - /// /// 类型: , 路径: RoomUI.Control.ActivePropBar.ActivePropBg /// public class ActivePropBg : UiNode @@ -519,19 +510,6 @@ private LifeBar _L_LifeBar; /// - /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.MapBar - /// - public MapBar L_MapBar - { - get - { - if (_L_MapBar == null) _L_MapBar = new MapBar(UiPanel, Instance.GetNode("MapBar")); - return _L_MapBar; - } - } - private MapBar _L_MapBar; - - /// /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: RoomUI.ActivePropBar /// public ActivePropBar L_ActivePropBar @@ -629,11 +607,6 @@ public LifeBar S_LifeBar => L_Control.L_LifeBar; /// - /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.MapBar - /// - public MapBar S_MapBar => L_Control.L_MapBar; - - /// /// 场景中唯一名称的节点, 节点类型: , 节点路径: RoomUI.Control.ActivePropBar.ActivePropBg /// public ActivePropBg S_ActivePropBg => L_Control.L_ActivePropBar.L_ActivePropBg;