diff --git a/DungeonShooting_Godot/scene/Main.tscn b/DungeonShooting_Godot/scene/Main.tscn index e121019..0b7e589 100644 --- a/DungeonShooting_Godot/scene/Main.tscn +++ b/DungeonShooting_Godot/scene/Main.tscn @@ -20,14 +20,12 @@ shader = SubResource("1") shader_parameter/offset = Vector2(0, 0) -[node name="Main" type="Node2D" node_paths=PackedStringArray("SubViewport", "SubViewportContainer", "SceneRoot", "Ui", "GlobalNodeRoot", "UiCanvas")] +[node name="Main" type="Node2D" node_paths=PackedStringArray("SubViewport", "SubViewportContainer", "SceneRoot", "GlobalNodeRoot")] script = ExtResource("3") SubViewport = NodePath("ViewCanvas/SubViewportContainer/SubViewport") SubViewportContainer = NodePath("ViewCanvas/SubViewportContainer") SceneRoot = NodePath("ViewCanvas/SubViewportContainer/SubViewport/SceneRoot") -Ui = NodePath("") GlobalNodeRoot = NodePath("GlobalNodeRoot") -UiCanvas = NodePath("") [node name="ViewCanvas" type="CanvasLayer" parent="."] layer = -1 diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 6832282..183c2bf 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Text.Json; using Godot; -using UI.RoomUI; public partial class GameApplication : Node2D { @@ -104,7 +103,7 @@ { // 3.5写法 //return (viewPos - GameCamera.Main.GlobalPosition + (GameConfig.ViewportSize / 2)) * GameConfig.WindowScale - GameCamera.Main.SubPixelPosition; - return (viewPos - GameCamera.Main.GlobalPosition + (GameConfig.ViewportSize / 2)) * GameConfig.WindowScale; + return (viewPos - (GameCamera.Main.GlobalPosition + GameCamera.Main.Offset) + (GameConfig.ViewportSize / 2)) * GameConfig.WindowScale; } //初始化房间配置 diff --git a/DungeonShooting_Godot/src/game/ui/Cursor.cs b/DungeonShooting_Godot/src/game/ui/Cursor.cs index 7bc0a69..f2447a9 100644 --- a/DungeonShooting_Godot/src/game/ui/Cursor.cs +++ b/DungeonShooting_Godot/src/game/ui/Cursor.cs @@ -97,6 +97,7 @@ } scope = len / GameConfig.ScatteringDistance * scope; } + scope = Mathf.Clamp(scope, 0, 200); lt.Position = new Vector2(-scope, -scope); lb.Position = new Vector2(-scope, scope); rt.Position = new Vector2(scope, -scope);