Auto-publish.

This commit is contained in:
nebulaliu 2025-06-17 19:35:24 +08:00
parent 207766f6db
commit 2d15ebedd8
109 changed files with 266 additions and 218 deletions

View File

@ -6,13 +6,6 @@ Removed - 删除功能/接口
Fixed - 修复问题
Others - 其他
-->
## v0.1.26 【普通更新】
### Feature
* 普通:增加禁止多点触控的配置
### Fixed
* 普通修复IOS长音频获取数据延迟的bug
* 普通性能分析工具修复callstack中的堆栈悬空丢失的问题
## v0.1.25 【普通更新】
### Feature
* 普通性能深入分析工具支持Lua capture能力

View File

@ -93,6 +93,14 @@ namespace WeChatWASM
#endif
}
}
// 用于replaceRules判断是否需要注入相关的修改
public static bool UseEmscriptenGLX
{
get
{
return config.CompileOptions.enableEmscriptenGLX;
}
}
// 可以调用这个来集成
public static WXExportError DoExport(bool buildWebGL = true)
{
@ -118,6 +126,7 @@ namespace WeChatWASM
CheckBuildTarget();
Init();
ProcessWxPerfBinaries();
ProcessWxEmscriptenGLXBinaries();
MakeEnvForLuaAdaptor();
// JSLib
SettingWXTextureMinJSLib();
@ -331,6 +340,39 @@ namespace WeChatWASM
AssetDatabase.Refresh();
}
private static void ProcessWxEmscriptenGLXBinaries()
{
string[] glLibs;
string DS = WXAssetsTextTools.DS;
if (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package)
{
glLibs = new string[]
{
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}libnative_command_buffer.a",
};
}
else
{
string glLibRootDir = $"Assets{DS}WX-WASM-SDK-V2{DS}Runtime{DS}Plugins{DS}";
glLibs = new string[]
{
$"{glLibRootDir}libnative_command_buffer.a",
};
}
for (int i = 0; i < glLibs.Length; i++)
{
var importer = AssetImporter.GetAtPath(glLibs[i]) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, config.CompileOptions.enableEmscriptenGLX);
#else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, config.CompileOptions.enableEmscriptenGLX);
#endif
// importer.SaveAndReimport();
SetPluginCompatibilityByModifyingMetadataFile(glLibs[i], config.CompileOptions.enableEmscriptenGLX);
}
AssetDatabase.Refresh();
}
/**
* Lua Adaptor Settings.
*/
@ -801,7 +843,8 @@ namespace WeChatWASM
PlayerSettings.WeixinMiniGame.emscriptenArgs = string.Empty;
if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER"))
{
PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_main,_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end -s ERROR_ON_UNDEFINED_SYMBOLS=0";
// PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_main,_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end";
PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end -s ERROR_ON_UNDEFINED_SYMBOLS=0";
}
#else
@ -1861,7 +1904,7 @@ namespace WeChatWASM
config.ProjectConf.bundleHashLength.ToString(),
bundlePathIdentifierStr,
excludeFileExtensionsStr,
config.CompileOptions.Webgl2 ? "2" : "1",
config.CompileOptions.enableEmscriptenGLX ? config.CompileOptions.Webgl2 ? "4" : "3" : config.CompileOptions.Webgl2 ? "2" : "1",
Application.unityVersion,
WXExtEnvDef.pluginVersion,
config.ProjectConf.dataFileSubPrefix,
@ -1908,7 +1951,6 @@ namespace WeChatWASM
config.CompileOptions.DevelopBuild ? "true" : "false",
config.CompileOptions.enablePerfAnalysis ? "true" : "false",
config.ProjectConf.MemorySize.ToString(),
config.SDKOptions.disableMultiTouch ? "true" : "false",
});
List<Rule> replaceList = new List<Rule>(replaceArrayList);

View File

