Пример #1
0
        public static bool HandleBundleRename(BundleTreeItem item, string newName)
        {
            var originalName = new BundleNameData(item.bundle.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.bundle.HandleRename(newName, 0);

            if (findDot > 0 || findSlash > 0 || findBSlash > 0)
            {
                item.bundle.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);
        }
Пример #2
0
        public static bool HandleBundleRename(BundleTreeItem item, string newName)
        {
            bool result = item.bundle.HandleRename(newName, 0);

            ExecuteAssetMove();
            return(result);
        }
Пример #3
0
        public override BundleTreeItem CreateTreeView(int depth)
        {
            var result = new BundleTreeItem(this, depth, "Folder Icon");

            foreach (var child in m_children)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return(result);
        }
Пример #4
0
        public override BundleTreeItem CreateTreeView(int depth)
        {
            RefreshMessages();
            var result = new BundleTreeItem(this, depth, Model.GetFolderIcon());

            foreach (var child in m_Children)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return(result);
        }
Пример #5
0
            public DragAndDropData(DragAndDropArgs a)
            {
                args         = a;
                draggedNodes = DragAndDrop.GetGenericData("AssetBundleModel.BundleInfo") as List <AssetBundleModel.BundleInfo>;
                targetNode   = args.parentItem as AssetBundleModel.BundleTreeItem;
                paths        = DragAndDrop.paths;

                if (draggedNodes != null)
                {
                    foreach (var bundle in draggedNodes)
                    {
                        if ((bundle as AssetBundleModel.BundleFolderInfo) != null)
                        {
                            hasBundleFolder = true;
                        }
                        else
                        {
                            var dataBundle = bundle as AssetBundleModel.BundleDataInfo;
                            if (dataBundle != null)
                            {
                                if (dataBundle.isSceneBundle)
                                {
                                    hasScene = true;
                                }
                                else
                                {
                                    hasNonScene = true;
                                }

                                if ((dataBundle as AssetBundleModel.BundleVariantDataInfo) != null)
                                {
                                    hasVariantChild = true;
                                }
                            }
                        }
                    }
                }
                else if (DragAndDrop.paths != null)
                {
                    foreach (var assetPath in DragAndDrop.paths)
                    {
                        if (AssetDatabase.GetMainAssetTypeAtPath(assetPath) == typeof(SceneAsset))
                        {
                            hasScene = true;
                        }
                        else
                        {
                            hasNonScene = true;
                        }
                    }
                }
            }
Пример #6
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;

                AssetBundleModel.BundleTreeItem renamedItem = FindItem(args.itemID, rootItem) as AssetBundleModel.BundleTreeItem;
                args.acceptedRename = AssetBundleModel.Model.HandleBundleRename(renamedItem, args.newName);
                ReloadAndSelect(renamedItem.bundle.nameHashCode, false);
            }
            else
            {
                args.acceptedRename = false;
            }
        }
Пример #7
0
        public static bool HandleBundleRename(BundleTreeItem item, string newName)
        {
            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.bundle.HandleRename(newName, 0);

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

            ExecuteAssetMove();
            return(result);
        }
Пример #8
0
        public override BundleTreeItem CreateTreeView(int depth)
        {
            Texture2D icon = null;

            if ((m_children.Count > 0) &&
                ((m_children.First().Value as BundleVariantDataInfo).IsSceneVariant()))
            {
                icon = Model.GetSceneIcon();
            }
            else
            {
                icon = Model.GetBundleIcon();
            }

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

            foreach (var child in m_children)
            {
                result.AddChild(child.Value.CreateTreeView(depth + 1));
            }
            return(result);
        }
Пример #9
0
 public static bool HandleBundleRename(BundleTreeItem item, string newName)
 {
     item.bundle.HandleRename(newName, 0);
     ExecuteAssetMove();
     return(true);  //is there an illegal rename?  if so, return false.
 }