67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class UIManager : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private TimeSliderUI _timeSliderPrefab;
|
|
[SerializeField]
|
|
private JobSelectorUI _jobSelectorPrefab;
|
|
[SerializeField]
|
|
private GameObject _blurOverlay;
|
|
[SerializeField]
|
|
private RadialMenuItem _radialMenuItemPrefab;
|
|
|
|
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(Dictionary<RadialMenuActions, RadialMenuActionDescription> actions,Action<RadialMenuActions> itemsMenuCallback)
|
|
{
|
|
var popupMenu = Instantiate(_radialMenuItemPrefab);
|
|
popupMenu.transform.transform.SetParent(transform, false);
|
|
popupMenu.transform.position = Input.mousePosition;
|
|
popupMenu.ShowButtons(actions,itemsMenuCallback);
|
|
}
|
|
|
|
public void Freeze()
|
|
{
|
|
_blurOverlay.SetActive(true);
|
|
}
|
|
|
|
public void Unfreeze()
|
|
{
|
|
_blurOverlay.SetActive(false);
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
}
|
|
|
|
}
|