52 lines
1.0 KiB
C#
52 lines
1.0 KiB
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem.UI;
|
|
|
|
public class UIManager : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private InputSystemUIInputModule _inputSystemUIInputModule;
|
|
|
|
[SerializeField]
|
|
private GameObject _menuPanelUI;
|
|
[SerializeField]
|
|
private GameObject _successPanel;
|
|
[SerializeField]
|
|
private GameObject _gameOverPanel;
|
|
|
|
private void InitUI()
|
|
{
|
|
_menuPanelUI.SetActive(false);
|
|
_successPanel.SetActive(false);
|
|
_gameOverPanel.SetActive(false);
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
InitUI();
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
_inputSystemUIInputModule.cancel.action.performed += ctx => OnCancelAction();
|
|
}
|
|
|
|
public void SetMenuPanelActive(bool value)
|
|
{
|
|
_menuPanelUI.SetActive(value);
|
|
}
|
|
|
|
private void OnCancelAction()
|
|
{
|
|
SetMenuPanelActive(!_menuPanelUI.activeSelf);
|
|
}
|
|
|
|
public void ShowSuccessPanel()
|
|
{
|
|
_successPanel.SetActive(true);
|
|
}
|
|
|
|
public void ShowGameOverPanel()
|
|
{
|
|
_gameOverPanel.SetActive(true);
|
|
}
|
|
} |