Scriptum/Assets/Scripts/REFACTORING/Application/Panel/Task/SceneTaskDataManager.cs

55 lines
1.5 KiB
C#
Raw Normal View History

2022-10-22 18:04:21 +02:00
using System;
2022-11-27 21:28:55 +01:00
using System.Collections.Generic;
2022-10-22 18:04:21 +02:00
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"; } }
2022-11-27 21:28:55 +01:00
[SerializeField] public List<Task> ElementsToBuildOnSceneList = new List<Task>();
public override void Start()
2022-10-22 18:04:21 +02:00
{
2022-11-27 21:28:55 +01:00
Debug.Log("Start SceneTaskdata manager");
2022-10-22 18:04:21 +02:00
2022-11-27 21:28:55 +01:00
//TaskUIManager.FindOrCreateInstance();
UiManager = TaskUIManager.Instance;
2022-10-22 18:04:21 +02:00
2022-11-27 21:28:55 +01:00
if (UiManager == null)
throw new NullReferenceException("TaskUIManager not found!!!");
2022-10-22 18:04:21 +02:00
2022-11-27 21:28:55 +01:00
DynamicDataList = (new TaskDataListManager()).SetUiManager(ref UiManager);
2022-11-27 21:28:55 +01:00
DataLoader = new SceneTaskDataLoader(OBJECT_LIST_NAME, OBJECT_FOLDER_NAME);
2022-10-22 18:04:21 +02:00
2022-11-27 21:28:55 +01:00
base.Start();
2022-10-22 18:04:21 +02:00
}
protected SceneBaseDataManager<Task> GetObjectType()
{
return GameObject.FindObjectOfType<SceneTaskDataManager>();
}
protected SceneBaseDataManager<Task> CreateInstance(ref GameObject managerGameObject)
{
return managerGameObject.AddComponent<SceneTaskDataManager>();
}
2022-11-27 21:28:55 +01:00
protected override void UseDefaultSettings()
{
DynamicDataList.SetList(ElementsToBuildOnSceneList);
UiManager.SetList(ElementsToBuildOnSceneList);
}
protected override void UseDynamicSettings()
{
LoadDynamicData();
UiManager.SetList(DynamicDataList.GetList());
}
2022-10-22 18:04:21 +02:00
}