示例#1
0
        public override IEnumerable <QuickOpenEntryMeta> GetQuickOpenEntries()
        {
            var           cacheFile = PathManager.OpenedSceneFileCachePath();
            List <string> ids       = null;

            if (File.Exists(cacheFile))
            {
                ids = File.ReadAllLines(cacheFile).Reverse().ToList();
            }

            var guids = AssetDatabase.FindAssets("t:Scene");

            if (ids != null)
            {
                foreach (var id in guids)
                {
                    if (ids.Contains(id))
                    {
                        continue;
                    }
                    ids.Add(id);
                }
            }
            else
            {
                ids = guids.ToList();
            }

            List <QuickOpenEntryMeta> data = new List <QuickOpenEntryMeta>();

            foreach (var id in ids)
            {
                if (string.IsNullOrEmpty(id))
                {
                    continue;
                }

                QuickOpenEntryMeta meta = new QuickOpenEntryMeta();
                meta.id = id;

                var scenePath = AssetDatabase.GUIDToAssetPath(id);
                meta.label       = Path.GetFileNameWithoutExtension(scenePath);
                meta.description = Path.GetDirectoryName(scenePath).Replace("\\", "/");
                meta.icon        = "scene";

                data.Add(meta);
            }

            return(data);
        }
示例#2
0
        public override IEnumerable <QuickOpenEntryMeta> GetQuickOpenEntries()
        {
            List <QuickOpenEntryMeta> list = new List <QuickOpenEntryMeta>();

            foreach (var item in SupportSnippetLanguages)
            {
                QuickOpenEntryMeta meta = new QuickOpenEntryMeta();
                meta.id    = item;
                meta.label = item;

                list.Add(meta);
            }

            return(list);
        }
示例#3
0
        public override IEnumerable <QuickOpenEntryMeta> GetQuickOpenEntries()
        {
            List <QuickOpenEntryMeta> metas = new List <QuickOpenEntryMeta>();

            for (int i = 0; i < SPECIAL_FOLDERS.Length; i++)
            {
                QuickOpenEntryMeta meta = new QuickOpenEntryMeta();
                meta.id          = i.ToString();
                meta.label       = SPECIAL_FOLDERS[i];
                meta.description = "";

                metas.Add(meta);
            }

            return(metas);
        }
示例#4
0
        public override IEnumerable <QuickOpenEntryMeta> GetQuickOpenEntries()
        {
            var folder = Utility.PathCombine(EditorApplication.applicationContentsPath, "Resources", "ScriptTemplates");
            var files  = Directory.GetFiles(Path.GetFullPath(folder), "*.txt");
            List <QuickOpenEntryMeta> quickOpens = new List <QuickOpenEntryMeta>();

            foreach (var file in files)
            {
                QuickOpenEntryMeta meta = new QuickOpenEntryMeta();
                meta.id    = file.Replace("\\", "/");
                meta.label = Path.GetFileNameWithoutExtension(file);
                meta.icon  = "text";

                quickOpens.Add(meta);
            }

            return(quickOpens);
        }