private void SaveData()
    {
        if (ProgressData == null)
        {
            ProgressData = new PlayerProgressData();
        }

        SaveDataManager.Save(ProgressData, ProgressData.DirectoryPath, ProgressData.FileNamePath);
    }
示例#2
0
 private void Awake()
 {
     if (Instance == null)
     {
         //DontDestroyOnLoad(gameObject);
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
示例#3
0
    public void Clear()
    {
        Debug.Log("Clearing player progress");

        var path = System.IO.Path.Combine(Application.persistentDataPath, PlayerProgressFilename);

        if (File.Exists(path))
        {
            File.Delete(path);
        }

        data = new PlayerProgressData();
    }
示例#4
0
    public void Load()
    {
        var path = System.IO.Path.Combine(Application.persistentDataPath, PlayerProgressFilename);

        if (System.IO.File.Exists(path))
        {
            Debug.Log("Loading player progress from: " + path);

            var json = System.IO.File.ReadAllText(path);
            data = JsonUtility.FromJson <PlayerProgressData>(json);
        }
        else
        {
            Debug.Log("Creating new player progress");
            data = new PlayerProgressData();
        }
    }
 private void LoadData()
 {
     ProgressData = SaveDataManager.Load <PlayerProgressData>(ProgressData.DirectoryPath, ProgressData.FileNamePath);
 }