static public void load() { float globalVolume, musicVolume, sfxVolume; bool invertCamX, invertCamY; int particleQuality, playerModel; globalVolume = PlayerPrefs.GetFloat("GlobalVolume", 1.0f); musicVolume = PlayerPrefs.GetFloat("MusicVolume", 0.6f); sfxVolume = PlayerPrefs.GetFloat("SfxVolume", 0.4f); invertCamX = getBool("InvertCamX", false); invertCamY = getBool("InvertCamY", false); particleQuality = PlayerPrefs.GetInt("ParticleQuality", (int)Global.ParticleQuality.High); playerModel = PlayerPrefs.GetInt("PlayerModel", 0); setGlobalVolume(globalVolume); setMusicVolume(musicVolume); setSfxVolume(sfxVolume); setHorCamInverted(invertCamX); setVerCamInverted(invertCamY); setParticlesQual((Global.ParticleQuality)particleQuality); setPlayerModel(playerModel); for (int i = 0; i < 3; i++) { loadInput(i); } }
static public int constructor(IntPtr l) { UnityEngine.PlayerPrefs o; o = new UnityEngine.PlayerPrefs(); pushObject(l, o); return(1); }
static public int constructor(IntPtr l) { try { #if DEBUG var method = System.Reflection.MethodBase.GetCurrentMethod(); string methodName = GetMethodName(method); #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.BeginSample(methodName); #else Profiler.BeginSample(methodName); #endif #endif UnityEngine.PlayerPrefs o; o = new UnityEngine.PlayerPrefs(); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } #if DEBUG finally { #if UNITY_5_5_OR_NEWER UnityEngine.Profiling.Profiler.EndSample(); #else Profiler.EndSample(); #endif } #endif }
private static void SetUserAccess(bool logged) { int loggedIn = logged ? 1 : 0; Prefs.SetInt(USER_LOGGED, loggedIn); Prefs.Save(); }
static private bool getBool(string key, bool def) { if (!PlayerPrefs.HasKey(key)) { return(def); } return(PlayerPrefs.GetInt(key) == 1); }
public static bool IsUserLogged() { if (Prefs.HasKey(USER_LOGGED)) { return(Prefs.GetInt(USER_LOGGED) == 1); } return(false); }
public static User GetUser() { if (Prefs.HasKey(USER_PROFILE)) { return(JsonConvert.DeserializeObject <User>(Prefs.GetString(USER_PROFILE))); } return(null); }
static private void saveInput(int column) { string key = $"Input-{column}"; try { string json = Input.axisToJson(column); PlayerPrefs.SetString(key, json); } catch (System.Exception) { } }
public static string GetToken() { string token = ""; if (Prefs.HasKey(AUTHENTICATION_TOKEN)) { token = Prefs.GetString(AUTHENTICATION_TOKEN); } return(token); }
private PropertyLayoutHelper.RenderFunc DrawValue(string key, SerializedProperty type) { return(delegate(Rect rect) { if (UnityPrefs.HasKey(key) == false) { EditorGUI.LabelField(rect, "Cannot find value"); return; } drawers[(Type)type.intValue].Draw(rect, key); }); }
static public int constructor(IntPtr l) { try { UnityEngine.PlayerPrefs o; o = new UnityEngine.PlayerPrefs(); pushValue(l, o); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int constructor(IntPtr l) { try { UnityEngine.PlayerPrefs o; o=new UnityEngine.PlayerPrefs(); pushValue(l,true); pushValue(l,o); return 2; } catch(Exception e) { return error(l,e); } }
private void Draw <T>(System.Func <Rect, T, T> DrawField, Rect rect, System.Func <string, T> Get, System.Action <string, T> Set, string key) { var value = Get(key); var newValue = DrawField(rect, value); if (value.Equals(newValue)) { return; } Set(key, newValue); UnityPrefs.Save(); }
public void Draw(Rect rect, string key) { var value = Get(key); var newValue = DrawField(rect, value); if (value.Equals(newValue)) { return; } Set(key, newValue); UnityPrefs.Save(); }
static public int constructor(IntPtr l) { try { UnityEngine.PlayerPrefs o; o = new UnityEngine.PlayerPrefs(); pushValue(l, o); return(1); } catch (Exception e) { LuaDLL.luaL_error(l, e.ToString()); return(0); } }
public static int constructor(IntPtr l) { try { UnityEngine.PlayerPrefs o; o=new UnityEngine.PlayerPrefs(); pushValue(l,o); return 1; } catch(Exception e) { LuaDLL.luaL_error(l, e.ToString()); return 0; } }
static public int constructor(IntPtr l) { LuaDLL.lua_remove(l, 1); UnityEngine.PlayerPrefs o; if (matchType(l, 1)) { o = new UnityEngine.PlayerPrefs(); pushObject(l, o); return(1); } LuaDLL.luaL_error(l, "New object failed."); return(0); }
static private void loadInput(int column) { string key = $"Input-{column}"; if (!PlayerPrefs.HasKey(key)) { return; } string json = PlayerPrefs.GetString(key, ""); try { Input.axisFromJson(column, json); } catch (System.Exception) { Input.RevertMap(column); } }
static int _CreateUnityEngine_PlayerPrefs(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { UnityEngine.PlayerPrefs obj = new UnityEngine.PlayerPrefs(); ToLua.PushSealed(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: UnityEngine.PlayerPrefs.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
private PropertyLayoutHelper.RenderFunc DrawButton(string key, SerializedProperty type) { if (key.IsNullOrEmpty() == true) { return(delegate { }); } return(delegate(Rect rect) { if (UnityPrefs.HasKey(key) == true) { if (GUI.Button(rect, "X") == true) { UnityPrefs.DeleteKey(key); } } else { if (GUI.Button(rect, "+") == true) { drawers[(Type)type.intValue].Add(key); } } }); }
static public void setSfxVolume(float v) { Global.Sfx.sfxVolume = v; PlayerPrefs.SetFloat("SfxVolume", v); }
public static void ResetUserAccess() { Prefs.SetInt(USER_LOGGED, 0); Prefs.SetString(USER_PROFILE, ""); Prefs.Save(); }
static public void setGlobalVolume(float v) { AudioListener.volume = v; PlayerPrefs.SetFloat("GlobalVolume", v); }
static public void setMusicVolume(float v) { Global.Sfx.setMusicVolume(v); PlayerPrefs.SetFloat("MusicVolume", v); }
static public void forceSave() { PlayerPrefs.Save(); }
static public void reset() { PlayerPrefs.DeleteAll(); }
public static void StoreAuthToken(string authToken) { Prefs.SetString(AUTHENTICATION_TOKEN, authToken); Prefs.Save(); }
static public void setPlayerModel(int v) { PlayerModel.active = v; PlayerPrefs.SetInt("PlayerModel", v); }
public static void StoreUserAccess(User user) { SetUserAccess(true); Prefs.SetString(USER_PROFILE, JsonConvert.SerializeObject(user)); Prefs.Save(); }
static public void setParticlesQual(Global.ParticleQuality gpq) { Global.particleQuality = gpq; PlayerPrefs.SetInt("ParticleQuality", (int)gpq); }
static private void setBool(string key, bool v) { PlayerPrefs.SetInt(key, (v ? 1 : 0)); }