Exemplo n.º 1
0
        private static AssetBundleFolderInfoConcrete AddFoldersToBundle(AssetBundleFolderInfo root, AssetBundleNameInfo nameData)
        {
            AssetBundleInfo assetBundleInfo = root;
            var             folder          = assetBundleInfo as AssetBundleFolderInfoConcrete;
            var             size            = nameData.pathTokens.Count;

            for (var index = 0; index < size; index++)
            {
                if (folder != null)
                {
                    assetBundleInfo = folder.GetAssetBundleInfoByName(nameData.pathTokens[index]);
                    if (assetBundleInfo == null)
                    {
                        assetBundleInfo = new AssetBundleFolderInfoConcrete(nameData.pathTokens, index + 1, folder);
                        folder.AddChild(assetBundleInfo);
                    }

                    folder = assetBundleInfo as AssetBundleFolderInfoConcrete;
                    if (folder == null)
                    {
                        s_InErrorState = true;
                        LogFolderAndBundleNameConflict(assetBundleInfo.m_Name.fullNativeName);
                        break;
                    }
                }
            }
            return(assetBundleInfo as AssetBundleFolderInfoConcrete);
        }
Exemplo n.º 2
0
        internal override void HandleReparent(string parentName, AssetBundleFolderInfo newParent = null)
        {
            RefreshAssetList();
            string newName = System.String.IsNullOrEmpty(parentName) ? "" : parentName + '/';

            newName += m_Name.shortName;
            if (newName == m_Name.bundleName)
            {
                return;
            }

            if (newParent != null && newParent.GetAssetBundleInfoByName(newName) != null)
            {
                AssetBundleModel.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy.  If your desire is to merge bundles, drag one on top of the other.");
                return;
            }

            foreach (var asset in m_ConcreteAssets)
            {
                AssetBundleModel.MoveAssetToBundle(asset, newName, m_Name.variant);
            }

            if (newParent != null)
            {
                m_Parent.HandleChildRename(m_Name.shortName, string.Empty);
                m_Parent = newParent;
                m_Parent.AddChild(this);
            }
            m_Name.SetBundleName(newName, m_Name.variant);
        }
Exemplo n.º 3
0
 internal BundleDataInfo(string name, AssetBundleFolderInfo parent) : base(name, parent)
 {
     m_ConcreteAssets     = new List <AssetInfo>();
     m_DependentAssets    = new List <AssetInfo>();
     m_BundleDependencies = new List <BundleDependencyInfo>();
     m_ConcreteCounter    = 0;
     m_DependentCounter   = 0;
 }
Exemplo n.º 4
0
        private static AssetBundleInfo AddBundleToFolder(AssetBundleFolderInfo root, AssetBundleNameInfo nameData)
        {
            AssetBundleInfo currInfo = root.GetAssetBundleInfoByName(nameData.shortName);

            if (!System.String.IsNullOrEmpty(nameData.variant))
            {
                if (currInfo == null)
                {
                    currInfo = new BundleVariantFolderInfo(nameData.bundleName, root);
                    root.AddChild(currInfo);
                }
                var folder = currInfo as BundleVariantFolderInfo;
                if (folder == null)
                {
                    var message = "Bundle named " + nameData.shortName;
                    message += " exists both as a standard bundle, and a bundle with variants.  ";
                    message += "This message is not supported for display or actual bundle building.  ";
                    message += "You must manually fix bundle naming in the inspector.";

                    LogError(message);
                    return(null);
                }


                currInfo = folder.GetAssetBundleInfoByName(nameData.variant);
                if (currInfo == null)
                {
                    currInfo = new BundleVariantDataInfo(nameData.fullNativeName, folder);
                    folder.AddChild(currInfo);
                }
            }
            else
            {
                if (currInfo == null)
                {
                    currInfo = new BundleDataInfo(nameData.fullNativeName, root);
                    root.AddChild(currInfo);
                }
                else
                {
                    var dataInfo = currInfo as BundleDataInfo;
                    if (dataInfo == null)
                    {
                        s_InErrorState = true;
                        LogFolderAndBundleNameConflict(nameData.fullNativeName);
                    }
                }
            }
            return(currInfo);
        }
