111
This commit is contained in:
@@ -64,7 +64,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
if (oneKeyBUildEntity.isRaw)
|
if (oneKeyBUildEntity.isRaw)
|
||||||
{
|
{
|
||||||
MarkAdressable.CollectSVC(MarkAdressable.DomainRoot, oneKeyBUildEntity.DomainName,
|
MarkAdressable.CollectSvc(MarkAdressable.DomainRoot, oneKeyBUildEntity.DomainName,
|
||||||
() => { EditorUtility.DisplayDialog("收集shader【材质异常或资源修改】", "收集成功", "确定"); });
|
() => { EditorUtility.DisplayDialog("收集shader【材质异常或资源修改】", "收集成功", "确定"); });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,6 +172,15 @@ namespace Stary.Evo.Editor
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 内置着色器资源包名称
|
||||||
|
/// 注意:和自动收集的着色器资源包名保持一致!
|
||||||
|
/// </summary>
|
||||||
|
protected string GetBuiltinShaderBundleName()
|
||||||
|
{
|
||||||
|
var uniqueBundleName = AssetBundleCollectorSettingData.Setting.UniqueBundleName;
|
||||||
|
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
||||||
|
return packRuleResult.GetBundleName(packageName, uniqueBundleName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -56,15 +56,6 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 内置着色器资源包名称
|
|
||||||
/// 注意:和自动收集的着色器资源包名保持一致!
|
|
||||||
/// </summary>
|
|
||||||
private string GetBuiltinShaderBundleName()
|
|
||||||
{
|
|
||||||
var uniqueBundleName = AssetBundleCollectorSettingData.Setting.UniqueBundleName;
|
|
||||||
var packRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
|
|
||||||
return packRuleResult.GetBundleName(packageName, uniqueBundleName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,26 +24,16 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
get { return Application.dataPath + "/Domain"; }
|
get { return Application.dataPath + "/Domain"; }
|
||||||
}
|
}
|
||||||
public static string ArtRoot
|
|
||||||
{
|
|
||||||
get { return Application.dataPath + "/Art"; }
|
|
||||||
}
|
|
||||||
|
|
||||||
//[MenuItem("Evo/Hotfix/Addressable")]
|
|
||||||
public static void AddHotfixAddressableDll()
|
public static void AddHotfixAddressableDll()
|
||||||
{
|
{
|
||||||
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(),
|
CopyDllHotUpdateAssembly(BuildAssetWindow.GetBuildPackageName(),
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||||
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes");
|
||||||
|
|
||||||
|
|
||||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void AddHotfixAddressableDllAll(List<OneKeyBuildEntity> oneKeyBUildEntities)
|
public static void AddHotfixAddressableDllAll(List<OneKeyBuildEntity> oneKeyBUildEntities)
|
||||||
{
|
{
|
||||||
var DomainAll = CreatAssetWindow.GetCreatDomainAll();
|
|
||||||
|
|
||||||
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
foreach (var oneKeyBUildEntity in oneKeyBUildEntities)
|
||||||
{
|
{
|
||||||
if (oneKeyBUildEntity.isRaw)
|
if (oneKeyBUildEntity.isRaw)
|
||||||
@@ -53,9 +43,6 @@ namespace Stary.Evo.Editor
|
|||||||
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes");
|
CopyDllStrippedAOTDllOutputRootDir($"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//EditorUtility.DisplayDialog("自动标记", "自动Hotfix成功", "确定");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
private static void CopyDllHotUpdateAssembly(string domain, string target)
|
||||||
@@ -137,13 +124,12 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
YooAsset.Editor.AssetBundleCollectorSettingData.RemovePackage(assetBundleCollectorPackage);
|
||||||
}
|
}
|
||||||
MarkDomain();
|
|
||||||
|
Mark();
|
||||||
|
|
||||||
CreateRes(_packageName,
|
CreateRes(_packageName,
|
||||||
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes",
|
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/AddressableRes",
|
||||||
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/HotUpdate");
|
$"{DomainRoot}/{oneKeyBUildEntity.DomainName}/HotUpdate");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,90 +161,36 @@ namespace Stary.Evo.Editor
|
|||||||
DomainConfig domainConfig =
|
DomainConfig domainConfig =
|
||||||
AssetDatabase.LoadAssetAtPath<DomainConfig>(configPath);
|
AssetDatabase.LoadAssetAtPath<DomainConfig>(configPath);
|
||||||
_packageName = domainConfig.domain;
|
_packageName = domainConfig.domain;
|
||||||
MarkDomain();
|
Mark();
|
||||||
|
|
||||||
|
|
||||||
|
CollectSvc(DomainRoot, BuildAssetWindow.GetBuildPackageName(), () =>
|
||||||
|
{
|
||||||
CreateRes(_packageName,
|
CreateRes(_packageName,
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/AddressableRes",
|
||||||
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
$"{DomainRoot}/{BuildAssetWindow.GetBuildPackageName()}/HotUpdate");
|
||||||
CollectSVC(DomainRoot,BuildAssetWindow.GetBuildPackageName(),()=>
|
|
||||||
{
|
|
||||||
EditorUtility.DisplayDialog("自动标记", "自动标记成功", "确定");
|
EditorUtility.DisplayDialog("自动标记", "自动标记成功", "确定");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// [MenuItem("Evo/Hotfix/一键Res")]
|
private static void CreateRes(string domain, string resPath, string outputPath)
|
||||||
public static void CreateRes(string domain, string resPath, string outputPath)
|
|
||||||
{
|
{
|
||||||
ResFileGet.CreateClass("Res", domain, outputPath,
|
ResFileGet.CreateClass(addressDic, "Res", domain, outputPath,
|
||||||
(a) => { ResFileGet.CreateContent(a, resPath, "\t"); });
|
(a) => { ResFileGet.CreateContent(a, resPath, "\t"); });
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 自动标记
|
#region 自动标记
|
||||||
|
|
||||||
public static Dictionary<string, string> addressDic = new Dictionary<string, string>();
|
private static Dictionary<string, string> addressDic = new Dictionary<string, string>();
|
||||||
|
|
||||||
public static Dictionary<string, AssetBundleCollectorGroup> collectorGroupDic =
|
private static Dictionary<string, AssetBundleCollectorGroup> _collectorGroupDic =
|
||||||
new Dictionary<string, AssetBundleCollectorGroup>();
|
new Dictionary<string, AssetBundleCollectorGroup>();
|
||||||
|
|
||||||
public static void MarkArt()
|
public static void Mark()
|
||||||
{
|
{
|
||||||
addressDic.Clear();
|
addressDic.Clear();
|
||||||
collectorGroupDic.Clear();
|
_collectorGroupDic.Clear();
|
||||||
///创建分组
|
|
||||||
string remotedRoot = $"{ArtRoot}/{_packageName}";
|
|
||||||
DirectoryInfo[] dirs = new DirectoryInfo(remotedRoot).GetDirectories();
|
|
||||||
|
|
||||||
var setting = YooAsset.Editor.AssetBundleCollectorSettingData.Setting;
|
|
||||||
setting.ShowPackageView = true;
|
|
||||||
setting.UniqueBundleName = true;
|
|
||||||
//创建Package文件
|
|
||||||
package = YooAsset.Editor.AssetBundleCollectorSettingData.CreatePackage(_packageName);
|
|
||||||
|
|
||||||
//检测Packages是否存在TestPackage
|
|
||||||
package.PackageName = _packageName;
|
|
||||||
package.EnableAddressable = true;
|
|
||||||
package.IncludeAssetGUID = true;
|
|
||||||
package.AutoCollectShaders = true;
|
|
||||||
package.IgnoreRuleName = "NormalIgnoreRule";
|
|
||||||
|
|
||||||
//检测Packages是否存在Group
|
|
||||||
foreach (var info in dirs)
|
|
||||||
{
|
|
||||||
string groupName = info.Name;
|
|
||||||
|
|
||||||
if (info.Name == "Scenes"||info.Name == "Config")
|
|
||||||
{
|
|
||||||
AssetBundleCollectorGroup collectorGroup =
|
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(package, groupName);
|
|
||||||
collectorGroup.AssetTags = groupName;
|
|
||||||
if (!collectorGroupDic.ContainsKey(groupName))
|
|
||||||
{
|
|
||||||
collectorGroupDic.Add(groupName, collectorGroup);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Debug.LogError("分组 : " + groupName + "已存在,请检查资源目录,避免重复");
|
|
||||||
}
|
|
||||||
AutoMarkRootAddress(info);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// AssetDatabase.SaveAssets();
|
|
||||||
// AssetDatabase.Refresh();
|
|
||||||
MarkStatus();
|
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.SaveFile();
|
|
||||||
|
|
||||||
// CreateRes();
|
|
||||||
|
|
||||||
|
|
||||||
Debug.Log("MarkAsset Successful");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void MarkDomain()
|
|
||||||
{
|
|
||||||
addressDic.Clear();
|
|
||||||
collectorGroupDic.Clear();
|
|
||||||
|
|
||||||
///创建分组
|
///创建分组
|
||||||
string remotedRoot = $"{DomainRoot}/{_packageName}/AddressableRes";
|
string remotedRoot = $"{DomainRoot}/{_packageName}/AddressableRes";
|
||||||
@@ -288,9 +220,10 @@ namespace Stary.Evo.Editor
|
|||||||
AssetBundleCollectorGroup collectorGroup =
|
AssetBundleCollectorGroup collectorGroup =
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(package, groupName);
|
YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(package, groupName);
|
||||||
collectorGroup.AssetTags = groupName;
|
collectorGroup.AssetTags = groupName;
|
||||||
if (!collectorGroupDic.ContainsKey(groupName))
|
|
||||||
|
if (!_collectorGroupDic.ContainsKey(groupName))
|
||||||
{
|
{
|
||||||
collectorGroupDic.Add(groupName, collectorGroup);
|
_collectorGroupDic.Add(groupName, collectorGroup);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -307,8 +240,6 @@ namespace Stary.Evo.Editor
|
|||||||
///自动创建图集
|
///自动创建图集
|
||||||
Debug.Log("开始创建图集");
|
Debug.Log("开始创建图集");
|
||||||
AutoCreateSpriteAtlas(remotedRoot);
|
AutoCreateSpriteAtlas(remotedRoot);
|
||||||
// AssetDatabase.SaveAssets();
|
|
||||||
// AssetDatabase.Refresh();
|
|
||||||
MarkStatus();
|
MarkStatus();
|
||||||
YooAsset.Editor.AssetBundleCollectorSettingData.SaveFile();
|
YooAsset.Editor.AssetBundleCollectorSettingData.SaveFile();
|
||||||
|
|
||||||
@@ -342,14 +273,10 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
if (Path.GetExtension(file) != ".meta" && Path.GetExtension(file) != ".spriteatlas")
|
if (Path.GetExtension(file) != ".meta" && Path.GetExtension(file) != ".spriteatlas")
|
||||||
{
|
{
|
||||||
// string[] dirSplit = file.Split(new string[] { $"AddressableRes\\{dir.Name}\\" },
|
|
||||||
// StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
// string address = (dirSplit[dirSplit.Length - 1]).Replace("\\", "/");
|
|
||||||
// Debug.Log("address:" + address);
|
|
||||||
string groupName = dir.Name;
|
string groupName = dir.Name;
|
||||||
string assetPath = FilesUtils.AbsoluteToRelativePath("Assets", file); //Asset到文件的路径
|
string assetPath = FilesUtils.AbsoluteToRelativePath("Assets", file); //Asset到文件的路径
|
||||||
var guid = AssetDatabase.AssetPathToGUID(assetPath);
|
var guid = AssetDatabase.AssetPathToGUID(assetPath);
|
||||||
var group = collectorGroupDic[groupName];
|
var group = _collectorGroupDic[groupName];
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
AssetBundleCollector collector = new AssetBundleCollector()
|
AssetBundleCollector collector = new AssetBundleCollector()
|
||||||
@@ -385,13 +312,13 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
public static void AutoCreateSpriteAtlas(string domainRootRes)
|
public static void AutoCreateSpriteAtlas(string domainRootRes)
|
||||||
{
|
{
|
||||||
string AtlasRemotedRoot = domainRootRes + "/SpriteAtlas";
|
string atlasRemotedRoot = domainRootRes + "/SpriteAtlas";
|
||||||
string SpriteRemotedAtlas = domainRootRes + "/Sprites";
|
string spriteRemotedAtlas = domainRootRes + "/Sprites";
|
||||||
DirectoryInfo[] remotedirs = new DirectoryInfo(SpriteRemotedAtlas).GetDirectories();
|
DirectoryInfo[] remotedirs = new DirectoryInfo(spriteRemotedAtlas).GetDirectories();
|
||||||
foreach (var info in remotedirs)
|
foreach (var info in remotedirs)
|
||||||
{
|
{
|
||||||
AddSpriteAtlas(SpriteRemotedAtlas + "/" + info.Name, SpriteRemotedAtlas,
|
AddSpriteAtlas(spriteRemotedAtlas + "/" + info.Name, spriteRemotedAtlas,
|
||||||
AtlasRemotedRoot, info);
|
atlasRemotedRoot, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,16 +331,11 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
var groupname = "SpriteAtlas";
|
var groupname = "SpriteAtlas";
|
||||||
var dirs = dir.GetDirectories();
|
var dirs = dir.GetDirectories();
|
||||||
if (dirs == null || dirs.Length == 0)
|
if (dirs.Length == 0)
|
||||||
{
|
{
|
||||||
string name = path.Replace(atlasRoot + "/", string.Empty).Replace("/", "_");
|
string name = path.Replace(atlasRoot + "/", string.Empty).Replace("/", "_");
|
||||||
string filePath = $"{spriteAtlas}/{name}.spriteatlas";
|
string filePath = $"{spriteAtlas}/{name}.spriteatlas";
|
||||||
// string[] dirSplit =
|
int assetIndex = filePath.IndexOf("Assets", StringComparison.Ordinal);
|
||||||
// filePath.Split(new string[] { $"AddressableRes/{Path.GetFileName(spriteAtlas)}" },
|
|
||||||
// StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
// string address = (dirSplit[dirSplit.Length - 1]).Substring(1).Replace("\\", "/");
|
|
||||||
// Debug.Log("spriteatlasaddress:" + address);
|
|
||||||
int assetIndex = filePath.IndexOf("Assets");
|
|
||||||
string guidPath = filePath.Remove(0, assetIndex);
|
string guidPath = filePath.Remove(0, assetIndex);
|
||||||
if (!File.Exists(filePath))
|
if (!File.Exists(filePath))
|
||||||
{
|
{
|
||||||
@@ -449,7 +371,7 @@ namespace Stary.Evo.Editor
|
|||||||
};
|
};
|
||||||
atlas.SetPlatformSettings(platformSettings);
|
atlas.SetPlatformSettings(platformSettings);
|
||||||
AssetDatabase.CreateAsset(atlas, guidPath);
|
AssetDatabase.CreateAsset(atlas, guidPath);
|
||||||
int pathIndex = path.IndexOf("Assets");
|
int pathIndex = path.IndexOf("Assets", StringComparison.Ordinal);
|
||||||
string spritePath = path.Remove(0, pathIndex);
|
string spritePath = path.Remove(0, pathIndex);
|
||||||
UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(spritePath, typeof(UnityEngine.Object));
|
UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(spritePath, typeof(UnityEngine.Object));
|
||||||
atlas.Add(new[] { obj });
|
atlas.Add(new[] { obj });
|
||||||
@@ -459,7 +381,7 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
var guid = AssetDatabase.AssetPathToGUID(guidPath);
|
var guid = AssetDatabase.AssetPathToGUID(guidPath);
|
||||||
|
|
||||||
var group = collectorGroupDic[groupname];
|
var group = _collectorGroupDic[groupname];
|
||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
AssetBundleCollector collector = new AssetBundleCollector()
|
AssetBundleCollector collector = new AssetBundleCollector()
|
||||||
@@ -512,8 +434,15 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
string fileName = Path.GetFileNameWithoutExtension(assetPath);
|
string fileName = Path.GetFileNameWithoutExtension(assetPath);
|
||||||
FileInfo fileInfo = new FileInfo(assetPath);
|
FileInfo fileInfo = new FileInfo(assetPath);
|
||||||
|
if (fileInfo.Directory != null)
|
||||||
|
{
|
||||||
return $"{fileInfo.Directory.Name}_{fileName}";
|
return $"{fileInfo.Directory.Name}_{fileName}";
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $"UnityEvo:{fileName}路径的fileInfo.Directory为Null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -542,7 +471,7 @@ namespace Stary.Evo.Editor
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CollectSVC(string root,string packageName,Action complete)
|
public static void CollectSvc(string root, string packageName, Action complete)
|
||||||
{
|
{
|
||||||
string remotedRoot = $"{root}/{packageName}/ShaderVariants";
|
string remotedRoot = $"{root}/{packageName}/ShaderVariants";
|
||||||
string remotedRootFileName = $"{remotedRoot}/{packageName}.shadervariants";
|
string remotedRootFileName = $"{remotedRoot}/{packageName}.shadervariants";
|
||||||
@@ -554,16 +483,14 @@ namespace Stary.Evo.Editor
|
|||||||
|
|
||||||
string localSavePath = FilesUtils.AbsoluteToRelativePath("Assets", remotedRootFileName); //Asset到文件的路径
|
string localSavePath = FilesUtils.AbsoluteToRelativePath("Assets", remotedRootFileName); //Asset到文件的路径
|
||||||
|
|
||||||
System.Action completedCallback = () =>
|
void CompletedCallback()
|
||||||
{
|
{
|
||||||
ShaderVariantCollection collection =
|
ShaderVariantCollection collection =
|
||||||
AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(localSavePath);
|
AssetDatabase.LoadAssetAtPath<ShaderVariantCollection>(localSavePath);
|
||||||
if (collection != null)
|
if (collection != null)
|
||||||
{
|
{
|
||||||
Debug.Log(
|
Debug.Log($"UnityEvo:【{packageName}】ShaderCount : {collection.shaderCount}");
|
||||||
$"UnityEvo:【{packageName}】ShaderCount : {collection.shaderCount}");
|
Debug.Log($"UnityEvo:【{packageName}】VariantCount : {collection.variantCount}");
|
||||||
Debug.Log(
|
|
||||||
$"UnityEvo:【{packageName}】VariantCount : {collection.variantCount}");
|
|
||||||
|
|
||||||
CreateShaderVariantsGroup(packageName, localSavePath);
|
CreateShaderVariantsGroup(packageName, localSavePath);
|
||||||
|
|
||||||
@@ -573,8 +500,9 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
throw new Exception("Failed to Collect shader Variants.");
|
throw new Exception("Failed to Collect shader Variants.");
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
ShaderVariantCollector.Run(localSavePath, packageName, 1000, completedCallback);
|
|
||||||
|
ShaderVariantCollector.Run(localSavePath, packageName, 1000, CompletedCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新增方法:创建独立的ShaderVariants分组(防止多个package冲突)
|
// 新增方法:创建独立的ShaderVariants分组(防止多个package冲突)
|
||||||
@@ -584,11 +512,12 @@ namespace Stary.Evo.Editor
|
|||||||
AssetBundleCollectorGroup collectorGroup = null;
|
AssetBundleCollectorGroup collectorGroup = null;
|
||||||
|
|
||||||
// 查找或创建package专属分组
|
// 查找或创建package专属分组
|
||||||
foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
|
foreach (var collectorPackage in AssetBundleCollectorSettingData.Setting.Packages)
|
||||||
{
|
{
|
||||||
if (package.PackageName == packageName)
|
if (collectorPackage.PackageName == packageName)
|
||||||
{
|
{
|
||||||
collectorGroup = YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(package, groupname);
|
collectorGroup =
|
||||||
|
YooAsset.Editor.AssetBundleCollectorSettingData.CreateGroup(collectorPackage, groupname);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
Assets/00.StaryEvoTools/Editor/MarkAdressable/PackVideo.cs
Normal file
17
Assets/00.StaryEvoTools/Editor/MarkAdressable/PackVideo.cs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
using System.IO;
|
||||||
|
using YooAsset.Editor;
|
||||||
|
|
||||||
|
namespace Stary.Evo.Editor
|
||||||
|
{
|
||||||
|
public class PackVideo : IPackRule
|
||||||
|
{
|
||||||
|
public PackRuleResult GetPackRuleResult(PackRuleData data)
|
||||||
|
{
|
||||||
|
string bundleName = Path.ChangeExtension(data.AssetPath, null); // 用路径当包名
|
||||||
|
string fileExt = Path.GetExtension(data.AssetPath).Substring(1);
|
||||||
|
return new PackRuleResult(bundleName, fileExt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsRawFilePackRule() => true; // 关键:标记为原生文件
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: bf8a560e6a06431d9f65c4503460451b
|
||||||
|
timeCreated: 1767671600
|
||||||
@@ -11,6 +11,8 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
public static class ResFileGet
|
public static class ResFileGet
|
||||||
{
|
{
|
||||||
|
private static Dictionary<string, string> _addressDic = new Dictionary<string, string>();
|
||||||
|
|
||||||
public static void CreateContent(StringBuilder variable, string path, string tab)
|
public static void CreateContent(StringBuilder variable, string path, string tab)
|
||||||
{
|
{
|
||||||
tab += "\t\t";
|
tab += "\t\t";
|
||||||
@@ -43,9 +45,11 @@ namespace Stary.Evo.Editor
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="className">类名</param>
|
/// <param name="className">类名</param>
|
||||||
/// <param name="content">字符串事件</param>
|
/// <param name="content">字符串事件</param>
|
||||||
public static void CreateClass(string className, string package, string outputPath,
|
public static void CreateClass(Dictionary<string, string> addressDic, string className, string package,
|
||||||
|
string outputPath,
|
||||||
Action<StringBuilder> content = null)
|
Action<StringBuilder> content = null)
|
||||||
{
|
{
|
||||||
|
ResFileGet._addressDic = addressDic;
|
||||||
string tdClassName = className;
|
string tdClassName = className;
|
||||||
StringBuilder variable = new StringBuilder();
|
StringBuilder variable = new StringBuilder();
|
||||||
//variable.Append("using System;\n");
|
//variable.Append("using System;\n");
|
||||||
@@ -67,6 +71,7 @@ namespace Stary.Evo.Editor
|
|||||||
{
|
{
|
||||||
File.Delete(outputPath);
|
File.Delete(outputPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileHelper.WriteFile(outputPath, variable.ToString());
|
FileHelper.WriteFile(outputPath, variable.ToString());
|
||||||
|
|
||||||
AssetDatabase.SaveAssets();
|
AssetDatabase.SaveAssets();
|
||||||
@@ -100,21 +105,8 @@ namespace Stary.Evo.Editor
|
|||||||
string[] fileSplit = fileName.FullName.Split(new string[] { "AddressableRes\\" },
|
string[] fileSplit = fileName.FullName.Split(new string[] { "AddressableRes\\" },
|
||||||
StringSplitOptions.RemoveEmptyEntries);
|
StringSplitOptions.RemoveEmptyEntries);
|
||||||
string[] resSplit = fileSplit[fileSplit.Length - 1].Split('\\');
|
string[] resSplit = fileSplit[fileSplit.Length - 1].Split('\\');
|
||||||
// fileSplit = fileName.FullName.Split(new string[] { $"AddressableRes\\{resSplit[0]}\\" },
|
|
||||||
// StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
// string filepath = fileSplit[fileSplit.Length - 1].Replace("\\", "/");
|
|
||||||
// // 删除文件后缀
|
|
||||||
// filepath = Path.Combine(
|
|
||||||
// Path.GetDirectoryName(filepath),
|
|
||||||
// Path.GetFileNameWithoutExtension(filepath)
|
|
||||||
// ).Replace("\\", "/");
|
|
||||||
// Debug.Log(filepath);
|
|
||||||
string filepath;
|
string filepath;
|
||||||
if (MarkAdressable.addressDic.ContainsKey(fileName.FullName))
|
if (!_addressDic.TryGetValue(fileName.FullName, out filepath))
|
||||||
{
|
|
||||||
filepath = MarkAdressable.addressDic[fileName.FullName];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Debug.LogError("未找到地址,请检查资源自动化标记逻辑:" + fileName.FullName);
|
Debug.LogError("未找到地址,请检查资源自动化标记逻辑:" + fileName.FullName);
|
||||||
filepath = "";
|
filepath = "";
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEditor.Build.Content;
|
||||||
|
using UnityEditor.Build.Pipeline;
|
||||||
|
|
||||||
|
namespace Stary.Evo.Editor
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public class VideoUncompressedParameters : BundleBuildParameters
|
||||||
|
{
|
||||||
|
// 需要保持无压缩的 bundle 名列表
|
||||||
|
public HashSet<string> UncompressedBundles { get; set; }
|
||||||
|
|
||||||
|
public VideoUncompressedParameters(BuildTarget target,
|
||||||
|
BuildTargetGroup group,
|
||||||
|
string outputFolder) : base(target, group, outputFolder)
|
||||||
|
{
|
||||||
|
UncompressedBundles = new HashSet<string>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 关键:按 bundle 名返回压缩方式
|
||||||
|
public override UnityEngine.BuildCompression GetCompressionForIdentifier(string identifier)
|
||||||
|
{
|
||||||
|
if (UncompressedBundles.Contains(identifier))
|
||||||
|
return UnityEngine.BuildCompression.Uncompressed; // 无压缩
|
||||||
|
return base.GetCompressionForIdentifier(identifier); // 其余走默认
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9bb39b8978f643919dc49fac6f74504b
|
||||||
|
timeCreated: 1767672764
|
||||||
@@ -15,7 +15,8 @@
|
|||||||
"DOTween.Modules",
|
"DOTween.Modules",
|
||||||
"ImmersalSDK",
|
"ImmersalSDK",
|
||||||
"Informationsave.runtime",
|
"Informationsave.runtime",
|
||||||
"UniTask"
|
"UniTask",
|
||||||
|
"Unity.ScriptableBuildPipeline.Editor"
|
||||||
],
|
],
|
||||||
"includePlatforms": [
|
"includePlatforms": [
|
||||||
"Editor"
|
"Editor"
|
||||||
|
|||||||
Reference in New Issue
Block a user