Example #1
0
 public void OnRegisteredToResourceStorage(ResourceStorage resourceStorage, WorkersQueue workersQueue, Action <Exception> onResourceLoadError)
 {
     _resourceStorage = resourceStorage;
     if (_memoryCache is BundlesMemoryCache)
     {
         (_memoryCache as BundlesMemoryCache).SetResourceStorage(resourceStorage);
     }
     _workersQueue        = workersQueue;
     _onResourceLoadError = onResourceLoadError;
 }
Example #2
0
        /// <summary>
        /// Dispose system
        /// </summary>
        public void Dispose()
        {
            UnloadAll();
            _workersQueue    = null;
            _onInternalError = null;
            _loaders.Clear();
            _isDisposed = true;
#if CRAZYPANDA_UNITYCORE_RESOURCESYSTEM_DEBUG_TOOLS
            ResourceSystemLocator.ReleaseInstance(this);
#endif
        }
Example #3
0
        /// <summary>
        ///     Constructor to customize Loaders resolver
        /// </summary>
        /// <param name="maxSimultaneousResouceLoadings">Max parallel loadings</param>
        /// <param name="loaderChoiceResolverOverride">Custom loader resolver</param>
        /// <param name="onInternalError">Handler to catch internal exceptions</param>
        /// <param name="onResourceLoadError">Handler to catch all loader loading exceptions</param>
        public ResourceStorage(int maxSimultaneousResouceLoadings, ILoaderChoiceResolver loaderChoiceResolverOverride, Action <Exception> onInternalError = null,
                               Action <Exception> onResourceLoadError = null)
        {
            _loaders              = new List <IResourceLoader>();
            _workersQueue         = new WorkersQueue(maxSimultaneousResouceLoadings);
            _loaderChoiceResolver = loaderChoiceResolverOverride;
            _loaderChoiceResolver.Init(_loaders);
            _onInternalError     = onInternalError;
            _onResourceLoadError = onResourceLoadError;
#if CRAZYPANDA_UNITYCORE_RESOURCESYSTEM_DEBUG_TOOLS
            ResourceSystemLocator.RegisterInstance(this);
#endif
            _isDisposed = false;
        }