Ejemplo n.º 1
0
        private static BundleFolderConcreteInfo AddFoldersToBundle(BundleFolderInfo root, BundleNameData nameData)
        {
            BundleInfo currInfo = root;
            var        folder   = currInfo as BundleFolderConcreteInfo;
            var        size     = nameData.pathTokens.Count;

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

                    folder = currInfo as BundleFolderConcreteInfo;
                    if (folder == null)
                    {
                        s_InErrorState = true;
                        LogFolderAndBundleNameConflict(currInfo.m_Name.fullNativeName);
                        break;
                    }
                }
            }
            return(currInfo as BundleFolderConcreteInfo);
        }
Ejemplo n.º 2
0
 internal BundleDataInfo(string name, BundleFolderInfo parent) : base(name, parent)
 {
     m_ConcreteAssets     = new List <AssetInfo>();
     m_DependentAssets    = new List <AssetInfo>();
     m_BundleDependencies = new HashSet <string>();
     m_ConcreteCounter    = 0;
     m_DependentCounter   = 0;
 }
Ejemplo n.º 3
0
 internal static void HandleBundleReparent(IEnumerable <BundleInfo> bundles, BundleFolderInfo parent)
 {
     parent = (parent == null) ? s_RootLevelBundles : parent;
     foreach (var bundle in bundles)
     {
         bundle.HandleReparent(parent.m_Name.bundleName, parent);
     }
     ExecuteAssetMove();
 }
Ejemplo n.º 4
0
        private static BundleInfo AddBundleToModel(string name)
        {
            if (name == null)
            {
                return(null);
            }

            BundleNameData nameData = new BundleNameData(name);

            BundleFolderInfo folder   = AddFoldersToBundle(s_RootLevelBundles, nameData);
            BundleInfo       currInfo = AddBundleToFolder(folder, nameData);

            return(currInfo);
        }
Ejemplo n.º 5
0
        internal static BundleInfo CreateEmptyBundle(BundleFolderInfo 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);
            BundleNameData nameData;

            nameData = new BundleNameData(folder.m_Name.bundleName, name);
            return(AddBundleToFolder(folder, nameData));
        }
Ejemplo n.º 6
0
        private static BundleInfo AddBundleToFolder(BundleFolderInfo root, BundleNameData nameData)
        {
            BundleInfo currInfo = root.GetChild(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.GetChild(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);
        }
Ejemplo n.º 7
0
        private static string GetUniqueName(BundleFolderInfo folder, string suggestedName = null)
        {
            suggestedName = (suggestedName == null) ? k_NewBundleBaseName : suggestedName;
            string name          = suggestedName;
            int    index         = 1;
            bool   foundExisting = (folder.GetChild(name) != null);

            while (foundExisting)
            {
                name = suggestedName + index;
                index++;
                foundExisting = (folder.GetChild(name) != null);
            }
            return(name);
        }
Ejemplo n.º 8
0
        internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null)
        {
            string newName = System.String.IsNullOrEmpty(parentName) ? "" : parentName + '/';

            newName += displayName;
            if (newName == m_Name.bundleName)
            {
                return;
            }
            foreach (var child in m_Children)
            {
                child.Value.HandleReparent(parentName);
            }

            if (newParent != null)
            {
                m_Parent.HandleChildRename(m_Name.shortName, string.Empty);
                m_Parent = newParent;
                m_Parent.AddChild(this);
            }
            m_Name.SetBundleName(newName, string.Empty);
        }
Ejemplo n.º 9
0
        internal override void HandleReparent(string parentName, BundleFolderInfo newParent = null)
        {
            RefreshAssetList();
            string newName = System.String.IsNullOrEmpty(parentName) ? "" : parentName + '/';

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

            foreach (var asset in m_ConcreteAssets)
            {
                Model.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);
        }
Ejemplo n.º 10
0
 internal BundleFolderConcreteInfo(List <string> path, int depth, BundleFolderInfo parent) : base(path, depth, parent)
 {
 }
Ejemplo n.º 11
0
 internal BundleFolderConcreteInfo(string name, BundleFolderInfo parent) : base(name, parent)
 {
 }
Ejemplo n.º 12
0
 internal BundleFolderInfo(string name, BundleFolderInfo parent) : base(name, parent)
 {
     m_Children = new Dictionary <string, BundleInfo>();
 }
Ejemplo n.º 13
0
 internal BundleVariantDataInfo(string name, BundleFolderInfo parent) : base(name, parent)
 {
 }
Ejemplo n.º 14
0
 abstract internal void HandleReparent(string parentName, BundleFolderInfo newParent = null);
Ejemplo n.º 15
0
 internal BundleInfo(string name, BundleFolderInfo parent)
 {
     m_Name   = new BundleNameData(name);
     m_Parent = parent;
 }
Ejemplo n.º 16
0
 internal BundleFolderInfo(List <string> path, int depth, BundleFolderInfo parent) : base("", parent)
 {
     m_Children        = new Dictionary <string, BundleInfo>();
     m_Name            = new BundleNameData("");
     m_Name.pathTokens = path.GetRange(0, depth);
 }
Ejemplo n.º 17
0
        protected virtual void CreateBundleUnderParent(AssetBundleModel.BundleFolderInfo folder)
        {
            var newBundle = AssetBundleModel.Model.CreateEmptyBundle(folder);

            ReloadAndSelect(newBundle.nameHashCode, true);
        }