2022-06-02 14:25:22 +02:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
2022-12-19 03:34:45 +01:00
|
|
|
/*
|
|
|
|
* IMPOSRTANT
|
|
|
|
* All methods must be binded in buttons actions list responsible for saving
|
|
|
|
*/
|
2022-06-02 14:25:22 +02:00
|
|
|
public class SaveController : MonoBehaviour
|
|
|
|
{
|
|
|
|
public void SaveScene()
|
|
|
|
{
|
|
|
|
string activeScene = SceneManager.GetActiveScene().name;
|
|
|
|
PlayerPrefs.SetString("SceneSaved", activeScene);
|
|
|
|
}
|
|
|
|
|
2022-12-06 01:20:01 +01:00
|
|
|
/// <summary>
|
|
|
|
/// Used only in 'MainMenu' scene in 'Contine' button
|
|
|
|
/// </summary>
|
2022-06-02 14:25:22 +02:00
|
|
|
public void LoadScene()
|
|
|
|
{
|
|
|
|
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
|
|
|
|
SceneManager.LoadScene(sceneToGoTo);
|
2022-10-01 19:28:26 +02:00
|
|
|
}
|
2022-10-02 18:45:58 +02:00
|
|
|
|
|
|
|
public void SaveHealth()
|
|
|
|
{
|
|
|
|
var player = GameObject.FindGameObjectWithTag("Player");
|
|
|
|
player.GetComponent<Player>().SaveCheckpoint();
|
2022-06-02 14:25:22 +02:00
|
|
|
}
|
2022-06-17 22:22:19 +02:00
|
|
|
|
2022-12-24 15:14:41 +01:00
|
|
|
public void SaveAccountBalance()
|
|
|
|
{
|
|
|
|
if (AccountBalanceManager.Instance)
|
|
|
|
AccountBalanceManager.Instance.SaveValue();
|
|
|
|
}
|
|
|
|
|
2022-12-19 03:34:45 +01:00
|
|
|
#region palyer panels data
|
2022-12-04 18:42:34 +01:00
|
|
|
public void SavePlayerEquipmentItems() // toDO change name to save Equipment - save items will save items on map eg after drops
|
2022-06-17 22:22:19 +02:00
|
|
|
{
|
2022-11-24 03:03:30 +01:00
|
|
|
EquipmentDataManager.Instance.SaveDynamicData();
|
2022-06-17 22:22:19 +02:00
|
|
|
}
|
2022-06-19 02:56:04 +02:00
|
|
|
|
2022-12-04 18:42:34 +01:00
|
|
|
public void SavePlayerQuests()
|
2022-06-19 02:56:04 +02:00
|
|
|
{
|
2022-11-27 21:28:55 +01:00
|
|
|
SceneTaskDataManager.Instance.SaveDynamicData();
|
2022-10-22 18:04:21 +02:00
|
|
|
|
|
|
|
// right now, we dont need to save dynamic list :D
|
2022-06-19 02:56:04 +02:00
|
|
|
}
|
2022-06-19 14:38:22 +02:00
|
|
|
|
2022-12-04 18:42:34 +01:00
|
|
|
public void SavePlayerInventory()
|
2022-06-19 14:38:22 +02:00
|
|
|
{
|
2022-11-27 21:28:55 +01:00
|
|
|
SceneInventoryDataManager.Instance.SaveDynamicData();
|
2022-06-19 14:38:22 +02:00
|
|
|
}
|
2022-12-19 03:34:45 +01:00
|
|
|
#endregion
|
2022-06-20 01:04:56 +02:00
|
|
|
|
|
|
|
public void SaveChests()
|
|
|
|
{
|
2022-12-06 01:20:01 +01:00
|
|
|
// 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();
|
2022-06-20 01:04:56 +02:00
|
|
|
}
|
2022-12-19 03:34:45 +01:00
|
|
|
|
|
|
|
public void SaveShops()
|
|
|
|
{
|
|
|
|
if(SceneShopDataManager.Instance)
|
|
|
|
SceneShopDataManager.Instance.SaveDynamicData();
|
|
|
|
}
|
2023-01-02 00:05:47 +01:00
|
|
|
|
|
|
|
public void SaveDialogues()
|
|
|
|
{
|
|
|
|
if (MultiDialogueDataManager.Instance)
|
|
|
|
MultiDialogueDataManager.Instance.SaveDynamicData();
|
|
|
|
}
|
2023-01-03 22:44:24 +01:00
|
|
|
|
|
|
|
public void SaveMissions()
|
|
|
|
{
|
|
|
|
if (MissionDataManager.Instance ) //&& MissionConditionDataManager.Instance
|
|
|
|
{
|
|
|
|
MissionDataManager.Instance.SaveDynamicData();
|
|
|
|
MissionConditionDataManager.Instance.SaveDynamicData();
|
|
|
|
}
|
|
|
|
}
|
2023-01-06 03:44:07 +01:00
|
|
|
|
|
|
|
public void SaveItemsOnMap()
|
|
|
|
{
|
|
|
|
if (SceneEquippableItemManager.Instance) //&& MissionConditionDataManager.Instance
|
|
|
|
{
|
|
|
|
SceneEquippableItemManager.Instance.SaveEquippableItems();
|
|
|
|
}
|
|
|
|
}
|
2022-06-02 14:25:22 +02:00
|
|
|
}
|