@ -170,7 +170,6 @@ namespace WeChatWASM
this.formCheckbox("useFriendRelation", "使用好友关系链");
this.formCheckbox("useMiniGameChat", "使用社交组件");
this.formCheckbox("preloadWXFont", "预加载微信字体(?)", "在game.js执行开始时预载微信系统字体运行期间可使用WX.GetWXFont获取微信字体");
this.formCheckbox("disableMultiTouch", "禁用多点触控");
EditorGUILayout.EndVertical();
}
@ -189,6 +188,7 @@ namespace WeChatWASM
this.formCheckbox("profilingMemory", "Profiling Memory");
this.formCheckbox("webgl2", "WebGL2.0(beta)");
this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存");
this.formCheckbox("EmscriptenGLX", "EmscriptenGLX(?)", "是否使用EmscriptenGLX渲染方案");
this.formCheckbox("deleteStreamingAssets", "Clear Streaming Assets");
this.formCheckbox("cleanBuild", "Clean WebGL Build");
// this.formCheckbox("cleanCloudDev", "Clean Cloud Dev");
@ -452,11 +452,11 @@ namespace WeChatWASM
this.setData("customNodePath", config.CompileOptions.CustomNodePath);
this.setData("webgl2", config.CompileOptions.Webgl2);
this.setData("iOSPerformancePlus", config.CompileOptions.enableIOSPerformancePlus);
this.setData("EmscriptenGLX", config.CompileOptions.enableEmscriptenGLX);
this.setData("fbslim", config.CompileOptions.fbslim);
this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation);
this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat);
this.setData("preloadWXFont", config.SDKOptions.PreloadWXFont);
this.setData("disableMultiTouch", config.SDKOptions.disableMultiTouch);
this.setData("bgImageSrc", config.ProjectConf.bgImageSrc);
tex = AssetDatabase.LoadAssetAtPath<Texture>(config.ProjectConf.bgImageSrc);
this.setData("memorySize", config.ProjectConf.MemorySize.ToString());
@ -530,11 +530,11 @@ namespace WeChatWASM
config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath");
config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2");
config.CompileOptions.enableIOSPerformancePlus = this.getDataCheckbox("iOSPerformancePlus");
config.CompileOptions.enableEmscriptenGLX = this.getDataCheckbox("EmscriptenGLX");
config.CompileOptions.fbslim = this.getDataCheckbox("fbslim");
config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation");
config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat");
config.SDKOptions.PreloadWXFont = this.getDataCheckbox("preloadWXFont");
config.SDKOptions.disableMultiTouch = this.getDataCheckbox("disableMultiTouch");
config.ProjectConf.bgImageSrc = this.getDataInput("bgImageSrc");
config.ProjectConf.MemorySize = int.Parse(this.getDataInput("memorySize"));
config.ProjectConf.HideAfterCallMain = this.getDataCheckbox("hideAfterCallMain");

View File

