Beispiel #1
0
        internal static BundleInfo CreateEmptyVariant(BundleVariantFolderInfo folder)
        {
            string         name        = GetUniqueName(folder, k_NewVariantBaseName);
            string         variantName = folder.m_Name.bundleName + "." + name;
            BundleNameData nameData    = new BundleNameData(variantName);

            return(AddBundleToFolder(folder.parent, nameData));
        }
 protected virtual void CreateVariantUnderParent(AssetBundleModel.BundleVariantFolderInfo folder)
 {
     if (folder != null)
     {
         var newBundle = AssetBundleModel.Model.CreateEmptyVariant(folder);
         ReloadAndSelect(newBundle.nameHashCode, true);
     }
 }
        void CreateNewVariant(object context)
        {
            AssetBundleModel.BundleVariantFolderInfo folder = null;
            var selectedNodes = context as List <AssetBundleModel.BundleTreeItem>;

            if (selectedNodes != null && selectedNodes.Count == 1)
            {
                folder = selectedNodes[0].bundle as AssetBundleModel.BundleVariantFolderInfo;
                CreateVariantUnderParent(folder);
            }
        }
Beispiel #4
0
        protected override void CreateVariantUnderParent(AssetBundleModel.BundleVariantFolderInfo folder)
        {
            if (folder != null)
            {
                folder = ValidateFolder(folder) as AssetBundleModel.BundleVariantFolderInfo;
                if (folder == null)
                {
                    return;
                }

                var newBundle = AssetBundleModel.Model.CreateEmptyVariant(folder);
                ReloadAndSelect(newBundle.nameHashCode, true);
            }
        }
Beispiel #5
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);
        }
        void CreateNewSiblingVariant(object context)
        {
            var selectedNodes = context as List <AssetBundleModel.BundleTreeItem>;

            if (selectedNodes != null && selectedNodes.Count > 0)
            {
                AssetBundleModel.BundleVariantFolderInfo folder = null;
                folder = selectedNodes[0].bundle.parent as AssetBundleModel.BundleVariantFolderInfo;
                CreateVariantUnderParent(folder);
            }
            else
            {
                Debug.LogError("could not add 'sibling' with no bundles selected");
            }
        }
Beispiel #7
0
        internal static BundleInfo HandleConvertToVariant(BundleDataInfo bundle)
        {
            bundle.HandleDelete(true, bundle.m_Name.bundleName, k_NewVariantBaseName);
            ExecuteAssetMove();
            var root = bundle.parent.GetChild(bundle.m_Name.shortName) as BundleVariantFolderInfo;

            if (root != null)
            {
                return(root.GetChild(k_NewVariantBaseName));
            }
            else
            {
                //we got here because the converted bundle was empty.
                var vfolder = new BundleVariantFolderInfo(bundle.m_Name.bundleName, bundle.parent);
                var vdata   = new BundleVariantDataInfo(bundle.m_Name.bundleName + "." + k_NewVariantBaseName, vfolder);
                bundle.parent.AddChild(vfolder);
                vfolder.AddChild(vdata);
                return(vdata);
            }
        }