public static void DeleteKey(string key, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } EditorPrefs.DeleteKey(key); }
public static bool HasKey(string key, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } return(EditorPrefs.HasKey(key)); }
public static string GetString(string key, string defaultValue = "", bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } return(EditorPrefs.GetString(key, defaultValue)); }
public static void SetString(string key, string value, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } EditorPrefs.SetString(key, value); }
public static float GetFloat(string key, float defaultValue = 0F, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } return(EditorPrefs.GetFloat(key, defaultValue)); }
public static int GetInt(string key, int defaultValue = 0, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } return(EditorPrefs.GetInt(key, defaultValue)); }
public static bool GetBool(string key, bool defaultValue = false, bool perProject = false) { if (perProject == true) { key = NGEditorPrefs.GetPerProjectPrefix() + key; } return(EditorPrefs.GetBool(key, defaultValue)); }
public override void Save(object instance, FieldInfo field, string prefix) { IList list = field.GetValue(instance) as IList; prefix += instance.GetType().FullName + '.' + field.Name; NGEditorPrefs.SetInt(prefix, list.Count); prefix += '.'; for (int i = 0; i < list.Count; i++) { NGEditorPrefs.SetString(prefix + i, Convert.ToBase64String(Utility.SerializeField(list[i]))); } }
public override void Load(object instance, FieldInfo field, string prefix) { IList list = field.GetValue(instance) as IList; int count = NGEditorPrefs.GetInt(prefix + instance.GetType().FullName + '.' + field.Name, -1); Type subType = Utility.GetArraySubType(field.FieldType); if (count != -1) { list.Clear(); prefix += instance.GetType().FullName + '.' + field.Name + '.'; try { for (int i = 0; i < count; i++) { object element = null; string v = NGEditorPrefs.GetString(prefix + i, null); if (v != null) { element = Utility.DeserializeField <object>(Convert.FromBase64String(v)); } else if (subType.IsValueType == true) { element = Activator.CreateInstance(subType); } list.Add(element); } field.SetValue(instance, list); } catch (Exception ex) { InternalNGDebug.LogException(prefix, ex); } } }
public override void Load(object instance, FieldInfo field, string prefix) { field.SetValue(instance, NGEditorPrefs.GetString(prefix + instance.GetType().FullName + '.' + field.Name, (String)(this.GetDefaultValue(field) ?? field.GetValue(instance)))); }
public override void Save(object instance, FieldInfo field, string prefix) { NGEditorPrefs.SetString(prefix + instance.GetType().FullName + '.' + field.Name, (String)field.GetValue(instance)); }