using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
/*
* IMPOSRTANT
* All methods must be binded in buttons actions list responsible for saving
*/
public class SaveController : MonoBehaviour
{
public void SaveScene()
{
string activeScene = SceneManager.GetActiveScene().name;
PlayerPrefs.SetString("SceneSaved", activeScene);
}
///
/// Used only in 'MainMenu' scene in 'Contine' button
///
public void LoadScene()
{
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
SceneManager.LoadScene(sceneToGoTo);
}
public void SaveHealth()
{
var player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent().SaveCheckpoint();
}
public void SaveAccountBalance()
{
if (AccountBalanceManager.Instance)
AccountBalanceManager.Instance.SaveValue();
}
#region palyer panels data
public void SavePlayerEquipmentItems() // toDO change name to save Equipment - save items will save items on map eg after drops
{
EquipmentDataManager.Instance.SaveDynamicData();
}
public void SavePlayerQuests()
{
SceneTaskDataManager.Instance.SaveDynamicData();
// right now, we dont need to save dynamic list :D
}
public void SavePlayerInventory()
{
SceneInventoryDataManager.Instance.SaveDynamicData();
}
#endregion
public void SaveChests()
{
// there may be mapos where we dont have this elements because we dont want to have there any chests - simple
// eg Cave Entrance
if(SceneChestDataManager.Instance)
SceneChestDataManager.Instance.SaveDynamicData();
}
public void SaveShops()
{
if(SceneShopDataManager.Instance)
SceneShopDataManager.Instance.SaveDynamicData();
}
public void SaveDialogues()
{
if (MultiDialogueDataManager.Instance)
MultiDialogueDataManager.Instance.SaveDynamicData();
}
public void SaveMissions()
{
if (MissionDataManager.Instance ) //&& MissionConditionDataManager.Instance
{
MissionDataManager.Instance.SaveDynamicData();
MissionConditionDataManager.Instance.SaveDynamicData();
}
}
public void SaveItemsOnMap()
{
if (SceneEquippableItemManager.Instance) //&& MissionConditionDataManager.Instance
{
SceneEquippableItemManager.Instance.SaveEquippableItems();
}
}
}