【m】增加两个一键脚本
This commit is contained in:
@@ -28,6 +28,51 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
private static BuildAssetWindow window;
|
private static BuildAssetWindow window;
|
||||||
|
|
||||||
|
[MenuItem("Evo/资源打包(一键)/标记所有资源")]
|
||||||
|
public static void OneClickMark()
|
||||||
|
{
|
||||||
|
//打dll
|
||||||
|
CompileDllCommand.CompileDllActiveBuildTarget();
|
||||||
|
//拷贝dll
|
||||||
|
MarkAdressable.AddHotfixAddressableDllAll();
|
||||||
|
//标记全部资源
|
||||||
|
MarkAdressable.AddMarkAll();
|
||||||
|
EditorUtility.DisplayDialog("提示", $"标记所有资源完成!", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
[MenuItem("Evo/资源打包(一键)/打包所有资源")]
|
||||||
|
public static void OneClickBuild()
|
||||||
|
{
|
||||||
|
//打包
|
||||||
|
EditorTools.ClearUnityConsole();
|
||||||
|
|
||||||
|
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
|
foreach (var domainEntity in DomainAll)
|
||||||
|
{
|
||||||
|
var mp = domainEntity.domainPath.Substring(domainEntity.domainPath.IndexOf("Assets"));
|
||||||
|
mp = mp.Replace('\\', '/');
|
||||||
|
|
||||||
|
BuildAssetDataSetting buildAssetDataSetting =
|
||||||
|
AssetDatabase.LoadAssetAtPath<BuildAssetDataSetting>(
|
||||||
|
$"{mp}/Conf/BuildAssetDataSetting.asset");
|
||||||
|
if (buildAssetDataSetting != null)
|
||||||
|
{
|
||||||
|
buildAssetDataSetting.environmentType = EnvironmentType.Release;
|
||||||
|
buildAssetDataSetting.SetEnvironmentType();
|
||||||
|
buildAssetDataSetting.viewer = new BuiltinBuildPipelineViewer(buildAssetDataSetting);
|
||||||
|
buildAssetDataSetting.viewer.clearBuildCacheToggle= true;
|
||||||
|
buildAssetDataSetting.viewer.SetBuildCacheToggle();
|
||||||
|
EditorApplication.delayCall += buildAssetDataSetting.viewer.ExecuteBuild;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogError("BuildAssetDataSetting 不存在:" + domainEntity.DomainName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EditorUtility.DisplayDialog("提示", $"打包所有资源完成!", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
[MenuItem("Evo/资源打包工具")]
|
[MenuItem("Evo/资源打包工具")]
|
||||||
static void ShowWindows()
|
static void ShowWindows()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,17 +19,16 @@ namespace Stary.Evo.Editor
|
|||||||
private static string[] configNames = new[] { "DomainConfig" };
|
private static string[] configNames = new[] { "DomainConfig" };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static string DomainRoot
|
public static string DomainRoot
|
||||||
{
|
{
|
||||||
get { return Application.dataPath + "/Domain"; }
|
get { return Application.dataPath + "/Domain"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string MainDomainRoot
|
public static string MainDomainRoot
|
||||||
{
|
{
|
||||||
get { return Application.dataPath + "/Main"; }
|
get { return Application.dataPath + "/Main"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static string SpriteRemotedAtlas
|
// public static string SpriteRemotedAtlas
|
||||||
// {
|
// {
|
||||||
// get { return Application.dataPath + "/AddressableRes/SpriteAtlas"; }
|
// get { return Application.dataPath + "/AddressableRes/SpriteAtlas"; }
|
||||||
@@ -51,13 +50,28 @@ namespace Stary.Evo.Editor
|
|||||||
//[MenuItem("Evo/Hotfix/Addressable")]
|
//[MenuItem("Evo/Hotfix/Addressable")]
|
||||||
public static void AddHotfixAddressableDll()
|
public static void AddHotfixAddressableDll()
|
||||||
{
|
{
|
||||||
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(), $"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(),
|
||||||
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||||
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||||
|
|
||||||
|
|
||||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddHotfixAddressableDllAll()
|
||||||
|
{
|
||||||
|
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
|
|
||||||
|
foreach (var domain in DomainAll)
|
||||||
|
{
|
||||||
|
CopyDllHotUpdateAssembly(domain.DomainName, $"{DomainRoot}/{domain}/AddressableRes");
|
||||||
|
CopyDllStrippedAOTDllOutputRootDir($"{domain}/AddressableRes");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
||||||
|
}
|
||||||
|
|
||||||
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
||||||
{
|
{
|
||||||
//读取打包dll位置
|
//读取打包dll位置
|
||||||
@@ -65,7 +79,7 @@ namespace Stary.Evo.Editor
|
|||||||
$"{SettingsUtil.HybridCLRSettings.hotUpdateDllCompileOutputRootDir}/{EditorUserBuildSettings.activeBuildTarget}";
|
$"{SettingsUtil.HybridCLRSettings.hotUpdateDllCompileOutputRootDir}/{EditorUserBuildSettings.activeBuildTarget}";
|
||||||
foreach (var dll in SettingsUtil.HybridCLRSettings.hotUpdateAssemblyDefinitions)
|
foreach (var dll in SettingsUtil.HybridCLRSettings.hotUpdateAssemblyDefinitions)
|
||||||
{
|
{
|
||||||
if (dll.name.Contains(domain))
|
if (dll.name.Contains(domain))
|
||||||
{
|
{
|
||||||
string hotfixDllPath = $"{hotUpdateDir}/{dll.name}.dll";
|
string hotfixDllPath = $"{hotUpdateDir}/{dll.name}.dll";
|
||||||
string hotfixDllPathTarget =
|
string hotfixDllPathTarget =
|
||||||
@@ -108,34 +122,38 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AddMarkAll()
|
||||||
|
{
|
||||||
|
YooAsset.Editor.AssetBundleCollectorSettingData.ClearAll();
|
||||||
|
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
||||||
|
|
||||||
|
foreach (var domain in DomainAll)
|
||||||
|
{
|
||||||
|
string configPath =
|
||||||
|
$"Assets/Domain/{domain.DomainName}/Conf/HotfixMainResDomain.asset";
|
||||||
|
HotfixMainResDomain hotfixMainResDomain =
|
||||||
|
AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(configPath);
|
||||||
|
packageName = hotfixMainResDomain.hotfixMainResDomainEntity.domain;
|
||||||
|
Mark();
|
||||||
|
if (! domain.DomainName.Equals("Main"))
|
||||||
|
CreateRes(packageName,
|
||||||
|
$"{DomainRoot}/{domain.DomainName}/AddressableRes",
|
||||||
|
$"{DomainRoot}/{domain.DomainName}/HotUpdate");
|
||||||
|
else
|
||||||
|
CreateRes(packageName,
|
||||||
|
$"{DomainRoot}/{domain.DomainName}/AddressableRes",
|
||||||
|
$"{MainDomainRoot}/Script/Runtime/HotUpdate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//[MenuItem("Evo/Hotfix/标记资源")]
|
//[MenuItem("Evo/Hotfix/标记资源")]
|
||||||
public static void AddMark()
|
public static void AddMark()
|
||||||
{
|
{
|
||||||
// //清空主包旧数据
|
// //清空主包旧数据
|
||||||
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
AssetBundleCollectorPackage assetBundleCollectorPackage = null;
|
||||||
// foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
|
||||||
// {
|
|
||||||
// if (package.PackageName == "Main")
|
|
||||||
// {
|
|
||||||
// assetBundleCollectorPackage = package;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (assetBundleCollectorPackage != null)
|
|
||||||
// {
|
|
||||||
// YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
|
||||||
// }
|
|
||||||
// DomainRoot = DomainMainPath;
|
|
||||||
// packageName = "Main";
|
|
||||||
// Mark();
|
|
||||||
// CreateRes(packageName,
|
|
||||||
// $"{DomainRoot}/Main/AddressableRes",
|
|
||||||
// $"{DomainRoot}/Main/Script");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//copydll
|
//copydll
|
||||||
if(!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
if (!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||||
AddHotfixAddressableDll();
|
AddHotfixAddressableDll();
|
||||||
//清空用户旧数据
|
//清空用户旧数据
|
||||||
|
|
||||||
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
||||||
@@ -145,19 +163,21 @@ namespace Stary.Evo.Editor
|
|||||||
assetBundleCollectorPackage = package;
|
assetBundleCollectorPackage = package;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (assetBundleCollectorPackage != null)
|
if (assetBundleCollectorPackage != null)
|
||||||
{
|
{
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
string configPath =
|
string configPath =
|
||||||
$"Assets/Domain/{BuildAssetWindow.GetBuildPackageName()}/Conf/HotfixMainResDomain.asset";
|
$"Assets/Domain/{BuildAssetWindow.GetBuildPackageName()}/Conf/HotfixMainResDomain.asset";
|
||||||
HotfixMainResDomain hotfixMainResDomain = AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(configPath);
|
HotfixMainResDomain hotfixMainResDomain = AssetDatabase.LoadAssetAtPath<HotfixMainResDomain>(configPath);
|
||||||
packageName = hotfixMainResDomain.hotfixMainResDomainEntity.domain;
|
packageName = hotfixMainResDomain.hotfixMainResDomainEntity.domain;
|
||||||
Mark();
|
Mark();
|
||||||
if(!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
if (!BuildAssetWindow.GetBuildPackageName().Equals("Main"))
|
||||||
CreateRes(packageName,
|
CreateRes(packageName,
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
||||||
else
|
else
|
||||||
CreateRes(packageName,
|
CreateRes(packageName,
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||||
@@ -325,7 +345,7 @@ namespace Stary.Evo.Editor
|
|||||||
AddressRuleName = nameof(AddressByFolderAndFileName),
|
AddressRuleName = nameof(AddressByFolderAndFileName),
|
||||||
AssetTags = groupName,
|
AssetTags = groupName,
|
||||||
};
|
};
|
||||||
|
|
||||||
//TODO 暂时不设置
|
//TODO 暂时不设置
|
||||||
// 如果是video目录,设置
|
// 如果是video目录,设置
|
||||||
// if (groupName == "Video")
|
// if (groupName == "Video")
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.main",
|
"name": "com.staryevo.main",
|
||||||
"version": "1.0.23",
|
"version": "1.0.24",
|
||||||
"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