Scriptum/Assets/Scripts/REFACTORING/Application/Panel/Task/SceneTaskDataManager.cs
2022-11-28 00:52:47 +01:00

55 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using UnityEngine;
public class SceneTaskDataManager : SceneBaseDataManager<Task>
{
protected override string OBJECT_FOLDER_NAME { get { return "Quest"; } }
protected override string OBJECT_LIST_NAME { get { return "QuestsList"; } }
[SerializeField] public List<Task> ElementsToBuildOnSceneList = new List<Task>();
public override void Start()
{
Debug.Log("Start SceneTaskdata manager");
//TaskUIManager.FindOrCreateInstance();
UiManager = TaskUIManager.Instance;
if (UiManager == null)
throw new NullReferenceException("TaskUIManager not found!!!");
DynamicDataList = (new TaskDataListManager()).SetUiManager(ref UiManager);
DataLoader = new SceneTaskDataLoader(OBJECT_LIST_NAME, OBJECT_FOLDER_NAME);
base.Start();
}
protected SceneBaseDataManager<Task> GetObjectType()
{
return GameObject.FindObjectOfType<SceneTaskDataManager>();
}
protected SceneBaseDataManager<Task> CreateInstance(ref GameObject managerGameObject)
{
return managerGameObject.AddComponent<SceneTaskDataManager>();
}
protected override void UseDefaultSettings()
{
DynamicDataList.SetList(ElementsToBuildOnSceneList);
UiManager.SetList(ElementsToBuildOnSceneList);
}
protected override void UseDynamicSettings()
{
LoadDynamicData();
UiManager.SetList(DynamicDataList.GetList());
}
}