Beispiel #1
0
        public static void Initialize(ResourceManagerArgs args)
        {
            _urls.Clear();
            _urls.AddRange(args.urls);
            if (_listener == null)
            {
                _listener = new EmptyAssetProviderListener();
            }

            JobScheduler.Initialize();

            if (_assetProvider != null)
            {
                _assetProvider.Close();
            }

#if UNITY_EDITOR
            if (_analyzer == null)
            {
                if (!string.IsNullOrEmpty(args.listDataPath))
                {
                    var listData =
                        UnityEditor.AssetDatabase.LoadMainAssetAtPath(NormalizedListPath(args.listDataPath)) as
                        AssetListData;
                    if (listData != null)
                    {
                        _analyzer = new Analyzer.DefaultAssetsAnalyzer(listData);
                    }
                }
            }

            if (args.devMode)
            {
                _assetProvider = new AssetDatabaseAssetProvider(args.asyncSimMin, args.asyncSimMax);
            }
            else
#endif
            {
                _assetProvider = new BundleAssetProvider();
            }

            args.oninitialize?.Invoke();
            _assetProvider.Open(args);
            if (args.oncomplete != null)
            {
                _assetProvider.completed += args.oncomplete;
            }
        }
Beispiel #2
0
        public static void Initialize(bool devMode, string localPathRoot, IList <string> urls, Action oninitialize, Action oncomplete)
        {
            _listener = new EmptyAssetProviderListener();
            UnityFS.JobScheduler.Initialize();
#if UNITY_EDITOR
            if (devMode)
            {
                _assetProvider = new UnityFS.AssetDatabaseAssetProvider();
            }
            else
#endif
            {
                _assetProvider = new UnityFS.BundleAssetProvider(localPathRoot, urls);
            }
            if (oninitialize != null)
            {
                oninitialize();
            }
            _assetProvider.Open();
            if (oncomplete != null)
            {
                _assetProvider.completed += oncomplete;
            }
        }
Beispiel #3
0
        public static void Initialize(ResourceManagerArgs args)
        {
            _listener = new EmptyAssetProviderListener();
            UnityFS.JobScheduler.Initialize();
#if UNITY_EDITOR
            if (args.devMode)
            {
                _assetProvider = new UnityFS.AssetDatabaseAssetProvider();
            }
            else
#endif
            {
                _assetProvider = new UnityFS.BundleAssetProvider(args.localPathRoot, args.urls, args.concurrentTasks, args.slow, args.bufferSize, args.assetPathTransformer);
            }
            if (args.oninitialize != null)
            {
                args.oninitialize();
            }
            _assetProvider.Open();
            if (args.oncomplete != null)
            {
                _assetProvider.completed += args.oncomplete;
            }
        }
Beispiel #4
0
 public static void SetListener(IAssetProviderListener listener)
 {
     _listener = listener;
 }