fix(): 修复设置事件注册丢失BUG,循环数据加载慢BUG

This commit is contained in:
2025-10-26 10:19:23 +08:00
parent 9094b17a3d
commit 8bd5849cd1
5 changed files with 174 additions and 14 deletions

View File

@@ -4,6 +4,7 @@ using Script.Gameplay.Global;
using TMPro;
using UnityEngine;
using Script.Gameplay.Input;
using UnityEngine.InputSystem;
namespace UI
{
@@ -17,21 +18,23 @@ namespace UI
{
base.Awake();
inputManager = InputManager.Instance;
inputManager.Input.Player.Setting.performed+= ctx =>
inputManager.Input.Player.Setting.performed += RegisterInput;
}
private void RegisterInput(InputAction.CallbackContext ctx)
{
if (!isActiveAndEnabled)
{
if (!isActiveAndEnabled)
{
Show();
inputManager.SetInputForLook(false);
inputManager.SetInputForMove(false);
}
else
{
Hide();
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
}
};
Show();
inputManager.SetInputForLook(false);
inputManager.SetInputForMove(false);
}
else
{
Hide();
inputManager.SetInputForLook(true);
inputManager.SetInputForMove(true);
}
}
public override void Show()
@@ -44,5 +47,10 @@ namespace UI
{
base.Hide();
}
private void OnDestroy()
{
inputManager.Input.Player.Setting.performed -= RegisterInput;
}
}
}