111
This commit is contained in:
@@ -35,7 +35,7 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
CreatMemberFiled();
|
||||
}
|
||||
else if (useType == UseType.Project)
|
||||
else if (useType == UseType.Art)
|
||||
{
|
||||
CreatArtFiled();
|
||||
}
|
||||
@@ -199,6 +199,8 @@ namespace Stary.Evo.Editor
|
||||
domainMemberList.Add(domainEntity);
|
||||
}
|
||||
|
||||
//添加本地Member
|
||||
GetMemberLocalAll();
|
||||
artList = GetCreatDomainAll();
|
||||
}
|
||||
|
||||
@@ -218,16 +220,17 @@ namespace Stary.Evo.Editor
|
||||
{
|
||||
artDomainPath = $"{Application.dataPath}/Member/{domain}";
|
||||
}
|
||||
else if (useType == UseType.Project)
|
||||
else if (useType == UseType.Art)
|
||||
{
|
||||
artDomainPath = $"{Application.dataPath}/Art/{domain}";
|
||||
if (!Directory.Exists(artDomainPath))
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", $"不存在此Domain:{domain},无法创建", "确定");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(artDomainPath))
|
||||
{
|
||||
EditorUtility.DisplayDialog("提示", $"不存在此Domain:{domain},无法创建", "确定");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (useType == UseType.Member)
|
||||
{
|
||||
@@ -237,8 +240,46 @@ namespace Stary.Evo.Editor
|
||||
CreatDirectory(artDomainPath + "/Scenes");
|
||||
//创建/Scenes/Test文件夹
|
||||
CreatDirectory(artDomainPath + "/Scenes/Test");
|
||||
|
||||
//创建Art 测试场景配置文件
|
||||
string configDir = $"{artDomainPath}/Config";
|
||||
|
||||
// 检测目标文件是否已存在
|
||||
string assetPath = $"Assets/Member/{domain}/Config/ArtSceneData.asset";
|
||||
if (File.Exists($"{Application.dataPath}/../{assetPath}"))
|
||||
{
|
||||
Debug.LogWarning($"ArtSceneData.asset 已存在: {assetPath}");
|
||||
|
||||
// 可选:询问是否覆盖
|
||||
if (EditorUtility.DisplayDialog("文件已存在",
|
||||
$"ArtSceneData.asset 已存在,是否覆盖?", "覆盖", "取消"))
|
||||
{
|
||||
// 删除现有文件
|
||||
AssetDatabase.DeleteAsset(assetPath);
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
// 创建新的ArtSceneData
|
||||
ArtSceneData artSceneData = CreateInstance<ArtSceneData>();
|
||||
AssetDatabase.CreateAsset(artSceneData, assetPath);
|
||||
Debug.Log($"已覆盖 ArtSceneData: {assetPath}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("用户取消创建 ArtSceneData");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 文件不存在,直接创建
|
||||
ArtSceneData artSceneData = CreateInstance<ArtSceneData>();
|
||||
AssetDatabase.CreateAsset(artSceneData, assetPath);
|
||||
Debug.Log($"已创建 ArtSceneData: {assetPath}");
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
else if (useType == UseType.Project)
|
||||
else if (useType == UseType.Art)
|
||||
{
|
||||
//创建Animation文件夹
|
||||
CreatDirectory(artDomainPath + "/Animation");
|
||||
@@ -303,13 +344,58 @@ namespace Stary.Evo.Editor
|
||||
return domainList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取全部作用域
|
||||
/// </summary>
|
||||
private void GetMemberLocalAll()
|
||||
{
|
||||
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<CreatMemberServerDomainEntity> domainList = new List<CreatMemberServerDomainEntity>();
|
||||
foreach (var item in domains)
|
||||
{
|
||||
if (File.Exists($"{domainPath}/{item}/Config/ArtSceneData.asset"))
|
||||
{
|
||||
bool isExit = domainMemberList.Any(x => x.DomainName == item);
|
||||
if (isExit)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CreatMemberServerDomainEntity entity = new CreatMemberServerDomainEntity(domainList)
|
||||
{
|
||||
DomainName = item,
|
||||
domainPath = $"{domainPath}/{item}"
|
||||
};
|
||||
entity.SetArtSceneData();
|
||||
domainList.Add(entity);
|
||||
}
|
||||
}
|
||||
|
||||
domainMemberList.AddRange(domainList);
|
||||
}
|
||||
|
||||
private void SetUseTypeData()
|
||||
{
|
||||
if (useType == UseType.Member)
|
||||
{
|
||||
_titleGroupName = "创建成员";
|
||||
}
|
||||
else if (useType == UseType.Project)
|
||||
else if (useType == UseType.Art)
|
||||
{
|
||||
_titleGroupName = "创建项目Art";
|
||||
}
|
||||
@@ -322,7 +408,7 @@ namespace Stary.Evo.Editor
|
||||
|
||||
private bool IsProject()
|
||||
{
|
||||
return useType == UseType.Project;
|
||||
return useType == UseType.Art;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -338,7 +424,7 @@ namespace Stary.Evo.Editor
|
||||
/// <summary>
|
||||
/// 项目使用
|
||||
/// </summary>
|
||||
Project
|
||||
Art
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user