@ -125,6 +125,10 @@ namespace WeChatWASM
{
return WXConvertCore.UseIL2CPP;
});
WXExtEnvDef.RegisterAction("WXConvertCore.UseEmscriptenGLX", (args) =>
{
return WXConvertCore.UseEmscriptenGLX;
});
WXExtEnvDef.RegisterAction("UnityUtil.GetWxSDKRootPath", (args) =>
{
#if UNITY_2018

View File

@ -2,7 +2,7 @@ namespace WeChatWASM
{
public class WXPluginVersion
{
public static string pluginVersion = "202505120809"; // 这一行不要改他,导出的时候会自动替换
public static string pluginVersion = "202506171134"; // 这一行不要改他,导出的时候会自动替换
}
public class WXPluginConf

Binary file not shown.

View File

@ -543,11 +543,6 @@
预载系统字体
</summary>
</member>
<member name="F:WeChatWASM.SDKOptions.disableMultiTouch">
<summary>
是否禁止多点触控
</summary>
</member>
<member name="F:WeChatWASM.CompileOptions.DevelopBuild">
<summary>
Development Build
@ -638,6 +633,11 @@
是否使用iOS高性能Plus
</summary>
</member>
<member name="F:WeChatWASM.CompileOptions.enableEmscriptenGLX">
<summary>
是否使用EmscriptenGLX
</summary>
</member>
<member name="F:WeChatWASM.CompileOptions.brotliMT">
<summary>
是否使用brotli多线程压缩

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 69a894eefcf7a97830ad465e4668424b
guid: 04a1db94446d5a589c34d50891927e93
DefaultImporter:
externalObjects: {}
userData:

Binary file not shown.

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: cccbd1d680cfe34fa1fef9e4875e5f06
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 0
Exclude OSXUniversal: 0
Exclude WebGL: 0
Exclude Win: 0
Exclude Win64: 0
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: OSXUniversal
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
Standalone: Win64
second:
enabled: 1
settings:
CPU: AnyCPU
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e804d8e7fcbdd8120297b31d43cba494
guid: 6e01e1367d2cfac9dadb2986b75e7dc9
DefaultImporter:
externalObjects: {}
userData:

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f1ac621062d513597aaf96b982e6d32a
guid: 5caae9f7ab2575bbdc9cfc455784799c
DefaultImporter:
externalObjects: {}
userData:

Binary file not shown.

Binary file not shown.

View File

@ -47,12 +47,6 @@ namespace WXSDKPerf
#if UNITY_EDITOR
return;
#else
// Don't record annotation if we are not recording.
if (!IsRecording())
{
return;
}
if (m_PerfEngineImplementation == null)
{
UnityEngine.Debug.LogError("Annotation: Invalid m_PerfEngineImplementation! ");

View File

@ -45,7 +45,7 @@ const isIOSWebgl2SystemVersionValid = compareVersion(systemVersion, '15.0') || G
// Android客户端版本>=8.0.19支持webgl2
const isAndroidWebGL2ClientVersionValid = compareVersion(version, '8.0.19');
// 是否用了webgl2
const isWebgl2 = () => GameGlobal.managerConfig.contextConfig.contextType === 2;
const isWebgl2 = () => GameGlobal.managerConfig.contextConfig.contextType === 2 || GameGlobal.managerConfig.contextConfig.contextType === 4;
// 是否支持BufferURL
export const isSupportBufferURL = !isPc
&& (isH5Renderer

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cc37c7d5506b085a6df346222b3ab6a5
guid: 9b4ce629ba3276f361d287677efc851b
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0c6505cc99fc839915faa622b6cccaff
guid: 1ee6718bc71617b01914c7a7d2d900cf
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1d581d1e0029e9c614b8f8f213920d0f
guid: 4809a1b12f0b487cc525d39cd46f193f
DefaultImporter:
externalObjects: {}
userData:

View File

@ -27,7 +27,7 @@ const managerConfig = {
'$PRELOAD_LIST',
],
contextConfig: {
contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2
contextType: $WEBGL_VERSION, // 1: webgl1, 2: webgl2, 3: wxwebgl, 4: wxwebgl2, 5: wxmetal
},
PROFILER_UPLOAD_URL: '',
};
@ -48,6 +48,7 @@ checkVersion().then((enable) => {
canvas,
events: GameGlobal.events,
WXWASMSDK: GameGlobal.WXWASMSDK,
isSuppportEmscriptenGLX: wx.env.isSuppportEmscriptenGLX ?? false,
},
}).default;
}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5b031ecc782f78cea8e6989d68732cb3
guid: c715711d143ea5f199d1ffe41d206ac9
DefaultImporter:
externalObjects: {}
userData:

View File

@ -23,7 +23,7 @@
],
"plugins": {
"UnityPlugin": {
"version": "1.2.72",
"version": "dev-15209a3d0baeecf4debbd5f34bb142f7",
"provider": "wxe5a48f1ed5f544b7",
"contexts": [
{

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dfb0e4876224d2c4895c8b6ffc41692a
guid: 20fae511dc269726d5b67825c242b4a8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4e7005d801d03c8f40b7d03fef28dd0d
guid: 401eb6da0b122edd25afa7b61a91f643
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4aa5e2d6d65e5f123b7024edea08d90e
guid: 9281baf4af73cbd889dc4a888e522ceb
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a57a7e708b31462e3e96e159b74d9ece
guid: 52a8258e47425905132fd6478959c1b8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9bd4067b4928849450aa2497d81c8309
guid: 0528f8f0d277d81d1c0b55e4223888a8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7d5ede0f5069e1216243d748a6194706
guid: af3c88bfb8228742d3b339737d0e6270
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 947ff46b2e5c42f09121ffa5d91a4e2e
guid: 2ae4f0bfb12f4ae5e6bb339b64115029
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4c4cbd2db17f742dbf2e9906c198ee66
guid: 53d99da43149767c785c4fd1a85c90b7
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: fffb1884d435f35f2fc4afb0dfa10f2e
guid: d61f6936f20b346d166dabd8627bab63
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 670428b454eee42aa1a2342bbf5de8ba
guid: 9e2cca77818075afe4c5ed1dca326158
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8f7498abde47adda094eb2386319c3dd
guid: 3bfe00bd89c1abdd948b043174491f4e
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 51a96b62dcb0e4c4b43c9954055a70e2
guid: d5beda53eec75401fd287033ddf17c67
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8e8892d2d973cb9ebefed399f94de3cb
guid: 4a7d2913dd57e8171adca07acd5fca4c
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2663cd8a6c36cde9bb045fe559937b69
guid: 6d74fcaae85764f0ccd76b7721fb98b3
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 73d0c8e298e9d108b405aa58b57c1412
guid: acc17ee776a2bd6e70559d3e508bfae0
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0095cb4357181a5ad837e15f71abd3c5
guid: 77fd86fdbccab71a1802bdf26f7bcae9
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b7786cc94403abb4c77ca7d320d69ffd
guid: 274a69d280c06cf55a90cb8b755484e6
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7752ac82de1afe56f9ad8c3f0f2054a1
guid: 95780c5fa320707c100c9ad46696cfb8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: accd3b9008ae1243954474f19fbdfaf4
guid: 35636f6d535ec8ca1b0c183084a2c493
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: be375a525905238eb889806efaf8f39e
guid: d505197f32fa39126364cee0c90f3327
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b4a1ea7f75bb16d4ccd1552249c4d1df
guid: 5b385c1377483fda81fc213617868bbd
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0907eeaa24ac1ec755f57f396f70169f
guid: d3c4ae6216ef6468fc295c2f783831df
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2a0badeb444f3c1d1182f14b64fe3d96
guid: 20ad82bf17b3230b440d540bf565c5ff
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ba2d38ed253ad969c2e04e6c71aef526
guid: 99e8a7c57298ae8d84961ee5bae80788
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 097d9da849631cad4a9289161caa8d8a
guid: cc5c69776aed69124ccbdbcab05d2a6c
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d8a04157a342f8f9bfb5b048cad64bae
guid: 2aa90d95a36118a8d5b1dddf3756bdfd
DefaultImporter:
externalObjects: {}
userData:

View File

@ -113,7 +113,6 @@ GameGlobal.WebAssembly = GameGlobal.WXWebAssembly;
GameGlobal.unityNamespace = GameGlobal.unityNamespace || unityNamespace;
GameGlobal.realtimeLogManager = wx.getRealtimeLogManager();
GameGlobal.logmanager = wx.getLogManager({ level: 0 });
GameGlobal.disableMultiTouch = $DISABLE_MULTI_TOUCH;
// 提前监听错误并打日志
function bindGloblException() {
// 默认上报小游戏实时日志与用户反馈日志(所有error日志+小程序框架异常)

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: da06eb2c03b61487943fec9ab1b2eae7
guid: 89adeca2c86cd74e66db7798b3f2fcba
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 8ca80df7e7218f6fe39668ca89007cbb
guid: 6945a2d9388b51e6e4dab668a071ce7e
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 71119a04b5075e9e086cb4d695cb5ebb
guid: 18364b4f9924b07734c8f4723aaec0da
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a79b9b59ad70bb85fbb1627c98157b26
guid: dffd1e26c771eb900233b624025f1f06
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: b766e2632c2efe53229999ec68fa3bf2
guid: 1ece0810b1a15ac3e4df5cf883eaaf08
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 17390c8131f551bba6610e44abf3036c
guid: 0eaec852c282885be0b5418adc6fc01b
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1dda419766006d67219138804be03d41
guid: ceeed17ec8ac156ff048e9cc37659013
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cb3eeaad97016020e38bc9f36ad197b1
guid: 01557b423c12ece06a6b28836fe66718
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6cd819420d3390c5cb16fa7f95b67946
guid: 9c584f24b1d944b4682f708231d9727d
DefaultImporter:
externalObjects: {}
userData:

View File

@ -9,7 +9,7 @@ import { debugLog } from '../utils';
const defaultSoundLength = 441000;
const needGetLength = true;
const needGetLength = false;
function jsAudioCreateUncompressedSoundClip(buffer, error, length) {
const soundClip = {
buffer,
@ -70,25 +70,6 @@ function jsAudioCreateUncompressedSoundClipFromCompressedAudio(audioData, ptr, l
});
return soundClip;
}
function getSoundLength(getAudio, retryCount = 3) {
return new Promise((resolve, reject) => {
const { duration } = getAudio;
if (duration > 0) {
resolve(duration);
}
else {
if (retryCount > 0) {
setTimeout(() => {
resolve(getSoundLength(getAudio, retryCount - 1));
}, 100);
}
else {
reject('getAudio.duration is 0');
}
}
});
}
function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
const soundClip = {
error: false,
@ -122,14 +103,12 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
if (isSupportBufferURL) {
const url = wx.createBufferURL(audioData);
soundClip.url = url;
setSoundLength();
WEBAudio.audioBufferLength += length;
}
else {
const tempFilePath = `${TEMP_DIR_PATH}/temp-audio${ptr + length}.mp3`;
if (GameGlobal.manager.getCachePath(tempFilePath)) {
soundClip.url = tempFilePath;
setSoundLength();
WEBAudio.audioBufferLength += length;
}
else {
@ -137,7 +116,6 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
.writeFile(tempFilePath, audioData)
.then(() => {
soundClip.url = tempFilePath;
setSoundLength();
WEBAudio.audioBufferLength += length;
})
.catch((res) => {
@ -146,24 +124,16 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
});
}
}
function setSoundLength() {
if (needGetLength && soundClip.url) {
const { audio: getAudio } = createInnerAudio();
getAudio.src = soundClip.url;
getAudio.onCanplay(() => {
getSoundLength(getAudio).then((duration) => {
soundClip.length = duration * 44100;
getAudio.destroy();
})
.catch((e) => {
if (soundClip.length === 0) {
soundClip.error = true;
printErrMsg(e);
}
soundClip.length = getAudio.duration * 44100;
setTimeout(() => {
soundClip.length = getAudio.duration * 44100;
getAudio.destroy();
}, 0);
});
});
}
}
return soundClip;
}
@ -249,7 +219,6 @@ export class AudioChannelInstance {
this.source.mediaElement.volume = 0;
}
this.source.mediaElement.onPlay(() => {
debugLog('this.source.mediaElement.onPlay');
if (typeof this.source !== 'undefined') {
this.source.isPlaying = true;
if (!this.source.loop && this.source.mediaElement) {
@ -271,7 +240,7 @@ export class AudioChannelInstance {
}
});
this.source.mediaElement.onPause(() => {
debugLog('this.source.mediaElement.onPause');
debugLog('onPause');
if (typeof this.source !== 'undefined') {
this.source.isPlaying = false;
if (this.source.stopTicker) {
@ -281,7 +250,7 @@ export class AudioChannelInstance {
}
});
this.source.mediaElement.onStop(() => {
debugLog('this.source.mediaElement.onStop');
debugLog('onStop');
if (typeof this.source !== 'undefined') {
if (this.source.playAfterStop) {
this.source._reset();
@ -298,7 +267,7 @@ export class AudioChannelInstance {
}
});
this.source.mediaElement.onEnded(() => {
debugLog('this.source.mediaElement.onEnded');
debugLog('onEnded');
if (typeof this.source !== 'undefined') {
this.source._reset();
this.disconnectSource();
@ -308,7 +277,7 @@ export class AudioChannelInstance {
}
});
this.source.mediaElement.onError((e) => {
debugLog('this.source.mediaElement.onError', e);
debugLog('onError', e);
printErrMsg(e);
const { errMsg } = e;
@ -322,17 +291,15 @@ export class AudioChannelInstance {
}
});
const fn = () => {
debugLog('this.source.mediaElement.onCanplay');
if (typeof this.source !== 'undefined' && this.source.mediaElement) {
getSoundLength(this.source.mediaElement).then((duration) => {
soundClip.length = duration * 44100;
})
.catch((e) => {
if (soundClip.length === 0) {
soundClip.error = true;
printErrMsg(e);
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration } = this.source.mediaElement;
setTimeout(() => {
if (soundClip && this.source && this.source.mediaElement) {
soundClip.length = Math.round(Math.max(this.source.mediaElement.duration, 0) * 44100);
}
});
}, 0);
}
};
if (!this.source.canPlayFnList) {
@ -943,7 +910,7 @@ export default {
if (isIOS175) {
WEBAudio.audioContext?.close();
WEBAudio.audioContext = wx.createWebAudioContext();
Object.values(WEBAudio.audioInstances).forEach((it) => it.resetGain());
Object.values(WEBAudio.audioInstances).forEach(it => it.resetGain());
}
else {
WEBAudio.audioContext?.resume();
@ -1159,7 +1126,6 @@ export default {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
debugLog('_JS_Sound_SetPaused', channelInstance, paused);
const channel = WEBAudio.audioInstances[channelInstance];
if (!!paused !== channel.isPaused()) {
if (paused) {

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: f65e6719bbf1a79f569dca5cf2299b96
guid: 802a48247692c705e30e6009a5734776
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 83ea95246b4a34f6d49b449998b32fce
guid: 06d022cc565cecdc8611eb5c14ccbc36
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ad3283f50a4d5e70b6747bb5019782de
guid: be62a19db4b717d4a2858cccda18c2aa
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 3f52df6608057cf7aa6a93f2e9001ce7
guid: 6257a0da3a8daaa27efd75f73a8f4b87
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dfc080ce256354f8366a0aeb42a48c2e
guid: 7f605ac26a126058ee6829e8a225d6da
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 70618cf437cdecdc8980e89319d8d3f3
guid: 93e199b057414490c68c651ccc7ee923
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2037d28ebba16820374ba6a40c1858f2
guid: 43f8d4b4ecef5242c226519d0f84b605
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e71b04341b5b2c08116e5227bde02ccf
guid: a08e0ba2ea589563a5827a6ea285e6e8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e3f8770fd8cb23d485c84d63b2e4003b
guid: b0d5217ab44b8987a6ea8fa4862f77b7
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 7df6b4dbd22118920d9ecc1c616197b5
guid: 2c8edd8439cc2f35683fd50d32fe9ba8
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 524afce71a79938d4709341b761ffd48
guid: cacd19f6b795bb375941cbdc78369550
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 856fb3e2282d080313cbfe4e6b417f55
guid: 59e4851aa4a91d5788e09a0c45e8cec7
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2a96d76916d429cf104cc2664a09c64a
guid: 9aaca5892ff376ff43c7d929ae0c327c
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 468c0ce3be26ae784ca796db1838e8e3
guid: 304e6dfcd165338ed363a64bc9153949
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 28e9e0f00912938e462e65d369c09035
guid: fc73235ad652bc68c3515d5ecadf882d
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1154c39f8d497da60511be50a37e7b71
guid: 551e1082ab7d4822a3af189774a49828
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 44d2f50cec161b668c974f16ac9644c7
guid: 2296e799c242eb29c9664f4afd5ee644
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 67beeca9622d08e2cf4d06cde485dc0f
guid: 3e88b866cfd76fe75630f97708b5cb06
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: cd03072d51b0a648a5d15248c75785a0
guid: d24a8e1fe17b04f2bb395de2003f5bd0
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5a51257b8600a38caa3c96860a7b4c05
guid: 7e732364ab6da071a79af5452c1281dc
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 2464224126d2b028947d6e2738541bea
guid: e5990bce15b16d9bfea463d65de5d08c
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6f098aa16fe8c501e48f3b522380df1e
guid: 2002cf34b1d6e76b8473f0f8c42a9e05
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 838e920a8b57e2bd06215103a7034da3
guid: 773cde5a39cd84220f627f87d4188ec1
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a03b4588b7f0a7348ee0d2e68ea7e6df
guid: 12eb6698ee82d1eabd35e72a2e7d7910
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6b5dee70678180bde43519658d9e2b28
guid: 75afbc2e8ee9c5266e059e2090111b5a
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: ad706d4d17566ba00ea38d26cdc3b44c
guid: b72d110d3e84e535d84791a10601a2eb
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: dce75ff1b8a8e3d89c302bb0fa994d9a
guid: 87025c6990b058c77fcdb76afe05ec6b
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1581db04b681c7aa23df4e44fe1eaaf6
guid: 2707d3d69abe5cb798f2e56f4a0405d0
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 15615a6b0d57713ea06ad37c4d7398d0
guid: 4eb3fa257b0ea1fcb4c91faf39023180
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 02652adbf286694cca9ea76551ebe4e3
guid: 98ca7dc87d819578ee435f5294552d47
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a4efc86e69127646796b3ce94b26b7eb
guid: 15f4e62e924321e914c933c7eb831a72
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: c0cb6d9b4a953b5a16a603e4af5090d0
guid: dcca773c4e557e0eb5beb7bddba03438
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1b7c62cf49cca4894002340e64adb8e6
guid: c74513a4064d45b021ce154c1f3fee41
DefaultImporter:
externalObjects: {}
userData:

View File

@ -34,13 +34,19 @@ wx.starDownloadTexture = function () {
}
}
};
const contextTypeMap = {
1: 'webgl',
2: 'webgl2',
3: 'wxwebgl',
4: 'wxwebgl2',
};
const mod = {
getSupportedExtensions() {
if (hasCheckSupportedExtensions) {
return GameGlobal.TextureCompressedFormat;
}
const list = canvas
.getContext(GameGlobal.managerConfig.contextConfig.contextType === 2 ? 'webgl2' : 'webgl')
.getContext(contextTypeMap[GameGlobal.managerConfig.contextConfig.contextType])
.getSupportedExtensions();
const noneLimitSupportedTextures = ['']; // 兜底采用png
GameGlobal.TextureCompressedFormat = '';

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 25701fdeb1d9aa5a997212b45e6be999
guid: 7f0feaac2b68a957a9b8285efd82062b
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 03fb4392690093e3c0356b1da1f23958
guid: 2ad6ca873ac3703701fa22114e74ab81
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 52748a96f26147d47abec3e7f2ef1520
guid: eaf49df7f1f159c56927b5a99b5e24e7
DefaultImporter:
externalObjects: {}
userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9cd3314178f847ce8f0d76e38b5d3aa5
guid: ef8b530f61d5aaa649961017f595b643
DefaultImporter:
externalObjects: {}
userData:

Some files were not shown because too many files have changed in this diff Show More