Exemple #1
0
        public static AssetBundleManifest GetMainfest(AiukAppModuleSetting module)
        {
            if (ManiFestMap.ContainsKey(module.Token))
            {
                return(ManiFestMap[module.Token]);
            }

            var    helper = new AiukAppModuleHelper(module);
            string path   = string.Empty;

            if (AiukUnityUtility.IsEditorMode)
            {
                path = helper.AssetBundleMainDir +
                       string.Format("{0}_Main", module.Token);
            }

            if (AiukUnityUtility.IsPlayer)
            {
                path = helper.SandboxDir + string.Format("AssetBundle/{0}_Main/",
                                                         module.Token);
            }

            var manifest = AssetBundle.LoadFromFile(path).LoadAsset("AssetBundleManifest") as AssetBundleManifest;

            ManiFestMap.Add(module.Token, manifest);
            return(manifest);
        }
        public AiukAssetInfo
        (
            AiukAppModuleSetting module,
            string assetName,
            string fullPath
        )
        {
            AssetName = assetName;
            LocModule = module.Name;
            var helper = new AiukAppModuleHelper(module);

            Type = fullPath.Replace(helper.AssetDatabaseRootDir, "")
                   .Split('/').First();
            RelativePath = fullPath.Replace(helper.AssetDatabaseRootDir, "")
                           .Split('.').First();
            ImporterPath = AiukUnityIOUtility.GetImporterPath(fullPath);
        }
Exemple #3
0
        private AiukAssetBundleRef SyncGetAssetBundle(AiukAssetInfo assetInfo)
        {
            var assetName = assetInfo.AssetName;
            var appModule = m_ModuleMap[assetInfo.LocModule];

            if (AiukAppModuleHelper.GetMainfest(appModule) == null)
            {
                AiukDebugUtility.LogError
                    ("Ab主描述文件为空,请确认执行了AssetBundle打包操作!");
                return(null);
            }

            var manifest = AiukAppModuleHelper.GetMainfest(appModule);
            var depends  = manifest.GetAllDependencies(assetName + ".assetbundle");

            foreach (var item in depends)
            {
                var bundleName = item.Replace(".assetbundle", "");
                if (m_CoreAssetBundleRefs.ContainsKey(bundleName))
                {
                    var bundleRef = m_CoreAssetBundleRefs[bundleName];
                    bundleRef.Use();
                }
                else
                {
                    var tempInfo  = GetAssetInfo(bundleName);
                    var tempAb    = AssetBundle.LoadFromFile(tempInfo.ImporterPath);
                    var bundleRef = new AiukAssetBundleRef(tempAb);
                    bundleRef.Use();
                    m_CoreAssetBundleRefs.Add(bundleName, bundleRef);
                    return(bundleRef);
                }
            }

            var assetBundle = AssetBundle.LoadFromFile(assetInfo.ImporterPath);
            var newAbRef    = new AiukAssetBundleRef(assetBundle);

            newAbRef.Use();
            m_NormalAssetBundleRefs.Add(assetInfo.BundleName, newAbRef);
            return(newAbRef);
        }
Exemple #4
0
        private void AsyncGetAssetBundle(AiukAssetInfo assetInfo, Action <AiukAssetBundleRef> callback)
        {
            var bundleRef = TryGetAssetBundleRefFromCache(assetInfo);

            if (bundleRef != null)
            {
                callback(bundleRef);
                return;
            }

            var assetName = assetInfo.AssetName;
            var appModule = m_ModuleMap[assetInfo.LocModule];

            if (AiukAppModuleHelper.GetMainfest(appModule) == null)
            {
                AiukDebugUtility.LogError
                    ("Ab主描述文件为空,请确认执行了AssetBundle打包操作!");
                return;
            }

            var manifest = AiukAppModuleHelper.GetMainfest(appModule);
            var depends  = manifest.GetAllDependencies(assetName + ".assetbundle");
        }