mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-21 07:50:20 +00:00
32 lines
769 B
C#
32 lines
769 B
C#
#if UNITY_WEBGL && WEIXINMINIGAME
|
|
using UnityEngine;
|
|
using UnityEngine.Networking;
|
|
using YooAsset;
|
|
using WeChatWASM;
|
|
|
|
/// <summary>
|
|
/// 微信小游戏平台实现
|
|
/// </summary>
|
|
internal class WechatPlatform : IWebGamePlatform
|
|
{
|
|
/// <inheritdoc/>
|
|
public UnityWebRequest CreateAssetBundleRequest(string url)
|
|
{
|
|
return WXAssetBundle.GetAssetBundle(url);
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public AssetBundle ExtractAssetBundle(UnityWebRequest request)
|
|
{
|
|
var downloadHandler = (DownloadHandlerWXAssetBundle)request.downloadHandler;
|
|
return downloadHandler.assetBundle;
|
|
}
|
|
|
|
/// <inheritdoc/>
|
|
public void UnloadAssetBundle(AssetBundle assetBundle, bool unloadAll)
|
|
{
|
|
assetBundle.WXUnload(unloadAll);
|
|
}
|
|
}
|
|
#endif
|