Пример #1
0
        /**
         * <summary>Saves specific options to a specific profile.</summary>
         * <param name = "ID">A unique identifier for the profile to save to</param>
         * <param name = "_optionsData">An instance of OptionsData containing the options to save</param>
         * <param name = "showLog">If True, the details of this save will be printed in the Console window</param>
         */
        public static void SavePrefsToID(int ID, OptionsData _optionsData = null, bool showLog = false)
        {
            if (_optionsData == null)
            {
                _optionsData = Options.optionsData;
            }
            string optionsSerialized = Serializer.SerializeObject <OptionsData> (_optionsData, true);

            if (optionsSerialized != "")
            {
                OptionsFileHandler.SaveOptions(ID, optionsSerialized, showLog);
            }
        }
Пример #2
0
        /**
         * <summary>Saves specific options to a specific profile.</summary>
         * <param name = "ID">A unique identifier for the profile to save to</param>
         * <param name = "_optionsData">An instance of OptionsData containing the options to save</param>
         * <param name = "showLog">If True, the details of this save will be printed in the Console window</param>
         */
        public static void SavePrefsToID(int ID, OptionsData _optionsData = null, bool showLog = false)
        {
            if (_optionsData == null)
            {
                _optionsData = Options.optionsData;
            }
            string optionsSerialized = Serializer.SerializeObject <OptionsData> (_optionsData, true, SaveSystem.OptionsFileFormatHandler);

            if (!string.IsNullOrEmpty(optionsSerialized))
            {
                OptionsFileHandler.SaveOptions(ID, optionsSerialized, showLog);
            }
        }
Пример #3
0
        /**
         * <summary>Saves specific options to a specific profile.</summary>
         * <param name = "ID">A unique identifier for the profile to save to</param>
         * <param name = "_optionsData">An instance of OptionsData containing the options to save</param>
         * <param name = "showLog">If True, the details of this save will be printed in the Console window</param>
         */
        public static void SavePrefsToID(int ID, OptionsData _optionsData = null, bool showLog = false)
        {
            if (_optionsData == null)
            {
                _optionsData = Options.optionsData;
            }
            string optionsSerialized = Serializer.SerializeObject <OptionsData> (_optionsData, true);

            if (optionsSerialized != "")
            {
                PlayerPrefs.SetString(GetPrefKeyName(ID), optionsSerialized);
                if (showLog)
                {
                    ACDebug.Log("PlayerPrefs Key '" + GetPrefKeyName(ID) + "' saved");
                }
            }
        }
Пример #4
0
        /**
         * <summary>Serializes a List of SingleLevelData, either by XML, Binary or Json, depending on the platform.</summary>
         * <param name = "dataObjects">The objects to serialize</param>
         * <param name = "delimieter">If using Json, then this string will be inserted between each SingleLevelData instance.</param>
         * <returns>The object, serialized to a string</returns>
         */
        public static string SerializeAllRoomData(List <SingleLevelData> dataObjects, string delimeter = "|ROOMDELIMITER|")
        {
            if (SaveSystem.GetSaveMethod() == SaveMethod.Json)
            {
                // Can't serialize a list, so split by delimeter
                string serializedString = "";
                if (dataObjects != null && dataObjects.Count > 0)
                {
                    for (int i = 0; i < dataObjects.Count; i++)
                    {
                        serializedString += Serializer.SerializeObject <SingleLevelData> (dataObjects[i]);
                        if (i < (dataObjects.Count - 1))
                        {
                            serializedString += delimeter;
                        }
                    }
                }
                return(serializedString);
            }

            return(Serializer.SerializeObject <List <SingleLevelData> > (dataObjects));
        }
Пример #5
0
 /**
  * <summary>Serializes a Remember script object, either XML, Binary or Json, depending on the platform.</summary>
  * <param name = "dataObject">The object to serialize</param>
  * <returns>The object, serialized to a string</returns>
  */
 public static string SaveScriptData <T> (object dataObject) where T : RememberData
 {
     return(Serializer.SerializeObject <T> (dataObject));
 }