예제 #1
0
    private void LoadFileExplorer(bool forward = true)
    {
        folderLevel = FolderLevel.FileExplorer;
        AllNodeStrings.Clear();

        path = "";
        string[] drives = Directory.GetLogicalDrives();
        foreach (string d in drives)
        {
            AllNodeStrings.Add(d.Replace(@"\", ".drive"));
        }

        AllNodeStrings.Add(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + ".desktop");
        AllNodeStrings.Add(Application.dataPath + ".folder");

        if (forward)
        {
            ResetCurrentPage();
        }
        else
        {
            GetSavedPage();
        }

        BuildNodes();
    }
예제 #2
0
    public void OpenFolder(string filename, bool addNew = false, bool forward = true)
    {
        folderLevel = FolderLevel.Folder;

        //Check if they passed a full path in, it will have a :\
        if (filename.LastIndexOf(@":") >= 0)
        {
            path = "";
        }

        string startPath = path;

        if (!path.Equals(""))
        {
            path += @"\";
        }
        path += filename;
        try
        {
            LoadFiles(addNew, forward);
        }
        catch
        {
            //manager.UpdateLog("Access denied: " + path);
            path = startPath;
        }
    }
예제 #3
0
    public void OpenCategory(string filename, bool forward = true)
    {
        folderLevel = FolderLevel.PickBundle;
        AllNodeStrings.Clear();
        returnToMenu     = false;
        this.topCategory = (BundleItem.TopCategory)Enum.Parse(typeof(BundleItem.TopCategory), filename);
        bundleItems      = TODV2.GetItemByTopCategory(this.topCategory);



        foreach (BundleItem b in bundleItems)
        {
//                if (File.Exists(Globals.BUNDLEPATH + b.bundle.ToString().ToLower()))

            AllNodeStrings.Add(b.BundleName.ToString() + ".bundle");
        }

        AllNodeStrings = AllNodeStrings.Distinct().ToList();

        if (forward)
        {
            ResetCurrentPage();
        }
        else
        {
            GetSavedPage();
        }
        BuildNodes();
    }
예제 #4
0
    public void LoadTopCategory(bool forward = true)
    {
        folderLevel  = FolderLevel.CategorySelect;
        returnToMenu = true;
        AllNodeStrings.Clear();

        var values = Enum.GetValues(typeof(BundleItem.TopCategory));

        foreach (BundleItem.TopCategory p in values)
        {
            if (p != BundleItem.TopCategory.Staging && p != BundleItem.TopCategory.Environment && p != BundleItem.TopCategory.Other)
            {
                AllNodeStrings.Add(p.ToString() + ".category");
            }
        }

        AllNodeStrings.Reverse();

        if (forward)
        {
            ResetCurrentPage();
        }
        else
        {
            GetSavedPage();
        }
        BuildNodes();
    }
예제 #5
0
    public void LoadFavList(List <int> fav)
    {
        folderLevel = FolderLevel.CustomList;
        nodeItems.Clear();
        AllNodeStrings.Clear();

        foreach (int i in fav)
        {
            nodeItems.Add(TODV2.GetItemByID(i));
            AllNodeStrings.Add(i.ToString() + ".prefab");
        }
        ResetCurrentPage();
        BuildNodes();
    }
예제 #6
0
    private void OpenSubFolder(string filename, bool back = false)
    {
        folderLevel = FolderLevel.SubFolder;
        if (!back)
        {
            currentPath.Add(filename);
        }
        nodeItems.Clear();

        AllNodeStrings.Clear();
        foreach (BundleItem b in bundleItems)
        {
            string[] tokens = b.path.Split(',');
            string   next;
            try
            {
                string comp = "";
                if (currentFolderIndex < tokens.Length && tokens[currentFolderIndex - 1] == filename)
                {
                    next = tokens[currentFolderIndex];
                    if (next.ToLower() != "hidden" || Application.isEditor || Debug.isDebugBuild)
                    {
                        AllNodeStrings.Add(next + ".subfolder");
                        nodeItems.Add(null);
                    }
                }
                else if (tokens[currentFolderIndex - 1] == filename)
                {
                    AllNodeStrings.Add(b.PrefabName);
                    nodeItems.Add(b);
                }
            }
            catch { }
        }
        AllNodeStrings = AllNodeStrings.Distinct().ToList();

        if (!back)
        {
            ResetCurrentPage();
        }
        else
        {
            GetSavedPage();
        }

        BuildNodes();
    }
예제 #7
0
    public void LoadZoneList()
    {
        folderLevel = FolderLevel.CustomList;
        nodeItems.Clear();
        AllNodeStrings.Clear();
        nodeItems.Add(TODV2.GetItemByID(14803));
        AllNodeStrings.Add("New Zone.zone");
        foreach (Zone z in WorldBuilderMain.currentWorld.zones)
        {
            nodeItems.Add(TODV2.GetItemByID(14803));
            string s = z.zoneId + ":" + ((z.name == null || z.name.Length == 0) ? @"<No Name>" : z.name) + ".zone";
            AllNodeStrings.Add(s);
        }

        ResetCurrentPage();
        BuildNodes();
    }
예제 #8
0
    private void LoadMode(string fileName)
    {
        folderLevel = FolderLevel.MainMenu;

        switch (fileName)
        {
        case "Exit Game":
            Application.Quit();
            return;

        case "Exit Mode":
            manager.ReturnToLastMode();
            return;
        }

        //if (nextMode != null)
        //    manager.NextMode(nextMode, subMode);
    }
예제 #9
0
    private void OpenBundle(string filename, bool forward = true)
    {
        folderLevel = FolderLevel.SubFolderLevelOne;
        AllNodeStrings.Clear();
        currentPath.Add(filename);

        this.bundleName = (BundleItem.BundleNames)Enum.Parse(typeof(BundleItem.BundleNames), filename);
        //  AssetBundleRequest req = AssetBundleManager.RequestBundle(this.bundleName);

        AssetBundleCreateRequest a = AssetBundleManager.GetAssetBundle(this.bundleName);

        ab = a.assetBundle;

        bundleItems = TODV2.GetItemByBundle(this.bundleName);

        foreach (BundleItem b in bundleItems)
        {
            string[] tokens = b.path.Split(',');
            string   next;
            if (currentFolderIndex < tokens.Length)
            {
                next = tokens[currentFolderIndex];
                if (next.ToLower() != "hidden" || Application.isEditor || Debug.isDebugBuild)
                {
                    AllNodeStrings.Add(next + ".subfolder");
                }
            }
        }

        AllNodeStrings = AllNodeStrings.Distinct().ToList();

        if (forward)
        {
            ResetCurrentPage();
        }
        else
        {
            GetSavedPage();
        }

        BuildNodes();
    }
        /// <summary>
        /// Add a song to directory tree.  Determine its place in the tree by walking the split directory path.
        /// </summary>
        /// <param name="customSongDirUri"></param>
        /// <param name="level"></param>
        private void AddItemToDirectoryTree(Uri customSongDirUri, LevelSO level)
        {
            //Logger.Debug("Processing item into directory tree: {0}", level.levelID);
            DirectoryNode currentNode = _directoryTree[CUSTOM_SONGS_DIR];

            // Just add original songs to root and bail
            if (level.levelID.Length < 32)
            {
                currentNode.Levels.Add(level);
                return;
            }

            CustomSongInfo songInfo      = _levelIdToCustomLevel[level.levelID].customSongInfo;
            Uri            customSongUri = new Uri(songInfo.path);
            Uri            pathDiff      = customSongDirUri.MakeRelativeUri(customSongUri);
            string         relPath       = Uri.UnescapeDataString(pathDiff.OriginalString);

            string[] paths      = relPath.Split('/');
            Sprite   folderIcon = Base64Sprites.FolderIcon;

            // Prevent cache directory from building into the tree, will add all its leafs to root.
            bool forceIntoRoot = false;

            //Logger.Debug("Processing path: {0}", songInfo.path);
            if (paths.Length > 2)
            {
                forceIntoRoot = paths[1].Contains(".cache");
                Regex r = new Regex(@"^\d{1,}-\d{1,}");
                if (r.Match(paths[1]).Success)
                {
                    forceIntoRoot = true;
                }
            }

            for (int i = 1; i < paths.Length; i++)
            {
                string path = paths[i];

                if (path == Path.GetFileName(songInfo.path))
                {
                    //Logger.Debug("\tLevel Found Adding {0}->{1}", currentNode.Key, level.levelID);
                    currentNode.Levels.Add(level);
                    break;
                }
                else if (currentNode.Nodes.ContainsKey(path))
                {
                    currentNode = currentNode.Nodes[path];
                }
                else if (!forceIntoRoot)
                {
                    currentNode.Nodes[path] = new DirectoryNode(path);
                    FolderLevel folderLevel = new FolderLevel();
                    folderLevel.Init(relPath, path, folderIcon);

                    //Logger.Debug("\tAdding folder level {0}->{1}", currentNode.Key, path);
                    currentNode.Levels.Add(folderLevel);

                    _cachedLastWriteTimes[folderLevel.levelID] = (File.GetLastWriteTimeUtc(relPath) - EPOCH).TotalMilliseconds;

                    currentNode = currentNode.Nodes[path];
                }
            }
        }