UI更新
This commit is contained in:
@@ -170,7 +170,8 @@ namespace Stary.Evo.Editor
|
||||
AssetDatabase.LoadAssetAtPath<DomainConfig>(configPath);
|
||||
packageName = domainConfig.domain;
|
||||
Mark();
|
||||
|
||||
CollectSVC();
|
||||
|
||||
CreateRes(packageName,
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
||||
@@ -251,6 +252,8 @@ namespace Stary.Evo.Editor
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.SaveFile();
|
||||
|
||||
// CreateRes();
|
||||
|
||||
|
||||
Debug.Log("MarkAsset Successful");
|
||||
}
|
||||
|
||||
@@ -452,38 +455,7 @@ namespace Stary.Evo.Editor
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// 标记是否有打包报错信息
|
||||
// /// </summary>
|
||||
// private static bool _isBuildSuccess = true;
|
||||
//
|
||||
// [MenuItem("Evo/BuildTools/BuildAdressable")]
|
||||
// private static void BuildByStatus()
|
||||
// {
|
||||
// InitAssetData();
|
||||
// _isBuildSuccess = true;
|
||||
// //BuildTools.ClearConsole();
|
||||
// Application.logMessageReceived += OnLogMessage;
|
||||
//
|
||||
// AssetDatabase.Refresh();
|
||||
// AssetDatabase.Refresh();
|
||||
// MarkStatus();
|
||||
// //SetMD5Info();
|
||||
// AssetDatabase.Refresh();
|
||||
// Application.logMessageReceived -= OnLogMessage;
|
||||
// if (!_isBuildSuccess)
|
||||
// {
|
||||
// if (EditorUtility.DisplayDialog("打包失败", "请检测报错信息", "确定"))
|
||||
// {
|
||||
// // EditorUtility.RevealInFinder(BuildTools.OutPath);
|
||||
// // BuildTools.OutPath = string.Empty;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 标记为资源分组
|
||||
/// </summary>
|
||||
@@ -508,62 +480,55 @@ namespace Stary.Evo.Editor
|
||||
package.Groups.Remove(deleteList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CollectSVC()
|
||||
{
|
||||
string remotedRoot = $"{DomainRoot}/{packageName}/AddressableRes";
|
||||
remotedRoot += $"/ShaderVariants/{BuildAssetWindow.GetBuildPackageName()}.shadervariants";
|
||||
|
||||
string localSavePath = FilesUtils.AbsoluteToRelativePath("Assets", remotedRoot); //Asset到文件的路径
|
||||
System.Action completedCallback = () =>
|
||||
{
|
||||
ShaderVariantCollection collection =
|
||||
AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(localSavePath);
|
||||
if (collection != null)
|
||||
{
|
||||
Debug.Log($"UnityEvo:【{BuildAssetWindow.GetBuildPackageName()}】ShaderCount : {collection.shaderCount}");
|
||||
Debug.Log($"UnityEvo:【{BuildAssetWindow.GetBuildPackageName()}】VariantCount : {collection.variantCount}");
|
||||
|
||||
// private static Dictionary<string, MD5Info> _md5Files = new Dictionary<string, MD5Info>();
|
||||
//
|
||||
// private static void SetMD5Info()
|
||||
// {
|
||||
// _md5Files.Clear();
|
||||
//
|
||||
// string path = Application.dataPath.Replace("Assets",
|
||||
// $"ServerData/{Application.platform}/Release");
|
||||
// if (Directory.Exists(path))
|
||||
// {
|
||||
// DirectoryInfo dir = new DirectoryInfo(path);
|
||||
// MD5File(dir);
|
||||
// }
|
||||
//
|
||||
// AssetDatabase.Refresh();
|
||||
// }
|
||||
//
|
||||
// private static void MD5File(DirectoryInfo info)
|
||||
// {
|
||||
// FileInfo[] files = info.GetFiles();
|
||||
// if (files.Length > 0)
|
||||
// {
|
||||
// for (int i = 0; i < files.Length; i++)
|
||||
// {
|
||||
// var file = files[i];
|
||||
// if (file == null || file.Extension == ".meta")
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// string filePath = file.FullName.Replace(@"\", "/");
|
||||
// MD5Info md5 = new MD5Info();
|
||||
// md5.AssetPath = filePath;
|
||||
// md5.MD5 = FilesUtils.CalculateMD5(file.FullName);
|
||||
// _md5Files.Add(md5.AssetPath, md5);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// DirectoryInfo[] dirs = info.GetDirectories();
|
||||
// if (dirs != null && dirs.Length > 0)
|
||||
// {
|
||||
// for (int i = 0; i < dirs.Length; i++)
|
||||
// {
|
||||
// MD5File(dirs[i]);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// private static void OnLogMessage(string condition, string stackTrace, LogType type)
|
||||
// {
|
||||
// if (type == LogType.Error)
|
||||
// {
|
||||
// if (condition != "EndLayoutGroup: BeginLayoutGroup must be called first.")
|
||||
// _isBuildSuccess = false;
|
||||
// }
|
||||
// }
|
||||
string groupname = "ShaderVariants";
|
||||
AssetBundleCollectorGroup collectorGroup = null;
|
||||
if (collectorGroupDic.ContainsKey(groupname))
|
||||
{
|
||||
collectorGroupDic[groupname].Collectors.Clear();
|
||||
collectorGroup = collectorGroupDic[groupname];
|
||||
}
|
||||
else
|
||||
{
|
||||
collectorGroup =
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(package, "ShaderVariants");
|
||||
}
|
||||
|
||||
var guid = AssetDatabase.AssetPathToGUID(localSavePath);
|
||||
AssetBundleCollector collector = new AssetBundleCollector()
|
||||
{
|
||||
CollectPath = localSavePath,
|
||||
CollectorGUID = guid,
|
||||
CollectorType = ECollectorType.MainAssetCollector,
|
||||
AddressRuleName = nameof(AddressByFolderAndFileName),
|
||||
PackRuleName = nameof(PackShaderVariants),
|
||||
FilterRuleName = nameof(CollectShaderVariants),
|
||||
AssetTags = groupname,
|
||||
};
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateCollector(collectorGroup, collector);
|
||||
YooAsset.Editor.AssetBundleCollectorSettingData.SaveFile();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("Failed to Collect shader Variants.");
|
||||
}
|
||||
};
|
||||
ShaderVariantCollector.Run(localSavePath,BuildAssetWindow.GetBuildPackageName(),1000, completedCallback);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user