Example #1
0
        public void SaveSettings()
        {
            List <string> toSave = new List <string>();

            toSave.Add(AudioManager.MusicVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
            toSave.Add(AudioManager.SoundVolume.ToString(System.Globalization.CultureInfo.InvariantCulture));
            toSave.Add(UseTrajectory.ToString());
            FileSaverLoader.SaveToFile(toSave, miscsave);
        }
Example #2
0
        public void SaveToFile()
        {
            List <string> toSave = new List <string>();

            for (int i = 0; i < levels.Count; i++)
            {
                toSave.Add(levels[i].CountryName + "#" + levels[i].LevelNum + "#" + levels[i].NumStars + "#" + levels[i].Score + "#" + levels[i].NumDonuts);
            }

            FileSaverLoader.SaveToFile(toSave, saveFile);
        }
Example #3
0
    public void SaveAllLevelInfoToFile()
    {
        GameProgress progress = new GameProgress();

        progress.levelsPlayed = new bool[allLevels.Length];
        for (int i = 0; i < allLevels.Length; i++)
        {
            progress.levelsPlayed[i] = allLevels[i].played;
        }

        FileSaverLoader.Save("gothere_saved_data.gd", progress);
    }
Example #4
0
        public void LoadSettings()
        {
            List <string> data = FileSaverLoader.LoadFromFile(miscsave);

            if (data == null || data.Count == 0)
            {
                //AudioManager.MusicVolume = 0.5f;
                AudioManager.SoundVolume = 1.0f;
            }
            else
            {
                AudioManager.MusicVolume = float.Parse(data[0].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                AudioManager.SoundVolume = float.Parse(data[1].ToString(), System.Globalization.CultureInfo.InvariantCulture);
                UseTrajectory            = bool.Parse(data[2].ToString());
            }
        }
Example #5
0
    // Start is called before the first frame update
    void Start()
    {
        if (File.Exists(Application.persistentDataPath + "/gothere_saved_data.gd"))
        {
            GameProgress progress = FileSaverLoader.Load("gothere_saved_data.gd");

            GameData.Instance.gameProgress = progress;
            if (continueMenuOption)
            {
                continueMenuOption.SetActive(true);
            }
        }
        else
        {
            if (continueMenuOption)
            {
                continueMenuOption.SetActive(false);
            }
        }
    }
Example #6
0
        public void LoadFromFile()
        {
            List <string> data = FileSaverLoader.LoadFromFile(saveFile);

            if (data == null)
            {
                return;
            }
            for (int i = 0; i < data.Count; i++)
            {
                string   thisone  = data[i];
                string[] splitted = thisone.Split('#');

                LevelState s = new LevelState();
                s.CountryName = splitted[0];
                s.LevelNum    = int.Parse(splitted[1], System.Globalization.CultureInfo.InvariantCulture);
                s.NumStars    = int.Parse(splitted[2], System.Globalization.CultureInfo.InvariantCulture);
                s.Score       = int.Parse(splitted[3], System.Globalization.CultureInfo.InvariantCulture);
                s.NumDonuts   = int.Parse(splitted[4], System.Globalization.CultureInfo.InvariantCulture);
                SetLevel(s.CountryName, s.Score, s.LevelNum, s.NumStars, s.NumDonuts);
            }
        }