Exemple #1
0
        internal static bool HandleBundleRename(BundleTreeViewItem item, string newName)
        {
            var originalName = new AssetBundleNameInfo(item.assetBundleInfo.m_Name.fullNativeName);

            var findDot    = newName.LastIndexOf('.');
            var findSlash  = newName.LastIndexOf('/');
            var findBSlash = newName.LastIndexOf('\\');

            if (findDot == 0 || findSlash == 0 || findBSlash == 0)
            {
                return(false); //can't start a bundle with a / or .
            }
            bool result = item.assetBundleInfo.HandleRename(newName, 0);

            if (findDot > 0 || findSlash > 0 || findBSlash > 0)
            {
                item.assetBundleInfo.parent.HandleChildRename(newName, string.Empty);
            }

            ExecuteAssetMove();

            var node = FindBundle(originalName);

            if (node != null)
            {
                var message = "Failed to rename bundle named: ";
                message += originalName.fullNativeName;
                message += ".  Most likely this is due to the bundle being assigned to a folder in your Assets directory, AND that folder is either empty or only contains assets that are explicitly assigned elsewhere.";
                Debug.LogError(message);
            }

            return(result);
        }
Exemple #2
0
        internal override BundleTreeViewItem CreateTreeView(int depth)
        {
            RefreshMessages();
            var result = new BundleTreeViewItem(this, depth, AssetBundleModel.folderIcon);

            foreach (var child in m_AssetBundleInfos)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return(result);
        }
Exemple #3
0
        protected override void RenameEnded(RenameEndedArgs args)
        {
            base.RenameEnded(args);
            if (args.newName.Length > 0 && args.newName != args.originalName)
            {
                args.newName        = args.newName.ToLower();
                args.acceptedRename = true;

                Model.BundleTreeViewItem renamedItem = FindItem(args.itemID, rootItem) as Model.BundleTreeViewItem;
                args.acceptedRename = Model.AssetBundleModel.HandleBundleRename(renamedItem, args.newName);
                ReloadAndSelect(renamedItem.assetBundleInfo.nameHashCode, false);
            }
            else
            {
                args.acceptedRename = false;
            }
        }
Exemple #4
0
        internal override BundleTreeViewItem CreateTreeView(int depth)
        {
            RefreshMessages();
            Texture2D icon = null;

            if ((m_AssetBundleInfos.Count > 0) &&
                ((m_AssetBundleInfos.First().Value as BundleVariantDataInfo).IsSceneVariant()))
            {
                icon = AssetBundleModel.sceneIcon;
            }
            else
            {
                icon = AssetBundleModel.bundleIcon;
            }

            var result = new BundleTreeViewItem(this, depth, icon);

            foreach (var child in m_AssetBundleInfos)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return(result);
        }