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

65 lines
2.0 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>> LoadStaticData() { throw new System.NotImplementedException(); }
2022-11-06 21:34:17 +01:00
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 SaveStaticData(List<IndexValuePair<int, EquippableItemPrefabAsset>> _elements) { throw new System.NotImplementedException(); }
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();
Debug.Log(SaveModelSystem.Path);
try
{
SaveModelSystem.SaveModelList(_elements);
return true;
}
catch (Exception e) { Debug.LogError(e.Message); }
return false;
}
2022-11-06 21:34:17 +01:00
}