feat(Cycle):实现循环提前检测,修复交互提示消失,按键绑定的事件在重启的时候没能正确,触发循环的提前检测有错误

This commit is contained in:
2025-10-27 10:31:01 +08:00
parent e8b9f47067
commit 9646483fa6
36 changed files with 6743 additions and 5221 deletions

View File

@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Core;
@@ -138,5 +139,11 @@ namespace UI
//go.SendMessage("SetComponent", components[i], SendMessageOptions.DontRequireReceiver);
}
}
private void OnDestroy()
{
editController.OnBeginEditTarget -= OnBeginEdit;
editController.OnEndEditTarget -= OnEndEdit;
}
}
}

View File

@@ -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);
}