Beispiel #1
0
        public Bundler(BundlerManifest manifest = null, BundlerOptions options = null)
        {
            options = options ?? new BundlerOptions();
            options.LoaderFactory = options.LoaderFactory ?? new DefaultBundleLoaderFactory();

            Initialize(manifest, options);
        }
Beispiel #2
0
        public Bundler(string json, BundlerOptions options = null)
        {
            BundlerManifest manifest = null;

            if (!string.IsNullOrEmpty(json))
            {
                manifest = JsonUtility.FromJson <BundlerManifest>(json);
            }
            Initialize(manifest, options);
        }
Beispiel #3
0
        private void Initialize(BundlerManifest manifest, BundlerOptions options)
        {
            Instance = this;

            _manifest      = manifest;
            _coroutinePool = new CoroutinePool("Bundler", options.MaxAsyncUploadCount);
            _context       = new BundlerContext {
                Options       = options,
                CoroutinePool = _coroutinePool,
            };

            _modes = new Dictionary <BundleModeType, ModeBase>(2);
            _modes[BundleModeType.Bundle]   = new BundleMode(manifest, _searchPaths, _context);
            _modes[BundleModeType.Resource] = new ResourceMode(manifest, _searchPaths, _context);

            var bundleMode = true;
            var logLevel   = Logger.LogLevel.ERROR;

#if UNITY_EDITOR
            bundleMode = EditorPrefs.GetBool("vFrameBundlerModePreferenceKey", false);
            logLevel   = EditorPrefs.GetInt("vFrameBundlerLogLevelPreferenceKey", Logger.LogLevel.ERROR - 1) + 1;
#endif
            if (bundleMode)
            {
                if (manifest != null)
                {
                    SetMode(BundleModeType.Bundle);
                    return;
                }

                Logger.LogInfo("Bundle manifest does not provided, bundle mode will disable.");
            }

            SetMode(BundleModeType.Resource);
            SetLogLevel(logLevel);
        }