git空目录无法上传,增加检索校验
This commit is contained in:
@@ -16,6 +16,7 @@ using UnityEngine;
|
|||||||
|
|
||||||
namespace Stary.Evo.Editor
|
namespace Stary.Evo.Editor
|
||||||
{
|
{
|
||||||
|
|
||||||
public class CreatAssetWindow : OdinEditorWindow
|
public class CreatAssetWindow : OdinEditorWindow
|
||||||
{
|
{
|
||||||
[MenuItem("Evo/创建Domain作用域")]
|
[MenuItem("Evo/创建Domain作用域")]
|
||||||
@@ -49,27 +50,28 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
Directory.CreateDirectory(artDomainPath);
|
Directory.CreateDirectory(artDomainPath);
|
||||||
|
|
||||||
|
if (!Directory.Exists(artDomainPath))
|
||||||
//创建Animation文件夹
|
//创建Animation文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Animation");
|
CreatDirectory(artDomainPath + "/Animation");
|
||||||
//创建Effects文件夹
|
//创建Effects文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Effects");
|
CreatDirectory(artDomainPath + "/Effects");
|
||||||
//创建Fbx文件夹
|
//创建Fbx文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Fbx");
|
CreatDirectory(artDomainPath + "/Fbx");
|
||||||
//创建Font文件夹
|
//创建Font文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Font");
|
CreatDirectory(artDomainPath + "/Font");
|
||||||
//创建Materials文件夹
|
//创建Materials文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Materials");
|
CreatDirectory(artDomainPath + "/Materials");
|
||||||
//创建Prefabs文件夹
|
//创建Prefabs文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Prefabs");
|
CreatDirectory(artDomainPath + "/Prefabs");
|
||||||
//创建Scenes文件夹
|
//创建Scenes文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Scenes");
|
CreatDirectory(artDomainPath + "/Scenes");
|
||||||
//创建/Scenes/Test文件夹
|
//创建/Scenes/Test文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Scenes/Test");
|
CreatDirectory(artDomainPath + "/Scenes/Test");
|
||||||
//创建Shader文件夹
|
//创建Shader文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Shader");
|
CreatDirectory(artDomainPath + "/Shader");
|
||||||
//创建Textures文件夹
|
//创建Textures文件夹
|
||||||
Directory.CreateDirectory(artDomainPath + "/Textures");
|
CreatDirectory(artDomainPath + "/Textures");
|
||||||
await File.WriteAllTextAsync(
|
File.WriteAllTextAsync(
|
||||||
$"{artDomainPath}/这里放所有美术的资源,因涉及打包依赖等原因,不建议在上一层节点新增文件夹,如涉及文件夹规范等问题请@张铮.hint", "");
|
$"{artDomainPath}/这里放所有美术的资源,因涉及打包依赖等原因,不建议在上一层节点新增文件夹,如涉及文件夹规范等问题请@张铮.hint", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,29 +83,29 @@ namespace Stary.Evo.Editor
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory.CreateDirectory(domainPath);
|
CreatDirectory(domainPath);
|
||||||
|
|
||||||
//程序资源存放文件夹
|
//程序资源存放文件夹
|
||||||
string resPath = $"{domainPath}/AddressableRes";
|
string resPath = $"{domainPath}/AddressableRes";
|
||||||
Directory.CreateDirectory(resPath);
|
CreatDirectory(resPath);
|
||||||
//创建音频文件夹
|
//创建音频文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Audios");
|
CreatDirectory(resPath + "/Audios");
|
||||||
//创建Config文件夹
|
//创建Config文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Config");
|
CreatDirectory(resPath + "/Config");
|
||||||
//创建Dll文件夹
|
//创建Dll文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Dll");
|
CreatDirectory(resPath + "/Dll");
|
||||||
//创建Prefabs文件夹
|
//创建Prefabs文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Prefabs");
|
CreatDirectory(resPath + "/Prefabs");
|
||||||
//创建Scenes文件夹
|
//创建Scenes文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Scenes");
|
CreatDirectory(resPath + "/Scenes");
|
||||||
//创建SpriteAtlas文件夹
|
//创建SpriteAtlas文件夹
|
||||||
Directory.CreateDirectory(resPath + "/SpriteAtlas");
|
CreatDirectory(resPath + "/SpriteAtlas");
|
||||||
//创建Sprites文件夹
|
//创建Sprites文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Sprites");
|
CreatDirectory(resPath + "/Sprites");
|
||||||
//创建Video文件夹
|
//创建Video文件夹
|
||||||
Directory.CreateDirectory(resPath + "/Video");
|
CreatDirectory(resPath + "/Video");
|
||||||
|
|
||||||
await File.WriteAllTextAsync($"{resPath}/这里放所有参与热更的资源.hint", "");
|
File.WriteAllTextAsync($"{resPath}/这里放所有参与热更的资源.hint", "");
|
||||||
|
|
||||||
//主入口预制件
|
//主入口预制件
|
||||||
GameObject gameObj = new GameObject(domain);
|
GameObject gameObj = new GameObject(domain);
|
||||||
@@ -119,19 +121,19 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Directory.CreateDirectory($"{resPath}/Prefabs");
|
CreatDirectory($"{resPath}/Prefabs");
|
||||||
string rootPfbFilePath = $"Assets/Domain/{domain}/AddressableRes/Prefabs/{domain}.prefab";
|
string rootPfbFilePath = $"Assets/Domain/{domain}/AddressableRes/Prefabs/{domain}.prefab";
|
||||||
var localPath = AssetDatabase.GenerateUniqueAssetPath(rootPfbFilePath);
|
var localPath = AssetDatabase.GenerateUniqueAssetPath(rootPfbFilePath);
|
||||||
PrefabUtility.SaveAsPrefabAsset(gameObj, localPath);
|
PrefabUtility.SaveAsPrefabAsset(gameObj, localPath);
|
||||||
|
|
||||||
//存放脚本文件夹
|
//存放脚本文件夹
|
||||||
string scriptsPath = $"{domainPath}/HotUpdate";
|
string scriptsPath = $"{domainPath}/HotUpdate";
|
||||||
Directory.CreateDirectory(scriptsPath);
|
CreatDirectory(scriptsPath);
|
||||||
await File.WriteAllTextAsync($"{scriptsPath}/这里放所有参与热更的脚本文件.hint", "该文件夹中的程序集定义文件,请勿删除,非常重要。");
|
File.WriteAllTextAsync($"{scriptsPath}/这里放所有参与热更的脚本文件.hint", "该文件夹中的程序集定义文件,请勿删除,非常重要。");
|
||||||
|
|
||||||
//创建配置文件夹
|
//创建配置文件夹
|
||||||
string confPath = $"{domainPath}/Conf";
|
string confPath = $"{domainPath}/Conf";
|
||||||
Directory.CreateDirectory(confPath);
|
CreatDirectory(confPath);
|
||||||
|
|
||||||
|
|
||||||
//程序集配置资源
|
//程序集配置资源
|
||||||
@@ -146,21 +148,7 @@ namespace Stary.Evo.Editor
|
|||||||
body = body.Replace("ROOT_NAMESPACE", hotfixDomain);
|
body = body.Replace("ROOT_NAMESPACE", hotfixDomain);
|
||||||
await writer.WriteAsync(body);
|
await writer.WriteAsync(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
// await File.WriteAllTextAsync($"{scriptsPath}/{hotfixDomain}.asmdef", body);
|
|
||||||
|
|
||||||
|
|
||||||
// string architectureClassName = $"{domain}Architecture";
|
|
||||||
// string architectureClassPath = $"{scriptsPath}/{architectureClassName}.txt";
|
|
||||||
// //await File.WriteAllTextAsync($"{scriptsPath}/{architectureClassName}.cs", architectureTemplate);
|
|
||||||
//
|
|
||||||
// await using (var writer = new StreamWriter(architectureClassPath))
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// string architectureTemplate = Resources.Load<TextAsset>("ArchitectureTemplate").text;
|
|
||||||
// architectureTemplate = architectureTemplate.Replace("XXXX", architectureClassName);
|
|
||||||
// await writer.WriteAsync(architectureTemplate);
|
|
||||||
// }
|
|
||||||
//模块化脚本生成配置
|
//模块化脚本生成配置
|
||||||
string domainClassName = $"{domain}Domain";
|
string domainClassName = $"{domain}Domain";
|
||||||
string architectureClassName = $"{domain}Architecture";
|
string architectureClassName = $"{domain}Architecture";
|
||||||
@@ -234,13 +222,7 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CreateDomainClass()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateArchitectureClass()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[TitleGroup("预览Domain作用域")] public List<CreatDomainEntity> domainList;
|
[TitleGroup("预览Domain作用域")] public List<CreatDomainEntity> domainList;
|
||||||
|
|
||||||
@@ -312,5 +294,62 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
return domainList;
|
return domainList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void CreatDirectory(string artDomainPath)
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(artDomainPath))
|
||||||
|
{
|
||||||
|
//创建Animation文件夹
|
||||||
|
Directory.CreateDirectory(artDomainPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CreateDomainDirectory(string domain)
|
||||||
|
{
|
||||||
|
string artDomainPath = $"{Application.dataPath}/Art/{domain}";
|
||||||
|
//创建Animation文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Animation");
|
||||||
|
//创建Effects文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Effects");
|
||||||
|
//创建Fbx文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Fbx");
|
||||||
|
//创建Font文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Font");
|
||||||
|
//创建Materials文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Materials");
|
||||||
|
//创建Prefabs文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Prefabs");
|
||||||
|
//创建Scenes文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Scenes");
|
||||||
|
//创建/Scenes/Test文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Scenes/Test");
|
||||||
|
//创建Shader文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Shader");
|
||||||
|
//创建Textures文件夹
|
||||||
|
CreatDirectory(artDomainPath + "/Textures");
|
||||||
|
|
||||||
|
string domainPath = $"{Application.dataPath}/Domain/{domain}";
|
||||||
|
//程序资源存放文件夹
|
||||||
|
string resPath = $"{domainPath}/AddressableRes";
|
||||||
|
CreatDirectory(resPath);
|
||||||
|
//创建音频文件夹
|
||||||
|
CreatDirectory(resPath + "/Audios");
|
||||||
|
//创建Config文件夹
|
||||||
|
CreatDirectory(resPath + "/Config");
|
||||||
|
//创建Dll文件夹
|
||||||
|
CreatDirectory(resPath + "/Dll");
|
||||||
|
//创建Prefabs文件夹
|
||||||
|
CreatDirectory(resPath + "/Prefabs");
|
||||||
|
//创建Scenes文件夹
|
||||||
|
CreatDirectory(resPath + "/Scenes");
|
||||||
|
//创建SpriteAtlas文件夹
|
||||||
|
CreatDirectory(resPath + "/SpriteAtlas");
|
||||||
|
//创建Sprites文件夹
|
||||||
|
CreatDirectory(resPath + "/Sprites");
|
||||||
|
//创建Video文件夹
|
||||||
|
CreatDirectory(resPath + "/Video");
|
||||||
|
|
||||||
|
AssetDatabase.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
27
Assets/00.StaryEvo/Editor/BuildAsset/CreatDomainDirectory.cs
Normal file
27
Assets/00.StaryEvo/Editor/BuildAsset/CreatDomainDirectory.cs
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
using Stary.Evo.Editor;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace Stary.Evo
|
||||||
|
{
|
||||||
|
[InitializeOnLoad]
|
||||||
|
public static class CreatDomainDirectory
|
||||||
|
{
|
||||||
|
static CreatDomainDirectory()
|
||||||
|
{
|
||||||
|
if (PlayerPrefs.GetInt("CreatDomainDirectory") == 0)
|
||||||
|
{
|
||||||
|
PlayerPrefs.SetInt("CreatDomainDirectory", 1);
|
||||||
|
bool isOk = EditorUtility.DisplayDialog("提示", "是否检索并创建缺失目录", "是", "否");
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
|
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
|
foreach (var domain in DomainAll)
|
||||||
|
{
|
||||||
|
CreatAssetWindow.CreateDomainDirectory(domain.DomainName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5388598f49c545f4ae628ad5d1b4e459
|
||||||
|
timeCreated: 1744798434
|
||||||
@@ -22,6 +22,21 @@ namespace Stary.Evo.Editor
|
|||||||
this.domainList = domainList;
|
this.domainList = domainList;
|
||||||
}
|
}
|
||||||
[HorizontalGroup(Width = 60)]
|
[HorizontalGroup(Width = 60)]
|
||||||
|
[Button("", Icon = SdfIconType.ArrowRepeat, IconAlignment = IconAlignment.RightEdge)]
|
||||||
|
public void CreatDomain()
|
||||||
|
{
|
||||||
|
if (DomainName == "Main")
|
||||||
|
{
|
||||||
|
EditorUtility.DisplayDialog("提示", "主包Main作用域无法再次创建", "确定");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bool isOk = EditorUtility.DisplayDialog("提示", "是否检索并创建缺失目录", "是", "否");
|
||||||
|
if (isOk)
|
||||||
|
{
|
||||||
|
CreatAssetWindow.CreateDomainDirectory(DomainName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HorizontalGroup(Width = 60)]
|
||||||
[Button("", Icon = SdfIconType.XCircle, IconAlignment = IconAlignment.RightEdge)]
|
[Button("", Icon = SdfIconType.XCircle, IconAlignment = IconAlignment.RightEdge)]
|
||||||
public void CloseDomain()
|
public void CloseDomain()
|
||||||
{
|
{
|
||||||
@@ -40,5 +55,6 @@ namespace Stary.Evo.Editor
|
|||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.main",
|
"name": "com.staryevo.main",
|
||||||
"version": "1.0.13",
|
"version": "1.0.14",
|
||||||
"displayName": "00.StaryEvo",
|
"displayName": "00.StaryEvo",
|
||||||
"description": "This is an Framework package",
|
"description": "This is an Framework package",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
|
|||||||
Reference in New Issue
Block a user