Scriptum/Assets/Scripts/REFACTORING/Application/Panel/Inventory/SceneInventoryDataLoader.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2022-11-06 21:34:17 +01:00
using System;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
2022-11-24 03:03:30 +01:00
public class SceneInventoryDataLoader : SceneBaseDataLoader<IndexValuePair<int, EquippableItemPrefabAsset>>
{
2022-11-06 21:34:17 +01:00
public SceneInventoryDataLoader(string _objectListName, string _objectFolderName)
{
SaveModelSystem = new SaveInventoryManager();
SaveModelSystem.ObjectFolderName = _objectFolderName;
SaveModelSystem.ObjectListName = _objectListName;
}
2022-11-24 03:03:30 +01:00
protected override List<IndexValuePair<int, EquippableItemPrefabAsset>> LoadGenericData()
2022-11-06 21:34:17 +01:00
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
return SaveModelSystem.LoadModelList();
}
2022-11-24 03:03:30 +01:00
protected override bool SaveGenericData(List<IndexValuePair<int, EquippableItemPrefabAsset>> _elements)
2022-11-06 21:34:17 +01:00
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
try
{
SaveModelSystem.SaveModelList(_elements);
return true;
}
catch (Exception e) { Debug.LogError(e.Message); }
return false;
}
2022-11-24 03:03:30 +01:00
protected override List<IndexValuePair<int, EquippableItemPrefabAsset>> LoadDynamicData()
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
return SaveModelSystem.LoadModelList();
}
2022-11-06 21:34:17 +01:00
2022-11-24 03:03:30 +01:00
protected override bool SaveDynamicData(List<IndexValuePair<int, EquippableItemPrefabAsset>> _elements)
{
SaveModelSystem.Path = PathBuilder.BuildSavePath().GetString();
2022-11-27 21:28:55 +01:00
return base.SaveDynamicData(_elements);
2022-11-24 03:03:30 +01:00
}
2022-11-06 21:34:17 +01:00
}