示例#1
0
        private static bool DependenceChainChecking(string assetDataId, BuildAssetBundleData.AssetBundleData assetBundleData)
        {
            Dictionary <string /*assetDataId*/, int> checkingList = new Dictionary <string, int>();

            while (!string.IsNullOrEmpty(assetDataId))
            {
                if (checkingList.ContainsKey(assetDataId))
                {
                    Debug.LogError("Illegal recursive dependence:" + assetDataId);
                    return(false);
                }
                checkingList.Add(assetDataId, 0);

                BuildAssetBundleData.AssetData assetData = null;
                if (!assetBundleData.assetDataMap.TryGetValue(assetDataId, out assetData))
                {
                    Debug.LogError("Undfined Error:" + assetDataId);
                    return(false);
                }

                if (assetData.HasDependence())
                {
                    assetDataId = assetData.dependence;
                }
                else
                {
                    assetDataId = null;
                }
            }
            return(true);
        }
示例#2
0
        private static bool BuildAsset(BuildAssetBundleData.AssetData assetData, BuildAssetBundleData.AssetBundleData assetBundleData)
        {
            if (assetData.IsEmpty())
            {
                return(true);
            }

            BuildAssetBundleData.AssetData[] assetDataChildren = null;
            bool hasAssetDataChildren = assetBundleData.TryGetDependenceChildren(assetData.id, out assetDataChildren);

            if (hasAssetDataChildren || assetData.HasDependence())
            {
                BuildPipeline.PushAssetDependencies();
            }

            assetData.enabled = false;
            foreach (BuildAssetBundleData.ItemDataCollection itemDataCollection in assetData.itemDataCollectionList)
            {
                if (itemDataCollection.IsEmpty())
                {
                    continue;
                }
                else
                {
                    if (!BuildItemDataCollection(itemDataCollection, assetBundleData))
                    {
                        return(false);
                    }
                }
            }

            if (hasAssetDataChildren)
            {
                foreach (BuildAssetBundleData.AssetData assetDataChild in assetDataChildren)
                {
                    BuildAsset(assetDataChild, assetBundleData);
                }
            }

            if (hasAssetDataChildren || assetData.HasDependence())
            {
                BuildPipeline.PopAssetDependencies();
            }
            return(true);
        }