Exemple #1
0
        public static bool IsCacheContainsKey(this GameObject self, string key)
        {
            CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>();

            return(cache.dict.ContainsKey(key));
        }
Exemple #2
0
        public static T GetCache <T>(this GameObject self, string key, string subKey)
        {
            CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>();

            return(cache.Get <T>(key, subKey));
        }
Exemple #3
0
        public static T GetOrAddCache <T>(this GameObject self, string key, string subKey, Func <T> defaultFunc)
        {
            CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>();

            return(cache.GetOrAdd(key, subKey, defaultFunc));
        }
Exemple #4
0
        public static void SetCache(this GameObject self, string key, string subKey, object obj)
        {
            CacheMonoBehaviour cache = self.GetOrAddComponent <CacheMonoBehaviour>();

            cache.Set(obj, key, subKey);
        }