refactor(WatchMode): 将鼠标逻辑修改移动到PlayerWatchModeController当中

This commit is contained in:
2025-10-18 09:20:37 +08:00
parent da7ba72698
commit a86107b79d
2 changed files with 10 additions and 10 deletions

View File

@@ -57,12 +57,21 @@ namespace Gameplay.Player
{ {
case WatchMode.Normal: case WatchMode.Normal:
SetSeeLines(false); SetSeeLines(false);
inputManager.SetCursorState(false, CursorLockMode.Locked);
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
break; break;
case WatchMode.Inside: case WatchMode.Inside:
SetSeeLines(false); SetSeeLines(false);
inputManager.SetCursorState(true, CursorLockMode.Confined);
inputManager.SetInputForLook(false);
inputManager.SetInputForMove(false);
break; break;
case WatchMode.Outside: case WatchMode.Outside:
SetSeeLines(true); SetSeeLines(true);
inputManager.SetCursorState(false, CursorLockMode.Locked);
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
break; break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();

View File

@@ -33,7 +33,6 @@ namespace UI
private void Start() private void Start()
{ {
inputManager = InputManager.Instance;
} }
public void OnEnterInsideWatchMode() public void OnEnterInsideWatchMode()
@@ -47,16 +46,11 @@ namespace UI
} }
else else
{ {
//TODO: 这里可能需要显示“无可编辑对象”之类的提示
if (noEditableTargetPanel != null) if (noEditableTargetPanel != null)
{ {
noEditableTargetPanel.SetActive(true); noEditableTargetPanel.SetActive(true);
} }
} }
inputManager.SetCursorState(true, CursorLockMode.Confined);
inputManager.SetInputForLook(false);
inputManager.SetInputForMove(false);
} }
public void OnExitInsideWatchMode() public void OnExitInsideWatchMode()
@@ -69,9 +63,6 @@ namespace UI
noEditableTargetPanel.SetActive(false); noEditableTargetPanel.SetActive(false);
} }
inputManager.SetCursorState(true, CursorLockMode.Locked);
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
} }
// 获取 PlayerEditController 的回调 // 获取 PlayerEditController 的回调
@@ -128,7 +119,7 @@ namespace UI
componentViewers.Clear(); componentViewers.Clear();
} }
// TODO: 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。 // 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。
private void GenerateComponentUI() private void GenerateComponentUI()
{ {
if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return; if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return;