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

            return(cache.dict.ContainsKey(key));
        }
Beispiel #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));
        }
Beispiel #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));
        }
Beispiel #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);
        }