67 lines
2.0 KiB
C#
67 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using Newtonsoft.Json;
|
|
using UnityEngine;
|
|
|
|
namespace Stary.Evo.Editor
|
|
{
|
|
public static class ArtLoadAssetLocal
|
|
{
|
|
|
|
/// <summary>
|
|
/// 获取本地全部作用域
|
|
/// </summary>
|
|
public static string[] GetLocalDomainAllName()
|
|
{
|
|
var creatDomainEntities = GetLocalDomainAll();
|
|
string[] domains = new string[creatDomainEntities.Count];
|
|
for (int i = 0; i < creatDomainEntities.Count; i++)
|
|
{
|
|
domains[i] = creatDomainEntities[i].DomainName;
|
|
}
|
|
|
|
return domains;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取全部作用域
|
|
/// </summary>
|
|
public static List<CreatArtDomainEntity> GetLocalDomainAll()
|
|
{
|
|
string domainPath = $"{Application.dataPath}/Member";
|
|
string[] domains;
|
|
// 新增目录获取代码
|
|
if (Directory.Exists(domainPath))
|
|
{
|
|
var dirInfo = new DirectoryInfo(domainPath);
|
|
// 获取直接子目录(不递归)
|
|
domains = dirInfo.GetDirectories("*", SearchOption.TopDirectoryOnly)
|
|
.Select(d => d.Name)
|
|
.ToArray();
|
|
}
|
|
else
|
|
{
|
|
domains = Array.Empty<string>();
|
|
}
|
|
|
|
List<CreatArtDomainEntity> domainList = new List<CreatArtDomainEntity>();
|
|
foreach (var item in domains)
|
|
{
|
|
if (File.Exists($"{domainPath}/{item}/Config/ArtSceneData.asset"))
|
|
{
|
|
CreatArtDomainEntity domainEntity = new CreatArtDomainEntity(domainList)
|
|
{
|
|
DomainName = item,
|
|
domainPath = $"{domainPath}/{item}"
|
|
};
|
|
domainList.Add(domainEntity);
|
|
}
|
|
}
|
|
|
|
return domainList;
|
|
}
|
|
}
|
|
} |