Neg_Utils/NEG/UI/UiManager.cs

51 lines
1.0 KiB
C#

using NEG.UI.Area;
using System.Collections.Generic;
using UnityEngine;
namespace NEG.UI
{
public class UiManager
{
//TODO: use default unity selection
//TODO: window snaping to slots
public static UiManager Instance { get; private set; }
public IArea CurrentArea
{
get => currentArea;
set
{
if (value == null)
{
Debug.LogError("CurrentArea can't be null");
return;
}
currentArea?.SetEnabled(false);
currentArea = value;
currentArea.SetEnabled(true);
}
}
private IArea currentArea;
public UiManager(IArea startArea)
{
if (Instance != null)
{
Debug.LogError("Only one instance od UiManager is allowed");
return;
}
Instance = this;
CurrentArea = startArea;
}
}
}