示例#1
0
 public T GetValueOrDefault()
 {
     if (HasValue)
     {
         return(serializer.Deserialize(Key));
     }
     else
     {
         return(default(T));
     }
 }
示例#2
0
 public MemCachedPreference(string key, IPrefSerializer <T> serializer, T initialDefaultValue = default(T))
 {
     this.key        = key;
     this.serializer = serializer;
     hasValue        = PlayerPrefs.HasKey(key);
     if (HasValue)
     {
         cache = serializer.Deserialize(key);
     }
     else
     {
         cache = initialDefaultValue;
     }
 }
示例#3
0
        public T Deserialize(string key)
        {
            var bytes = serializer.Deserialize(key);

            return(encoder.Decode(bytes));
        }