Пример #1
0
        public static BundleInfo CreateEmptyVariant(BundleVariantFolderInfo folder)
        {
            string         name        = GetUniqueName(folder, kNewVariantBaseName);
            string         variantName = folder.m_name.BundleName + "." + name;
            BundleNameData nameData    = new BundleNameData(variantName);

            return(AddBundleToFolder(folder.Parent, nameData));
        }
Пример #2
0
        private static BundleInfo AddBundleToFolder(BundleFolderInfo root, BundleNameData nameData)
        {
            BundleInfo currInfo = root.GetChild(nameData.ShortName);

            if (nameData.Variant != string.Empty)
            {
                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)
                    {
                        m_inErrorState = true;
                        LogError("Bundle " + nameData.FullNativeName + " has a name conflict with a bundle-folder.  Display of bundle data and building of bundles will not work.");
                    }
                }
            }
            return(currInfo);
        }
Пример #3
0
        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;
                if (folder != null)
                {
                    var newBundle = AssetBundleModel.Model.CreateEmptyVariant(folder);
                    ReloadAndSelect(newBundle.NameHashCode, true);
                }
            }
        }
Пример #4
0
        public static BundleInfo ConvertToVariant(BundleDataInfo bundle)
        {
            bundle.HandleDelete(true, bundle.m_name.BundleName, kNewVariantBaseName);
            ExecuteAssetMove();
            var root = bundle.Parent.GetChild(bundle.m_name.ShortName) as BundleVariantFolderInfo;

            if (root != null)
            {
                return(root.GetChild(kNewVariantBaseName));
            }
            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 + "." + kNewVariantBaseName, vfolder);
                bundle.Parent.AddChild(vfolder);
                vfolder.AddChild(vdata);
                return(vdata);
            }
        }