示例#1
0
    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);
        }
    }
示例#2
0
 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
 }
示例#4
0
    private static void SetUserAccess(bool logged)
    {
        int loggedIn = logged ? 1 : 0;

        Prefs.SetInt(USER_LOGGED, loggedIn);
        Prefs.Save();
    }
示例#5
0
 static private bool getBool(string key, bool def)
 {
     if (!PlayerPrefs.HasKey(key))
     {
         return(def);
     }
     return(PlayerPrefs.GetInt(key) == 1);
 }
示例#6
0
 public static bool IsUserLogged()
 {
     if (Prefs.HasKey(USER_LOGGED))
     {
         return(Prefs.GetInt(USER_LOGGED) == 1);
     }
     return(false);
 }
示例#7
0
 public static User GetUser()
 {
     if (Prefs.HasKey(USER_PROFILE))
     {
         return(JsonConvert.DeserializeObject <User>(Prefs.GetString(USER_PROFILE)));
     }
     return(null);
 }
示例#8
0
    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);
    }
示例#10
0
        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);
		}
	}
示例#13
0
        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();
        }
示例#14
0
            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);
 }
示例#18
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));
        }
    }
示例#20
0
        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);
                    }
                }
            });
        }
示例#21
0
 static public void setSfxVolume(float v)
 {
     Global.Sfx.sfxVolume = v;
     PlayerPrefs.SetFloat("SfxVolume", v);
 }
示例#22
0
 public static void ResetUserAccess()
 {
     Prefs.SetInt(USER_LOGGED, 0);
     Prefs.SetString(USER_PROFILE, "");
     Prefs.Save();
 }
示例#23
0
 static public void setGlobalVolume(float v)
 {
     AudioListener.volume = v;
     PlayerPrefs.SetFloat("GlobalVolume", v);
 }
示例#24
0
 static public void setMusicVolume(float v)
 {
     Global.Sfx.setMusicVolume(v);
     PlayerPrefs.SetFloat("MusicVolume", v);
 }
示例#25
0
 static public void forceSave()
 {
     PlayerPrefs.Save();
 }
示例#26
0
 static public void reset()
 {
     PlayerPrefs.DeleteAll();
 }
 public static void StoreAuthToken(string authToken)
 {
     Prefs.SetString(AUTHENTICATION_TOKEN, authToken);
     Prefs.Save();
 }
示例#28
0
 static public void setPlayerModel(int v)
 {
     PlayerModel.active = v;
     PlayerPrefs.SetInt("PlayerModel", v);
 }
示例#29
0
 public static void StoreUserAccess(User user)
 {
     SetUserAccess(true);
     Prefs.SetString(USER_PROFILE, JsonConvert.SerializeObject(user));
     Prefs.Save();
 }
示例#30
0
 static public void setParticlesQual(Global.ParticleQuality gpq)
 {
     Global.particleQuality = gpq;
     PlayerPrefs.SetInt("ParticleQuality", (int)gpq);
 }
示例#31
0
 static private void setBool(string key, bool v)
 {
     PlayerPrefs.SetInt(key, (v ? 1 : 0));
 }