コード例 #1
0
        // Loads the saved achievements file and updates the array with its content.
        public static void LoadSavedAchievements()
        {
            DeterminePath();
            SerializedAchievementManager serializedAchievementManager = (SerializedAchievementManager)SaveLoadManager.Load(typeof(SerializedAchievementManager), _saveFileName + _saveFileExtension, _saveFolderName);

            ExtractSerializedMMAchievementManager(serializedAchievementManager);
        }
コード例 #2
0
        // Saves the achievements current status to a file on disk
        public static void SaveAchievements()
        {
            DeterminePath();
            SerializedAchievementManager serializedAchievementManager = new SerializedAchievementManager();

            FillSerializedAchievementManager(serializedAchievementManager);
            SaveLoadManager.Save(serializedAchievementManager, _saveFileName + _saveFileExtension, _saveFolderName);
        }
コード例 #3
0
        // Serializes the contents of the achievements array to a serialized, ready to save object
        public static void FillSerializedAchievementManager(SerializedAchievementManager serializedAchievements)
        {
            serializedAchievements.Achievements = new SerializedAchievement[_achievements.Count];

            for (int i = 0; i < _achievements.Count(); i++)
            {
                SerializedAchievement newAchievement = new SerializedAchievement(_achievements[i].AchievementID, _achievements[i].UnlockedStatus, _achievements[i].ProgressCurrent);
                serializedAchievements.Achievements[i] = newAchievement;
            }
        }
コード例 #4
0
        // Extracts the serialized achievements into our achievements array if the achievements ID match.
        public static void ExtractSerializedMMAchievementManager(SerializedAchievementManager serializedAchievements)
        {
            if (serializedAchievements == null)
            {
                return;
            }

            for (int i = 0; i < _achievements.Count(); i++)
            {
                for (int j = 0; j < serializedAchievements.Achievements.Length; j++)
                {
                    if (_achievements[i].AchievementID == serializedAchievements.Achievements[j].AchievementID)
                    {
                        _achievements[i].UnlockedStatus  = serializedAchievements.Achievements[j].UnlockedStatus;
                        _achievements[i].ProgressCurrent = serializedAchievements.Achievements[j].ProgressCurrent;
                    }
                }
            }
        }