From a86107b79dff45220ec989835c51f230b2039e9c Mon Sep 17 00:00:00 2001 From: GanX <2423855310@qq.com> Date: Sat, 18 Oct 2025 09:20:37 +0800 Subject: [PATCH] =?UTF-8?q?refactor(WatchMode):=20=E5=B0=86=E9=BC=A0?= =?UTF-8?q?=E6=A0=87=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E5=88=B0PlayerWatchModeController=E5=BD=93=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Gameplay/Player/PlayerWatchModeController.cs | 9 +++++++++ Assets/Script/Gameplay/UI/PlayerEditViewer.cs | 11 +---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs index 45abbfc..39bde59 100644 --- a/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs +++ b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs @@ -57,12 +57,21 @@ namespace Gameplay.Player { case WatchMode.Normal: SetSeeLines(false); + inputManager.SetCursorState(false, CursorLockMode.Locked); + inputManager.SetInputForLook(true); + inputManager.SetInputForMove(true); break; case WatchMode.Inside: SetSeeLines(false); + inputManager.SetCursorState(true, CursorLockMode.Confined); + inputManager.SetInputForLook(false); + inputManager.SetInputForMove(false); break; case WatchMode.Outside: SetSeeLines(true); + inputManager.SetCursorState(false, CursorLockMode.Locked); + inputManager.SetInputForLook(true); + inputManager.SetInputForMove(true); break; default: throw new ArgumentOutOfRangeException(); diff --git a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs index 150cfd3..90accbc 100644 --- a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs +++ b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs @@ -33,7 +33,6 @@ namespace UI private void Start() { - inputManager = InputManager.Instance; } public void OnEnterInsideWatchMode() @@ -47,16 +46,11 @@ namespace UI } else { - //TODO: 这里可能需要显示“无可编辑对象”之类的提示 if (noEditableTargetPanel != null) { noEditableTargetPanel.SetActive(true); } } - - inputManager.SetCursorState(true, CursorLockMode.Confined); - inputManager.SetInputForLook(false); - inputManager.SetInputForMove(false); } public void OnExitInsideWatchMode() @@ -69,9 +63,6 @@ namespace UI noEditableTargetPanel.SetActive(false); } - inputManager.SetCursorState(true, CursorLockMode.Locked); - inputManager.SetInputForLook(true); - inputManager.SetInputForMove(true); } // 获取 PlayerEditController 的回调 @@ -128,7 +119,7 @@ namespace UI componentViewers.Clear(); } - // TODO: 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。 + // 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。 private void GenerateComponentUI() { if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return;