29 lines
947 B
C#
29 lines
947 B
C#
using System;
|
|
using YooAsset.Editor;
|
|
|
|
namespace TH1_Logic.Editor.YooAssetTools
|
|
{
|
|
[DisplayName("定位地址: TH1 BundleResources 路径")]
|
|
public class TH1AddressByBundleResourcesPath : IAddressRule
|
|
{
|
|
private const string BundleResourceRoot = "Assets/BundleResources/";
|
|
|
|
public string GetAssetAddress(AddressRuleData data)
|
|
{
|
|
var assetPath = data.AssetPath.Replace('\\', '/');
|
|
var collectPath = data.CollectPath.Replace('\\', '/').TrimEnd('/') + "/";
|
|
|
|
if (assetPath.StartsWith(BundleResourceRoot, StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
assetPath = assetPath.Substring(BundleResourceRoot.Length);
|
|
}
|
|
else if (assetPath.StartsWith(collectPath, StringComparison.OrdinalIgnoreCase))
|
|
{
|
|
assetPath = assetPath.Substring(collectPath.Length);
|
|
}
|
|
|
|
return assetPath;
|
|
}
|
|
}
|
|
}
|