feat(Cycle):实现循环提前检测,修复交互提示消失,按键绑定的事件在重启的时候没能正确,触发循环的提前检测有错误
This commit is contained in:
@@ -5,6 +5,7 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using Script.Gameplay.Input;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UI
|
||||
{
|
||||
@@ -12,6 +13,7 @@ namespace UI
|
||||
{
|
||||
[SerializeField] private TMP_Text TitleText;
|
||||
[SerializeField] private TMP_Text ContentText;
|
||||
[SerializeField] private Button reloadButton;
|
||||
|
||||
private InputManager inputManager;
|
||||
protected override void Awake()
|
||||
@@ -19,6 +21,16 @@ namespace UI
|
||||
base.Awake();
|
||||
inputManager = InputManager.Instance;
|
||||
inputManager.Input.Player.Setting.performed += RegisterInput;
|
||||
reloadButton.onClick.AddListener(OnReloadButtonClicked);
|
||||
}
|
||||
|
||||
private void OnReloadButtonClicked()
|
||||
{
|
||||
GameManager.Instance.ReStartGame();
|
||||
ContentText.text = "循环次数:" + GameDataManager.Instance.TotalLoopCount.ToString();
|
||||
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
||||
inputManager.SetInputForLook(true);
|
||||
inputManager.SetInputForMove(true);
|
||||
}
|
||||
|
||||
private void RegisterInput(InputAction.CallbackContext ctx)
|
||||
@@ -26,12 +38,14 @@ namespace UI
|
||||
if (!isActiveAndEnabled)
|
||||
{
|
||||
Show();
|
||||
inputManager.SetCursorState(true, CursorLockMode.Confined);
|
||||
inputManager.SetInputForLook(false);
|
||||
inputManager.SetInputForMove(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide();
|
||||
inputManager.SetCursorState(false, CursorLockMode.Locked);
|
||||
inputManager.SetInputForLook(true);
|
||||
inputManager.SetInputForMove(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user