66 lines
1.6 KiB
C#
66 lines
1.6 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class UIManager : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private TimeSliderUI _timeSliderPrefab;
|
|
[SerializeField]
|
|
private JobSelectorUI _jobSelectorPrefab;
|
|
[SerializeField]
|
|
private GameObject _blurOverlay;
|
|
[SerializeField]
|
|
private PopupItemMenu _itemPopupMenuPrefab;
|
|
|
|
public static UIManager Instance { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
if (Instance != null)
|
|
{
|
|
return;
|
|
}
|
|
Instance = this;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
_blurOverlay.SetActive(false);
|
|
}
|
|
|
|
public void ShowTimeSliderDialog(string title, string description, Action onCancel, Action<TimeSpan> onConfirm)
|
|
{
|
|
var timeSlider = Instantiate(_timeSliderPrefab, transform);
|
|
timeSlider.ShowTimeSliderDialog(title, description, onCancel, onConfirm);
|
|
}
|
|
|
|
public void ShowJobSelectionDialog(string title, Action onCancel, Action<JobInfoSO> onConfirm)
|
|
{
|
|
var jobSelector = Instantiate(_jobSelectorPrefab, transform);
|
|
jobSelector.ShowJobSelectionDialog(title, onCancel, onConfirm);
|
|
}
|
|
|
|
public void ShowItemsMenu()
|
|
{
|
|
var popupMenu = Instantiate(_itemPopupMenuPrefab) as PopupItemMenu;
|
|
popupMenu.transform.transform.SetParent(transform, false);
|
|
popupMenu.transform.position = Input.mousePosition;
|
|
popupMenu.ShowButtons();
|
|
}
|
|
|
|
public void Freeze()
|
|
{
|
|
_blurOverlay.SetActive(true);
|
|
}
|
|
|
|
public void Unfreeze()
|
|
{
|
|
_blurOverlay.SetActive(false);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
}
|
|
|
|
}
|