fix(): 修复设置事件注册丢失BUG,循环数据加载慢BUG
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user