[feat] 添加跨平台资源收集

This commit is contained in:
Sayo
2023-01-30 12:07:34 +08:00
parent cc75594747
commit 6488e96127
4 changed files with 101 additions and 3 deletions
@@ -31,4 +31,36 @@ namespace YooAsset.Editor
return $"{collectorName}_{fileName}";
}
}
[DisplayName("以Address+文件路径为定位地址")]
public class AddressByAddressAndFilePath : IAddressRule
{
string IAddressRule.GetAssetAddress(AddressRuleData data)
{
if (Path.HasExtension(data.CollectPath))
{
return data.Address;
}
else
{
string path = data.AssetPath.Replace(data.CollectPath, "");
if (data.IsMultiPlatform)
{
string platform = "Windows";
#if UNITY_ANDROID
platform = "Android";
#elif UNITY_IOS
platform = "iOS";
#elif UNITY_STANDALONE_OSX
platform = "OSX";
#endif
path = path.Replace($"{platform}/", "");
}
string fileName = Path.GetFileName(data.AssetPath);
return $"{data.Address}{path}";
}
}
}
}