コード例 #1
0
            // 将指定资源放入合适的分包中, 产生变化时返回 true
            // buildPlatform: 当前正在打包的平台
            private bool AdjustBundleSlice(BundleBuilderData data, BundleBuilderData.BundleInfo bundleInfo,
                                           string bundleName, PackedObject packedObject)
            {
                var assetPath       = AssetDatabase.GetAssetPath(packedObject.asset);
                var guid            = AssetDatabase.AssetPathToGUID(assetPath);
                var streamingAssets = data.IsStreamingAssets(guid, bundleInfo);
                var slicePlatform   = packedObject.platform;

                for (var i = 0; i < this.slices.Count; i++)
                {
                    var oldSlice = this.slices[i];
                    if (oldSlice.AddHistory(guid, streamingAssets, slicePlatform))
                    {
                        return(false);
                    }
                }

                var lastSlice = GetLastSlice(streamingAssets, slicePlatform);

                if (lastSlice == null || !lastSlice.AddNew(guid))
                {
                    var sliceName = GetBundleSliceName(bundleName).ToLower();
                    var newSlice  = new BundleSlice(sliceName, sliceObjects, streamingAssets, slicePlatform);
                    this.slices.Add(newSlice);
                    newSlice.AddNew(guid);
                }

                return(true);
            }
コード例 #2
0
            public bool Lookup(string assetGuid, out BundleSplit bundleSplit, out BundleSlice bundleSlice)
            {
                for (int i = 0, size = splits.Count; i < size; i++)
                {
                    var split = splits[i];
                    var slice = split.Lookup(assetGuid);
                    if (slice != null)
                    {
                        bundleSplit = split;
                        bundleSlice = slice;
                        return(true);
                    }
                }

                bundleSplit = null;
                bundleSlice = null;
                return(false);
            }
コード例 #3
0
ファイル: BundleBuilderData.cs プロジェクト: mengtest/unityfs
            public BundleSlice GetBundleSlice(string bundleName)
            {
                var splitName = this.name ?? string.Empty;
                var count     = this.slices.Count;
                var slice     = count > 0 ? this.slices[count - 1] : null;

                if (slice == null || this.sliceObjects >= 1 && slice.assets.Count >= this.sliceObjects)
                {
                    slice = new BundleSlice();
                    this.slices.Add(slice);
                    var baseName = splitName;
                    if (this.sliceObjects != 0 && count != 0)
                    {
                        baseName += "_" + count;
                    }
                    slice.name = GetBundleName(bundleName, baseName).ToLower();
                }
                return(slice);
            }
コード例 #4
0
        public bool Lookup(string assetGuid, out BundleInfo bundleInfo, out BundleSplit bundleSplit, out BundleSlice bundleSlice)
        {
            for (int i = 0, size = bundles.Count; i < size; i++)
            {
                var bundle = bundles[i];
                if (bundle.Lookup(assetGuid, out bundleSplit, out bundleSlice))
                {
                    bundleInfo = bundle;
                    return(true);
                }
            }

            bundleInfo  = null;
            bundleSplit = null;
            bundleSlice = null;
            return(false);
        }