Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
            }
        }