Exemple #1
0
        public static string GetPath(SavePaths path)
        {
            if (path == SavePaths.Base)
            {
                return("generalSave");
            }
            else if (path == SavePaths.Player)
            {
                return("playerSave");
            }
            else if (path == SavePaths.Settings)
            {
                return("settingsSave");
            }

            return("generalSave");
        }
Exemple #2
0
 /// <summary>
 /// PAS GOED OP, OP HET MOMENT WORDEN DEZE VALUES NOG NIET NAAR EEN BESTAND GESCHREVEN
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="variableName"></param>
 /// <param name="value"></param>
 internal static void SaveValue <T>(SavePaths path, string variableName, T value)
 {
     if (!saveFileLoaded)
     {
         LoadFile();
     }
     try
     {
         hashtable.Add(variableName, new QueueValueObject(path, variableName, value));
     }
     catch (ArgumentException e)
     {
         hashtable[variableName] = new QueueValueObject(path, variableName, value);
         Debug.Log(e.ToString());
     }
     WriteTheFile(new List <QueueValueObject>()
     {
         hashtable[variableName]
     });
     Debug.Log(hashtable[variableName]);
 }
Exemple #3
0
        internal static void QueueSaveValue <T>(SavePaths path, string variableName, T value)
        {
            bool hasToOverwrite = false;
            int  overwritenum   = 0;

            for (int i = 0; i < queue.Count; i++)
            {
                if (queue[i].variableName == variableName)
                {
                    hasToOverwrite = true;
                    overwritenum   = i;
                    break;
                }
            }
            if (hasToOverwrite)
            {
                queue[overwritenum] = new QueueValueObject(path, variableName, value);
            }
            else
            {
                queue.Add(new QueueValueObject(path, variableName, value));
            }
        }
Exemple #4
0
 /// <summary>
 /// Queue a variable here in order to save it with the SaveQueue command
 /// </summary>
 /// <typeparam name="T">The type of the variable you want to save</typeparam>
 /// <param name="path">The path of the file you want to save the variable to</param>
 /// <param name="variableName">The name of the variable you want to save in the queue</param>
 /// <param name="value">The value you want to save in the queue</param>
 internal static void QueueVariable <T>(string variableName, T value, SavePaths path)
 {
     SaveEssentials.QueueSaveValue <T>(path, variableName, value);
 }
Exemple #5
0
 public QueueValueObject(SavePaths path, string name, object value)
 {
     this.variableName = name;
     this.value        = value;
     this.specialPath  = SaveEssentials.GetPath(path);
 }