mirror of https://github.com/tuyoogame/YooAsset
Update document
parent
77c387bfe9
commit
c782e8154b
|
@ -104,6 +104,8 @@ public class GameEncryption : IEncryptionServices
|
||||||
|
|
||||||
如果需要自动化构建,可以参考如下代码范例:
|
如果需要自动化构建,可以参考如下代码范例:
|
||||||
|
|
||||||
|
使用内置构建管线来构建资源包。
|
||||||
|
|
||||||
````c#
|
````c#
|
||||||
private static void BuildInternal(BuildTarget buildTarget)
|
private static void BuildInternal(BuildTarget buildTarget)
|
||||||
{
|
{
|
||||||
|
@ -114,9 +116,10 @@ private static void BuildInternal(BuildTarget buildTarget)
|
||||||
|
|
||||||
// 构建参数
|
// 构建参数
|
||||||
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
||||||
AssetBundleBuilder.BuildParameters buildParameters = new AssetBundleBuilder.BuildParameters();
|
BuildParameters buildParameters = new BuildParameters();
|
||||||
buildParameters.OutputRoot = defaultOutputRoot;
|
buildParameters.OutputRoot = defaultOutputRoot;
|
||||||
buildParameters.BuildTarget = buildTarget;
|
buildParameters.BuildTarget = buildTarget;
|
||||||
|
buildParameters.BuildPipeline = EBuildPipeline.BuiltinBuildPipeline;
|
||||||
buildParameters.BuildMode = EBuildMode.ForceRebuild;
|
buildParameters.BuildMode = EBuildMode.ForceRebuild;
|
||||||
buildParameters.BuildVersion = buildVersion;
|
buildParameters.BuildVersion = buildVersion;
|
||||||
buildParameters.BuildinTags = "buildin";
|
buildParameters.BuildinTags = "buildin";
|
||||||
|
@ -126,10 +129,11 @@ private static void BuildInternal(BuildTarget buildTarget)
|
||||||
buildParameters.CopyBuildinTagFiles = true;
|
buildParameters.CopyBuildinTagFiles = true;
|
||||||
buildParameters.EncryptionServices = new GameEncryption();
|
buildParameters.EncryptionServices = new GameEncryption();
|
||||||
buildParameters.CompressOption = ECompressOption.LZ4;
|
buildParameters.CompressOption = ECompressOption.LZ4;
|
||||||
|
|
||||||
// 执行构建
|
// 执行构建
|
||||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||||
builder.Run(buildParameters);
|
bool succeed = builder.Run(buildParameters);
|
||||||
|
Debug.Log($"构建结果:{succeed}");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从构建命令里获取参数
|
// 从构建命令里获取参数
|
||||||
|
|
|
@ -68,8 +68,8 @@ private IEnumerator InitializeYooAsset()
|
||||||
initParameters.LocationServices = new DefaultLocationServices("Assets/GameRes");
|
initParameters.LocationServices = new DefaultLocationServices("Assets/GameRes");
|
||||||
initParameters.DecryptionServices = null;
|
initParameters.DecryptionServices = null;
|
||||||
initParameters.ClearCacheWhenDirty = false;
|
initParameters.ClearCacheWhenDirty = false;
|
||||||
initParameters.DefaultHostServer = "http://127.0.0.1/CDN1/Android";
|
initParameters.DefaultHostServer = "http://127.0.0.1/CDN1/Android/v1.0";
|
||||||
initParameters.FallbackHostServer = "http://127.0.0.1/CDN2/Android";
|
initParameters.FallbackHostServer = "http://127.0.0.1/CDN2/Android/v1.0";
|
||||||
initParameters.VerifyLevel = EVerifyLevel.High;
|
initParameters.VerifyLevel = EVerifyLevel.High;
|
||||||
yield return YooAssets.InitializeAsync(initParameters);
|
yield return YooAssets.InitializeAsync(initParameters);
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ private IEnumerator InitializeYooAsset()
|
||||||
````c#
|
````c#
|
||||||
public class BundleDecryption : IDecryptionServices
|
public class BundleDecryption : IDecryptionServices
|
||||||
{
|
{
|
||||||
public ulong GetFileOffset()
|
public ulong GetFileOffset(DecryptionFileInfo fileInfo)
|
||||||
{
|
{
|
||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue