Exemplo n.º 1
0
 public static void SetDateTime(string key, DateTime value)
 {
     if (value.Kind == DateTimeKind.Local)
     {
         value = value.ToUniversalTime();
     }
     UserPrefs.SetLong(key, value.ToBinary());
 }
Exemplo n.º 2
0
        public static long?SetLongAndReturnPrevious(string key, long value)
        {
            long?result = null;

            if (UserPrefs.HasKey(key))
            {
                string @string = PlayerPrefs.GetString(key);
                try
                {
                    result = new long?(long.Parse(@string, NumberStyles.Integer, NumberFormatInfo.InvariantInfo));
                }
                catch (FormatException)
                {
                }
                catch (OverflowException)
                {
                }
            }
            UserPrefs.SetLong(key, value);
            return(result);
        }