コード例 #1
0
ファイル: BundleCache.cs プロジェクト: zwwl0801/RvoProject
        /// <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);
        }