示例#1
0
        public static Color GetColor(string key)
        {
            string k = EncryptionUtility.XOREncrypt(key);

            if (PlayerPrefs.HasKey(k))
            {
                string json = PlayerPrefs.GetString(k, string.Empty);
                return(JSONSerializer.DeserializeFromJson <Color>(json, true));
            }
            return(Color.clear);
        }
示例#2
0
        public static Quaternion GetQuaternion(string Key)
        {
            string k = EncryptionUtility.XOREncrypt(Key);

            if (PlayerPrefs.HasKey(k))
            {
                string json = PlayerPrefs.GetString(k, string.Empty);
                return(Quaternion.Euler(JSONSerializer.DeserializeFromJson <Vector3>(json, true)));
            }
            return(Quaternion.identity);
        }
示例#3
0
        public static Vector3 GetVector3(string key)
        {
            string k = EncryptionUtility.XOREncrypt(key);

            if (PlayerPrefs.HasKey(k))
            {
                string json = PlayerPrefs.GetString(k);

                return(JSONSerializer.DeserializeFromJson <Vector3>(json, false));
            }
            return(Vector3.zero);
        }
示例#4
0
        public static void SetColor(string key, Color col)
        {
            string json = JSONSerializer.SerializeToJson(col, true);

            PlayerPrefs.SetString(EncryptionUtility.XOREncrypt(key), json);
        }
示例#5
0
 public static int GetInt(string key, int DefaultValue = 0)
 {
     return(PlayerPrefs.GetInt(EncryptionUtility.XOREncrypt(key), DefaultValue));
 }
示例#6
0
        public static void SetVector3(string key, Vector3 Value)
        {
            string json = JSONSerializer.SerializeToJson(Value, false);

            PlayerPrefs.SetString(EncryptionUtility.XOREncrypt(key), json);
        }
示例#7
0
 public static float GetFloat(string key, float DefaultValue = 0.0f)
 {
     return(PlayerPrefs.GetFloat(EncryptionUtility.XOREncrypt(key), DefaultValue));
 }
示例#8
0
 public static void SetInt(string key, int Value)
 {
     PlayerPrefs.SetInt(EncryptionUtility.XOREncrypt(key), new SafeInt(Value));
 }
示例#9
0
 public static void SetFloat(string key, float value)
 {
     PlayerPrefs.SetFloat(EncryptionUtility.XOREncrypt(key), new SafeFloat(value));
 }
示例#10
0
 public static string GetString(string key, string DefaultValue = "")
 {
     return(PlayerPrefs.GetString(EncryptionUtility.XOREncrypt(key), DefaultValue));
 }
示例#11
0
 public static void DeleteKey(string key)
 {
     PlayerPrefs.DeleteKey(EncryptionUtility.XOREncrypt(key));
 }
示例#12
0
        //---

        public static bool HasKey(string key)
        {
            return(PlayerPrefs.HasKey(EncryptionUtility.XOREncrypt(key)));
        }
示例#13
0
 public static void SetString(string key, string value)
 {
     PlayerPrefs.SetString(EncryptionUtility.XOREncrypt(key), new SafeString(value));
 }