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

52 lines
1.5 KiB
C#

using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class SceneInventoryDataLoader : SceneBaseDataLoader<IndexValuePair<int, EquippableItemPrefabAsset>>
{
public SceneInventoryDataLoader(string _objectListName, string _objectFolderName)
{
SaveModelSystem = new SaveInventoryManager();
SaveModelSystem.ObjectFolderName = _objectFolderName;
SaveModelSystem.ObjectListName = _objectListName;
}
protected override List<IndexValuePair<int, EquippableItemPrefabAsset>> LoadGenericData()
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
return SaveModelSystem.LoadModelList();
}
protected override bool SaveGenericData(List<IndexValuePair<int, EquippableItemPrefabAsset>> _elements)
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
try
{
SaveModelSystem.SaveModelList(_elements);
return true;
}
catch (Exception e) { Debug.LogError(e.Message); }
return false;
}
protected override List<IndexValuePair<int, EquippableItemPrefabAsset>> LoadDynamicData()
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
return SaveModelSystem.LoadModelList();
}
protected override bool SaveDynamicData(List<IndexValuePair<int, EquippableItemPrefabAsset>> _elements)
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
return base.SaveDynamicData(_elements);
}
}