Scriptum/Assets/Scripts/REFACTORING/Application/Shared/Manager/UI/Panel/PanelController.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2022-10-22 18:04:21 +02:00
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public abstract class PanelController<T> : MonoBehaviour, PanelControllerInterface<T>
{
[Header("Panel Information")]
[SerializeField] protected GameObject _panelContent;
//[SerializeField] private TaskBox TaskBoxTemplate;
[SerializeField] protected GameObject ChildBoxTemplate;
[SerializeField] protected List<GameObject> ChildBoxList;
/// <summary>
/// Fetch reference to static instance of UiManager script
/// </summary>
private static UIBaseManager<T> _uiManager;
protected UIBaseManager<T> UiManager
{
get
{
if (_uiManager == null) { return FetchUiManager(); }
return null;
}
}
// TODO decide whick method use and where bind object with itself
// public abstract void Bind(ManagerInterfac<T>e manager);
protected abstract UIBaseManager<T> FetchUiManager();
public virtual void SetUp(List<T> elements)
{
BuildPanelSlots();
BuildPanelContent(elements);
}
public virtual void BuildPanelContent(List<T> elements)
{
if (_panelContent == null)
throw new Exception("Panel content is not attaches");
}
public abstract void BuildPanelSlots();
public abstract GameObject BuildSlot(int key, GameObject _parent);
public abstract void ClearSlots();
}