Пример #1
0
        /// <summary>
        /// 添加bundle
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="ab"></param>
        /// <returns></returns>
        public IBundleRef PushAsset(BundlePkgInfo pkg, AssetBundle ab)
        {
            IBundleRef bundle = null;

            if (!this.Contains(pkg.AbFileName))
            {
                bundle = BundleRef.Create(this.TryGetPtr(pkg.AbFileName, ab), pkg.AbFileName, pkg.EditorPath, pkg.BundleName);
                this[pkg.AbFileName] = bundle;
            }
            else
            {
                bundle = this[pkg.AbFileName];
            }
            return(bundle);
        }
Пример #2
0
        public static BundleRef  Create(KAssetBundle ab, string abname, string loadname, string bundlename)
        {
            BundleRef bundle = new BundleRef();

            bundle.Res = ab;

            bundle.depends = new List <IBundleRef>();
            bundle.refs    = new List <WeakReference>();

            if (ab.isStreamedSceneAssetBundle)
            {
                bundle.LoadName = System.IO.Path.GetFileNameWithoutExtension(ab.GetAllScenePaths()[0]);
            }
            else
            {
                bundle.LoadName = BundlePathConvert.EditorName2AssetName(loadname);
            }

            bundle.name     = bundlename;
            bundle.filename = abname;
            return(bundle);
        }