Example #1
0
        internal virtual bool HandleChildRename(string oldName, string newName)
        {
            if (string.IsNullOrEmpty(oldName))
            {
                AssetBundleModel.LogWarning("Attempting to Rename an item '" + "' which oldName is NullOrEmpty.");
                return(false);
            }

            if (string.IsNullOrEmpty(newName))
            {
                AssetBundleModel.LogWarning("Attempting to Rename an item '" + "' which newName is NullOrEmpty.");
                return(false);
            }

            if (!System.String.IsNullOrEmpty(newName) && m_AssetBundleInfos.ContainsKey(newName))
            {
                AssetBundleModel.LogWarning("Attempting to name an item '" + newName + "' which matches existing name at this level in hierarchy.  If your desire is to merge bundles, drag one on top of the other.");
                return(false);
            }

            if (m_AssetBundleInfos.TryGetValue(oldName, out AssetBundleInfo info))
            {
                m_AssetBundleInfos.Remove(oldName);
                m_AssetBundleInfos.Add(newName, info);
            }

            return(true);
        }
Example #2
0
        internal override void HandleReparent(string parentName, AssetBundleFolderInfo newParent = null)
        {
            RefreshAssetList();
            string newName = System.String.IsNullOrEmpty(parentName) ? "" : parentName + '/';

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

            if (newParent != null && newParent.GetAssetBundleInfoByName(newName) != null)
            {
                AssetBundleModel.LogWarning("An item named '" + newName + "' already exists at this level in hierarchy.  If your desire is to merge bundles, drag one on top of the other.");
                return;
            }

            foreach (var asset in m_ConcreteAssets)
            {
                AssetBundleModel.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);
        }