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
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,20 +19,24 @@ namespace Stary.Evo.Editor
|
||||
[HorizontalGroup] [ReadOnly] public string DomainName;
|
||||
|
||||
private bool IsValidPath => IsValidProjectPath(domainPath);
|
||||
private bool IsValidIP => string.IsNullOrEmpty(ip);
|
||||
|
||||
[ReadOnly] [InfoBox("当前路径在Unity项目中不存在,请检查路径是否需要删除", InfoMessageType.Error, "IsValidPath")]
|
||||
[ReadOnly]
|
||||
[InfoBox("当前用户在Unity项目中不存在,请检查该用户是否需要删除", InfoMessageType.Warning, "IsValidPath")]
|
||||
[InfoBox("当前用户在服务器上不存在,暂不支持数据管理,仅支持数据配置", InfoMessageType.Warning, "IsValidIP")]
|
||||
public string domainPath;
|
||||
|
||||
private ResDmainResponse resDmainResponse;
|
||||
|
||||
|
||||
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)]
|
||||
[HideLabel]
|
||||
[InlineEditor(InlineEditorObjectFieldModes.CompletelyHidden)] [HideLabel]
|
||||
public ArtSceneData artSceneData;
|
||||
|
||||
public CreatMemberServerDomainEntity(List<CreatMemberServerDomainEntity> domainList)
|
||||
{
|
||||
this.domainList = domainList;
|
||||
}
|
||||
|
||||
public void SetDomainData(string domainName, string domainPath, ResDmainResponse response, string ip)
|
||||
{
|
||||
resDmainResponse = response;
|
||||
@@ -49,8 +53,14 @@ namespace Stary.Evo.Editor
|
||||
_endableBtnName = "禁用";
|
||||
_endableBtnColor = Color.red;
|
||||
}
|
||||
|
||||
SetArtSceneData();
|
||||
}
|
||||
|
||||
public void SetArtSceneData()
|
||||
{
|
||||
string artSceneDataPath =
|
||||
$"Assets/Member/{domainName}/Config/ArtSceneData.asset";
|
||||
$"Assets/Member/{DomainName}/Config/ArtSceneData.asset";
|
||||
ArtSceneData artSceneData =
|
||||
AssetDatabase.LoadAssetAtPath<ArtSceneData>(artSceneDataPath);
|
||||
if (artSceneData != null)
|
||||
@@ -59,11 +69,13 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"UnityEvo:ArtSceneData 不存在,请检查路径{artSceneDataPath}");
|
||||
//Debug.LogError($"UnityEvo:ArtSceneData 不存在,请检查路径{artSceneDataPath}");
|
||||
}
|
||||
}
|
||||
|
||||
[HorizontalGroup(Width = 60)]
|
||||
[Button("", Icon = SdfIconType.ArrowRepeat, IconAlignment = IconAlignment.RightEdge)]
|
||||
[Button("", Icon = SdfIconType.ArrowDownCircle, IconAlignment = IconAlignment.RightEdge)]
|
||||
[HideIf("@ IsValidIP")]
|
||||
public void CreatDomain()
|
||||
{
|
||||
if (DomainName == "Main")
|
||||
@@ -79,12 +91,14 @@ namespace Stary.Evo.Editor
|
||||
if (window != null)
|
||||
{
|
||||
window.CreateDomainDirectory(DomainName);
|
||||
SetArtSceneData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HorizontalGroup(Width = 60)]
|
||||
[Button("", Icon = SdfIconType.XCircle, IconAlignment = IconAlignment.RightEdge)]
|
||||
[HideIf("@ IsValidIP")]
|
||||
public async void CloseDomain()
|
||||
{
|
||||
if (DomainName == "Main")
|
||||
@@ -129,6 +143,7 @@ namespace Stary.Evo.Editor
|
||||
[Button("@ _endableBtnName", IconAlignment = IconAlignment.RightEdge)]
|
||||
[GUIColor("@ _endableBtnColor")]
|
||||
[DisableIf("@ IsReadOnly")]
|
||||
[HideIf("@ IsValidIP")]
|
||||
public async void IsEndable()
|
||||
{
|
||||
if (DomainName == "Main")
|
||||
@@ -149,6 +164,7 @@ namespace Stary.Evo.Editor
|
||||
_endableBtnName = "禁用";
|
||||
_endableBtnColor = Color.red;
|
||||
}
|
||||
|
||||
string url = $"{ip}/ResDomain/UpdateResDomain";
|
||||
var requst = new ResDmainUpdateRequst()
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.buildoriginality",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"displayName": "00.StaryEvo.BuildOriginality",
|
||||
"description": "美术打包工具",
|
||||
"unity": "2021.3",
|
||||
|
||||
@@ -32,6 +32,21 @@ namespace Stary.Evo
|
||||
return;
|
||||
}
|
||||
|
||||
string assetPath = AssetDatabase.GetAssetPath(sceneAsset);
|
||||
|
||||
// 验证路径是否在Assets/Art目录下
|
||||
if (!assetPath.StartsWith("Assets/Art/"))
|
||||
{
|
||||
Debug.LogError($"场景必须位于Assets/Art目录下,当前路径: {assetPath}");
|
||||
EditorUtility.DisplayDialog("提示", "场景必须位于Assets/Art目录下,才可配置!", "确定");
|
||||
|
||||
// 可以选择自动清空无效的场景引用
|
||||
sceneAsset = null;
|
||||
scenePath = "";
|
||||
sceneIdentifier = "";
|
||||
return;
|
||||
}
|
||||
|
||||
scenePath = AssetDatabase.GetAssetPath(sceneAsset);
|
||||
sceneIdentifier = $"Scenes_{sceneAsset.name}";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.main",
|
||||
"version": "2.0.17",
|
||||
"version": "2.0.18",
|
||||
"displayName": "00.StaryEvo",
|
||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user