Пример #1
0
        /// <summary>
        /// <para>This will get you the type of a key you only know the name of.</para>
        /// <para>Returns null, if either the key does not exist or the preferences have not been loaded yet. Check "SettingsLoaded" for this.</para>
        /// <para>Note that this question generates some of garbage. Use carefully!</para>
        /// </summary>
        /// <param name="key">is the key you are looking at</param>
        /// <returns>The type for the key, or null, if it does not exist or the preferences have not been loaded yet</returns>
        public System.Type GetTypeOfKey(string key)
        {
            if (!SettingsLoaded)
            {
                return(null);
            }

            if (BoolKeys.Contains(key))
            {
                return(typeof(bool));
            }
            if (IntKeys.Contains(key))
            {
                return(typeof(int));
            }
            if (FloatKeys.Contains(key))
            {
                return(typeof(float));
            }
            if (StringKeys.Contains(key))
            {
                return(typeof(string));
            }

            return(null);
        }
Пример #2
0
 public void MergeReplacing(KeySaveStruct p_saveStructToMerge)
 {
     if (p_saveStructToMerge != null)
     {
         FloatKeys.MergeReplacing(p_saveStructToMerge.FloatKeys);
         IntKeys.MergeReplacing(p_saveStructToMerge.IntKeys);
         BoolKeys.MergeReplacing(p_saveStructToMerge.BoolKeys);
         StringKeys.MergeReplacing(p_saveStructToMerge.StringKeys);
         ObjectKeys.MergeReplacing(p_saveStructToMerge.ObjectKeys);
     }
 }