mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-31 14:08:48 +00:00
update extension sample
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
#if !UNITY_WECHAT_GAME
|
#if UNITY_WECHAT_GAME
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -7,6 +7,19 @@ using UnityEngine.Networking;
|
|||||||
using YooAsset;
|
using YooAsset;
|
||||||
using WeChatWASM;
|
using WeChatWASM;
|
||||||
|
|
||||||
|
public static class WechatFileSystemCreater
|
||||||
|
{
|
||||||
|
public static FileSystemParameters CreateWechatFileSystemParameters(IRemoteServices remoteServices)
|
||||||
|
{
|
||||||
|
string fileSystemClass = $"{nameof(WechatFileSystem)},YooAsset.RuntimeExtension";
|
||||||
|
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
|
||||||
|
fileSystemParams.AddParameter("REMOTE_SERVICES", remoteServices);
|
||||||
|
fileSystemParams.AddParameter("DISABLE_UNITY_WEB_CACHE", true);
|
||||||
|
fileSystemParams.AddParameter("ALLOW_CROSS_ACCESS", true);
|
||||||
|
return fileSystemParams;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 微信小游戏文件系统扩展
|
/// 微信小游戏文件系统扩展
|
||||||
/// 参考:https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/UsingAssetBundle.html
|
/// 参考:https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/UsingAssetBundle.html
|
||||||
@@ -36,7 +49,7 @@ internal partial class WechatFileSystem : DefaultWebFileSystem
|
|||||||
|
|
||||||
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
string mainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
|
||||||
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
string fallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
|
||||||
var operation = new WechatDownloadFileOperation(this, bundle, mainURL,fallbackURL, failedTryAgain, timeout);
|
var operation = new WechatDownloadFileOperation(this, bundle, mainURL, fallbackURL, failedTryAgain, timeout);
|
||||||
OperationSystem.StartOperation(PackageName, operation);
|
OperationSystem.StartOperation(PackageName, operation);
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user