Exemplo n.º 1
0
        public static string SetStringAndReturnPrevious(string key, string value)
        {
            string result = null;

            if (UserPrefs.HasKey(key))
            {
                result = PlayerPrefs.GetString(key);
            }
            UserPrefs.SetString(key, value);
            return(result);
        }
Exemplo n.º 2
0
        public static void SetXml <T>(string key, T obj)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(T));
            StringWriter  sw         = new StringWriter();

            serializer.Serialize(sw, obj);
            //Debug.LogError(sw.ToString());
            Debug.Log("Save Obj : " + key);
            string en = EncryptUtils.Base64Encrypt(sw.ToString());

            UserPrefs.SetString(key, en);
        }
Exemplo n.º 3
0
        public static void SetCollection(string key, ICollection <string> collection)
        {
            string value;

            if (collection == null || collection.Count == 0)
            {
                value = EmptyCollectionValue;
            }
            else
            {
                value = StringUtils.CollectionToCommaDelimitedString <string>(collection);
            }
            UserPrefs.SetString(key, value);
        }
Exemplo n.º 4
0
        public static void SetHash(string originalKey, string value, string hashSuffix)
        {
            string value2 = UserPrefs.CreateHashValue(value, hashSuffix);

            UserPrefs.SetString(UserPrefs.CreateHashKey(originalKey), value2);
        }
Exemplo n.º 5
0
 public static void SetJson(string key, JsonObject value)
 {
     UserPrefs.SetString(key, (!(value != null)) ? null : value.ToString());
 }