Пример #1
0
        internal static AssetFileLoader CreateFileLoaderInternal(string loadPath, string manifestPath)
        {
            // 如果加载器已经存在
            AssetFileLoader loader = TryGetFileLoader(loadPath);

            if (loader != null)
            {
                loader.Reference();                 //引用计数
                return(loader);
            }

            // 创建加载器
            AssetFileLoader newLoader = null;

            if (SystemMode == EAssetSystemMode.EditorMode)
            {
                newLoader = new AssetDatabaseFileLoader(loadPath);
            }
            else if (SystemMode == EAssetSystemMode.ResourcesMode)
            {
                newLoader = new AssetResourcesFileLoader(loadPath);
            }
            else if (SystemMode == EAssetSystemMode.BundleMode)
            {
                newLoader = new AssetBundleFileLoader(loadPath, manifestPath);
            }
            else
            {
                throw new NotImplementedException($"{SystemMode}");
            }

            // 新增下载需求
            _fileLoaders.Add(newLoader);
            newLoader.Reference();             //引用计数
            return(newLoader);
        }
Пример #2
0
 public AssetBundleProvider(AssetFileLoader owner, string assetName, System.Type assetType)
     : base(owner, assetName, assetType)
 {
     _loader = owner as AssetBundleFileLoader;
 }