refactor(UI):完善对于各个界面的管理逻辑,esc可以直接关闭所有的顶层UI

This commit is contained in:
2025-10-27 21:41:25 +08:00
parent 1462f4689e
commit 4951f25187
21 changed files with 18049 additions and 6374 deletions

View File

@@ -16,14 +16,20 @@ namespace UI
[SerializeField] private Button reloadButton;
private InputManager inputManager;
protected override void Awake()
{
base.Awake();
inputManager = InputManager.Instance;
inputManager.Input.Player.Setting.performed += RegisterInput;
reloadButton.onClick.AddListener(OnReloadButtonClicked);
}
protected override void Start()
{
base.Start();
inputManager = InputManager.Instance;
inputManager.Input.Player.Setting.performed += (ctx) => { UIManager.Instance.SwitchUI<SettingViewer>(); };
}
private void OnReloadButtonClicked()
{
GameManager.Instance.ReStartGame();
@@ -32,7 +38,7 @@ namespace UI
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
}
private void RegisterInput(InputAction.CallbackContext ctx)
{
if (!isActiveAndEnabled)