Esempio n. 1
0
        public static float GetEncryptedFloat(string key, float defaultValue = 0.0f)
        {
            string str = PlayerPrefs.GetString("ENC-" + SimpleEncryption.EncryptString(key));

            if (!string.IsNullOrEmpty(str))
            {
                return(SimpleEncryption.DecryptFloat(str.Remove(0, 1)));
            }
            return(defaultValue);
        }
Esempio n. 2
0
    // Token: 0x06004DB2 RID: 19890 RVA: 0x001A10A4 File Offset: 0x0019F4A4
    public static float GetEncryptedFloat(string key, float defaultValue = 0f)
    {
        string key2 = "ENC-" + SimpleEncryption.EncryptString(key);
        string text = PlayerPrefs.GetString(key2);

        if (!string.IsNullOrEmpty(text))
        {
            text = text.Remove(0, 1);
            return(SimpleEncryption.DecryptFloat(text));
        }
        return(defaultValue);
    }
Esempio n. 3
0
    /// <summary>
    /// Encrypted version of PlayerPrefs.GetFloat(), an unencrypted key is passed and the value is returned decrypted
    /// </summary>
    public static float GetEncryptedFloat(string key, float defaultValue = 0.0f)
    {
        // Encrypt and prefix the key so we can look it up from player prefs
        string encryptedKey = KEY_PREFIX + SimpleEncryption.EncryptString(key);

        // Look up the encrypted value
        string fetchedString = PlayerPrefs.GetString(encryptedKey);

        if (string.IsNullOrEmpty(fetchedString))
        {
            return(defaultValue);
        }

        // Strip out the type identifier character
        fetchedString = fetchedString.Remove(0, 1);

        // Decrypt and return the float value
        return(SimpleEncryption.DecryptFloat(fetchedString));
    }