internal bool FindContentMismatch(BundleVariantDataInfo other) { bool result = false; if (m_FolderIncludeAssets.Count != 0 || other.m_FolderIncludeAssets.Count != 0) { var myUniqueAssets = new HashSet <string>(); var otherUniqueAssets = new HashSet <string>(other.m_FolderIncludeAssets.Select(x => x.displayName)); foreach (var asset in m_FolderIncludeAssets) { if (!otherUniqueAssets.Remove(asset.displayName)) { myUniqueAssets.Add(asset.displayName); } } if (myUniqueAssets.Count > 0) { m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); result = true; } if (otherUniqueAssets.Count > 0) { other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); result = true; } } else //this doesn't cover the super weird case of including a folder and some explicit assets. TODO - fix that. { var myUniqueAssets = new HashSet <string>(); var otherUniqueAssets = new HashSet <string>(other.m_ConcreteAssets.Select(x => x.displayName)); foreach (var asset in m_ConcreteAssets) { if (!otherUniqueAssets.Remove(asset.displayName)) { myUniqueAssets.Add(asset.displayName); } } if (myUniqueAssets.Count > 0) { m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); result = true; } if (otherUniqueAssets.Count > 0) { other.m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, true); result = true; } } return(result); }
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); }
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); } }
internal void ValidateVariants() { m_validated = true; bool childMismatch = false; if (m_Children.Count > 1) { BundleVariantDataInfo goldChild = null; foreach (var c in m_Children) { var child = c.Value as BundleVariantDataInfo; child.SetMessageFlag(MessageSystem.MessageFlag.VariantBundleMismatch, false); if (goldChild == null) { goldChild = child; continue; } childMismatch |= goldChild.FindContentMismatch(child); } } m_BundleMessages.SetFlag(MessageSystem.MessageFlag.VariantBundleMismatch, childMismatch); }