update mini game sample

新增Google Play文件系统扩展
This commit is contained in:
何冠峰
2025-07-10 22:43:43 +08:00
parent e34b9270d2
commit f383c59327
7 changed files with 167 additions and 1 deletions
@@ -0,0 +1,42 @@
#if UNITY_ANDROID && GOOGLE_PLAY
using System.Collections.Generic;
using UnityEngine;
using YooAsset;
using System.Linq;
using System;
public static class GooglePlayFileSystemCreater
{
public static FileSystemParameters CreateFileSystemParameters(string packageRoot)
{
string fileSystemClass = $"{nameof(GooglePlayFileSystem)},YooAsset.MiniGame";
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
return fileSystemParams;
}
}
/// <summary>
/// 兼容谷歌Play Asset Delivery的文件系统
/// </summary>
internal class GooglePlayFileSystem : DefaultBuildinFileSystem
{
public GooglePlayFileSystem()
{
}
public override FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{
if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
{
var operation = new DBFSLoadAssetBundleOperation(this, bundle);
return operation;
}
else
{
string error = $"{nameof(GooglePlayFileSystem)} not support load bundle type : {bundle.BundleType}";
var operation = new FSLoadBundleCompleteOperation(error);
return operation;
}
}
}
#endif