Exemplo n.º 5
0
        private static AssetBundleInfo AddAssetBundleByName(string name)
        {
            if (name == null)
            {
                return(null);
            }

            AssetBundleNameInfo assetBundleNameInfo = new AssetBundleNameInfo(name);

            AssetBundleFolderInfo assetBundleFolderInfo = AddFoldersToBundle(s_RootLevelBundles, assetBundleNameInfo);
            AssetBundleInfo       assetBundleInfo       = AddBundleToFolder(assetBundleFolderInfo, assetBundleNameInfo);

            return(assetBundleInfo);
        }
Exemplo n.º 6
0
        internal static AssetBundleInfo CreateEmptyBundle(AssetBundleFolderInfo folder = null, string newName = null)
        {
            if ((folder as BundleVariantFolderInfo) != null)
            {
                return(CreateEmptyVariant(folder as BundleVariantFolderInfo));
            }

            folder = (folder == null) ? s_RootLevelBundles : folder;
            string name = GetUniqueName(folder, newName);
            AssetBundleNameInfo nameData;

            nameData = new AssetBundleNameInfo(folder.m_Name.bundleName, name);
            return(AddBundleToFolder(folder, nameData));
        }
Exemplo n.º 7
0
        private static string GetUniqueName(AssetBundleFolderInfo folder, string suggestedName = null)
        {
            suggestedName = (suggestedName == null) ? kNewBundleBaseName : suggestedName;
            string name          = suggestedName;
            int    index         = 1;
            bool   foundExisting = (folder.GetAssetBundleInfoByName(name) != null);

            while (foundExisting)
            {
                name = suggestedName + index;
                index++;
                foundExisting = (folder.GetAssetBundleInfoByName(name) != null);
            }
            return(name);
        }
Exemplo n.º 8
0
 internal static void HandleBundleReparent(IEnumerable <AssetBundleInfo> bundles, AssetBundleFolderInfo parent)
 {
     parent = (parent == null) ? s_RootLevelBundles : parent;
     foreach (var bundle in bundles)
     {
         bundle.HandleReparent(parent.m_Name.bundleName, parent);
     }
     ExecuteAssetMove();
 }
Exemplo n.º 9
0
 internal AssetBundleFolderInfo(List <string> path, int depth, AssetBundleFolderInfo parent) : base("", parent)
 {
     m_AssetBundleInfos = new Dictionary <string, AssetBundleInfo>();
     m_Name             = new AssetBundleNameInfo("");
     m_Name.pathTokens  = path.GetRange(0, depth);
 }
Exemplo n.º 10
0
 internal AssetBundleFolderInfo(string name, AssetBundleFolderInfo parent) : base(name, parent)
 {
     m_AssetBundleInfos = new Dictionary <string, AssetBundleInfo>();
 }
Exemplo n.º 11
0
 internal BundleVariantDataInfo(string name, AssetBundleFolderInfo parent) : base(name, parent)
 {
 }
Exemplo n.º 12
0
 abstract internal void HandleReparent(string parentName, AssetBundleFolderInfo newParent = null);
Exemplo n.º 13
0
 internal AssetBundleInfo(string name, AssetBundleFolderInfo parent)
 {
     m_Name   = new AssetBundleNameInfo(name);
     m_Parent = parent;
 }
Exemplo n.º 14
0
 internal AssetBundleFolderInfoConcrete(List <string> path, int depth, AssetBundleFolderInfo parent) : base(path, depth, parent)
 {
 }
Exemplo n.º 15
0
 internal AssetBundleFolderInfoConcrete(string name, AssetBundleFolderInfo parent) : base(name, parent)
 {
 }