Ejemplo n.º 1
0
        /// <summary>
        /// Wrapper for the same method in PlayerPrefs but works with encrypted player prefs.
        /// </summary>
        public static void SetString(string key, string value, bool?useSecurePrefs = null)
        {
            // if not using secure prefs, or we provide an override then just fall through to standard call.
            if ((!UseSecurePrefs && !useSecurePrefs.HasValue) || (useSecurePrefs.HasValue && useSecurePrefs.Value == false))
            {
                JSONPrefs.SetString(key, value);
                return;
            }

            var valueBytes = Encoding.UTF8.GetBytes(value);

            SetEncryptedPrefsEntry(key, valueBytes, ItemType.String);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Set an encrypted prefs entry based upon the passed byte array and type
 /// </summary>
 /// <param name="key"></param>
 /// <param name="value"></param>
 /// <param name="type"></param>
 public static void SetEncryptedPrefsEntry(string key, byte[] value, ItemType type)
 {
     JSONPrefs.SetString(EncryptKey(key), EncryptValue(value, type));
 }