refactor(UI):完善对于各个界面的管理逻辑,esc可以直接关闭所有的顶层UI
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user