Example #1
0
        private AsyncAssetRequst LoadAsync(BundleType bundleType, string resPath)
        {
            string          assetNameByResPath = this.GetAssetNameByResPath(bundleType, resPath);
            AssetBundleInfo info = !string.IsNullOrEmpty(assetNameByResPath) ? this.GetAssetBundleInfoByAssetName(bundleType, assetNameByResPath) : null;

            if ((info == null) || !info.IsDownloaded())
            {
                return(new AsyncAssetRequst(Resources.LoadAsync(resPath)));
            }
            switch ((((!GlobalVars.UseSpliteResources ? 0 : 1) * 3) + info.FileDownloadMode))
            {
            case 0:
                return(new AsyncAssetRequst(Resources.LoadAsync(resPath)));

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                return(new AsyncAssetRequst(info.LoadAsync(assetNameByResPath)));
            }
            return(null);
        }
Example #2
0
        private T Load <T>(BundleType bundleType, string resPath) where T : UnityEngine.Object
        {
            string          assetNameByResPath = this.GetAssetNameByResPath(bundleType, resPath);
            AssetBundleInfo info = !string.IsNullOrEmpty(assetNameByResPath) ? this.GetAssetBundleInfoByAssetName(bundleType, assetNameByResPath) : null;

            if ((info == null) || !info.IsDownloaded())
            {
                return(Resources.Load <T>(resPath));
            }
            switch ((((!GlobalVars.UseSpliteResources ? 0 : 1) * 3) + info.FileDownloadMode))
            {
            case 0:
                return(Resources.Load <T>(resPath));

            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
                return(info.Load <T>(assetNameByResPath));
            }
            return(null);
        }