Example #1
0
        public void Load()
        {
            if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
            {
                BinaryFormatter bf   = new BinaryFormatter();
                FileStream      file = File.Open(Application.persistentDataPath + "/playerInfo.dat", FileMode.Open);
                try
                {
                    GameInfo i = (GameInfo)bf.Deserialize(file);
                    Debug.Log("Loaded \'" + Application.persistentDataPath + "/playerInfo.dat\'");


                    i.bonuses.Load();
                    bonuses = i.bonuses;

                    GameManager.Instance.CollectionInitializedEvent(bonuses);

                    completedLevels = i.completedLevels;
                    lang            = i.lang;
                }
                catch (Exception)
                {
                    Debug.Log("Created new info. (Catched exception in Deserialize())");
                    Reset();
                }

                file.Close();
            }
            else
            {
                Debug.Log("File \'" + Application.persistentDataPath + "/playerInfo.dat\' isn't exist");
                Reset();
            }
        }
Example #2
0
 public void Reset()
 {
     bonuses         = new BonusCollection();
     completedLevels = 0;
     lang            = dfLanguageCode.EN;
     Debug.Log("info reseted");
     GameManager.Instance.CollectionInitializedEvent(bonuses);
 }
Example #3
0
 public GameInfo()
 {
     bonuses         = new BonusCollection();
     completedLevels = 0;
     lang            = dfLanguageCode.EN;
 }