diff --git a/CHANGELOG.md b/CHANGELOG.md index 760f15c8d..e10a8861f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,39 @@ Removed - 删除功能/接口 Fixed - 修复问题 Others - 其他 --> +## 2024-8-28 【预发布】 +PackageManager(git URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git#pre-v0.1.19 +### Feature +* 普通: UDPSocket.write适配 +* 普通: 部分JS API接口更新 +* 普通: 云开发/云托管支持 +### Fixed +* 普通: 修复.net8 OnApplicationFocus/Pause适配 +* 普通: 修复插件自动调节dpr后,获取不到实际dpr + +## 2024-8-13 【重要更新】 +### Feature +* 普通: 横竖屏切换,PC窗口大小自动适配 +* 普通: PC分辨率模糊,自动调节dpr属性 +### Fixed +* 严重:修复多点触控产生的异常 +* 普通:适配2021,去_JS_Focus_Window +* 普通:修复多线程压缩的扩展名判定 + +## 2024-7-09 【普通更新】 +### Feature +* 普通:兼容2022新增的音频API +* 普通:更快的转换打包速度 +* 普通:Unity侧添加设置分辨率接口 +### Fixed +* 普通:临时兼容wk 17.5暂停音频无法恢复的bug +* 普通:Touch id在特定情况丢失 +* 普通:使用微信压缩纹理工具sprite atlas版本被修改 + +## 2024-5-17 【普通更新】 +Fixed +* 普通:修复WXAssetBundle与预下载冲突问题 + ## 2024-5-15 【普通更新】 ### Feature * 普通:支持JS构建模板,请查阅[模板文档](https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/BuildTemplate.html) diff --git a/Editor/WXAssetPostprocessor.cs b/Editor/WXAssetPostprocessor.cs new file mode 100644 index 000000000..fcc48d9b3 --- /dev/null +++ b/Editor/WXAssetPostprocessor.cs @@ -0,0 +1,181 @@ +using UnityEditor; +using System; +using System.Reflection; +using System.IO; +/* +public class WXAssetPostprocessor : AssetPostprocessor +{ + private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) + { + foreach (string asset in importedAssets) + { + ProcessWxPerfPluginAsset(asset); + } + } + + public static bool EnableWXPostProcess = false; + + static void ProcessWxPerfPluginAsset(string wxPerfPluginAsset) + { + PluginImporter importer = AssetImporter.GetAtPath(wxPerfPluginAsset) as PluginImporter; + if (importer == null) return; + + // 判断是否是wx_perf_2022.a/o文件 + if (wxPerfPluginAsset.Contains("wx_perf_2022.a")) + { + if (IsCompatibleWithUnity202203OrNewer() && EnableWXPostProcess) + { +#if PLATFORM_WEIXINMINIGAME + if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame)) +#else + if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL)) +#endif + { + return; + } + EnablePluginAsset(wxPerfPluginAsset); + AssetDatabase.Refresh(); + } + else + { + RemovePluginAssetAllCompatibility(wxPerfPluginAsset); + } + + return; + } + + + // 判断是否是wx_perf_2021.a/o文件 + if (wxPerfPluginAsset.Contains("wx_perf_2021.a")) + { + if (IsCompatibleWithUnity202103To202203() && EnableWXPostProcess) + { + // UnityEngine.Debug.Log($"Before --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}"); +#if PLATFORM_WEIXINMINIGAME + if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame)) +#else + if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL)) +#endif + { + return; + } + + EnablePluginAsset(wxPerfPluginAsset); + // UnityEngine.Debug.Log($"After --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}"); + + AssetDatabase.Refresh(); + } + else + { + RemovePluginAssetAllCompatibility(wxPerfPluginAsset); + } + + return; + } + + if (wxPerfPluginAsset.Contains("WxPerfJsBridge.jslib")) + { + if (EnableWXPostProcess) + { + // UnityEngine.Debug.Log($"Before --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}"); +#if PLATFORM_WEIXINMINIGAME + if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame)) +#else + if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL)) +#endif + { + return; + } + + EnablePluginAsset(wxPerfPluginAsset); + // UnityEngine.Debug.Log($"After --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}"); + + AssetDatabase.Refresh(); + } + else + { + RemovePluginAssetAllCompatibility(wxPerfPluginAsset); + } + + return; + } + + + + } + + static bool IsCompatibleWithUnity202203OrNewer() + { +#if UNITY_2022_3_OR_NEWER + return true; +#endif + return false; + } + + static bool IsCompatibleWithUnity202103To202203() + { +#if UNITY_2022_3_OR_NEWER + return false; +#endif + +#if !UNITY_2021_3_OR_NEWER + return false; +#endif + + return true; + } + + + private static void RemovePluginAssetAllCompatibility(string inAssetPath) + { + PluginImporter importer = AssetImporter.GetAtPath(inAssetPath) as PluginImporter; + +#if PLATFORM_WEIXINMINIGAME + importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, false); +#else + importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false); +#endif + + AssetDatabase.WriteImportSettingsIfDirty(inAssetPath); + } + + private static bool IsPluginAssetValid(PluginImporter inPluginImporter) + { + if (inPluginImporter == null) return false; + + if (inPluginImporter.GetCompatibleWithEditor()) return true; + + foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget))) + { + if (inPluginImporter.GetCompatibleWithPlatform(target)) + { + return true; + } + } + + return false; + } + + private static void EnablePluginAsset(string inAssetPath) + { + PluginImporter importer = AssetImporter.GetAtPath(inAssetPath) as PluginImporter; +#if PLATFORM_WEIXINMINIGAME + importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, EnableWXPostProcess); +#else + importer.SetCompatibleWithPlatform(BuildTarget.WebGL, EnableWXPostProcess); +#endif + AssetDatabase.WriteImportSettingsIfDirty(inAssetPath); + } + + private static int GetEnabledFlagStringIndex(string inAllText, string inTagStr) + { + int tagStrIdx = inAllText.IndexOf(inTagStr); + + int enabledStrIdx = inAllText.IndexOf("enabled: ", tagStrIdx); + + // inAllText[enabledStrIdx] == 'e' + // And that is to say, inAllText[enabledStrIdx + 9] should be 0 or 1 + return enabledStrIdx + 9; + } +} +*/ \ No newline at end of file diff --git a/Editor/WXAssetPostprocessor.cs.meta b/Editor/WXAssetPostprocessor.cs.meta new file mode 100644 index 000000000..5566e748b --- /dev/null +++ b/Editor/WXAssetPostprocessor.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e8dec6e99bf04b4f787998f122542793 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Editor/WXConvertCore.cs b/Editor/WXConvertCore.cs index ccd3c06d5..93005d908 100644 --- a/Editor/WXConvertCore.cs +++ b/Editor/WXConvertCore.cs @@ -109,8 +109,16 @@ namespace WeChatWASM Debug.LogError("因构建模板检查失败终止导出。"); return WXExportError.BUILD_WEBGL_FAILED; } + if (CheckInvalidPerfIntegration()) + { + Debug.LogError("性能分析工具只能用于Development Build, 终止导出! "); + return WXExportError.BUILD_WEBGL_FAILED; + } + + CheckBuildTarget(); Init(); + ProcessWxPerfBinaries(); // JSLib SettingWXTextureMinJSLib(); UpdateGraphicAPI(); @@ -208,6 +216,96 @@ namespace WeChatWASM return WXExportError.SUCCEED; } + private static void ProcessWxPerfBinaries() + { + string[] wxPerfPlugins; + string DS = WXAssetsTextTools.DS; + if (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package) + { + wxPerfPlugins = new string[] + { + $"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}WxPerfJsBridge.jslib", + $"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}wx_perf_2022.a", + $"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}wx_perf_2021.a", + }; + } + else + { + string jsLibRootDir = $"Assets{DS}WX-WASM-SDK-V2{DS}Runtime{DS}Plugins{DS}"; + + // 下方顺序不可变动 + wxPerfPlugins = new string[] + { + $"{jsLibRootDir}WxPerfJsBridge.jslib", + $"{jsLibRootDir}wx_perf_2022.a", + $"{jsLibRootDir}wx_perf_2021.a", + }; + } + + { + // WxPerfJsBridge.jslib + var wxPerfJSBridgeImporter = AssetImporter.GetAtPath(wxPerfPlugins[0]) as PluginImporter; +#if PLATFORM_WEIXINMINIGAME + wxPerfJSBridgeImporter.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, config.CompileOptions.enablePerfAnalysis); +#else + wxPerfJSBridgeImporter.SetCompatibleWithPlatform(BuildTarget.WebGL, config.CompileOptions.enablePerfAnalysis); +#endif + } + + { + // wx_perf_2022.a + bool bShouldEnablePerf2022Plugin = config.CompileOptions.enablePerfAnalysis && IsCompatibleWithUnity202203OrNewer(); + + var wxPerf2022Importer = AssetImporter.GetAtPath(wxPerfPlugins[1]) as PluginImporter; +#if PLATFORM_WEIXINMINIGAME + wxPerf2022Importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, bShouldEnablePerf2022Plugin); +#else + wxPerf2022Importer.SetCompatibleWithPlatform(BuildTarget.WebGL, bShouldEnablePerf2022Plugin); +#endif + } + + { + // wx_perf_2021.a + bool bShouldEnablePerf2021Plugin = config.CompileOptions.enablePerfAnalysis && IsCompatibleWithUnity202103To202203(); + + var wxPerf2021Importer = AssetImporter.GetAtPath(wxPerfPlugins[2]) as PluginImporter; +#if PLATFORM_WEIXINMINIGAME + wxPerf2021Importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, bShouldEnablePerf2021Plugin); +#else + wxPerf2021Importer.SetCompatibleWithPlatform(BuildTarget.WebGL, bShouldEnablePerf2021Plugin); +#endif + } + + for (int i = 0; i < wxPerfPlugins.Length; i++) + { + var importer = AssetImporter.GetAtPath(wxPerfPlugins[i]) as PluginImporter; + importer.SaveAndReimport(); + AssetDatabase.WriteImportSettingsIfDirty(wxPerfPlugins[i]); + AssetDatabase.Refresh(); + } + } + + private static bool IsCompatibleWithUnity202203OrNewer() + { +#if UNITY_2022_3_OR_NEWER + return true; +#endif + return false; + } + + static bool IsCompatibleWithUnity202103To202203() + { +#if UNITY_2022_3_OR_NEWER + return false; +#endif + +#if !UNITY_2021_3_OR_NEWER + return false; +#endif + + return true; + } + private static void CheckBuildTarget() { Emit(LifeCycle.beforeSwitchActiveBuildTarget); @@ -318,6 +416,16 @@ namespace WeChatWASM return true; } + + // Assert when release + Perf-feature + private static bool CheckInvalidPerfIntegration() + { + const string MACRO_ENABLE_WX_PERF_FEATURE = "ENABLE_WX_PERF_FEATURE"; + string defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); + + return (!config.CompileOptions.DevelopBuild) && (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) != -1); + } + private static void ConvertDotnetCode() { CompressAssemblyBrotli(); @@ -1310,16 +1418,24 @@ namespace WeChatWASM { StringBuilder sb = new StringBuilder(); // 添加player-connection-ip信息 - var host = Dns.GetHostEntry(""); - foreach (var ip in host.AddressList) + try { - if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + var host = Dns.GetHostEntry(""); + foreach (var ip in host.AddressList) { - sb.Append($"player-connection-ip={ip.ToString()}"); - break; + if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork) + { + sb.Append($"player-connection-ip={ip.ToString()}"); + break; + } } } + catch (Exception e) + { + Debug.LogWarning("[可选]生成Boot info 失败!错误:" + e.Message); + } + return sb.ToString(); } @@ -1402,6 +1518,9 @@ namespace WeChatWASM config.FontOptions.Mathematical_Operators ? "true" : "false", customUnicodeRange, boolConfigInfo, + config.CompileOptions.DevelopBuild ? "true" : "false", + config.CompileOptions.enablePerfAnalysis ? "true" : "false", + config.ProjectConf.MemorySize.ToString(), }); List replaceList = new List(replaceArrayList); diff --git a/Editor/WXEditorSettingHelper.cs b/Editor/WXEditorSettingHelper.cs index a188dc15a..b8edcf6eb 100644 --- a/Editor/WXEditorSettingHelper.cs +++ b/Editor/WXEditorSettingHelper.cs @@ -53,7 +53,7 @@ namespace WeChatWASM } //private static WXEditorScriptObject config = UnityUtil.GetEditorConf(); - + private static bool m_EnablePerfTool = false; public void OnFocus() { @@ -172,7 +172,7 @@ namespace WeChatWASM EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true)); - this.formCheckbox("developBuild", "Development Build"); + this.formCheckbox("developBuild", "Development Build", "", false, null, OnDevelopmentBuildToggleChanged); this.formCheckbox("autoProfile", "Auto connect Profiler"); this.formCheckbox("scriptOnly", "Scripts Only Build"); this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项,勾选时使用OptimizeSize(默认推荐),生成代码小15%左右,取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed,在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP); @@ -194,9 +194,15 @@ namespace WeChatWASM this.formCheckbox("enableProfileStats", "显示性能面板"); this.formCheckbox("enableRenderAnalysis", "显示渲染日志(dev only)"); this.formCheckbox("brotliMT", "brotli多线程压缩(?)", "开启多线程压缩可以提高出包速度,但会降低压缩率。如若不使用wasm代码分包请勿用多线程出包上线"); + if (m_EnablePerfTool) + { + this.formCheckbox("enablePerfAnalysis", "集成性能分析工具", "将性能分析工具集成入Development Build包中", false, null, OnPerfAnalysisFeatureToggleChanged); + } + EditorGUILayout.EndVertical(); } + #if UNITY_INSTANTGAME foldInstantGame = EditorGUILayout.Foldout(foldInstantGame, "Instant Game - AutoStreaming"); if (foldInstantGame) @@ -455,6 +461,7 @@ namespace WeChatWASM this.setData("enableProfileStats", config.CompileOptions.enableProfileStats); this.setData("enableRenderAnalysis", config.CompileOptions.enableRenderAnalysis); this.setData("brotliMT", config.CompileOptions.brotliMT); + this.setData("enablePerfAnalysis", config.CompileOptions.enablePerfAnalysis); this.setData("autoUploadFirstBundle", true); // font options @@ -525,6 +532,7 @@ namespace WeChatWASM config.CompileOptions.enableProfileStats = this.getDataCheckbox("enableProfileStats"); config.CompileOptions.enableRenderAnalysis = this.getDataCheckbox("enableRenderAnalysis"); config.CompileOptions.brotliMT = this.getDataCheckbox("brotliMT"); + config.CompileOptions.enablePerfAnalysis = this.getDataCheckbox("enablePerfAnalysis"); // font options config.FontOptions.CJK_Unified_Ideographs = this.getDataCheckbox("CJK_Unified_Ideographs"); @@ -546,6 +554,8 @@ namespace WeChatWASM config.FontOptions.Geometric_Shapes = this.getDataCheckbox("Geometric_Shapes"); config.FontOptions.Mathematical_Operators = this.getDataCheckbox("Mathematical_Operators"); config.FontOptions.CustomUnicode = this.getDataInput("CustomUnicode"); + + ApplyPerfAnalysisSetting(); } private string getDataInput(string target) @@ -633,7 +643,7 @@ namespace WeChatWASM GUILayout.EndHorizontal(); } - private void formCheckbox(string target, string label, string help = null, bool disable = false, Action setting = null) + private void formCheckbox(string target, string label, string help = null, bool disable = false, Action setting = null, Action onValueChanged = null) { if (!formCheckboxData.ContainsKey(target)) { @@ -650,7 +660,15 @@ namespace WeChatWASM GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140)); } EditorGUI.BeginDisabledGroup(disable); - formCheckboxData[target] = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]); + + // Toggle the checkbox value based on the disable condition + bool newValue = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]); + // Update the checkbox data if the value has changed and invoke the onValueChanged action + if (newValue != formCheckboxData[target]) + { + formCheckboxData[target] = newValue; + onValueChanged?.Invoke(newValue); + } if (setting != null) { @@ -670,6 +688,45 @@ namespace WeChatWASM GUILayout.EndHorizontal(); } + private void OnDevelopmentBuildToggleChanged(bool InNewValue) + { + // 针对non-dev build,取消性能分析工具的集成 + if (!InNewValue) + { + this.setData("enablePerfAnalysis", false); + } + } + + private void OnPerfAnalysisFeatureToggleChanged(bool InNewValue) + { + // 针对non-dev build,取消性能分析工具的集成 + if (!formCheckboxData["developBuild"] && InNewValue) + { + this.setData("enablePerfAnalysis", false); + } + } + + private void ApplyPerfAnalysisSetting() + { + const string MACRO_ENABLE_WX_PERF_FEATURE = "ENABLE_WX_PERF_FEATURE"; + string defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup); + if (this.getDataCheckbox("enablePerfAnalysis") && this.getDataCheckbox("developBuild")) + { + if (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) == -1) + { + PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, MACRO_ENABLE_WX_PERF_FEATURE + $";{defineSymbols}"); + } + } + else + { + // 删除掉已有的ENABLE_WX_PERF_FEATURE + if (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) != -1) + { + defineSymbols = defineSymbols.Replace(MACRO_ENABLE_WX_PERF_FEATURE, "").Replace(";;", ";").Trim(';'); + PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, defineSymbols); + } + } + } } diff --git a/Editor/WXPluginVersion.cs b/Editor/WXPluginVersion.cs index 173d2680e..2e262508c 100644 --- a/Editor/WXPluginVersion.cs +++ b/Editor/WXPluginVersion.cs @@ -2,7 +2,7 @@ { public class WXPluginVersion { - public static string pluginVersion = "202408200401"; // 这一行不要改他,导出的时候会自动替换 + public static string pluginVersion = "202410080706"; // 这一行不要改他,导出的时候会自动替换 } public class WXPluginConf diff --git a/Editor/wx-editor.dll b/Editor/wx-editor.dll index 1c88402a9..599a94c0e 100644 Binary files a/Editor/wx-editor.dll and b/Editor/wx-editor.dll differ diff --git a/Editor/wx-editor.xml b/Editor/wx-editor.xml index c71aba3f8..1df2b5611 100644 --- a/Editor/wx-editor.xml +++ b/Editor/wx-editor.xml @@ -618,6 +618,11 @@ 是否显示渲染分析日志(develop build才生效) + + + 是否开启运行时性能分析工具(develop build才生效) + + iOS高性能模式自动GC间隔(毫秒) diff --git a/Editor/wx-editor.xml.meta b/Editor/wx-editor.xml.meta index 6f1c92882..4597a66ba 100644 --- a/Editor/wx-editor.xml.meta +++ b/Editor/wx-editor.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1719462b86bf92b2183f2a29654d14bc +guid: b1f260667675a9a7d0a655237a4c3430 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/Plugins/SDK-Call-JS-Old.jslib b/Runtime/Plugins/SDK-Call-JS-Old.jslib index 4161b4535..f8675ae22 100755 --- a/Runtime/Plugins/SDK-Call-JS-Old.jslib +++ b/Runtime/Plugins/SDK-Call-JS-Old.jslib @@ -310,19 +310,6 @@ mergeInto(LibraryManager.library, { WXReportUserBehaviorBranchAnalytics: function (branchId, branchDim, eventType) { window.WXWASMSDK.WXReportUserBehaviorBranchAnalytics(_WXPointer_stringify_adaptor(branchId), _WXPointer_stringify_adaptor(branchDim), eventType); }, - WXCallFunction: function (name, data, conf, s, f, c) { - window.WXWASMSDK.WXCallFunction(_WXPointer_stringify_adaptor(name), _WXPointer_stringify_adaptor(data), _WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(s), _WXPointer_stringify_adaptor(f), _WXPointer_stringify_adaptor(c)); - }, - WXCallFunctionInit: function (conf) { - window.WXWASMSDK.WXCallFunctionInit(_WXPointer_stringify_adaptor(conf)); - }, - WXCloudID: function (cloudID) { - var returnStr = window.WXWASMSDK.WXCloudID(_WXPointer_stringify_adaptor(cloudID)); - var bufferSize = lengthBytesUTF8(returnStr || '') + 1; - var buffer = _malloc(bufferSize); - stringToUTF8(returnStr, buffer, bufferSize); - return buffer; - }, WXCreateInnerAudioContext: function (src, loop, startTime, autoplay, volume, playbackRate, needDownload) { var returnStr = window.WXWASMSDK.WXCreateInnerAudioContext(_WXPointer_stringify_adaptor(src), loop, startTime, autoplay, volume, playbackRate, needDownload); var bufferSize = lengthBytesUTF8(returnStr || '') + 1; @@ -555,9 +542,13 @@ mergeInto(LibraryManager.library, { GameGlobal.avgExFrameTime = exTotalTime / 60; frameCount = 0; exTotalTime = 0; + } else if (typeof GameGlobal.avgExFrameTime === "undefined") { + GameGlobal.avgExFrameTime = exTotalTime / frameCount; } }; }(); + //Set initial value to 0 for preventing GameGlobal.avgExFrameTime from being undefined in Unity 2019 + GameGlobal.avgExFrameTime = 0; } return GameGlobal.avgExFrameTime }, @@ -999,5 +990,72 @@ mergeInto(LibraryManager.library, { }, WX_SetDevicePixelRatio: function(ratio) { window.devicePixelRatio = ratio; - } + }, + WX_CallJSFunction: function (sdkName, functionName, args) { + var sdk = _WXPointer_stringify_adaptor(sdkName); + var func = _WXPointer_stringify_adaptor(functionName); + var formattedArgs = JSON.parse(_WXPointer_stringify_adaptor(args)); + GameGlobal[sdk][func](...formattedArgs); + }, + WX_CallJSFunctionWithReturn: function (sdkName, functionName, args) { + var sdk = _WXPointer_stringify_adaptor(sdkName); + var func = _WXPointer_stringify_adaptor(functionName); + var formattedArgs = JSON.parse(_WXPointer_stringify_adaptor(args)); + var res = GameGlobal[sdk][func](...formattedArgs); + var resStr = JSON.stringify(res); + var bufferSize = lengthBytesUTF8(resStr || '') + 1; + var buffer = _malloc(bufferSize); + stringToUTF8((resStr || ''), buffer, bufferSize); + return buffer; + }, + WX_CloudCloud: function (option) { + window.WXWASMSDK.WX_CloudCloud(_WXPointer_stringify_adaptor(option)); + }, + WX_CloudInit: function (option) { + window.WXWASMSDK.WX_CloudInit(_WXPointer_stringify_adaptor(option)); + }, + WX_CloudCallFunction: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudCallFunction(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudCloudID: function (env, cloudID) { + var returnStr = window.WXWASMSDK.WX_CloudCloudID(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(cloudID)); + var bufferSize = lengthBytesUTF8(returnStr || '') + 1; + var buffer = _malloc(bufferSize); + stringToUTF8(returnStr, buffer, bufferSize); + return buffer; + }, + WX_CloudCallContainer: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudCallContainer(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudUploadFile: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudUploadFile(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudDownloadFile: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudDownloadFile(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudGetTempFileURL: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudGetTempFileURL(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudDeleteFile: function(env, option, callbackId) { + window.WXWASMSDK.WX_CloudDeleteFile(_WXPointer_stringify_adaptor(env), _WXPointer_stringify_adaptor(option), _WXPointer_stringify_adaptor(callbackId)); + }, + WX_CloudCDNString: function(env, target, isJSON) { + if (isJSON) { + target = JSON.parse(_WXPointer_stringify_adaptor(target)); + } else { + target = _WXPointer_stringify_adaptor(target); + } + var returnStr = window.WXWASMSDK.WX_CloudCDN(_WXPointer_stringify_adaptor(env), target); + var bufferSize = lengthBytesUTF8(returnStr || '') + 1; + var buffer = _malloc(bufferSize); + stringToUTF8(returnStr, buffer, bufferSize); + return buffer; + }, + WX_CloudCDNBuffer: function(env, targetPtr, targetLength) { + var returnStr = window.WXWASMSDK.WX_CloudCDN(_WXPointer_stringify_adaptor(env), HEAPU8.buffer.slice(targetPtr, targetPtr + targetLength)); + var bufferSize = lengthBytesUTF8(returnStr || '') + 1; + var buffer = _malloc(bufferSize); + stringToUTF8(returnStr, buffer, bufferSize); + return buffer; + }, }); diff --git a/Runtime/Plugins/SDK-Call-JS.jslib b/Runtime/Plugins/SDK-Call-JS.jslib index 23e4c3154..17a85e0b4 100644 --- a/Runtime/Plugins/SDK-Call-JS.jslib +++ b/Runtime/Plugins/SDK-Call-JS.jslib @@ -92,6 +92,9 @@ WX_GetClipboardData:function(conf, callbackId) { WX_GetConnectedBluetoothDevices:function(conf, callbackId) { window.WXWASMSDK.WX_GetConnectedBluetoothDevices(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, +WX_GetDeviceBenchmarkInfo:function(conf, callbackId) { + window.WXWASMSDK.WX_GetDeviceBenchmarkInfo(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); +}, WX_GetExtConfig:function(conf, callbackId) { window.WXWASMSDK.WX_GetExtConfig(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, @@ -239,6 +242,9 @@ WX_RequestMidasFriendPayment:function(conf, callbackId) { WX_RequestMidasPayment:function(conf, callbackId) { window.WXWASMSDK.WX_RequestMidasPayment(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, +WX_RequestMidasPaymentGameItem:function(conf, callbackId) { + window.WXWASMSDK.WX_RequestMidasPaymentGameItem(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); +}, WX_RequestSubscribeMessage:function(conf, callbackId) { window.WXWASMSDK.WX_RequestSubscribeMessage(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, @@ -392,9 +398,6 @@ WX_OpenChannelsLiveCollection:function(conf, callbackId) { WX_OpenPage:function(conf, callbackId) { window.WXWASMSDK.WX_OpenPage(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, -WX_RequestMidasPaymentGameItem:function(conf, callbackId) { - window.WXWASMSDK.WX_RequestMidasPaymentGameItem(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); -}, WX_RequestSubscribeLiveActivity:function(conf, callbackId) { window.WXWASMSDK.WX_RequestSubscribeLiveActivity(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId)); }, @@ -414,9 +417,6 @@ WX_RemoveStorageSync:function(key){ WX_ReportEvent:function(eventId, data){ window.WXWASMSDK.WX_ReportEvent(_WXPointer_stringify_adaptor(eventId), _WXPointer_stringify_adaptor(data)); }, -WX_ReportMonitor:function(name, value){ - window.WXWASMSDK.WX_ReportMonitor(_WXPointer_stringify_adaptor(name), value); -}, WX_ReportPerformance:function(id, value, dimensions){ window.WXWASMSDK.WX_ReportPerformance(id, value, _WXPointer_stringify_adaptor(dimensions)); }, @@ -586,6 +586,12 @@ WX_OnMemoryWarning:function() { WX_OffMemoryWarning:function() { window.WXWASMSDK.WX_OffMemoryWarning(); }, +WX_OnMenuButtonBoundingClientRectWeightChange:function() { + window.WXWASMSDK.WX_OnMenuButtonBoundingClientRectWeightChange(); +}, +WX_OffMenuButtonBoundingClientRectWeightChange:function() { + window.WXWASMSDK.WX_OffMenuButtonBoundingClientRectWeightChange(); +}, WX_OnMessage:function() { window.WXWASMSDK.WX_OnMessage(); }, @@ -849,8 +855,9 @@ WX_GetWindowInfo:function( return buffer; }, WX_CreateImageData:function( + width,height ){ - var res = window.WXWASMSDK.WX_CreateImageData(); + var res = window.WXWASMSDK.WX_CreateImageData(width,height); var bufferSize = lengthBytesUTF8(res || '') + 1; var buffer = _malloc(bufferSize); stringToUTF8(res, buffer, bufferSize); diff --git a/Runtime/Plugins/UDPSocket.jslib b/Runtime/Plugins/UDPSocket.jslib index fd092e993..7e7f91254 100644 --- a/Runtime/Plugins/UDPSocket.jslib +++ b/Runtime/Plugins/UDPSocket.jslib @@ -46,8 +46,11 @@ var WXUDPSocketLibrary = WX_UDPSocketSetTTL:function(id, ttl) { window.WXWASMSDK.WX_UDPSocketSetTTL(_WXPointer_stringify_adaptor(id), ttl); }, - WX_UDPSocketWrite:function(id) { - window.WXWASMSDK.WX_UDPSocketWrite(_WXPointer_stringify_adaptor(id)); + WX_UDPSocketWriteString:function(id, data, param) { + window.WXWASMSDK.WX_UDPSocketWriteString(_WXPointer_stringify_adaptor(id), _WXPointer_stringify_adaptor(data), _WXPointer_stringify_adaptor(param)); + }, + WX_UDPSocketWriteBuffer:function(id, dataPtr, dataLength, param) { + window.WXWASMSDK.WX_UDPSocketWriteBuffer(_WXPointer_stringify_adaptor(id), dataPtr, dataLength, _WXPointer_stringify_adaptor(param)); }, WX_UDPSocketBind:function(id, port) { var res = window.WXWASMSDK.WX_UDPSocketBind(_WXPointer_stringify_adaptor(id), port); diff --git a/Runtime/Plugins/WXAssetBundle.jslib b/Runtime/Plugins/WXAssetBundle.jslib index 8f4b711fd..9314aaad2 100644 --- a/Runtime/Plugins/WXAssetBundle.jslib +++ b/Runtime/Plugins/WXAssetBundle.jslib @@ -269,6 +269,10 @@ var WXAssetBundleLibrary = { var err_msg = !!e ? e.toString() : 'unknown'; } var expected_size = WXFS.disk.get(path); + if(expected_size === 0){ + WXFS.disk.set(path, res.byteLength); + expected_size = res.byteLength; + } if(!res || res.byteLength != expected_size){ var wxab_error = { stage: WXFS.WXABErrorSteps['kLoadBundleFromFile'], @@ -308,12 +312,16 @@ var WXAssetBundleLibrary = { return buffer; }, - UnCleanbyPath: function (ptr) { + UnCleanbyPath: function (ptr, fromFile) { var url = UTF8ToString(ptr); var path = WXFS.url2path(url); + if(fromFile && !GameGlobal.manager.fs.accessSync(path)){ + return false; + } if(!WXFS.disk.has(path)){ WXFS.disk.set(path, 0); } + return true; }, UnloadbyPath: function (ptr) { diff --git a/Runtime/Plugins/WxPerfJsBridge.jslib b/Runtime/Plugins/WxPerfJsBridge.jslib new file mode 100644 index 000000000..f9dbd70a7 --- /dev/null +++ b/Runtime/Plugins/WxPerfJsBridge.jslib @@ -0,0 +1,85 @@ +mergeInto(LibraryManager.library, { + + JSInitProfiler: function(savePathPtr, metaInfoPtr) { + const savePath = UTF8ToString(savePathPtr); + // const uploadUrl = UTF8ToString(uploadUrlPtr); + const metaInfo = UTF8ToString(metaInfoPtr); + //if (GameGlobal && GameGlobal.manager && GameGlobal.manager.initProfiler) { + const uploadUrl = GameGlobal.managerConfig.PROFILER_UPLOAD_URL; + GameGlobal.manager.initProfiler({'savePath': savePath, 'uploadUrl': uploadUrl, 'meta': metaInfo, 'cb': _JSInitProfilerCallback, 'errorCb': _JSProfilerErrorCallback}); + //} + }, + JSStartProfiler: function() { + //const savePath = UTF8ToString(savePathPtr); + //const uploadUrl = UTF8ToString(uploadUrlPtr); + //const metaInfo = UTF8ToString(metaInfoPtr); + //if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) { + GameGlobal.manager.profiler.startProfile(); + //} + }, + StartJSProfilerRecord: function(frameId, interval, savePathPtr) { + const savePath = UTF8ToString(savePathPtr); + if (GameGlobal && GameGlobal.unityNamespace && GameGlobal.unityNamespace.ProfileWebgl && GameGlobal.unityNamespace.ProfileWebgl.startRecord) { + GameGlobal.unityNamespace.ProfileWebgl.startRecord(frameId, interval, savePath); + } + }, + StopJSProfilerRecord: function() { + if (GameGlobal && GameGlobal.unityNamespace && GameGlobal.unityNamespace.ProfileWebgl && GameGlobal.unityNamespace.ProfileWebgl.stopRecord) { + GameGlobal.unityNamespace.ProfileWebgl.stopRecord(); + } + }, + JSProfilerUploadString: function(dataPtr, bufSize, namePtr, dirPtr, id, inStartFrameIdx, inEndFrameIdx) { + //if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) { + const name = UTF8ToString(namePtr); + const dir = UTF8ToString(dirPtr); + const content = UTF8ToString(dataPtr); + GameGlobal.manager.profiler.uploadString({'str': content, 'len': bufSize, 'fileName': name, 'uploadDir': dir, 'id': id, 'cb': _JSPerfUploadStringCallback, 'startFrameIdx': inStartFrameIdx, 'endFrameIdx': inEndFrameIdx}); + //} + }, + JSProfilerUploadAnnotation: function(inAnnotationDataPtr, inFrameIdx) { + const annotationData = UTF8ToString(inAnnotationDataPtr); + GameGlobal.manager.profiler.uploadAnnotation({'annotationData': annotationData, 'annotationFrameIDX': inFrameIdx}); + }, + JSGetMetaDataInfo: function() { + var convertPluginVersion = GameGlobal.unityNamespace.convertPluginVersion; + var unityHeapReservedMemory = GameGlobal.unityNamespace.unityHeapReservedMemory; + var contextType = GameGlobal.managerConfig.contextConfig.contextType; + var webglVersion; + + switch (contextType) { + case 1: + webglVersion = "webgl1"; + break; + case 2: + webglVersion = "webgl2"; + break; + case 3: + webglVersion = "auto"; + break; + default: + webglVersion = "unknown"; + } + + var metaDataString = "convertPluginVersion=" + + convertPluginVersion + "\nwebglVersion=" + webglVersion + + "\nunityHeapReservedMemory=" + unityHeapReservedMemory + "\ndpr=" + + window.devicePixelRatio + "\n"; + var lengthBytes = lengthBytesUTF8(metaDataString) + 1; + var stringOnWasmHeap = _malloc(lengthBytes); + stringToUTF8(metaDataString, stringOnWasmHeap, lengthBytes); + + return stringOnWasmHeap; + }, + + JSFreeIntPtr: function(ptr) { + _free(ptr); + }, + JSProfilerUploadStringWithDir: function(dataPtr, bufSize, namePtr, dirPtr) { + //if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) { + const name = UTF8ToString(namePtr); + const dir = UTF8ToString(dirPtr); + const content = UTF8ToString(dataPtr); + GameGlobal.manager.profiler.uploadStringWithDir({'str': content, 'len': bufSize, 'fileName': name, 'uploadDir': dir, 'cb': _JSProfilerUploadStringWithDirCallback}); + //} + } +}); diff --git a/Runtime/Plugins/WxPerfJsBridge.jslib.meta b/Runtime/Plugins/WxPerfJsBridge.jslib.meta new file mode 100644 index 000000000..373be8acc --- /dev/null +++ b/Runtime/Plugins/WxPerfJsBridge.jslib.meta @@ -0,0 +1,79 @@ +fileFormatVersion: 2 +guid: de46a37ac18378340bae0bc523c46892 +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 0 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WeixinMiniGame: 0 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Facebook: WebGL + second: + enabled: 1 + settings: {} + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: AnyCPU + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: x86 + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: x86_64 + - first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + - first: + WeixinMiniGame: WeixinMiniGame + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/wx-perf.dll b/Runtime/Plugins/wx-perf.dll new file mode 100644 index 000000000..6afd8452a Binary files /dev/null and b/Runtime/Plugins/wx-perf.dll differ diff --git a/Runtime/Plugins/wx-perf.dll.meta b/Runtime/Plugins/wx-perf.dll.meta new file mode 100644 index 000000000..a1d38627c --- /dev/null +++ b/Runtime/Plugins/wx-perf.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f0cbdcf50f6d52cea758f1ea825443c0 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/Plugins/wx-perf.xml b/Runtime/Plugins/wx-perf.xml new file mode 100644 index 000000000..8be02f617 --- /dev/null +++ b/Runtime/Plugins/wx-perf.xml @@ -0,0 +1,18 @@ + + + + wx-perf + + + + + This method is used to add an annotation to the performance data. + The annotation string is uploaded to the server along with the current frame ID. + + The annotation string to be added. It should not be null or empty. + + If the provided annotation string is null or empty, an error message will be logged. + + + + diff --git a/Runtime/Plugins/wx-perf.xml.meta b/Runtime/Plugins/wx-perf.xml.meta new file mode 100644 index 000000000..f0d3a97e1 --- /dev/null +++ b/Runtime/Plugins/wx-perf.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8ea3a597042b1e09596b698c5fcfd06b +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/Plugins/wx-runtime-editor.dll b/Runtime/Plugins/wx-runtime-editor.dll index eace04a23..cdff2a318 100644 Binary files a/Runtime/Plugins/wx-runtime-editor.dll and b/Runtime/Plugins/wx-runtime-editor.dll differ diff --git a/Runtime/Plugins/wx-runtime-editor.xml b/Runtime/Plugins/wx-runtime-editor.xml index d1a77d77a..cd7cc8dec 100644 --- a/Runtime/Plugins/wx-runtime-editor.xml +++ b/Runtime/Plugins/wx-runtime-editor.xml @@ -4,25 +4,6 @@ wx-runtime-editor - - - 云函数,调用前必须先Init初始化 - - - - - 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html - - - - - - - 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html - - 通过开放能力在小程序端 / web 端获取得到的 CloudID - 返回字符串,原样传回云函数调用就好 - Banner 广告,详见 https://developers.weixin.qq.com/minigame/dev/guide/open-ability/ad/banner-ad.html @@ -293,6 +274,25 @@ 面板缩放比例,默认大小 40x40,低于 375 宽度的屏幕会等比缩小 + + + 云函数,调用前必须先Init初始化 + + + + + 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html + + + + + + + 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html + + 通过开放能力在小程序端 / web 端获取得到的 CloudID + 返回字符串,原样传回云函数调用就好 + 插屏广告组件广告,详见 https://developers.weixin.qq.com/minigame/dev/api/ad/CustomAd.html @@ -1422,16 +1422,6 @@ 视频是否是在用户完整观看的情况下被关闭的,详见 https://developers.weixin.qq.com/minigame/dev/api/ad/RewardedVideoAd.onClose.html - - - 云函数回调 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html - - - - - 后端返回的经过json序列化后的数据 - - 对应JS版里的 extraData,这里序列化成JSON字符串 @@ -1572,31 +1562,6 @@ 事件触发时的时间戳 - - - 调用云函数 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html - - - - - 这里请将数据json序列化为字符串再赋值到data - - - - - 云函数初始化 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html - - - - - 必填,环境ID,指定接下来调用 API 时访问哪个环境的云资源 - - - - - 是否在将用户访问记录到用户管理中,在控制台中可见 - - 音频资源的地址,用于直接播放。可以设置为网络地址,或者unity中的本地路径如 Assets/xx.wav,运行时会自动和配置的音频地址前缀做拼接得到最终线上地址 @@ -3081,6 +3046,36 @@ 接口调用成功的回调函数 + + + 必填,环境ID,指定接下来调用 API 时访问哪个环境的云资源 + + + + + 是否在将用户访问记录到用户管理中,在控制台中可见 + + + + + 云函数回调 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html + + + + + 后端返回的经过json序列化后的数据 + + + + + 调用云函数 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html + + + + + 后端返回的经过json序列化后的数据 + + 小程序账号信息 @@ -3187,6 +3182,17 @@ 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/minigame/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 + + + 微信字体大小缩放比例 + + + + + 需要基础库: `2.23.4` + 微信字体大小,单位px + + 当前小程序运行的宿主环境 @@ -3220,6 +3226,12 @@ 是否正在充电中 + + + 需要基础库: `3.4.3` + 是否处于省电模式,目前仅 iOS 端支持 + + 设备电量,范围 1 - 100 @@ -3230,11 +3242,7 @@ 应用(微信APP)二进制接口类型(仅 Android 支持) - - - 设备性能等级(仅 Android 支持)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) - - + 设备品牌 @@ -3447,7 +3455,7 @@ - 设备方向 + 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准) 可选值: - 'portrait': 竖屏; - 'landscape': 横屏; @@ -3651,7 +3659,7 @@ - 设备方向 + 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准) 可选值: - 'portrait': 竖屏; - 'landscape': 横屏; @@ -3717,6 +3725,23 @@ 接口调用结束的回调函数(调用成功、失败都会执行) + + + 需要基础库: `2.10.4` + 是否开启 http2 + + + + + 是否开启 profile,默认开启。开启后可在接口回调的 res.profile 中查看性能调试信息。 + + + + + 需要基础库: `2.10.4` + 是否开启 Quic 协议(gQUIC Q43) + + 接口调用失败的回调函数 @@ -3744,6 +3769,12 @@ 超时时间,单位为毫秒,默认值为 60000 即一分钟。 + + + 需要基础库: `3.4.1` + 使用高性能模式,暂仅支持 Android,默认关闭。该模式下有更优的网络性能表现。 + + 错误信息 @@ -3895,6 +3926,11 @@ 传输层根据多个请求评估的当前网络的 rtt(仅供参考) + + + 是否走到了高性能模式。基础库 v3.3.4 起支持。 + + 开发者服务器返回的 HTTP Response Header @@ -3943,6 +3979,26 @@ 背景颜色 + + + 高度 + + + + + 左上角横坐标 + + + + + 左上角纵坐标 + + + + + 宽度 + + 边框颜色 @@ -3968,16 +4024,6 @@ 字号 - - - 高度 - - - - - 左上角横坐标 - - 文本的行高 @@ -3992,16 +4038,6 @@ - 'right': 居右; - - - 左上角纵坐标 - - - - - 宽度 - - 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 @@ -4159,7 +4195,7 @@ - shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](#) + shareTicket。可以从 wx.getEnterOptionsSync 中获取。详情 [shareTicket](#) @@ -4748,7 +4784,7 @@ 开始广播本地创建的外围设备。 **注意** - Android 8.0.9 开始,支持直接使用 16/32/128 位 UUID; - - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](#); + - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](https://developers.weixin.qq.com/minigame/dev/guide/device/ble.html); - iOS 必须直接使用 16 位的 UUID,不能补位到 128 位,否则系统组包时仍会按照 128 位传输。iOS 暂不支持 32 位 UUID。 - iOS 同时只能发起一个广播,安卓支持同时发起多个广播。 - 传 beacon 参数时,不能同时传入 deviceName,serviceUuids,manufacturerData 参数。 @@ -5534,6 +5570,12 @@ 是否正在充电中 + + + 需要基础库: `3.4.3` + 是否处于省电模式,目前仅 iOS 端支持 + + 设备电量,范围 1 - 100 @@ -5902,6 +5944,23 @@ 蓝牙设备名称,某些设备可能没有 + + + 接口调用结束的回调函数(调用成功、失败都会执行) + + + + + 接口调用失败的回调函数 + + + + + 接口调用成功的回调函数 + + + + 接口调用结束的回调函数(调用成功、失败都会执行) @@ -6020,6 +6079,24 @@ 接口调用成功的回调函数 + + + 错误信息 + | 错误码 | 错误信息 | 说明 | + | - | - | - | + | 40097 | | 场景错误 | + | 65206 | | 用户已不在该群内 | + + + + + 错误码 + | 错误码 | 错误信息 | 说明 | + | - | - | - | + | 40097 | | 场景错误 | + | 65206 | | 用户已不在该群内 | + + 需要基础库: `2.7.0` @@ -6252,7 +6329,7 @@ - shareTicket + shareTicket,详见[获取更多转发信息](#) @@ -7105,6 +7182,36 @@ - 15: TRIM_MEMORY_RUNNING_CRITICAL; + + + 下边界坐标,单位:px + + + + + 高度,单位:px + + + + + 左边界坐标,单位:px + + + + + 右边界坐标,单位:px + + + + + 上边界坐标,单位:px + + + + + 宽度,单位:px + + 按键类型,0左键,1中键,2右键 @@ -7275,6 +7382,12 @@ 拒绝原因,一般是一个 Error 对象 + + + 需要基础库: `3.3.0` + 支持开发者自定义一键打开小程序时的 query + + 错误码 @@ -8200,11 +8313,6 @@ 分区 ID - - - 其他参数 - - 错误信息 @@ -8212,6 +8320,7 @@ | - | - | - | | -1 | | 系统失败 | | -2 | | 支付取消 | + | -6 | | 下单参数类型不对 | | -15001 | | 虚拟支付接口错误码,缺少参数 | | -15002 | | 虚拟支付接口错误码,参数不合法 | | -15003 | | 虚拟支付接口错误码,订单重复 | @@ -8221,6 +8330,9 @@ | -15007 | | 虚拟支付接口错误码,订单已支付 | | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | + | -15011 | | 请求的数据类型错误 | + | -15013 | | 代币未发布 | + | -15017 | | 订单已关闭 | | 1 | | 虚拟支付接口错误码,用户取消支付 | | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | @@ -8230,7 +8342,9 @@ | 7 | | 虚拟支付接口错误码,支付取消 | | 1000 | | 参数错误 | | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | + | 1003 | | 代币/分区未发布或者对应商户号被封禁或者米大师Portal错误,请先确保虚拟支付2.0代币和分区已发布,然后自查商户号封禁情况https://kf.qq.com/faq/190523Mb6VRJ190523RV363E.html,对应的商户号可以在mp-虚拟支付2.0-基础配置-微信支付账号信息中查询 | + | 3017/-15012 | | 道具id非法 | + | 701001 | | ios禁止支付 | @@ -8240,6 +8354,7 @@ | - | - | - | | -1 | | 系统失败 | | -2 | | 支付取消 | + | -6 | | 下单参数类型不对 | | -15001 | | 虚拟支付接口错误码,缺少参数 | | -15002 | | 虚拟支付接口错误码,参数不合法 | | -15003 | | 虚拟支付接口错误码,订单重复 | @@ -8249,6 +8364,9 @@ | -15007 | | 虚拟支付接口错误码,订单已支付 | | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | + | -15011 | | 请求的数据类型错误 | + | -15013 | | 代币未发布 | + | -15017 | | 订单已关闭 | | 1 | | 虚拟支付接口错误码,用户取消支付 | | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | @@ -8258,7 +8376,9 @@ | 7 | | 虚拟支付接口错误码,支付取消 | | 1000 | | 参数错误 | | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | + | 1003 | | 代币/分区未发布或者对应商户号被封禁或者米大师Portal错误,请先确保虚拟支付2.0代币和分区已发布,然后自查商户号封禁情况https://kf.qq.com/faq/190523Mb6VRJ190523RV363E.html,对应的商户号可以在mp-虚拟支付2.0-基础配置-微信支付账号信息中查询 | + | 3017/-15012 | | 道具id非法 | + | 701001 | | ios禁止支付 | @@ -8271,11 +8391,116 @@ 错误信息 + + + 错误码 + + 调用成功信息 + + + + 支付原串 + 具体支付参数见下面的signData,需要将数据以json格式传递 + signData例子: + '{"mode":"goods","offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","zoneId":"1","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' + + + + + 用户态签名 + signature参数签名算法参考[用户态签名](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/signature.html#%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%E6%80%81%E7%AD%BE%E5%90%8D) + 可参考[calc_signature](https://docs.qq.com/doc/DVUN0QWJja0J5c2x4) + + + + + 接口调用结束的回调函数(调用成功、失败都会执行) + + + + + 接口调用失败的回调函数 + + + + + 接口调用成功的回调函数 + + + + + 购买数量 + + + + + 币种 + 可选值: + - 'CNY': 人民币; + + + + + 道具单价(分) + 用来校验价格与后台道具价格是否一致,避免用户在业务商城页看到的价格与实际价格不一致导致投诉 + + + + + 支付的类型 + 不同的支付类型有各自额外要传的附加参数 + + + + + 在米大师侧申请的应用id + mp-支付基础配置中的offerid + + + + + 业务订单号 + 每个订单号只能使用一次,重复使用会失败(极端情况不保证唯一,不建议业务强依赖唯一性)。 + 要求32个字符内,只能是数字、大小写字母、符号 _-|*@组成,不能以下划线(_)开头。 + 若没有传入,则平台会自动填充一个,并以下划线开头。 + + + + + 道具ID + + + + + 透传数据 + 发货通知时会透传给开发者 + + + + + 环境配置 + 可选值: + - 0: 米大师正式环境; + - 1: 米大师沙箱环境; + + + + + 平台 + 可选值: + - 'android': 安卓; + + + + + 分区ID + + 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 @@ -9021,7 +9246,7 @@ 需要基础库: `3.2.0` - 分享的图片消息是否要带小程序入口 + 分享的图片消息是否要带小程序入口 (仅部分小程序类目可用) @@ -9400,6 +9625,11 @@ 参数列表 + + + 模板ID + + 参数名 @@ -9716,101 +9946,6 @@ 接口调用成功的回调函数 - - - 支付原串 - - - - - 支付签名 - - - - - 用户态签名 - - - - - 其他参数 - - - - - 接口调用结束的回调函数(调用成功、失败都会执行) - - - - - 接口调用失败的回调函数 - - - - - 接口调用成功的回调函数 - - - - - 错误信息 - | 错误码 | 错误信息 | 说明 | - | - | - | - | - | -1 | | 系统失败 | - | -2 | | 支付取消 | - | -15001 | | 虚拟支付接口错误码,缺少参数 | - | -15002 | | 虚拟支付接口错误码,参数不合法 | - | -15003 | | 虚拟支付接口错误码,订单重复 | - | -15004 | | 虚拟支付接口错误码,后台错误 | - | -15005 | | 虚拟支付接口错误码,appId权限被封禁 | - | -15006 | | 虚拟支付接口错误码,货币类型不支持 | - | -15007 | | 虚拟支付接口错误码,订单已支付 | - | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | - | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | - | 1 | | 虚拟支付接口错误码,用户取消支付 | - | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | - | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | - | 4 | | 虚拟支付接口错误码,用户操作系统支付状态异常 | - | 5 | | 虚拟支付接口错误码,操作系统错误 | - | 6 | | 虚拟支付接口错误码,其他错误 | - | 7 | | 虚拟支付接口错误码,支付取消 | - | 1000 | | 参数错误 | - | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | - - - - - 错误码 - | 错误码 | 错误信息 | 说明 | - | - | - | - | - | -1 | | 系统失败 | - | -2 | | 支付取消 | - | -15001 | | 虚拟支付接口错误码,缺少参数 | - | -15002 | | 虚拟支付接口错误码,参数不合法 | - | -15003 | | 虚拟支付接口错误码,订单重复 | - | -15004 | | 虚拟支付接口错误码,后台错误 | - | -15005 | | 虚拟支付接口错误码,appId权限被封禁 | - | -15006 | | 虚拟支付接口错误码,货币类型不支持 | - | -15007 | | 虚拟支付接口错误码,订单已支付 | - | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | - | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | - | -15012 | | 虚拟支付接口错误码,小游戏用户态签名错误 | - | -15014 | | 虚拟支付接口错误码,小游戏支付签名错误 | - | -15015 | | sessionkey过期 | - | -15016 | | goodsprice道具价格错误 | - | 1 | | 虚拟支付接口错误码,用户取消支付 | - | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | - | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | - | 4 | | 虚拟支付接口错误码,用户操作系统支付状态异常 | - | 5 | | 虚拟支付接口错误码,操作系统错误 | - | 6 | | 虚拟支付接口错误码,其他错误 | - | 7 | | 虚拟支付接口错误码,支付取消 | - | 1000 | | 参数错误 | - | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | - - 接口调用结束的回调函数(调用成功、失败都会执行) @@ -10273,7 +10408,7 @@ 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 - + [UDPSocket.write()](https://developers.weixin.qq.com/minigame/dev/api/network/udp/UDPSocket.write.html) 需要基础库: `2.15.0` diff --git a/Runtime/Plugins/wx-runtime-editor.xml.meta b/Runtime/Plugins/wx-runtime-editor.xml.meta index 4aee18733..6e0f8dc8e 100644 --- a/Runtime/Plugins/wx-runtime-editor.xml.meta +++ b/Runtime/Plugins/wx-runtime-editor.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ff1c8cafe7253ab3b25ac0da12acf740 +guid: 57aa93b43d006f13c8e05e350d6cd32f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/Plugins/wx-runtime.dll b/Runtime/Plugins/wx-runtime.dll index 8bf9e84ba..92fc12df8 100644 Binary files a/Runtime/Plugins/wx-runtime.dll and b/Runtime/Plugins/wx-runtime.dll differ diff --git a/Runtime/Plugins/wx-runtime.xml b/Runtime/Plugins/wx-runtime.xml index 88f72f019..052c8601c 100644 --- a/Runtime/Plugins/wx-runtime.xml +++ b/Runtime/Plugins/wx-runtime.xml @@ -4,25 +4,12 @@ wx-runtime - + - 云函数,调用前必须先Init初始化 + 覆盖unity的PlayerPrefs + 注意:调用均为同步调用, 容易阻塞游戏主线程造成卡顿,不建议频繁调用 - - - 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html - - - - - - - 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html - - 通过开放能力在小程序端 / web 端获取得到的 CloudID - 返回字符串,原样传回云函数调用就好 - Banner 广告,详见 https://developers.weixin.qq.com/minigame/dev/guide/open-ability/ad/banner-ad.html @@ -293,6 +280,25 @@ 面板缩放比例,默认大小 40x40,低于 375 宽度的屏幕会等比缩小 + + + 云函数,调用前必须先Init初始化 + + + + + 初始化,详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html + + + + + + + 声明字符串为 CloudID(开放数据 ID),该接口传入一个字符串,返回一个 CloudID 特殊字符串,将该对象传至云函数可以获取其对应的开放数据。详见 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/open/Cloud.CloudID.html + + 通过开放能力在小程序端 / web 端获取得到的 CloudID + 返回字符串,原样传回云函数调用就好 + 插屏广告组件广告,详见 https://developers.weixin.qq.com/minigame/dev/api/ad/CustomAd.html @@ -1422,16 +1428,6 @@ 视频是否是在用户完整观看的情况下被关闭的,详见 https://developers.weixin.qq.com/minigame/dev/api/ad/RewardedVideoAd.onClose.html - - - 云函数回调 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html - - - - - 后端返回的经过json序列化后的数据 - - 对应JS版里的 extraData,这里序列化成JSON字符串 @@ -1572,31 +1568,6 @@ 事件触发时的时间戳 - - - 调用云函数 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html - - - - - 这里请将数据json序列化为字符串再赋值到data - - - - - 云函数初始化 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/init/client.init.html - - - - - 必填,环境ID,指定接下来调用 API 时访问哪个环境的云资源 - - - - - 是否在将用户访问记录到用户管理中,在控制台中可见 - - 音频资源的地址,用于直接播放。可以设置为网络地址,或者unity中的本地路径如 Assets/xx.wav,运行时会自动和配置的音频地址前缀做拼接得到最终线上地址 @@ -3081,6 +3052,36 @@ 接口调用成功的回调函数 + + + 必填,环境ID,指定接下来调用 API 时访问哪个环境的云资源 + + + + + 是否在将用户访问记录到用户管理中,在控制台中可见 + + + + + 云函数回调 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html + + + + + 后端返回的经过json序列化后的数据 + + + + + 调用云函数 https://developers.weixin.qq.com/minigame/dev/wxcloud/reference-sdk-api/functions/Cloud.callFunction.html + + + + + 后端返回的经过json序列化后的数据 + + 小程序账号信息 @@ -3187,6 +3188,17 @@ 是否已打开调试。可通过右上角菜单或 [wx.setEnableDebug](https://developers.weixin.qq.com/minigame/dev/api/base/debug/wx.setEnableDebug.html) 打开调试。 + + + 微信字体大小缩放比例 + + + + + 需要基础库: `2.23.4` + 微信字体大小,单位px + + 当前小程序运行的宿主环境 @@ -3220,6 +3232,12 @@ 是否正在充电中 + + + 需要基础库: `3.4.3` + 是否处于省电模式,目前仅 iOS 端支持 + + 设备电量,范围 1 - 100 @@ -3230,11 +3248,7 @@ 应用(微信APP)二进制接口类型(仅 Android 支持) - - - 设备性能等级(仅 Android 支持)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) - - + 设备品牌 @@ -3447,7 +3461,7 @@ - 设备方向 + 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准) 可选值: - 'portrait': 竖屏; - 'landscape': 横屏; @@ -3651,7 +3665,7 @@ - 设备方向 + 设备方向(注意:IOS客户端横屏游戏获取deviceOrientation可能不准,建议以屏幕宽高为准) 可选值: - 'portrait': 竖屏; - 'landscape': 横屏; @@ -3717,6 +3731,23 @@ 接口调用结束的回调函数(调用成功、失败都会执行) + + + 需要基础库: `2.10.4` + 是否开启 http2 + + + + + 是否开启 profile,默认开启。开启后可在接口回调的 res.profile 中查看性能调试信息。 + + + + + 需要基础库: `2.10.4` + 是否开启 Quic 协议(gQUIC Q43) + + 接口调用失败的回调函数 @@ -3744,6 +3775,12 @@ 超时时间,单位为毫秒,默认值为 60000 即一分钟。 + + + 需要基础库: `3.4.1` + 使用高性能模式,暂仅支持 Android,默认关闭。该模式下有更优的网络性能表现。 + + 错误信息 @@ -3895,6 +3932,11 @@ 传输层根据多个请求评估的当前网络的 rtt(仅供参考) + + + 是否走到了高性能模式。基础库 v3.3.4 起支持。 + + 开发者服务器返回的 HTTP Response Header @@ -3943,6 +3985,26 @@ 背景颜色 + + + 高度 + + + + + 左上角横坐标 + + + + + 左上角纵坐标 + + + + + 宽度 + + 边框颜色 @@ -3968,16 +4030,6 @@ 字号 - - - 高度 - - - - - 左上角横坐标 - - 文本的行高 @@ -3992,16 +4044,6 @@ - 'right': 居右; - - - 左上角纵坐标 - - - - - 宽度 - - 一维数组,包含以 RGBA 顺序的数据,数据使用 0 至 255(包含)的整数表示 @@ -4159,7 +4201,7 @@ - shareTicket。可以从 wx.onShow 中获取。详情 [shareTicket](#) + shareTicket。可以从 wx.getEnterOptionsSync 中获取。详情 [shareTicket](#) @@ -4748,7 +4790,7 @@ 开始广播本地创建的外围设备。 **注意** - Android 8.0.9 开始,支持直接使用 16/32/128 位 UUID; - - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](#); + - Android 8.0.9 以下版本只支持 128 位 UUID,使用 16/32 位的 UUID 时需要进行补位(系统会自动识别是否属于预分配区间),可以参考[蓝牙指南](https://developers.weixin.qq.com/minigame/dev/guide/device/ble.html); - iOS 必须直接使用 16 位的 UUID,不能补位到 128 位,否则系统组包时仍会按照 128 位传输。iOS 暂不支持 32 位 UUID。 - iOS 同时只能发起一个广播,安卓支持同时发起多个广播。 - 传 beacon 参数时,不能同时传入 deviceName,serviceUuids,manufacturerData 参数。 @@ -5534,6 +5576,12 @@ 是否正在充电中 + + + 需要基础库: `3.4.3` + 是否处于省电模式,目前仅 iOS 端支持 + + 设备电量,范围 1 - 100 @@ -5902,6 +5950,23 @@ 蓝牙设备名称,某些设备可能没有 + + + 接口调用结束的回调函数(调用成功、失败都会执行) + + + + + 接口调用失败的回调函数 + + + + + 接口调用成功的回调函数 + + + + 接口调用结束的回调函数(调用成功、失败都会执行) @@ -6020,6 +6085,24 @@ 接口调用成功的回调函数 + + + 错误信息 + | 错误码 | 错误信息 | 说明 | + | - | - | - | + | 40097 | | 场景错误 | + | 65206 | | 用户已不在该群内 | + + + + + 错误码 + | 错误码 | 错误信息 | 说明 | + | - | - | - | + | 40097 | | 场景错误 | + | 65206 | | 用户已不在该群内 | + + 需要基础库: `2.7.0` @@ -6252,7 +6335,7 @@ - shareTicket + shareTicket,详见[获取更多转发信息](#) @@ -7105,6 +7188,36 @@ - 15: TRIM_MEMORY_RUNNING_CRITICAL; + + + 下边界坐标,单位:px + + + + + 高度,单位:px + + + + + 左边界坐标,单位:px + + + + + 右边界坐标,单位:px + + + + + 上边界坐标,单位:px + + + + + 宽度,单位:px + + 按键类型,0左键,1中键,2右键 @@ -7275,6 +7388,12 @@ 拒绝原因,一般是一个 Error 对象 + + + 需要基础库: `3.3.0` + 支持开发者自定义一键打开小程序时的 query + + 错误码 @@ -8200,11 +8319,6 @@ 分区 ID - - - 其他参数 - - 错误信息 @@ -8212,6 +8326,7 @@ | - | - | - | | -1 | | 系统失败 | | -2 | | 支付取消 | + | -6 | | 下单参数类型不对 | | -15001 | | 虚拟支付接口错误码,缺少参数 | | -15002 | | 虚拟支付接口错误码,参数不合法 | | -15003 | | 虚拟支付接口错误码,订单重复 | @@ -8221,6 +8336,9 @@ | -15007 | | 虚拟支付接口错误码,订单已支付 | | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | + | -15011 | | 请求的数据类型错误 | + | -15013 | | 代币未发布 | + | -15017 | | 订单已关闭 | | 1 | | 虚拟支付接口错误码,用户取消支付 | | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | @@ -8230,7 +8348,9 @@ | 7 | | 虚拟支付接口错误码,支付取消 | | 1000 | | 参数错误 | | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | + | 1003 | | 代币/分区未发布或者对应商户号被封禁或者米大师Portal错误,请先确保虚拟支付2.0代币和分区已发布,然后自查商户号封禁情况https://kf.qq.com/faq/190523Mb6VRJ190523RV363E.html,对应的商户号可以在mp-虚拟支付2.0-基础配置-微信支付账号信息中查询 | + | 3017/-15012 | | 道具id非法 | + | 701001 | | ios禁止支付 | @@ -8240,6 +8360,7 @@ | - | - | - | | -1 | | 系统失败 | | -2 | | 支付取消 | + | -6 | | 下单参数类型不对 | | -15001 | | 虚拟支付接口错误码,缺少参数 | | -15002 | | 虚拟支付接口错误码,参数不合法 | | -15003 | | 虚拟支付接口错误码,订单重复 | @@ -8249,6 +8370,9 @@ | -15007 | | 虚拟支付接口错误码,订单已支付 | | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | + | -15011 | | 请求的数据类型错误 | + | -15013 | | 代币未发布 | + | -15017 | | 订单已关闭 | | 1 | | 虚拟支付接口错误码,用户取消支付 | | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | @@ -8258,7 +8382,9 @@ | 7 | | 虚拟支付接口错误码,支付取消 | | 1000 | | 参数错误 | | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | + | 1003 | | 代币/分区未发布或者对应商户号被封禁或者米大师Portal错误,请先确保虚拟支付2.0代币和分区已发布,然后自查商户号封禁情况https://kf.qq.com/faq/190523Mb6VRJ190523RV363E.html,对应的商户号可以在mp-虚拟支付2.0-基础配置-微信支付账号信息中查询 | + | 3017/-15012 | | 道具id非法 | + | 701001 | | ios禁止支付 | @@ -8271,11 +8397,116 @@ 错误信息 + + + 错误码 + + 调用成功信息 + + + + 支付原串 + 具体支付参数见下面的signData,需要将数据以json格式传递 + signData例子: + '{"mode":"goods","offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","zoneId":"1","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}' + + + + + 用户态签名 + signature参数签名算法参考[用户态签名](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/signature.html#%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95%E6%80%81%E7%AD%BE%E5%90%8D) + 可参考[calc_signature](https://docs.qq.com/doc/DVUN0QWJja0J5c2x4) + + + + + 接口调用结束的回调函数(调用成功、失败都会执行) + + + + + 接口调用失败的回调函数 + + + + + 接口调用成功的回调函数 + + + + + 购买数量 + + + + + 币种 + 可选值: + - 'CNY': 人民币; + + + + + 道具单价(分) + 用来校验价格与后台道具价格是否一致,避免用户在业务商城页看到的价格与实际价格不一致导致投诉 + + + + + 支付的类型 + 不同的支付类型有各自额外要传的附加参数 + + + + + 在米大师侧申请的应用id + mp-支付基础配置中的offerid + + + + + 业务订单号 + 每个订单号只能使用一次,重复使用会失败(极端情况不保证唯一,不建议业务强依赖唯一性)。 + 要求32个字符内,只能是数字、大小写字母、符号 _-|*@组成,不能以下划线(_)开头。 + 若没有传入,则平台会自动填充一个,并以下划线开头。 + + + + + 道具ID + + + + + 透传数据 + 发货通知时会透传给开发者 + + + + + 环境配置 + 可选值: + - 0: 米大师正式环境; + - 1: 米大师沙箱环境; + + + + + 平台 + 可选值: + - 'android': 安卓; + + + + + 分区ID + + 需要订阅的消息模板的id的集合,一次调用最多可订阅3条消息(注意:iOS客户端7.0.6版本、Android客户端7.0.7版本之后的一次性订阅/长期订阅才支持多个模板消息,iOS客户端7.0.5版本、Android客户端7.0.6版本之前的一次订阅只支持一个模板消息)消息模板id在[微信公众平台(mp.weixin.qq.com)-功能-订阅消息]中配置。每个tmplId对应的模板标题需要不相同,否则会被过滤。 @@ -9021,7 +9252,7 @@ 需要基础库: `3.2.0` - 分享的图片消息是否要带小程序入口 + 分享的图片消息是否要带小程序入口 (仅部分小程序类目可用) @@ -9400,6 +9631,11 @@ 参数列表 + + + 模板ID + + 参数名 @@ -9716,101 +9952,6 @@ 接口调用成功的回调函数 - - - 支付原串 - - - - - 支付签名 - - - - - 用户态签名 - - - - - 其他参数 - - - - - 接口调用结束的回调函数(调用成功、失败都会执行) - - - - - 接口调用失败的回调函数 - - - - - 接口调用成功的回调函数 - - - - - 错误信息 - | 错误码 | 错误信息 | 说明 | - | - | - | - | - | -1 | | 系统失败 | - | -2 | | 支付取消 | - | -15001 | | 虚拟支付接口错误码,缺少参数 | - | -15002 | | 虚拟支付接口错误码,参数不合法 | - | -15003 | | 虚拟支付接口错误码,订单重复 | - | -15004 | | 虚拟支付接口错误码,后台错误 | - | -15005 | | 虚拟支付接口错误码,appId权限被封禁 | - | -15006 | | 虚拟支付接口错误码,货币类型不支持 | - | -15007 | | 虚拟支付接口错误码,订单已支付 | - | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | - | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | - | 1 | | 虚拟支付接口错误码,用户取消支付 | - | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | - | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | - | 4 | | 虚拟支付接口错误码,用户操作系统支付状态异常 | - | 5 | | 虚拟支付接口错误码,操作系统错误 | - | 6 | | 虚拟支付接口错误码,其他错误 | - | 7 | | 虚拟支付接口错误码,支付取消 | - | 1000 | | 参数错误 | - | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | - - - - - 错误码 - | 错误码 | 错误信息 | 说明 | - | - | - | - | - | -1 | | 系统失败 | - | -2 | | 支付取消 | - | -15001 | | 虚拟支付接口错误码,缺少参数 | - | -15002 | | 虚拟支付接口错误码,参数不合法 | - | -15003 | | 虚拟支付接口错误码,订单重复 | - | -15004 | | 虚拟支付接口错误码,后台错误 | - | -15005 | | 虚拟支付接口错误码,appId权限被封禁 | - | -15006 | | 虚拟支付接口错误码,货币类型不支持 | - | -15007 | | 虚拟支付接口错误码,订单已支付 | - | -15009 | | 虚拟支付接口错误码,由于健康系统限制,本次支付已超过限额(这种错误情况会有默认弹窗提示) | - | -15010 | | 虚拟支付接口错误码,正式版小游戏不允许在沙箱环境支付 | - | -15012 | | 虚拟支付接口错误码,小游戏用户态签名错误 | - | -15014 | | 虚拟支付接口错误码,小游戏支付签名错误 | - | -15015 | | sessionkey过期 | - | -15016 | | goodsprice道具价格错误 | - | 1 | | 虚拟支付接口错误码,用户取消支付 | - | 2 | | 虚拟支付接口错误码,客户端错误,判断到小程序在用户处于支付中时,又发起了一笔支付请求 | - | 3 | | 虚拟支付接口错误码,Android独有错误:用户使用GooglePlay支付,而手机未安装GooglePlay | - | 4 | | 虚拟支付接口错误码,用户操作系统支付状态异常 | - | 5 | | 虚拟支付接口错误码,操作系统错误 | - | 6 | | 虚拟支付接口错误码,其他错误 | - | 7 | | 虚拟支付接口错误码,支付取消 | - | 1000 | | 参数错误 | - | 1001 | | 分区未发布 | - | 1003 | | 米大师Portal错误 | - - 接口调用结束的回调函数(调用成功、失败都会执行) @@ -10273,7 +10414,7 @@ 设置 IP_TTL 套接字选项,用于设置一个 IP 数据包传输时允许的最大跳步数 - + [UDPSocket.write()](https://developers.weixin.qq.com/minigame/dev/api/network/udp/UDPSocket.write.html) 需要基础库: `2.15.0` @@ -10619,11 +10760,5 @@ 注册监听录制事件的回调函数。当对应事件触发时,回调函数会被执行 - - - 覆盖unity的PlayerPrefs - 注意:调用均为同步调用, 容易阻塞游戏主线程造成卡顿,不建议频繁调用 - - diff --git a/Runtime/Plugins/wx-runtime.xml.meta b/Runtime/Plugins/wx-runtime.xml.meta index 215621fbe..ad82ab242 100644 --- a/Runtime/Plugins/wx-runtime.xml.meta +++ b/Runtime/Plugins/wx-runtime.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a059cf8813f306b3aab52c161b8307af +guid: fa414b40926610979325ff6d05eada8c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/Plugins/wx_perf_2021.a b/Runtime/Plugins/wx_perf_2021.a new file mode 100644 index 000000000..4071db347 Binary files /dev/null and b/Runtime/Plugins/wx_perf_2021.a differ diff --git a/Runtime/Plugins/wx_perf_2021.a.meta b/Runtime/Plugins/wx_perf_2021.a.meta new file mode 100644 index 000000000..201212399 --- /dev/null +++ b/Runtime/Plugins/wx_perf_2021.a.meta @@ -0,0 +1,74 @@ +fileFormatVersion: 2 +guid: 0dedb8177ed8f384d9833f379a1b9b2a +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + WebGL: WebGL + second: + enabled: 0 + settings: {} + - first: + WeixinMiniGame: WeixinMiniGame + second: + enabled: 0 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/Plugins/wx_perf_2022.a b/Runtime/Plugins/wx_perf_2022.a new file mode 100644 index 000000000..71296d3fd Binary files /dev/null and b/Runtime/Plugins/wx_perf_2022.a differ diff --git a/Runtime/Plugins/wx_perf_2022.a.meta b/Runtime/Plugins/wx_perf_2022.a.meta new file mode 100644 index 000000000..326a8274b --- /dev/null +++ b/Runtime/Plugins/wx_perf_2022.a.meta @@ -0,0 +1,74 @@ +fileFormatVersion: 2 +guid: 187d3306362e8bec07846a683aeb77da +PluginImporter: + externalObjects: {} + serializedVersion: 2 + iconMap: {} + executionOrder: {} + defineConstraints: [] + isPreloaded: 0 + isOverridable: 1 + isExplicitlyReferenced: 0 + validateReferences: 1 + platformData: + - first: + : Any + second: + enabled: 0 + settings: + Exclude Editor: 1 + Exclude Linux64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 1 + Exclude Win: 1 + Exclude Win64: 1 + - first: + Any: + second: + enabled: 0 + settings: {} + - first: + Editor: Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + DefaultValueInitialized: true + OS: AnyOS + - first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win + second: + enabled: 0 + settings: + CPU: None + - first: + Standalone: Win64 + second: + enabled: 0 + settings: + CPU: None + - first: + WebGL: WebGL + second: + enabled: 0 + settings: {} + - first: + WeixinMiniGame: WeixinMiniGame + second: + enabled: 0 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/WX.cs b/Runtime/WX.cs index fdb841666..046d53e34 100644 --- a/Runtime/WX.cs +++ b/Runtime/WX.cs @@ -108,9 +108,11 @@ namespace WeChatWASM /// /// [wx.checkSession(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/login/wx.checkSession.html) - /// 检查登录态是否过期。 - /// 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 wx.checkSession 接口检测当前用户登录态是否有效。 - /// 登录态过期后开发者可以再调用 wx.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。 + /// 检查登录态 session_key 是否过期。 + /// session_key 具有唯一性,在使用小程序时,同一用户在同一时刻仅有一个有效的 session_key。 + /// 通过 wx.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能过期。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。除了过期失效外,触发获取临时登录凭证 code 的操作([小程序登录](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/login.html) 和 [数据预拉取](https://developers.weixin.qq.com/minigame/dev/guide/base-ability/pre-fetch.html))可能会生成新的登录态session_key,从而使旧的 session_key 被顶替而失效。 + /// 开发者可以调用 wx.checkSession 接口检测用户登录态是否过期。**注意,wx.checkSession 的校验对象是最后一次获取 code 操作对应的登录态 session_key**,调用成功说明该 session_key 未过期,调用失败说明 session_key 已过期。如果要校验指定的 session_key 是否有效,可以在开发者服务器后台调用 [checkSessionKey](#)。 + /// 登录态失效后开发者可以再调用 wx.login 获取新的用户登录态。 /// **示例代码** /// ```js /// wx.checkSession({ @@ -150,8 +152,8 @@ namespace WeChatWASM /// maxDuration: 30, /// camera: 'back', /// success(res) { - /// console.log(res.tempFiles.tempFilePath) - /// console.log(res.tempFiles.size) + /// console.log(res.tempFiles[0].tempFilePath) + /// console.log(res.tempFiles[0].size) /// } /// }) /// ``` @@ -224,7 +226,7 @@ namespace WeChatWASM /// /// [wx.compressImage(Object object)](https://developers.weixin.qq.com/minigame/dev/api/media/image/wx.compressImage.html) /// 需要基础库: `3.0.1` - /// 压缩图片接口,可选压缩质量 + /// 压缩图片接口,可选压缩质量。iOS 仅支持压缩 JPG 格式图片。 /// **示例代码** /// ```js /// wx.compressImage({ @@ -394,7 +396,7 @@ namespace WeChatWASM /// [wx.getBackgroundFetchData(object object)](https://developers.weixin.qq.com/minigame/dev/api/storage/background-fetch/wx.getBackgroundFetchData.html) /// 需要基础库: `3.0.1` /// 拉取 backgroundFetch 客户端缓存数据。 - /// 当调用接口时,若当次请求未结束,会先返回本地的旧数据(之前打开小程序时请求的),如果本地没有旧数据,安卓上会返回fail,不会等待请求完成,iOS上会返回success但fetchedData为空,也不会等待请求完成。 + /// 当调用接口时,若当次请求未结束,会先返回本地的旧数据(之前打开小程序时请求的),如果本地没有旧数据,安卓上会返回fail,不会等待请求完成,iOS上会返回success但fetchedData为空,也不会等待请求完成。建议和 [wx.onBackgroundFetchData](https://developers.weixin.qq.com/minigame/dev/api/storage/background-fetch/wx.onBackgroundFetchData.html) 配合使用 /// public static void GetBackgroundFetchData(GetBackgroundFetchDataOption callback) { @@ -413,7 +415,7 @@ namespace WeChatWASM /// /// [wx.getBatteryInfo(Object object)](https://developers.weixin.qq.com/minigame/dev/api/device/battery/wx.getBatteryInfo.html) - /// 获取设备电量。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/minigame/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 + /// 获取设备电池信息。同步 API [wx.getBatteryInfoSync](https://developers.weixin.qq.com/minigame/dev/api/device/battery/wx.getBatteryInfoSync.html) 在 iOS 上不可用。 /// public static void GetBatteryInfo(GetBatteryInfoOption callback) { @@ -541,6 +543,25 @@ namespace WeChatWASM WXSDKManagerHandler.Instance.GetConnectedBluetoothDevices(callback); } + /// + /// [wx.getDeviceBenchmarkInfo(Object object)](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getDeviceBenchmarkInfo.html) + /// 需要基础库: `3.4.5` + /// 获取设备性能得分和机型档位数据 + /// **示例代码** + /// ```js + /// wx.getDeviceBenchmarkInfo({ + /// success (res) { + /// console.log(res.benchmarkLevel) + /// console.log(res.modelLevel) + /// } + /// }) + /// ``` + /// + public static void GetDeviceBenchmarkInfo(GetDeviceBenchmarkInfoOption callback) + { + WXSDKManagerHandler.Instance.GetDeviceBenchmarkInfo(callback); + } + /// /// [wx.getExtConfig(Object object)](https://developers.weixin.qq.com/minigame/dev/api/ext/wx.getExtConfig.html) /// 需要基础库: `2.8.3` @@ -857,36 +878,6 @@ namespace WeChatWASM /// /// [wx.getSystemInfo(Object object)](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfo.html) - /// 获取系统信息。**由于历史原因,wx.getSystemInfo 是异步的调用格式,但是是同步返回,需要异步获取系统信息请使用 [wx.getSystemInfoAsync](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfoAsync.html)。** - /// **示例代码** - /// [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) - /// ```js - /// wx.getSystemInfo({ - /// success (res) { - /// console.log(res.model) - /// console.log(res.pixelRatio) - /// console.log(res.windowWidth) - /// console.log(res.windowHeight) - /// console.log(res.language) - /// console.log(res.version) - /// console.log(res.platform) - /// } - /// }) - /// ``` - /// ```js - /// try { - /// const res = wx.getSystemInfoSync() - /// console.log(res.model) - /// console.log(res.pixelRatio) - /// console.log(res.windowWidth) - /// console.log(res.windowHeight) - /// console.log(res.language) - /// console.log(res.version) - /// console.log(res.platform) - /// } catch (e) { - /// // Do something when catch error - /// } - /// ``` /// public static void GetSystemInfo(GetSystemInfoOption callback) { @@ -896,22 +887,6 @@ namespace WeChatWASM /// /// [wx.getSystemInfoAsync(Object object)](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfoAsync.html) /// 需要基础库: `2.25.3` - /// 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。 - /// **示例代码** - /// [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) - /// ```js - /// wx.getSystemInfoAsync({ - /// success (res) { - /// console.log(res.model) - /// console.log(res.pixelRatio) - /// console.log(res.windowWidth) - /// console.log(res.windowHeight) - /// console.log(res.language) - /// console.log(res.version) - /// console.log(res.platform) - /// } - /// }) - /// ``` /// public static void GetSystemInfoAsync(GetSystemInfoAsyncOption callback) { @@ -1339,7 +1314,7 @@ namespace WeChatWASM /// /// [wx.openChannelsUserProfile(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/channels/wx.openChannelsUserProfile.html) /// 需要基础库: `2.21.2` - /// 打开视频号主页 + /// 打开视频号主页。若为插件环境,只允许在插件页面中调用。 /// public static void OpenChannelsUserProfile(OpenChannelsUserProfileOption callback) { @@ -1593,7 +1568,9 @@ namespace WeChatWASM /// /// [wx.requestMidasPayment(Object object)](https://developers.weixin.qq.com/minigame/dev/api/midas-payment/wx.requestMidasPayment.html) - /// 发起米大师支付 + /// 需要基础库: `2.19.2` + /// 发起购买游戏币支付请求,可参考[虚拟支付2.0游戏币](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/virtual-payment/coins.html) + /// 虚拟支付全流程可参考[技术手册-虚拟支付篇](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/virtual-payment/guide.html) /// **buyQuantity 限制说明** /// 购买游戏币的时候,buyQuantity 不可任意填写。需满足 buyQuantity * 游戏币单价 = 限定的价格等级。如:游戏币单价为 0.1 元,一次购买最少数量是 10。 /// 有效价格等级如下: @@ -1634,6 +1611,46 @@ namespace WeChatWASM WXSDKManagerHandler.Instance.RequestMidasPayment(callback); } + /// + /// [wx.requestMidasPaymentGameItem(Object object)](https://developers.weixin.qq.com/minigame/dev/api/midas-payment/wx.requestMidasPaymentGameItem.html) + /// 需要基础库: `2.19.2` + /// 发起道具直购支付请求,可参考[虚拟支付2.0道具直购](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/virtual-payment/goods.html ),虚拟支付全流程可参考[技术手册-虚拟支付篇](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/virtual-payment/guide.html) + /// **示例代码** + /// ```js + /// wx.requestMidasPaymentGameItem({ + /// signData: '{"mode":"goods","offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","platform":"android","zoneId":"1","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}', + /// paySig: 'd0b8bbccbe34ed11549bcfd6602b08711f4acc0965253a949cd6a2b895152f9d', + /// signature: 'd0b8bbccbe34ed11549bcfd6602b08711f4acc0965253a949cd6a2b895152f9d', + /// success(res, errCode) { + /// console.log('pay', res, errCode); + /// }, + /// fail({ + /// errMsg, + /// errCode + /// }) { + /// console.error(errMsg, errCode) + /// } + /// ``` + /// 支付签名代码实现 + /// ```python + /// import hmac + /// import hashlib + /// import urllib.parse + /// # sign_data 支付原串 注意这里sign_data需要和前端一致,原格式传递(包括空格和回车),建议后台下发, + /// # appkey 米大师密钥 + /// # method 需要签名方法 requestMidasPaymentGameItem + /// def gen_pay_sig(sign_data, appkey, method): + /// need_encode_body = method + '&' + sign_data + /// print(need_encode_body) + /// return hmac.new(key=appkey.encode('utf-8'), msg=need_encode_body.encode('utf-8'), + /// digestmod=hashlib.sha256).hexdigest() + /// ``` + /// + public static void RequestMidasPaymentGameItem(RequestMidasPaymentGameItemOption callback) + { + WXSDKManagerHandler.Instance.RequestMidasPaymentGameItem(callback); + } + /// /// [wx.requestSubscribeMessage(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/subscribe-message/wx.requestSubscribeMessage.html) /// 需要基础库: `2.4.4` @@ -1901,7 +1918,7 @@ namespace WeChatWASM /// 设置 [InnerAudioContext](https://developers.weixin.qq.com/minigame/dev/api/media/audio/InnerAudioContext.html) 的播放选项。设置之后对当前小程序全局生效。 /// **** /// ## 注意事项 - /// - 为保证微信整体体验,speakerOn 为 true 时,客户端会忽略 mixWithOthers 参数的内容,强制与其它音频互斥 + /// - 为保证微信整体体验,speakerOn 为 true 时,客户端会忽略 mixWithOther 参数的内容,强制与其它音频互斥 /// - 不支持在播放音频的过程中切换为扬声器播放,开发者如需切换可以先暂停当前播放的音频并记录下当前暂停的时间点,然后切换后重新从原来暂停的时间点开始播放音频 /// - 目前 wx.setInnerAudioOption 接口不兼容 wx.createWebAudioContext 接口,也不兼容 wx.createInnerAudioContext 开启 useWebAudioImplement 的情况,将在后续版本中支持 /// @@ -1947,7 +1964,7 @@ namespace WeChatWASM /// /// [wx.setStatusBarStyle(Object object)](https://developers.weixin.qq.com/minigame/dev/api/ui/statusbar/wx.setStatusBarStyle.html) - /// 当在配置中设置 showStatusBarStyle 时,屏幕顶部会显示状态栏。此接口可以修改状态栏的样式。 + /// 当在配置中设置 showStatusBar 时,屏幕顶部会显示状态栏。此接口可以修改状态栏的样式。 /// public static void SetStatusBarStyle(SetStatusBarStyleOption callback) { @@ -1971,7 +1988,10 @@ namespace WeChatWASM /// /// [wx.setVisualEffectOnCapture(Object object)](https://developers.weixin.qq.com/minigame/dev/api/device/screen/wx.setVisualEffectOnCapture.html) /// 需要基础库: `3.1.4` - /// 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用 + /// 设置截屏/录屏时屏幕表现 + /// **Bug & Tip** + /// 1. `tip`:iOS 要求基础库版本为 3.3.0 以上,且系统版本为 iOS 16 以上 + /// 2. `tip`:iOS 目前只支持处理录屏时的表现 /// public static void SetVisualEffectOnCapture(SetVisualEffectOnCaptureOption callback) { @@ -2064,6 +2084,9 @@ namespace WeChatWASM /// [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.showShareImageMenu.html) /// 需要基础库: `2.14.3` /// 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载 + /// **Bug & Tip** + /// 1. `tip`: `needShowEntrance`分享的图片消息是否要带小程序入口,支持申明类目:商家自营、电商平台、餐饮服务(餐饮服务场所/餐饮服务管理企业、点餐平台、外卖平台)、旅游服务(住宿服务、景区服务、OTA、旅游管理单位)、生活服务(家政服务、丽人服务、宠物(非医院类)、婚庆服务、洗浴保健、休闲娱乐、百货/超市/便利店、开锁服务、营业性演出票务、其他宠物健康服务、洗浴保健平台、共享服务、跑腿、寄存、求职/招聘) + /// 2. `tip`: `needShowEntrance`小游戏所有类目都支持 /// public static void ShowShareImageMenu(ShowShareImageMenuOption callback) { @@ -2464,15 +2487,6 @@ namespace WeChatWASM WXSDKManagerHandler.Instance.OpenPage(callback); } - /// - /// [wx.requestMidasPaymentGameItem(Object object)] - /// 发起米大师支付 - /// - public static void RequestMidasPaymentGameItem(RequestMidasPaymentGameItemOption callback) - { - WXSDKManagerHandler.Instance.RequestMidasPaymentGameItem(callback); - } - public static void RequestSubscribeLiveActivity(RequestSubscribeLiveActivityOption callback) { WXSDKManagerHandler.Instance.RequestSubscribeLiveActivity(callback); @@ -2542,22 +2556,6 @@ namespace WeChatWASM WXSDKManagerHandler.Instance.ReportEvent(eventId, data); } - /// - /// [wx.reportMonitor(string name, number value)](https://developers.weixin.qq.com/minigame/dev/api/data-analysis/wx.reportMonitor.html) - /// 需要基础库: `2.1.2` - /// 自定义业务数据监控上报接口。 - /// **使用说明** - /// 使用前,需要在「小程序管理后台-运维中心-性能监控-业务数据监控」中新建监控事件,配置监控描述与告警类型。每一个监控事件对应唯一的监控ID,开发者最多可以创建128个监控事件。 - /// **示例代码** - /// ```js - /// wx.reportMonitor('1', 1) - /// ``` - /// - public static void ReportMonitor(string name, double value) - { - WXSDKManagerHandler.Instance.ReportMonitor(name, value); - } - /// /// [wx.reportPerformance(Number id, Number value, String|Array dimensions)](https://developers.weixin.qq.com/minigame/dev/api/base/performance/wx.reportPerformance.html) /// 需要基础库: `2.10.0` @@ -2651,6 +2649,9 @@ namespace WeChatWASM /// /// [wx.shareAppMessage(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.shareAppMessage.html) /// 主动拉起转发,进入选择通讯录界面。 + /// **** + /// ## 注意事项 + /// - 转发图片说明:仅当自定义分享图片权限被封禁时用 imageUrlId,其他情况都会用 imageUrl。 imageUrl 不填时使用游戏画面截图。 /// public static void ShareAppMessage(ShareAppMessageOption option) { @@ -3107,6 +3108,28 @@ namespace WeChatWASM WXSDKManagerHandler.Instance.OffMemoryWarning(result); } + /// + /// [wx.onMenuButtonBoundingClientRectWeightChange(function listener)](https://developers.weixin.qq.com/minigame/dev/api/ui/menu/wx.onMenuButtonBoundingClientRectWeightChange.html) + /// 需要基础库: `3.4.3` + /// 监听菜单按钮(右上角胶囊按钮)的布局位置信息变化事件 + /// **示例代码** + /// ```js + /// const callback = res => console.log('menuButtonBoundingClientRectWeightChange', res) + /// wx.onMenuButtonBoundingClientRectWeightChange(callback) + /// // 取消监听 + /// wx.offMenuButtonBoundingClientRectWeightChange(callback) + /// ``` + /// + public static void OnMenuButtonBoundingClientRectWeightChange(Action result) + { + WXSDKManagerHandler.Instance.OnMenuButtonBoundingClientRectWeightChange(result); + } + + public static void OffMenuButtonBoundingClientRectWeightChange(Action result) + { + WXSDKManagerHandler.Instance.OffMenuButtonBoundingClientRectWeightChange(result); + } + /// /// [wx.onMessage(function callback)](https://developers.weixin.qq.com/minigame/dev/api/open-api/context/wx.onMessage.html) /// 监听主域发送的消息 @@ -3270,17 +3293,28 @@ namespace WeChatWASM /// ```js /// wx.onUserCaptureScreen(function (res) { /// console.log('用户截屏了') - /// }) + /// return { + /// query: "parameter=test", // 通过截屏图片打开小程序的query参数 + /// promise: new Promise((resolve) => { // 通过promise延时传递小程序的query参数 + /// setTimeout(() => { + /// resolve({ + /// query: "parameter=test2", + /// }) + /// }, 1000) // 在1秒内对query进行解析 + /// }) + /// } + /// } + /// ) /// ``` /// - public static void OnUserCaptureScreen(Action res) + public static void OnUserCaptureScreen(Action result) { - WXSDKManagerHandler.Instance.OnUserCaptureScreen(res); + WXSDKManagerHandler.Instance.OnUserCaptureScreen(result); } - public static void OffUserCaptureScreen(Action res) + public static void OffUserCaptureScreen(Action result) { - WXSDKManagerHandler.Instance.OffUserCaptureScreen(res); + WXSDKManagerHandler.Instance.OffUserCaptureScreen(result); } /// @@ -3420,6 +3454,9 @@ namespace WeChatWASM /// [wx.onShareTimeline(function listener)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.onShareTimeline.html) /// 需要基础库: `2.11.3` /// 监听用户点击右上角菜单的「分享到朋友圈」按钮时触发的事件。本接口为 Beta 版本,暂只在 Android 平台支持。 + /// **** + /// ## 注意事项 + /// - 转发图片说明:仅当自定义分享图片权限被封禁时用 imageUrlId,其他情况都会用 imageUrl。 imageUrl 不填时使用当前游戏的icon。 /// public static void OnShareTimeline(Action> callback) { @@ -3696,36 +3733,6 @@ namespace WeChatWASM /// /// [Object wx.getSystemInfoSync()](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfoSync.html) - /// [wx.getSystemInfo](https://developers.weixin.qq.com/minigame/dev/api/base/system/wx.getSystemInfo.html) 的同步版本 - /// **示例代码** - /// [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/WkUCgXmS7mqO) - /// ```js - /// wx.getSystemInfo({ - /// success (res) { - /// console.log(res.model) - /// console.log(res.pixelRatio) - /// console.log(res.windowWidth) - /// console.log(res.windowHeight) - /// console.log(res.language) - /// console.log(res.version) - /// console.log(res.platform) - /// } - /// }) - /// ``` - /// ```js - /// try { - /// const res = wx.getSystemInfoSync() - /// console.log(res.model) - /// console.log(res.pixelRatio) - /// console.log(res.windowWidth) - /// console.log(res.windowHeight) - /// console.log(res.language) - /// console.log(res.version) - /// console.log(res.platform) - /// } catch (e) { - /// // Do something when catch error - /// } - /// ``` /// /// public static SystemInfo GetSystemInfoSync() @@ -3776,14 +3783,19 @@ namespace WeChatWASM } /// - /// [[ImageData](https://developers.weixin.qq.com/minigame/dev/api/render/image/ImageData.html) wx.createImageData()](https://developers.weixin.qq.com/minigame/dev/api/render/image/wx.createImageData.html) - /// 需要基础库: `2.24.6` - /// 创建一个 ImageData 图片数据对象 + /// [[ImageData](https://developers.weixin.qq.com/minigame/dev/api/render/image/ImageData.html) wx.createImageData(number width, number height)](https://developers.weixin.qq.com/minigame/dev/api/render/image/wx.createImageData.html) + /// 需要基础库: `3.4.10` + /// 这里有两种使用方法, 一种是指定ImageData的宽和高, 另外一种是使用ImageData, 通过它本身的宽高尺寸来构建新的对象。 + /// **示例代码** + /// ```js + /// const imageData1 = wx.createImageData(100, 100) + /// const imageData2 = wx.createImageData(imageData1) + /// ``` /// /// - public static ImageData CreateImageData() + public static ImageData CreateImageData(double width, double height) { - return WXSDKManagerHandler.Instance.CreateImageData(); + return WXSDKManagerHandler.Instance.CreateImageData(width, height); } /// @@ -3840,6 +3852,30 @@ namespace WeChatWASM /// /// [boolean wx.setMessageToFriendQuery(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.setMessageToFriendQuery.html) /// 设置 wx.shareMessageToFriend 接口 query 字段的值 + /// **提示 + /// 1. 此处的 query 参数与 wx.onShow 取到的启动查询参数 query 不是同一个概念,仅仅是启动查询参数会增加一个字段为 query。 + /// 2. query 参数如涉及 "?"和"&" 等特殊符号,需自行进行 encodeURIComponent 和 decodeURIComponent 等操作。 + /// 示例代码 + /// ```js + /// // 发送方 + /// wx.setMessageToFriendQuery({ + /// shareMessageToFriendScene: 1, + /// query: 'testquery' + /// }) + /// // 预期接收方可以通过以下方式拿到设置 + /// wx.getEnterOptionsSync().query.shareMessageToFriendScene // 1 + /// wx.getEnterOptionsSync().query.query // 'testquery' + /// 示例代码-特殊字符query** + /// ```js + /// // 发送方 + /// wx.setMessageToFriendQuery({ + /// query: encodeURIComponent('foo=1&bar=2') // 如果 query 涉及特殊符号,需要自行 encodeURIComponent + /// }) + /// // 接收方 + /// // 预期可以通过以下方式拿到设置 + /// wx.getEnterOptionsSync().query.query // 此处拿到的是 'foo%3D1%26bar%3D2',需要 decodeURIComponent + /// decodeURIComponent(wx.getEnterOptionsSync().query.query) // 'foo=1&bar=2' + /// ``` /// </summary> /// <returns></returns> public static bool SetMessageToFriendQuery(SetMessageToFriendQueryOption option) diff --git a/Runtime/WXBase.cs b/Runtime/WXBase.cs index 589bc7ee1..d82b1092c 100644 --- a/Runtime/WXBase.cs +++ b/Runtime/WXBase.cs @@ -37,7 +37,7 @@ namespace WeChatWASM /// <summary> /// Gets 云函数 /// </summary> - public static Cloud cloud + public static WXCloud cloud { get { @@ -264,31 +264,31 @@ namespace WeChatWASM /// <param name="param">param各字段说明详见这里,https://developers.weixin.qq.com/minigame/dev/api/ad/wx.createBannerAd.html </param> /// <returns>对banner广告做操作的对象,详见 https://developers.weixin.qq.com/minigame/dev/api/ad/BannerAd.html </returns> /// <example> - /// // 底部banner广告示例 - /// var sysInfo = WX.GetSystemInfoSync(); - /// var banner = WX.CreateBannerAd(new WXCreateBannerAdParam() + /// // 底部banner广告示例 + /// var windowInfo = WX.GetWindowInfo(); + /// var banner = WX.CreateBannerAd(new WXCreateBannerAdParam() + /// { + /// adUnitId = "adunit-2e20328227ca771b", + /// adIntervals = 30, + /// style = new Style() /// { - /// adUnitId = "adunit-2e20328227ca771b", - /// adIntervals = 30, - /// style = new Style() - /// { - /// left = 0, - /// top = sysInfo.windowHeight - 100, - /// width = sysInfo.windowWidth, - /// height = 100 - /// } - /// }); - /// banner.OnError((WXADErrorResponse res)=> - /// { - /// Debug.Log("bannerad error response"); - /// }); - /// banner.OnLoad(()=> { - /// banner.Show(); - /// }); + /// left = 0, + /// top = windowInfo.windowHeight - 100, + /// width = windowInfo.windowWidth, + /// height = 100 + /// } + /// }); + /// banner.OnError((WXADErrorResponse res)=> + /// { + /// Debug.Log("bannerad error response"); + /// }); + /// banner.OnLoad(()=> { + /// banner.Show(); + /// }); /// banner.OnResize((WXADResizeResponse res) => /// { - /// //拉取的广告可能跟设置的不一样,需要动态调整位置 - /// banner.style.top = sysInfo.windowHeight - res.height; + /// // 拉取的广告可能跟设置的不一样,需要动态调整位置 + /// banner.style.top = windowInfo.windowHeight - res.height; /// }); /// </example> public static WXBannerAd CreateBannerAd(WXCreateBannerAdParam param) @@ -1088,6 +1088,16 @@ namespace WeChatWASM { WXSDKManagerHandler.Instance.SetDevicePixelRatio(ratio); } + + public static void CallJSFunction(string sdkName, string functionName, params object[] args) + { + WXSDKManagerHandler.CallJSFunction(sdkName, functionName, args); + } + + public static string CallJSFunctionWithReturn(string sdkName, string functionName, params object[] args) + { + return WXSDKManagerHandler.CallJSFunctionWithReturn(sdkName, functionName, args); + } } } #endif diff --git a/Runtime/WXRuntimeExtDef.cs b/Runtime/WXRuntimeExtDef.cs new file mode 100644 index 000000000..069c718b6 --- /dev/null +++ b/Runtime/WXRuntimeExtDef.cs @@ -0,0 +1,133 @@ +using System.Collections; +using System.Collections.Generic; +using System.IO; +using UnityEngine; + +namespace WeChatWASM +{ + public class WXRuntimeExtDef + { + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] + static void OnWXRuntimeExtDefLoadRuntimeMethod() + { + Init(); + } + + private static void Init() + { + +#if UNITY_2018_1_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", false); +#endif + +#if UNITY_2020_1_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", false); +#endif + +#if UNITY_2021_1_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", false); +#endif +#if UNITY_2021_2_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", false); +#endif +#if UNITY_2021_3_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", false); +#endif +#if UNITY_EDITOR_OSX + WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", false); +#endif +#if UNITY_EDITOR_LINUX + WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", false); +#endif +#if UNITY_2020 + WXRuntimeExtEnvDef.SETDEF("UNITY_2020", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2020", false); +#endif +#if UNITY_2021 + WXRuntimeExtEnvDef.SETDEF("UNITY_2021", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2021", false); +#endif +#if UNITY_2022 + WXRuntimeExtEnvDef.SETDEF("UNITY_2022", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2022", false); +#endif +#if UNITY_2022_2_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", false); +#endif +#if UNITY_INSTANTGAME + WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", true); +#else + WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", false); +#endif +#if WEIXINMINIGAME + WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", true); +#else + WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", false); +#endif +#if TUANJIE_2022_3_OR_NEWER + WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", true); +#else + WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", false); +#endif + +#if PLATFORM_WEIXINMINIGAME + WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", true); +#else + WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", false); +#endif + +#if PLATFORM_WEBGL + WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", true); +#else + WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", false); +#endif + RegisterController(); + } + + private static void RegisterController() + { + // Example: + /* + WXRuntimeExtDef.RegisterAction("xxx", (args) => + { + #if UNITY_2018 + return 1; + #else + return 0; + #endif + }); + */ + WXRuntimeExtEnvDef.RegisterAction("Unity.GetObjectInstanceID", (args) => + { + #if UNITY_2021_3_OR_NEWER + if (args is UnityEngine.Object unityObject) + { + return unityObject.GetInstanceID(); + } + #endif + // unityObject.GetInstanceID() would never return 0. + return 0; + }); + } + } + +} \ No newline at end of file diff --git a/Runtime/WXRuntimeExtDef.cs.meta b/Runtime/WXRuntimeExtDef.cs.meta new file mode 100644 index 000000000..e8a92958c --- /dev/null +++ b/Runtime/WXRuntimeExtDef.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1bfa8a2ba04dd8c133e09ac1dcaa6539 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/WXSDKPerf.meta b/Runtime/WXSDKPerf.meta new file mode 100644 index 000000000..d62382e12 --- /dev/null +++ b/Runtime/WXSDKPerf.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aef8914ede3654c3fbed916372d75964 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/WXSDKPerf/WXPerfEngine.cs b/Runtime/WXSDKPerf/WXPerfEngine.cs new file mode 100644 index 000000000..1327a8132 --- /dev/null +++ b/Runtime/WXSDKPerf/WXPerfEngine.cs @@ -0,0 +1,49 @@ +#if ENABLE_WX_PERF_FEATURE + +using System; +using System.Diagnostics; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Xml; +using UnityEngine; +using UnityEngine.Scripting; +using WXPerf; + +namespace WXSDKPerf +{ + [Preserve] + [ComVisible(false)] + public class WXPerfEngine + { + static WXPerfEngine_Implementation m_PerfEngineImplementation = null; + + [RuntimeInitializeOnLoadMethod] + public static void StartWXPerfEngine() + { +#if UNITY_EDITOR + return; +#endif + + m_PerfEngineImplementation = new WXPerfEngine_Implementation(); + + m_PerfEngineImplementation.StartPerfEngine(); + } + + + public static void Annotation(string InAnnotationString) + { +#if UNITY_EDITOR + return; +#endif + if (m_PerfEngineImplementation == null) + { + UnityEngine.Debug.LogError("Annotation: Invalid m_PerfEngineImplementation! "); + return; + } + + m_PerfEngineImplementation.Annotation(InAnnotationString); + } + } + +} +#endif // ENABLE_WX_PERF_FEATURE \ No newline at end of file diff --git a/Runtime/WXSDKPerf/WXPerfEngine.cs.meta b/Runtime/WXSDKPerf/WXPerfEngine.cs.meta new file mode 100644 index 000000000..ecf9068ca --- /dev/null +++ b/Runtime/WXSDKPerf/WXPerfEngine.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8cf919bdb0222454ca11dee03ff47d57 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/WXTouchInputOverride.cs b/Runtime/WXTouchInputOverride.cs index e081f196f..ca48d174c 100644 --- a/Runtime/WXTouchInputOverride.cs +++ b/Runtime/WXTouchInputOverride.cs @@ -37,7 +37,11 @@ public class WXTouchInputOverride : BaseInput protected override void OnEnable() { base.OnEnable(); - if (string.IsNullOrEmpty(WeChatWASM.WX.GetSystemInfoSync().platform)) return; +#if UNITY_WEBGL && !UNITY_EDITOR + if (string.IsNullOrEmpty(WeChatWASM.WX.GetDeviceInfo().platform)) return; +#else + return; +#endif InitWechatTouchEvents(); if (_standaloneInputModule) { diff --git a/Runtime/wechat-default/check-version.js b/Runtime/wechat-default/check-version.js index 73f554b66..e9e0a97b3 100644 --- a/Runtime/wechat-default/check-version.js +++ b/Runtime/wechat-default/check-version.js @@ -1,6 +1,7 @@ /* eslint-disable no-multi-assign */ /* eslint-disable @typescript-eslint/naming-convention */ -const { version, SDKVersion, platform, system } = wx.getSystemInfoSync(); +const { version, SDKVersion } = wx.getAppBaseInfo(); +const { platform, system } = wx.getDeviceInfo(); const accountInfo = wx.getAccountInfoSync(); const envVersion = accountInfo?.miniProgram?.envVersion; function compareVersion(v1, v2) { @@ -61,6 +62,8 @@ const isPcBrotliInvalid = isPc && !compareVersion(SDKVersion, $LOAD_DATA_FROM_SU const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1'); // @ts-ignore const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid); +// iOS系统版本>=17.5时,小游戏退后台会导致异常 +export const isIOS175 = compareVersion(systemVersion, '17.5') || isH5Renderer; // 是否能以iOS高性能模式运行 // 请勿修改GameGlobal.canUseH5Renderer赋值!!! GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid; diff --git a/Runtime/wechat-default/check-version.js.meta b/Runtime/wechat-default/check-version.js.meta index f9c0db893..2ba2786ac 100644 --- a/Runtime/wechat-default/check-version.js.meta +++ b/Runtime/wechat-default/check-version.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 72d6dce4f8fc2897d45ce801d61a4dc2 +guid: 44a7e1e416ef5132a57ccfa3939eca38 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/data-package/game.js.meta b/Runtime/wechat-default/data-package/game.js.meta index a3ec106fc..9c26ad31c 100644 --- a/Runtime/wechat-default/data-package/game.js.meta +++ b/Runtime/wechat-default/data-package/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a2d4f5bdedb1bc3b95c91a779ba77ec6 +guid: a8c126ddc61c8cc6ed296c38f7f1e957 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/events.js.meta b/Runtime/wechat-default/events.js.meta index 1c0ff687f..5be2c1cc1 100644 --- a/Runtime/wechat-default/events.js.meta +++ b/Runtime/wechat-default/events.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59cfd066f14f854efa857ecb2fadcf4f +guid: 98eb2eb98064d124aae821b0310bacf2 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.js b/Runtime/wechat-default/game.js index 74a5bd10c..2d09dae72 100644 --- a/Runtime/wechat-default/game.js +++ b/Runtime/wechat-default/game.js @@ -27,8 +27,9 @@ const managerConfig = { '$PRELOAD_LIST', ], contextConfig: { - contextType: $WEBGL_VERSION, // 1=>webgl1 2=>webgl2 3=>auto + contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2 }, + PROFILER_UPLOAD_URL: '', }; GameGlobal.managerConfig = managerConfig; // 版本检查 diff --git a/Runtime/wechat-default/game.js.meta b/Runtime/wechat-default/game.js.meta index d9a29457f..8c18f2417 100644 --- a/Runtime/wechat-default/game.js.meta +++ b/Runtime/wechat-default/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ec0c02137f9d2e4044b68f37374cd7d +guid: d7844e1d7d7626fe49436142ee66a9e6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.json b/Runtime/wechat-default/game.json index 4ae3eaeb3..47b3f18d8 100644 --- a/Runtime/wechat-default/game.json +++ b/Runtime/wechat-default/game.json @@ -23,7 +23,7 @@ ], "plugins": { "UnityPlugin": { - "version": "1.2.57", + "version": "1.2.60", "provider": "wxe5a48f1ed5f544b7", "contexts": [ { diff --git a/Runtime/wechat-default/game.json.meta b/Runtime/wechat-default/game.json.meta index 2b13e9304..ddc4e86ba 100644 --- a/Runtime/wechat-default/game.json.meta +++ b/Runtime/wechat-default/game.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4a9ed3cdd5ee4249a9a0e9d362af10f1 +guid: 277f37fd525363bcd0ac1e76c7190146 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/background.jpg.meta b/Runtime/wechat-default/images/background.jpg.meta index 69f093a8f..cbc7d33e8 100644 --- a/Runtime/wechat-default/images/background.jpg.meta +++ b/Runtime/wechat-default/images/background.jpg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e1e18f34ba2da9dc774aaa9f71b6c65d +guid: 6f7065a76a20ec762f47e6af22bd76d9 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/unity_logo.png.meta b/Runtime/wechat-default/images/unity_logo.png.meta index c3423893a..90be6ff12 100644 --- a/Runtime/wechat-default/images/unity_logo.png.meta +++ b/Runtime/wechat-default/images/unity_logo.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 018bde0dd2339559e0356d0d2b9de69e +guid: 1c01ed2e5319c00de34c7913548e1b60 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/data/index.js.meta b/Runtime/wechat-default/open-data/data/index.js.meta index 508f0b3b1..6b8c6122c 100644 --- a/Runtime/wechat-default/open-data/data/index.js.meta +++ b/Runtime/wechat-default/open-data/data/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a68c82a0213815cacd975d33bf6afd9b +guid: 3d4add50de1d58ec65ecc3bec54d3de1 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/data/utils.js.meta b/Runtime/wechat-default/open-data/data/utils.js.meta index 0a7a9ce15..8613ace77 100644 --- a/Runtime/wechat-default/open-data/data/utils.js.meta +++ b/Runtime/wechat-default/open-data/data/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0fa0f0271021426b2080ded743c8b0bf +guid: 471715336cf16bf9aa11245d6cb64343 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/index.js.meta b/Runtime/wechat-default/open-data/index.js.meta index c3348fabe..1e4d8e5a3 100644 --- a/Runtime/wechat-default/open-data/index.js.meta +++ b/Runtime/wechat-default/open-data/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d11e31e7caca540fdc766f871122c80 +guid: dc92d9012b6b5518e4ee161dd9ee324f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/loading.js.meta b/Runtime/wechat-default/open-data/loading.js.meta index 6a76bb3a7..b685d2542 100644 --- a/Runtime/wechat-default/open-data/loading.js.meta +++ b/Runtime/wechat-default/open-data/loading.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7cb5c1387d3b2acb3ce5356ce57380e6 +guid: e408a2e1dafb6b88fe6fea613212ccdc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/avatar.png.meta b/Runtime/wechat-default/open-data/render/image/avatar.png.meta index 4d5f35d30..df58c1fca 100644 --- a/Runtime/wechat-default/open-data/render/image/avatar.png.meta +++ b/Runtime/wechat-default/open-data/render/image/avatar.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 02a12edbd7b0f6ee4ba77232630ca383 +guid: fca653978f3fe1e0541ebe4d81db4271 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button1.png.meta b/Runtime/wechat-default/open-data/render/image/button1.png.meta index a73c028ee..3057fb3fa 100644 --- a/Runtime/wechat-default/open-data/render/image/button1.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button1.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59779c16150d1f382b45ba4866e7dd1c +guid: ac9029b2e489f669e74be2600ee58343 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button2.png.meta b/Runtime/wechat-default/open-data/render/image/button2.png.meta index 0aa927d74..e9164f6dc 100644 --- a/Runtime/wechat-default/open-data/render/image/button2.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button2.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2532269bcf252fcee88ecba03de5d72d +guid: f0bd9aa7e524c03c5dd7d51bc605a57a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button3.png.meta b/Runtime/wechat-default/open-data/render/image/button3.png.meta index ed6e5bc9d..e8f9c54de 100644 --- a/Runtime/wechat-default/open-data/render/image/button3.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button3.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: edf0798181946fe765cffbfa275107b8 +guid: bcc0d1cce30fa211c0684b1cab7aa4ab DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/loading.png.meta b/Runtime/wechat-default/open-data/render/image/loading.png.meta index 681d0b97e..78c7bf080 100644 --- a/Runtime/wechat-default/open-data/render/image/loading.png.meta +++ b/Runtime/wechat-default/open-data/render/image/loading.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4f35c0f99890aa7167a8b793ef796f7b +guid: 423a761412c9bb3c2fa7e3b745917f8c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/nameBg.png.meta b/Runtime/wechat-default/open-data/render/image/nameBg.png.meta index 499b4cb39..bb89c2dae 100644 --- a/Runtime/wechat-default/open-data/render/image/nameBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/nameBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e7f5cdaff48140433dfab80dcc60ff50 +guid: e9f20942a9f85ab47412b9fce3937954 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta b/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta index edd79e8e8..71f723e2f 100644 --- a/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta +++ b/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e20c703a4afeffbc151a8529e610628f +guid: 0b69c585d2010389e4455b910717079f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/rankBg.png.meta b/Runtime/wechat-default/open-data/render/image/rankBg.png.meta index 530a071e1..2c98b6db6 100644 --- a/Runtime/wechat-default/open-data/render/image/rankBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/rankBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f2d4bf3f9e7cca52022c9916a0bc805a +guid: 21a2b3bbc3c4c4394354fe38eaebe2f1 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/shareBg.png.meta b/Runtime/wechat-default/open-data/render/image/shareBg.png.meta index d89fa70a1..1b8c75bfc 100644 --- a/Runtime/wechat-default/open-data/render/image/shareBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/shareBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9fb683a8d8682a682df92d7d4b57bccd +guid: 4d933c70f2eadac74f8f05b07b3265f5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta b/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta index 6ef84a566..194007edd 100644 --- a/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta +++ b/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d13bcdff7663b0186343ad1cd5f01351 +guid: a044c9fb8bcc674808b1922fc08d517a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta b/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta index 84a596d0b..94a477f66 100644 --- a/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta +++ b/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: aa6c5025c4f439deebc67f3c201ce3fe +guid: e05acefc59d97fe85f2d4c5db3ad919e DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/styles/tips.js.meta b/Runtime/wechat-default/open-data/render/styles/tips.js.meta index c4988707f..74da28f8b 100644 --- a/Runtime/wechat-default/open-data/render/styles/tips.js.meta +++ b/Runtime/wechat-default/open-data/render/styles/tips.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 473696906e6decf639a7b151b55b06d0 +guid: d49e7b1725866a315e43d17ef34ffe02 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta b/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta index 0a69266ac..7b81e76ad 100644 --- a/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta +++ b/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a7633767ecff0c165078c8a39a65f57d +guid: 9fa840e35fcb24b74a5d7ba50fb15c61 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/tpls/tips.js.meta b/Runtime/wechat-default/open-data/render/tpls/tips.js.meta index 8474fc67a..9c1875645 100644 --- a/Runtime/wechat-default/open-data/render/tpls/tips.js.meta +++ b/Runtime/wechat-default/open-data/render/tpls/tips.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3e974b94f0607e60e2ed654660c28197 +guid: dbc5a57b21ae6ff0474262aa85d04a9f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugin-config.js.meta b/Runtime/wechat-default/plugin-config.js.meta index ec1e871be..66e06cc42 100644 --- a/Runtime/wechat-default/plugin-config.js.meta +++ b/Runtime/wechat-default/plugin-config.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7fd5bda63363df9354b79c947a54c9dc +guid: 582c265cbb4802baaeb8b4951551027d DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/check-update.js.meta b/Runtime/wechat-default/plugins/check-update.js.meta index bd716efd8..cc8d1e301 100644 --- a/Runtime/wechat-default/plugins/check-update.js.meta +++ b/Runtime/wechat-default/plugins/check-update.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b2f277527f24b913e7191f7a03bfda7d +guid: 5b3878e7fa96b761a24d659858f80a57 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/screen-adapter.js.meta b/Runtime/wechat-default/plugins/screen-adapter.js.meta index a4ddfb0cc..44a5c80fd 100644 --- a/Runtime/wechat-default/plugins/screen-adapter.js.meta +++ b/Runtime/wechat-default/plugins/screen-adapter.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6ec5bc93a18bd82ab155bb0f188c2330 +guid: ad740f946e41fcc1eb2a431f058be6d7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/project.config.json.meta b/Runtime/wechat-default/project.config.json.meta index ce493cda6..1243eabe1 100644 --- a/Runtime/wechat-default/project.config.json.meta +++ b/Runtime/wechat-default/project.config.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 62e052f5b55673e931795d2d026560aa +guid: 70169de3f7f88310e8a581b1d4ee7cd5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/texture-config.js.meta b/Runtime/wechat-default/texture-config.js.meta index a5278daab..c40a03811 100644 --- a/Runtime/wechat-default/texture-config.js.meta +++ b/Runtime/wechat-default/texture-config.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 455e8dee47c748b7f399c53bac8a19f5 +guid: d92d43031458152693c68d32566ca073 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-namespace.js b/Runtime/wechat-default/unity-namespace.js index 34f32e00c..e3b1002b5 100644 --- a/Runtime/wechat-default/unity-namespace.js +++ b/Runtime/wechat-default/unity-namespace.js @@ -53,6 +53,12 @@ const unityNamespace = { useBrotliMT: $USE_BROTLI_MT, // Boot config配置,包含例如wait-for-native-debugger、player-connection-ip等信息 bootConfig: '$BOOT_CONFIG_INFO', + // 是否以Development Build构建 + isDevelopmentBuild: $Is_Development_Build, + // 是否以Profiling Build导出 + isProfilingBuild: $Is_Profiling_Build, + // 预留的堆内存 + unityHeapReservedMemory: $UnityHeapReservedMemory, }; // 最佳实践检测配置 unityNamespace.monitorConfig = { @@ -131,62 +137,50 @@ function bindGloblException() { console.error('unhandledRejection:', result.reason); }); // 上报初始信息 - function printSystemInfo(systemInfo) { - GameGlobal.systemInfoCached = systemInfo; - const { version, SDKVersion, platform, renderer, system } = systemInfo; + function printSystemInfo(appBaseInfo, deviceInfo) { + const { version, SDKVersion } = appBaseInfo; + const { platform, system } = deviceInfo; unityNamespace.version = version; unityNamespace.SDKVersion = SDKVersion; unityNamespace.platform = platform; - unityNamespace.renderer = renderer; unityNamespace.system = system; unityNamespace.isPc = platform === 'windows' || platform === 'mac'; unityNamespace.isDevtools = platform === 'devtools'; unityNamespace.isMobile = !unityNamespace.isPc && !unityNamespace.isDevtools; - unityNamespace.isH5Renderer = unityNamespace.isMobile && unityNamespace.renderer === 'h5'; + unityNamespace.isH5Renderer = GameGlobal.isIOSHighPerformanceMode; unityNamespace.isIOS = platform === 'ios'; unityNamespace.isAndroid = platform === 'android'; const bootinfo = { - renderer: systemInfo.renderer || '', + renderer: GameGlobal.isIOSHighPerformanceMode ? 'h5' : '', isH5Plus: GameGlobal.isIOSHighPerformanceModePlus || false, - abi: systemInfo.abi || '', - brand: systemInfo.brand, - model: systemInfo.model, - platform: systemInfo.platform, - system: systemInfo.system, - version: systemInfo.version, - SDKVersion: systemInfo.SDKVersion, - benchmarkLevel: systemInfo.benchmarkLevel, + abi: deviceInfo.abi || '', + brand: deviceInfo.brand, + model: deviceInfo.model, + platform: deviceInfo.platform, + system: deviceInfo.system, + version: appBaseInfo.version, + SDKVersion: appBaseInfo.SDKVersion, + benchmarkLevel: deviceInfo.benchmarkLevel, }; GameGlobal.realtimeLogManager.info('game starting', bootinfo); GameGlobal.logmanager.info('game starting', bootinfo); console.info('game starting', bootinfo); } - const systemInfoSync = wx.getSystemInfoSync(); - const isEmptySystemInfo = systemInfoSync && Object.keys(systemInfoSync).length === 0; - // iOS会出现getSystemInfoSync返回空对象的情况,使用异步方法替代 - if (isEmptySystemInfo) { - wx.getSystemInfo({ - success(systemInfo) { - printSystemInfo(systemInfo); - }, - }); - } - else { - printSystemInfo(systemInfoSync); - } + const appBaseInfo = wx.getAppBaseInfo(); + const deviceInfo = wx.getDeviceInfo(); + printSystemInfo(appBaseInfo, deviceInfo); } bindGloblException(); // eslint-disable-next-line no-multi-assign GameGlobal.onCrash = GameGlobal.unityNamespace.onCrash = function () { GameGlobal.manager.showAbort(); - // 避免已经修改屏幕尺寸,故不使用缓存的systeminfo - const sysInfo = wx.getSystemInfoSync(); + const windowInfo = wx.getWindowInfo(); wx.createFeedbackButton({ type: 'text', text: '提交反馈', style: { - left: (sysInfo.screenWidth - 184) / 2, - top: sysInfo.screenHeight / 3 + 140, + left: (windowInfo.screenWidth - 184) / 2, + top: windowInfo.screenHeight / 3 + 140, width: 184, height: 40, lineHeight: 40, diff --git a/Runtime/wechat-default/unity-namespace.js.meta b/Runtime/wechat-default/unity-namespace.js.meta index c80972601..84c2a2f77 100644 --- a/Runtime/wechat-default/unity-namespace.js.meta +++ b/Runtime/wechat-default/unity-namespace.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 16e3f2377b457ce84bab2c0dc79372ad +guid: 11aed45104c833a22c3f244a3d1e3591 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js index 47c41f473..9c3208e07 100644 --- a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js +++ b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertInfoToPointer, formatResponse, convertDataToPointer } from '../utils'; const TCPSocketList = {}; const wxTCPSocketBindWifiList = {}; diff --git a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta index 3c6a502df..d373ceb00 100644 --- a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7915839ff66cc08534f380f28d421a23 +guid: 8be8a5e031b65ccdd4964fac6fadd791 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js index a0955f1a9..da3a3a97a 100644 --- a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js +++ b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertDataToPointer, convertInfoToPointer, formatResponse } from '../utils'; const UDPSocketList = {}; const wxUDPSocketCloseList = {}; @@ -150,12 +151,33 @@ function WX_UDPSocketSetTTL(id, ttl) { } obj.setTTL(ttl); } -function WX_UDPSocketWrite(id) { +function WX_UDPSocketWriteString(id, data, param) { const obj = getUDPSocketObject(id); if (!obj) { return; } - obj.write(); + const config = formatJsonStr(param); + obj.write({ + address: config.address, + message: data, + port: config.port, + setBroadcast: config.setBroadcast, + }); +} +function WX_UDPSocketWriteBuffer(id, dataPtr, dataLength, param) { + const obj = getUDPSocketObject(id); + if (!obj) { + return; + } + const config = formatJsonStr(param); + obj.write({ + address: config.address, + message: GameGlobal.Module.HEAPU8.buffer.slice(dataPtr, dataPtr + dataLength), + port: config.port, + length: config.length, + offset: config.offset, + setBroadcast: config.setBroadcast, + }); } function WX_UDPSocketBind(id, param) { const obj = getUDPSocketObject(id); @@ -184,6 +206,7 @@ export default { WX_UDPSocketSendString, WX_UDPSocketSendBuffer, WX_UDPSocketSetTTL, - WX_UDPSocketWrite, + WX_UDPSocketWriteString, + WX_UDPSocketWriteBuffer, WX_RegisterUDPSocketOnMessageCallback, }; diff --git a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta index d45f4e567..36579b4a1 100644 --- a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ad0c2af65d2aaa61039b1a91f60c965e +guid: 37c799c396873071f6eb977f96c2abd5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/ad.js b/Runtime/wechat-default/unity-sdk/ad.js index 280878f85..36ad7ce41 100644 --- a/Runtime/wechat-default/unity-sdk/ad.js +++ b/Runtime/wechat-default/unity-sdk/ad.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from './module-helper'; import response from './response'; import { formatJsonStr, uid } from './utils'; @@ -34,7 +35,7 @@ export default { return key; }, WXCreateFixedBottomMiddleBannerAd(adUnitId, adIntervals, height) { - const info = wx.getSystemInfoSync(); + const info = wx.getWindowInfo(); const ad = wx.createBannerAd({ adUnitId, adIntervals, diff --git a/Runtime/wechat-default/unity-sdk/ad.js.meta b/Runtime/wechat-default/unity-sdk/ad.js.meta index 44ac04843..260e8d90f 100644 --- a/Runtime/wechat-default/unity-sdk/ad.js.meta +++ b/Runtime/wechat-default/unity-sdk/ad.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4ca24a076f21f26128fcda26c99ff736 +guid: 37e21b438d686abe321627746a8a0ea4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/common.js.meta b/Runtime/wechat-default/unity-sdk/audio/common.js.meta index 578c5ebc5..a0aacb84d 100644 --- a/Runtime/wechat-default/unity-sdk/audio/common.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/common.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b9a20da3800ed88e020b6a62126c4702 +guid: 8f1ec5dc506b985667e29b95461c737d DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/const.js.meta b/Runtime/wechat-default/unity-sdk/audio/const.js.meta index 533ac42a1..293a3f8cd 100644 --- a/Runtime/wechat-default/unity-sdk/audio/const.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/const.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ac82fe9291b4bfbf76796bc4d7098c9e +guid: 288b902e490b8deeb4f5a9fbacdbdd94 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/index.js.meta b/Runtime/wechat-default/unity-sdk/audio/index.js.meta index 24a0a4313..7ce544a67 100644 --- a/Runtime/wechat-default/unity-sdk/audio/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0020cf35611516ccea666c36102ebf84 +guid: 97555a13c2ad9d2a5028a2045a4a1a49 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js index f7cd2c8c4..8c5471219 100644 --- a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js +++ b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from '../module-helper'; import { isSupportPlayBackRate } from '../../check-version'; import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store'; @@ -320,8 +321,8 @@ export default { if (key === 'onCanplay') { audios[id][key](() => { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration, buffered, referrerPolicy, volume } = audios[id]; setTimeout(() => { moduleHelper.send('OnAudioCallback', JSON.stringify({ diff --git a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta index 7fb1ed534..b5d93cec1 100644 --- a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6ac05f55130b3aa93cd6ef326374a2e8 +guid: 8e7ab8fe88edbd8067c59fe238e64a70 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/store.js.meta b/Runtime/wechat-default/unity-sdk/audio/store.js.meta index b269b1cdc..78c23f3e9 100644 --- a/Runtime/wechat-default/unity-sdk/audio/store.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/store.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 52cfb592dc9faceedd5a4aaa660d1f3e +guid: 328cd64e28047419abd725446a57bd03 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js index 4afc7c74e..74f032604 100644 --- a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js +++ b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js @@ -1,4 +1,7 @@ -import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayBackRate, isSupportInnerAudio, } from '../../check-version'; +/* eslint-disable no-param-reassign */ +/* eslint-disable eqeqeq */ +/* eslint-disable no-plusplus */ +import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayBackRate, isSupportInnerAudio, isIOS175, } from '../../check-version'; import { WEBAudio, unityAudioVolume } from './store'; import { TEMP_DIR_PATH } from './const'; import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils'; @@ -14,6 +17,7 @@ function jsAudioCreateUncompressedSoundClip(buffer, error, length) { this.buffer = null; WEBAudio.audioBufferLength -= length; }, + resetGain() { }, getLength() { if (!this.buffer) { @@ -77,10 +81,11 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) { } delete this.url; }, + resetGain() { }, getLength() { return this.length || 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars getData(ptr, length) { console.warn('getData() is not supported for compressed sound.'); return 0; @@ -161,13 +166,18 @@ export class AudioChannelInstance { constructor(callback, userData) { if (WEBAudio.audioContext) { this.gain = WEBAudio.audioContext.createGain(); - if (this.gain) { - this.gain.connect(WEBAudio.audioContext.destination); - } + this.gain?.connect(WEBAudio.audioContext.destination); } this.callback = callback; this.userData = userData; } + resetGain() { + if (WEBAudio.audioContext && this.gain) { + this.gain.disconnect(); + this.gain = WEBAudio.audioContext.createGain(); + this.gain?.connect(WEBAudio.audioContext.destination); + } + } release() { this.disconnectSource(); if (this.gain) { @@ -276,8 +286,8 @@ export class AudioChannelInstance { }); const fn = () => { if (typeof this.source !== 'undefined' && this.source.mediaElement) { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration } = this.source.mediaElement; setTimeout(() => { if (soundClip && this.source && this.source.mediaElement) { @@ -538,7 +548,7 @@ export class AudioChannelInstance { } }, 100); }; - const innerPlay = () => { + const innerPlay = (callback) => { if (this.source && this.source.mediaElement) { if (isSupportBufferURL && this.source.readyToPlay) { if (this.source.stopCache) { @@ -551,6 +561,7 @@ export class AudioChannelInstance { innerFixPlay(); } this.source.mediaElement.play(); + callback?.(); } } else { @@ -561,8 +572,8 @@ export class AudioChannelInstance { this.source.needCanPlay = false; this.source.readyToPlay = true; if (typeof this.source.mediaElement !== 'undefined') { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration } = this.source.mediaElement; @@ -582,6 +593,7 @@ export class AudioChannelInstance { } if (typeof this.source.mediaElement !== 'undefined') { this.source.mediaElement.play(); + callback?.(); } } }; @@ -594,7 +606,7 @@ export class AudioChannelInstance { } } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _reset = () => { if (!this.source) { return; @@ -609,7 +621,7 @@ export class AudioChannelInstance { this.source.stopTicker = undefined; } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _pauseMediaElement = () => { if (typeof this.source === 'undefined') { return; @@ -621,28 +633,22 @@ export class AudioChannelInstance { this.source.mediaElement.pause(); } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _startPlayback = (offset) => { if (typeof this.source === 'undefined' || !this.source.mediaElement) { return; } if (this.source.playTimeout) { - if (typeof this.source.mediaElement.seek === 'function') { - this.source.mediaElement.seek(offset); - } - else { - this.source.mediaElement.currentTime = offset; - } + this.source.mediaElement.seek(offset); this.source.pauseRequested = false; return; } - innerPlay(); - if (typeof this.source.mediaElement.seek === 'function') { - this.source.mediaElement.seek(offset); - } - else { - this.source.mediaElement.currentTime = offset; - } + innerPlay(() => { + + if (this.source && this.source.mediaElement) { + this.source.mediaElement.seek(offset); + } + }); }; const start = (startTime, offset) => { if (typeof this.source === 'undefined') { @@ -710,22 +716,22 @@ export class AudioChannelInstance { start, stop, }; - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { buffered, referrerPolicy, volume } = getAudio; const { source } = this; Object.defineProperty(this.source, 'loopStart', { get() { return 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars set(v) { }, }); Object.defineProperty(source, 'loopEnd', { get() { return 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars set(v) { }, }); Object.defineProperty(source, 'loop', { @@ -845,7 +851,7 @@ export default { if (!soundClip) { return defaultSoundLength; } - const length = soundClip.getLength() || defaultSoundLength; + const length = soundClip.getLength(); return length; }, _JS_Sound_GetLoadState(bufferInstance) { @@ -882,13 +888,18 @@ export default { clearTimeout(webAutoResumeTicker); webAutoResumeTicker = null; } - - if (!GameGlobal.isIOSHighPerformanceMode) { - WEBAudio.audioContext?.suspend(); - } + WEBAudio.audioContext?.suspend(); }); wx.onShow(() => { - WEBAudio.audioContext?.resume(); + + if (isIOS175) { + WEBAudio.audioContext?.close(); + WEBAudio.audioContext = wx.createWebAudioContext(); + Object.values(WEBAudio.audioInstances).forEach(it => it.resetGain()); + } + else { + WEBAudio.audioContext?.resume(); + } }); if (webAudioNeedResume) { @@ -1033,12 +1044,12 @@ export default { WEBAudio.lOrientation.yUp = yUp; WEBAudio.lOrientation.zUp = zUp; if (WEBAudio.audioContext.listener.forwardX) { - WEBAudio.audioContext.listener.forwardX.setValueAtTime(-x, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.forwardY.setValueAtTime(-y, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.forwardZ.setValueAtTime(-z, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.upX.setValueAtTime(xUp, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.upY.setValueAtTime(yUp, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.upZ.setValueAtTime(zUp, WEBAudio.audioContext.currentTime); + WEBAudio.audioContext.listener.forwardX = -x; + WEBAudio.audioContext.listener.forwardY = -y; + WEBAudio.audioContext.listener.forwardZ = -z; + WEBAudio.audioContext.listener.upX = xUp; + WEBAudio.audioContext.listener.upY = yUp; + WEBAudio.audioContext.listener.upZ = zUp; } else { WEBAudio.audioContext.listener.setOrientation(-x, -y, -z, xUp, yUp, zUp); @@ -1061,9 +1072,9 @@ export default { WEBAudio.lPosition.y = y; WEBAudio.lPosition.z = z; if (WEBAudio.audioContext.listener.positionX) { - WEBAudio.audioContext.listener.positionX.setValueAtTime(x, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.positionY.setValueAtTime(y, WEBAudio.audioContext.currentTime); - WEBAudio.audioContext.listener.positionZ.setValueAtTime(z, WEBAudio.audioContext.currentTime); + WEBAudio.audioContext.listener.positionX = x; + WEBAudio.audioContext.listener.positionY = y; + WEBAudio.audioContext.listener.positionZ = z; } else { WEBAudio.audioContext.listener.setPosition(x, y, z); @@ -1120,7 +1131,7 @@ export default { printErrMsg(`Invalid audio pitch ${v} specified to WebAudio backend!`); } }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars _JS_Sound_SetPosition(channelInstance, x, y, z) { if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) { return; @@ -1186,7 +1197,7 @@ export default { if (!audioInstance) { return WEBAudio.FAKEMOD_SAMPLERATE; } - + // eslint-disable-next-line no-nested-ternary const buffer = audioInstance.buffer ? audioInstance.buffer : audioInstance.source diff --git a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta index 6ff2d0368..bb1b96df0 100644 --- a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e3304f73e6fd57ceed8d59be6fefc04a +guid: 02d563b4452e1007500b8f1a82ad59c6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/utils.js b/Runtime/wechat-default/unity-sdk/audio/utils.js index 20c847d6b..1a0e39b9e 100644 --- a/Runtime/wechat-default/unity-sdk/audio/utils.js +++ b/Runtime/wechat-default/unity-sdk/audio/utils.js @@ -45,7 +45,7 @@ export const destroyInnerAudio = (id, useCache) => { Object.keys(state).forEach((key) => { try { - + // @ts-ignore audios[id][key] = state[key]; } catch (e) { } diff --git a/Runtime/wechat-default/unity-sdk/audio/utils.js.meta b/Runtime/wechat-default/unity-sdk/audio/utils.js.meta index 4e7c781f4..325a88361 100644 --- a/Runtime/wechat-default/unity-sdk/audio/utils.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 99543aed462d8c06b7ed83009a04cf79 +guid: d8d8260bbc052f164588d3e5683220b5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/authorize.js b/Runtime/wechat-default/unity-sdk/authorize.js index 3d89ea983..f3beba68d 100644 --- a/Runtime/wechat-default/unity-sdk/authorize.js +++ b/Runtime/wechat-default/unity-sdk/authorize.js @@ -7,7 +7,7 @@ export default { resolveFn = resolve; moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}'); }; - + // @ts-ignore wx.onNeedPrivacyAuthorization(callback); }, WX_PrivacyAuthorizeResolve(conf) { diff --git a/Runtime/wechat-default/unity-sdk/authorize.js.meta b/Runtime/wechat-default/unity-sdk/authorize.js.meta index 0934e77f2..ab4e930b8 100644 --- a/Runtime/wechat-default/unity-sdk/authorize.js.meta +++ b/Runtime/wechat-default/unity-sdk/authorize.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 37d6c89cb9a832b610c5c23cb3f808c0 +guid: c21bc9b30537e30c57d58da5f12d5aa1 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/bluetooth/index.js b/Runtime/wechat-default/unity-sdk/bluetooth/index.js index 2ee523f29..4a10e505b 100644 --- a/Runtime/wechat-default/unity-sdk/bluetooth/index.js +++ b/Runtime/wechat-default/unity-sdk/bluetooth/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { convertDataToPointer } from '../utils'; let wxOnBLECharacteristicValueChangeCallback; const OnBLECharacteristicValueChange = (res) => { diff --git a/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta b/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta index 5f51608bd..654a1c977 100644 --- a/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c6f77f8b5f01b8c19a73d84cf0b780c +guid: 79c014c85810762878fb9fba6d6db4f6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/camera.js.meta b/Runtime/wechat-default/unity-sdk/camera.js.meta index b6e4cc40d..dd0110c4e 100644 --- a/Runtime/wechat-default/unity-sdk/camera.js.meta +++ b/Runtime/wechat-default/unity-sdk/camera.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f817a176c576ff473ef5d3444e8c2643 +guid: c2c4c40648ddc3e939370bd89d3508f9 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/canvas-context.js.meta b/Runtime/wechat-default/unity-sdk/canvas-context.js.meta index 9ef2bf9f1..bf064230a 100644 --- a/Runtime/wechat-default/unity-sdk/canvas-context.js.meta +++ b/Runtime/wechat-default/unity-sdk/canvas-context.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 68f8f465fdafa7882b0af50892a53c33 +guid: 48e1f02e9b0b91f9c537510dd6b54716 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/canvas.js.meta b/Runtime/wechat-default/unity-sdk/canvas.js.meta index e613c7cac..bf4a37cc3 100644 --- a/Runtime/wechat-default/unity-sdk/canvas.js.meta +++ b/Runtime/wechat-default/unity-sdk/canvas.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b8b705a1320c936bd0ea596851bba410 +guid: cc598f0b5a617250e913512b28f32801 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/chat.js b/Runtime/wechat-default/unity-sdk/chat.js index 29ac9ccb7..2a0258122 100644 --- a/Runtime/wechat-default/unity-sdk/chat.js +++ b/Runtime/wechat-default/unity-sdk/chat.js @@ -10,7 +10,7 @@ function createMiniGameChat(options, callback) { try { if (typeof requirePlugin !== 'undefined') { if (!MiniGameChat) { - + // @ts-ignore MiniGameChat = requirePlugin('MiniGameChat', { enableRequireHostModule: true, customEnv: { @@ -124,7 +124,7 @@ export default { if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') { return; } - + // eslint-disable-next-line no-restricted-syntax for (const key in Object.keys(onList[eventType])) { const callback = onList[eventType][key]; if (callback) { diff --git a/Runtime/wechat-default/unity-sdk/chat.js.meta b/Runtime/wechat-default/unity-sdk/chat.js.meta index 0f14c3e27..74cbaadc4 100644 --- a/Runtime/wechat-default/unity-sdk/chat.js.meta +++ b/Runtime/wechat-default/unity-sdk/chat.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e3380dcf693977eacbdb98eb9bd1df40 +guid: 42abf1423fd47313211d9aef0fc5d845 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/cloud.js b/Runtime/wechat-default/unity-sdk/cloud.js index 7c6c4654a..babe75e4d 100644 --- a/Runtime/wechat-default/unity-sdk/cloud.js +++ b/Runtime/wechat-default/unity-sdk/cloud.js @@ -1,37 +1,253 @@ -import response from './response'; -import { formatJsonStr } from './utils'; +/* eslint-disable no-param-reassign */ +import moduleHelper from './module-helper'; +import { uid, formatJsonStr, formatResponse } from './utils'; const CloudIDObject = {}; -function fixWXCallFunctionData(data) { - - for (const key in data) { +const CDNObject = {}; +function fixCallFunctionData(data) { + Object.keys(data).forEach((key) => { if (typeof data[key] === 'object') { - fixWXCallFunctionData(data[key]); + fixCallFunctionData(data[key]); } - else if (typeof data[key] === 'string' && CloudIDObject[data[key]]) { - data[key] = CloudIDObject[data[key]]; + else if (typeof data[key] === 'string') { + if (CloudIDObject[data[key]]) { + data[key] = CloudIDObject[data[key]]; + } + if (CDNObject[data[key]]) { + data[key] = CDNObject[data[key]]; + } } - } + }); } +const CloudList = {}; export default { - WXCallFunctionInit(conf) { - const config = formatJsonStr(conf); - wx.cloud.init(config); + WX_CloudCloud(option) { + const config = formatJsonStr(option); + // @ts-ignore + const cloud = new wx.cloud.Cloud(config); + CloudList[config.resourceEnv] = cloud; }, - WXCallFunction(name, data, conf, s, f, c) { - const d = JSON.parse(data); - fixWXCallFunctionData(d); - wx.cloud.callFunction({ - name, - data: d, - config: conf === '' ? null : JSON.parse(conf), - ...response.handlecloudCallFunction(s, f, c), + WX_CloudInit(option) { + const config = formatJsonStr(option); + if (config.env === '_default_') { + wx.cloud.init(); + } + else { + CloudList[config.env].init(config); + } + }, + WX_CloudCallFunction(env, conf, callbackId) { + const config = formatJsonStr(conf); + if (config.data) { + fixCallFunctionData(config.data); + } + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.callFunction({ + ...config, + success(res) { + formatResponse('CallFunctionResult', res); + moduleHelper.send('_CloudCallFunctionCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudCallFunctionCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudCallFunctionCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, }); }, - WXCloudID(cloudId) { - - const res = wx.cloud.CloudID(cloudId); - const r = JSON.stringify(res); - CloudIDObject[r] = res; - return r; + WX_CloudCloudID(env, cloudID) { + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + const res = targetCloud.CloudID(cloudID); + const id = `CloudID-${uid()}`; + CloudIDObject[id] = res; + return id; + }, + WX_CloudCDN(env, target) { + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + const res = targetCloud.CDN(target); + const id = `CDN-${uid()}`; + CDNObject[id] = res; + return id; + }, + WX_CloudCallContainer(env, conf, callbackId) { + const config = formatJsonStr(conf); + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.callContainer({ + ...config, + success(res) { + formatResponse('CallContainerResult', res); + moduleHelper.send('_CloudCallContainerCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudCallContainerCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudCallContainerCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, + WX_CloudUploadFile(env, conf, callbackId) { + const config = formatJsonStr(conf); + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.uploadFile({ + ...config, + success(res) { + formatResponse('UploadFileResult', res); + moduleHelper.send('_CloudUploadFileCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudUploadFileCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudUploadFileCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, + WX_CloudDownloadFile(env, conf, callbackId) { + const config = formatJsonStr(conf); + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.downloadFile({ + ...config, + success(res) { + formatResponse('DownloadFileResult', res); + moduleHelper.send('_CloudDownloadFileCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudDownloadFileCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudDownloadFileCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, + WX_CloudGetTempFileURL(env, conf, callbackId) { + const config = formatJsonStr(conf); + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.getTempFileURL({ + ...config, + success(res) { + formatResponse('GetTempFileURLResult', res); + moduleHelper.send('_CloudGetTempFileURLCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudGetTempFileURLCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudGetTempFileURLCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, + WX_CloudDeleteFile(env, conf, callbackId) { + const config = formatJsonStr(conf); + let targetCloud; + if (env === '_default_') { + targetCloud = wx.cloud; + } + else { + targetCloud = CloudList[env]; + } + targetCloud.deleteFile({ + ...config, + success(res) { + formatResponse('DeleteFileResult', res); + moduleHelper.send('_CloudDeleteFileCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudDeleteFileCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('_CloudDeleteFileCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); }, }; diff --git a/Runtime/wechat-default/unity-sdk/cloud.js.meta b/Runtime/wechat-default/unity-sdk/cloud.js.meta index 5e27c8609..771895690 100644 --- a/Runtime/wechat-default/unity-sdk/cloud.js.meta +++ b/Runtime/wechat-default/unity-sdk/cloud.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5fa4b26864e64bd3c5c7c1c830e75fb5 +guid: 05cd7b2d8a5c623ddede1517790281bc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/conf.js.meta b/Runtime/wechat-default/unity-sdk/conf.js.meta index eea2d9db6..fa5242eee 100644 --- a/Runtime/wechat-default/unity-sdk/conf.js.meta +++ b/Runtime/wechat-default/unity-sdk/conf.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0ed5cfbc1cb1dca5dfd9f4d41870b25e +guid: b6624fa1bb3493bc3f3e4f05984deee4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/file-info.js.meta b/Runtime/wechat-default/unity-sdk/file-info.js.meta index 0ad8eebff..0060c5289 100644 --- a/Runtime/wechat-default/unity-sdk/file-info.js.meta +++ b/Runtime/wechat-default/unity-sdk/file-info.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c11ec3d27960784cf9d6ad75dfeaeb1 +guid: 21b69774392f14c148c8bea5c247b378 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fix.js b/Runtime/wechat-default/unity-sdk/fix.js index a8dc486ef..b6e84c48e 100644 --- a/Runtime/wechat-default/unity-sdk/fix.js +++ b/Runtime/wechat-default/unity-sdk/fix.js @@ -1,3 +1,5 @@ +/* eslint-disable prefer-spread */ +/* eslint-disable prefer-rest-params */ export default { init() { @@ -15,13 +17,13 @@ export default { } return id; }; - + // @ts-ignore window.setTimeout = function (vCallback, nDelay) { const aArgs = Array.prototype.slice.call(arguments, 2); const id = getId(); const t = privateSetTimeout(vCallback instanceof Function ? () => { - + // @ts-ignore vCallback.apply(null, aArgs); delete wm[id]; } @@ -30,7 +32,7 @@ export default { return id; }; const privateClearTimeout = window.clearTimeout; - + // @ts-ignore window.clearTimeout = function (id) { if (id) { const t = wm[id]; @@ -41,13 +43,13 @@ export default { } }; const privateSetInterval = window.setInterval; - + // @ts-ignore window.setInterval = function (vCallback, nDelay) { const aArgs = Array.prototype.slice.call(arguments, 2); const id = getId(); const t = privateSetInterval(vCallback instanceof Function ? () => { - + // @ts-ignore vCallback.apply(null, aArgs); } : vCallback, nDelay); @@ -55,7 +57,7 @@ export default { return id; }; const privateClearInterval = window.clearInterval; - + // @ts-ignore window.clearInterval = function (id) { if (id) { const t = wm[id]; diff --git a/Runtime/wechat-default/unity-sdk/fix.js.meta b/Runtime/wechat-default/unity-sdk/fix.js.meta index 59f563f9a..889e2c41b 100644 --- a/Runtime/wechat-default/unity-sdk/fix.js.meta +++ b/Runtime/wechat-default/unity-sdk/fix.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 181613de8694f03f69975420d9883673 +guid: 665edb287fe85eacb5c0e2947f80101e DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta b/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta index 4f3676f59..6ca04875e 100644 --- a/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b8b0d6e0bfc3c0bd2dff08c6831167c +guid: 7b3701d66ad840d6ce5fba1ce2c225d5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/index.js b/Runtime/wechat-default/unity-sdk/font/index.js index ec05a51ad..800648f74 100644 --- a/Runtime/wechat-default/unity-sdk/font/index.js +++ b/Runtime/wechat-default/unity-sdk/font/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from '../module-helper'; import { formatJsonStr } from '../utils'; @@ -5,7 +6,7 @@ import fixCmapTable from './fix-cmap'; import readMetrics from './read-metrics'; import splitTTCToBufferOnlySC from './split-sc'; -const { platform } = wx.getSystemInfoSync(); +const { platform } = wx.getDeviceInfo(); const tempCacheObj = {}; let fontDataCache; @@ -94,7 +95,7 @@ function handleGetFontData(config, forceLoad = false) { if (!config && !canGetWxCommonFont) { return Promise.reject('invalid usage'); } - + // eslint-disable-next-line @typescript-eslint/no-misused-promises if (!getFontPromise || forceLoad) { getFontPromise = new Promise((resolve, reject) => { if (!canGetWxCommonFont && !!config) { diff --git a/Runtime/wechat-default/unity-sdk/font/index.js.meta b/Runtime/wechat-default/unity-sdk/font/index.js.meta index 551ed519f..994742a80 100644 --- a/Runtime/wechat-default/unity-sdk/font/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 82cd05553adbf694a7aa41d15dfc513d +guid: 20ba3d24ca45406882d87c30309e072b DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta b/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta index 5ef4edd8e..06c4e255c 100644 --- a/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f880f376a130f0bcb740b0607ef4e9c2 +guid: d7a76d71627b5e97314fcf3cb54ef8fe DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta b/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta index 663e7c031..4da06e288 100644 --- a/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 52282aba774f8ca0eb45671280e17e55 +guid: 4a125bd5351b97f74e3b5f349e4053d5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/util.js.meta b/Runtime/wechat-default/unity-sdk/font/util.js.meta index 500315cc3..347a58913 100644 --- a/Runtime/wechat-default/unity-sdk/font/util.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/util.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 877cf45afb634b8db9d49507494e2a7e +guid: 1ce1e19c6a89d0be31c757f1e5ab0a03 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fs.js b/Runtime/wechat-default/unity-sdk/fs.js index 41593114e..a245372af 100644 --- a/Runtime/wechat-default/unity-sdk/fs.js +++ b/Runtime/wechat-default/unity-sdk/fs.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import response from './response'; import moduleHelper from './module-helper'; import { cacheArrayBuffer, formatJsonStr, formatResponse } from './utils'; @@ -81,7 +82,7 @@ export default { WXWriteFileSync(filePath, data, encoding) { try { const fs = wx.getFileSystemManager(); - + // @ts-ignore fs.writeFileSync(filePath, data, encoding); fileInfoHandler.addFileInfo(filePath, data); } @@ -283,9 +284,9 @@ export default { ...config, success(res) { if (!Array.isArray(res.stats)) { - + // @ts-ignore C#中特殊处理 res.one_stat = res.stats; - + // @ts-ignore C#中特殊处理 res.stats = null; } moduleHelper.send('StatCallback', JSON.stringify({ @@ -302,11 +303,11 @@ export default { })); }, complete(res) { - + // @ts-ignore C#中特殊处理 if (!Array.isArray(res.stats)) { - + // @ts-ignore C#中特殊处理 res.one_stat = res.stats; - + // @ts-ignore C#中特殊处理 res.stats = null; } moduleHelper.send('StatCallback', JSON.stringify({ diff --git a/Runtime/wechat-default/unity-sdk/fs.js.meta b/Runtime/wechat-default/unity-sdk/fs.js.meta index 9cf3fe4d9..7e8d96900 100644 --- a/Runtime/wechat-default/unity-sdk/fs.js.meta +++ b/Runtime/wechat-default/unity-sdk/fs.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 76ce4625fec95a9195dc1cf7920d1614 +guid: 7706abe8371bf5bcdcc88b6e24259b86 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-club.js b/Runtime/wechat-default/unity-sdk/game-club.js index 31779291f..e13b54b5f 100644 --- a/Runtime/wechat-default/unity-sdk/game-club.js +++ b/Runtime/wechat-default/unity-sdk/game-club.js @@ -15,15 +15,15 @@ const getObject = getListObject(gameClubButtonList, 'gameClubButton'); export default { WXCreateGameClubButton(conf) { const config = formatJsonStr(conf); - + // @ts-ignore config.style = JSON.parse(config.styleRaw); if (config.style.fontSize === 0) { - + // @ts-ignore config.style.fontSize = undefined; } - + // @ts-ignore config.type = typeEnum[config.type]; - + // @ts-ignore config.icon = iconEnum[config.icon]; const id = uid(); gameClubButtonList[id] = wx.createGameClubButton(config); diff --git a/Runtime/wechat-default/unity-sdk/game-club.js.meta b/Runtime/wechat-default/unity-sdk/game-club.js.meta index ea5fd636d..f0136877c 100644 --- a/Runtime/wechat-default/unity-sdk/game-club.js.meta +++ b/Runtime/wechat-default/unity-sdk/game-club.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cfff2eb80fb5091fc25f37502518c47d +guid: 43b8eb5313337c61950a44b41eb6d72b DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-recorder.js b/Runtime/wechat-default/unity-sdk/game-recorder.js index 6959dd61b..3aa869b47 100644 --- a/Runtime/wechat-default/unity-sdk/game-recorder.js +++ b/Runtime/wechat-default/unity-sdk/game-recorder.js @@ -17,7 +17,7 @@ export default { if (!obj || typeof wxGameRecorderList === 'undefined' || typeof wxGameRecorderList[eventType] === 'undefined') { return; } - + // eslint-disable-next-line no-restricted-syntax for (const key in Object.keys(wxGameRecorderList[eventType])) { const callback = wxGameRecorderList[eventType][key]; if (callback) { diff --git a/Runtime/wechat-default/unity-sdk/game-recorder.js.meta b/Runtime/wechat-default/unity-sdk/game-recorder.js.meta index b29c39295..f2781bcbb 100644 --- a/Runtime/wechat-default/unity-sdk/game-recorder.js.meta +++ b/Runtime/wechat-default/unity-sdk/game-recorder.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 122eb78360a34f4b62123b4f8fdb37aa +guid: 0f7a23834543a8c77d2d1790d0801fec DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/gyroscope/index.js b/Runtime/wechat-default/unity-sdk/gyroscope/index.js index ada975e60..b2cf9f44f 100644 --- a/Runtime/wechat-default/unity-sdk/gyroscope/index.js +++ b/Runtime/wechat-default/unity-sdk/gyroscope/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, formatResponse, convertDataToPointer } from '../utils'; let wxStartGyroscopeCallback; let wxStopGyroscopeCallback; diff --git a/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta b/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta index 0ab54ecc7..264daac58 100644 --- a/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 79341585e29028a8971f7b605b72b556 +guid: 38646574248504f5b7d734483adf66ba DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/index.js.meta b/Runtime/wechat-default/unity-sdk/index.js.meta index 7fb94c067..3c0e85674 100644 --- a/Runtime/wechat-default/unity-sdk/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 482d406ceb182221a298dd3880d4e941 +guid: 1b18c50ea896e41cd31100e6e88e5d71 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/logger.js.meta b/Runtime/wechat-default/unity-sdk/logger.js.meta index a7deabd81..7a0dcc5dd 100644 --- a/Runtime/wechat-default/unity-sdk/logger.js.meta +++ b/Runtime/wechat-default/unity-sdk/logger.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b74bb48a82089f1cf9d6b0013340a9b3 +guid: 0ae7d52d9bf63f0d07f717fc90c83d62 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta b/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta index 71a0d49c3..bf7d7d28e 100644 --- a/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0ba9a2529e567edb67dd295f6e2828e0 +guid: 78208776132b56e2d5f9d2343b943056 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/module-helper.js b/Runtime/wechat-default/unity-sdk/module-helper.js index fb5cb8f0f..9af0cfa2f 100644 --- a/Runtime/wechat-default/unity-sdk/module-helper.js +++ b/Runtime/wechat-default/unity-sdk/module-helper.js @@ -1,3 +1,4 @@ +/* eslint-disable no-underscore-dangle */ import { MODULE_NAME } from './conf'; export default { _send: null, @@ -8,7 +9,7 @@ export default { if (!this._send) { this.init(); } - + // @ts-ignore this._send(MODULE_NAME, method, str); }, }; diff --git a/Runtime/wechat-default/unity-sdk/module-helper.js.meta b/Runtime/wechat-default/unity-sdk/module-helper.js.meta index 9b607e6dc..4090b151a 100644 --- a/Runtime/wechat-default/unity-sdk/module-helper.js.meta +++ b/Runtime/wechat-default/unity-sdk/module-helper.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5155261f77084bf5ae78c491e36a94e5 +guid: 05566ffda7a016ee34212dd4403ea1ce DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/open-data.js.meta b/Runtime/wechat-default/unity-sdk/open-data.js.meta index 7b9126183..c00a9d514 100644 --- a/Runtime/wechat-default/unity-sdk/open-data.js.meta +++ b/Runtime/wechat-default/unity-sdk/open-data.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fe5c372c88c446bf5c9f9b2c05b122bf +guid: e00b2bc56897cf34fe0e5e9f01cf859f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/recorder.js.meta b/Runtime/wechat-default/unity-sdk/recorder.js.meta index 1457bc9d6..697901b28 100644 --- a/Runtime/wechat-default/unity-sdk/recorder.js.meta +++ b/Runtime/wechat-default/unity-sdk/recorder.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 22123e9efab710435dadd47cfe7157c7 +guid: 883a5927606cd035636ce9cde6826013 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resType.js b/Runtime/wechat-default/unity-sdk/resType.js index 6c96c1f49..9235347b2 100644 --- a/Runtime/wechat-default/unity-sdk/resType.js +++ b/Runtime/wechat-default/unity-sdk/resType.js @@ -28,6 +28,8 @@ export const ResType = { AppBaseInfo: { SDKVersion: 'string', enableDebug: 'bool', + fontSizeScaleFactor: 'number', + fontSizeSetting: 'number', host: 'AppBaseInfoHost', language: 'string', version: 'string', @@ -38,6 +40,7 @@ export const ResType = { }, GetBatteryInfoSyncResult: { isCharging: 'bool', + isLowPowerModeEnabled: 'bool', level: 'number', }, DeviceInfo: { @@ -186,6 +189,7 @@ export const ResType = { socketReused: 'bool', throughputKbps: 'number', transportRttEstimate: 'number', + usingHighPerformanceMode: 'bool', }, DownloadTaskOnHeadersReceivedListenerResult: { header: 'object', @@ -203,17 +207,17 @@ export const ResType = { }, OptionStyle: { backgroundColor: 'string', + height: 'number', + left: 'number', + top: 'number', + width: 'number', borderColor: 'string', borderRadius: 'number', borderWidth: 'number', color: 'string', fontSize: 'number', - height: 'number', - left: 'number', lineHeight: 'number', textAlign: 'string', - top: 'number', - width: 'number', }, ImageData: { height: 'number', @@ -446,6 +450,7 @@ export const ResType = { }, GetBatteryInfoSuccessCallbackResult: { isCharging: 'bool', + isLowPowerModeEnabled: 'bool', level: 'number', errMsg: 'string', }, @@ -518,6 +523,11 @@ export const ResType = { deviceId: 'string', name: 'string', }, + GetDeviceBenchmarkInfoSuccessCallbackResult: { + benchmarkLevel: 'number', + modelLevel: 'number', + errMsg: 'string', + }, GetExtConfigSuccessCallbackResult: { extConfig: 'object', errMsg: 'string', @@ -538,6 +548,10 @@ export const ResType = { signature: 'string', errMsg: 'string', }, + GetGroupEnterInfoError: { + errMsg: 'string', + errCode: 'number', + }, GetGroupEnterInfoSuccessCallbackResult: { cloudID: 'string', encryptedData: 'string', @@ -726,6 +740,14 @@ export const ResType = { OnMemoryWarningListenerResult: { level: 'number', }, + OnMenuButtonBoundingClientRectWeightChangeListenerResult: { + bottom: 'number', + height: 'number', + left: 'number', + right: 'number', + top: 'number', + width: 'number', + }, OnMouseDownListenerResult: { button: 'number', timeStamp: 'long', @@ -774,6 +796,9 @@ export const ResType = { promise: 'string', reason: 'string', }, + OnUserCaptureScreenListenerResult: { + query: 'string', + }, OnVoIPChatInterruptedListenerResult: { errCode: 'number', errMsg: 'string', @@ -873,10 +898,24 @@ export const ResType = { RequestMidasPaymentFailCallbackErr: { errCode: 'number', errMsg: 'string', + errno: 'number', }, RequestMidasPaymentSuccessCallbackResult: { errMsg: 'string', }, + SignData1: { + buyQuantity: 'number', + currencyType: 'string', + goodsPrice: 'number', + mode: 'string', + offerId: 'string', + outTradeNo: 'string', + productId: 'string', + attach: 'string', + env: 'number', + platform: 'string', + zoneId: 'string', + }, RequestSubscribeMessageFailCallbackResult: { errCode: 'number', errMsg: 'string', @@ -931,6 +970,7 @@ export const ResType = { }, UpdatableMessageFrontEndTemplateInfo: { parameterList: 'UpdatableMessageFrontEndParameter[]', + templateId: 'string', }, UpdatableMessageFrontEndParameter: { name: 'string', @@ -963,10 +1003,6 @@ export const ResType = { feedIdList: 'string[]', errMsg: 'string', }, - MidasPaymentGameItemError: { - errMsg: 'string', - errCode: 'number', - }, RequestSubscribeLiveActivitySuccessCallbackResult: { code: 'string', errMsg: 'string', diff --git a/Runtime/wechat-default/unity-sdk/resType.js.meta b/Runtime/wechat-default/unity-sdk/resType.js.meta index be8e4409e..d468d85eb 100644 --- a/Runtime/wechat-default/unity-sdk/resType.js.meta +++ b/Runtime/wechat-default/unity-sdk/resType.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: cfcdd546b700155e56cc2afcaa07350c +guid: 63c39eca6eea7ffde1d6df27a9a7b091 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resTypeOther.js b/Runtime/wechat-default/unity-sdk/resTypeOther.js index 3e50c1cba..9ca8b5a42 100644 --- a/Runtime/wechat-default/unity-sdk/resTypeOther.js +++ b/Runtime/wechat-default/unity-sdk/resTypeOther.js @@ -44,4 +44,46 @@ export const ResTypeOther = { offset: 'number', setBroadcast: 'bool', }, + CallFunctionResult: { + result: 'string', + requestID: 'string', + errMsg: 'string', + }, + CallContainerResult: { + data: 'string', + statusCode: 'number', + header: 'object', + callID: 'string', + errMsg: 'string', + }, + UploadFileResult: { + fileID: 'string', + statusCode: 'number', + errMsg: 'string', + }, + DownloadFileResult: { + tempFilePath: 'string', + statusCode: 'number', + errMsg: 'string', + }, + GetTempFileURLResult: { + fileList: 'GetTempFileURLResultItem[]', + errMsg: 'string', + }, + GetTempFileURLResultItem: { + fileID: 'string', + tempFileURL: 'string', + maxAge: 'number', + status: 'number', + errMsg: 'string', + }, + DeleteFileResult: { + fileList: 'DeleteFileResultItem[]', + errMsg: 'string', + }, + DeleteFileResultItem: { + fileID: 'string', + status: 'number', + errMsg: 'string', + }, }; diff --git a/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta b/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta index 5d4642eb2..267bab2cc 100644 --- a/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta +++ b/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5ccdd03466101f6b24ca385f549ef3fc +guid: 831e033db393e20865c9af9e9bd6fae1 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/response.js b/Runtime/wechat-default/unity-sdk/response.js index 9377fd1b4..f5febd7b7 100644 --- a/Runtime/wechat-default/unity-sdk/response.js +++ b/Runtime/wechat-default/unity-sdk/response.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-this-alias */ import moduleHelper from './module-helper'; export default { handleText(s, f, c) { @@ -48,31 +49,6 @@ export default { errCode: res.errCode, })); }, - handlecloudCallFunction(s, f, c) { - const self = this; - return { - success(res) { - self.cloudCallFunctionFormat(s, res); - }, - fail(res) { - self.cloudCallFunctionFormat(f, res); - }, - complete(res) { - self.cloudCallFunctionFormat(c, res); - }, - }; - }, - cloudCallFunctionFormat(id, res) { - if (!id) { - return false; - } - moduleHelper.send('CloudCallFunctionResponseCallback', JSON.stringify({ - callbackId: id, - errMsg: res.errMsg, - result: typeof res.result === 'object' ? JSON.stringify(res.result) : res.result, - requestID: res.requestID, - })); - }, handle(formatFunc, s, f, c) { return { success(res) { diff --git a/Runtime/wechat-default/unity-sdk/response.js.meta b/Runtime/wechat-default/unity-sdk/response.js.meta index d2a0f31ac..fab4e421a 100644 --- a/Runtime/wechat-default/unity-sdk/response.js.meta +++ b/Runtime/wechat-default/unity-sdk/response.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 68e60b198ef194d7222fddf27177459d +guid: ac3f128015ad7b912c5304514cb63ff5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/sdk.js b/Runtime/wechat-default/unity-sdk/sdk.js index c6787c207..c0de7e820 100644 --- a/Runtime/wechat-default/unity-sdk/sdk.js +++ b/Runtime/wechat-default/unity-sdk/sdk.js @@ -24,6 +24,7 @@ let OnKeyboardConfirmList; let OnKeyboardHeightChangeList; let OnKeyboardInputList; let OnMemoryWarningList; +let OnMenuButtonBoundingClientRectWeightChangeList; let OnMouseDownList; let OnMouseMoveList; let OnMouseUpList; @@ -805,6 +806,30 @@ export default { }, }); }, + WX_GetDeviceBenchmarkInfo(conf, callbackId) { + const config = formatJsonStr(conf); + wx.getDeviceBenchmarkInfo({ + ...config, + success(res) { + formatResponse('GetDeviceBenchmarkInfoSuccessCallbackResult', res); + moduleHelper.send('GetDeviceBenchmarkInfoCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('GetDeviceBenchmarkInfoCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('GeneralCallbackResult', res); + moduleHelper.send('GetDeviceBenchmarkInfoCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, WX_GetExtConfig(conf, callbackId) { const config = formatJsonStr(conf); wx.getExtConfig({ @@ -888,13 +913,13 @@ export default { })); }, fail(res) { - formatResponse('GeneralCallbackResult', res); + formatResponse('GetGroupEnterInfoError', res); moduleHelper.send('GetGroupEnterInfoCallback', JSON.stringify({ callbackId, type: 'fail', res: JSON.stringify(res), })); }, complete(res) { - formatResponse('GeneralCallbackResult', res); + formatResponse('GetGroupEnterInfoError', res); moduleHelper.send('GetGroupEnterInfoCallback', JSON.stringify({ callbackId, type: 'complete', res: JSON.stringify(res), })); @@ -1987,6 +2012,30 @@ export default { }, }); }, + WX_RequestMidasPaymentGameItem(conf, callbackId) { + const config = formatJsonStr(conf); + wx.requestMidasPaymentGameItem({ + ...config, + success(res) { + formatResponse('MidasPaymentError', res); + moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ + callbackId, type: 'success', res: JSON.stringify(res), + })); + }, + fail(res) { + formatResponse('MidasPaymentError', res); + moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ + callbackId, type: 'fail', res: JSON.stringify(res), + })); + }, + complete(res) { + formatResponse('MidasPaymentError', res); + moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ + callbackId, type: 'complete', res: JSON.stringify(res), + })); + }, + }); + }, WX_RequestSubscribeMessage(conf, callbackId) { const config = formatJsonStr(conf); wx.requestSubscribeMessage({ @@ -3211,30 +3260,6 @@ export default { }, }); }, - WX_RequestMidasPaymentGameItem(conf, callbackId) { - const config = formatJsonStr(conf); - wx.requestMidasPaymentGameItem({ - ...config, - success(res) { - formatResponse('GeneralCallbackResult', res); - moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ - callbackId, type: 'success', res: JSON.stringify(res), - })); - }, - fail(res) { - formatResponse('MidasPaymentGameItemError', res); - moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ - callbackId, type: 'fail', res: JSON.stringify(res), - })); - }, - complete(res) { - formatResponse('MidasPaymentGameItemError', res); - moduleHelper.send('RequestMidasPaymentGameItemCallback', JSON.stringify({ - callbackId, type: 'complete', res: JSON.stringify(res), - })); - }, - }); - }, WX_RequestSubscribeLiveActivity(conf, callbackId) { const config = formatJsonStr(conf); wx.requestSubscribeLiveActivity({ @@ -3295,9 +3320,6 @@ export default { WX_ReportEvent(eventId, data) { wx.reportEvent(eventId, formatJsonStr(data)); }, - WX_ReportMonitor(name, value) { - wx.reportMonitor(name, value); - }, WX_ReportPerformance(id, value, dimensions) { wx.reportPerformance(id, value, dimensions); }, @@ -3723,6 +3745,23 @@ export default { wx.offMemoryWarning(v); }); }, + WX_OnMenuButtonBoundingClientRectWeightChange() { + if (!OnMenuButtonBoundingClientRectWeightChangeList) { + OnMenuButtonBoundingClientRectWeightChangeList = []; + } + const callback = (res) => { + formatResponse('OnMenuButtonBoundingClientRectWeightChangeListenerResult', res); + const resStr = stringifyRes(res); + moduleHelper.send('_OnMenuButtonBoundingClientRectWeightChangeCallback', resStr); + }; + OnMenuButtonBoundingClientRectWeightChangeList.push(callback); + wx.onMenuButtonBoundingClientRectWeightChange(callback); + }, + WX_OffMenuButtonBoundingClientRectWeightChange() { + (OnMenuButtonBoundingClientRectWeightChangeList || []).forEach((v) => { + wx.offMenuButtonBoundingClientRectWeightChange(v); + }); + }, WX_OnMessage() { const callback = (res) => { const resStr = res; @@ -3879,7 +3918,7 @@ export default { OnUserCaptureScreenList = []; } const callback = (res) => { - formatResponse('GeneralCallbackResult', res); + formatResponse('OnUserCaptureScreenListenerResult', res); const resStr = stringifyRes(res); moduleHelper.send('_OnUserCaptureScreenCallback', resStr); }; @@ -4168,8 +4207,8 @@ export default { formatResponse('WindowInfo', res); return JSON.stringify(res); }, - WX_CreateImageData() { - const res = wx.createImageData(); + WX_CreateImageData(width, height) { + const res = wx.createImageData(width, height); formatResponse('ImageData', res); return JSON.stringify(res); }, diff --git a/Runtime/wechat-default/unity-sdk/sdk.js.meta b/Runtime/wechat-default/unity-sdk/sdk.js.meta index 5c47a07e7..d7c271365 100644 --- a/Runtime/wechat-default/unity-sdk/sdk.js.meta +++ b/Runtime/wechat-default/unity-sdk/sdk.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 449796eedaab4f6d12d8491eb190833a +guid: 79267e7b3197ac6f478019c75e75193a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/share.js.meta b/Runtime/wechat-default/unity-sdk/share.js.meta index 331ec81a9..6ff3bb3d5 100644 --- a/Runtime/wechat-default/unity-sdk/share.js.meta +++ b/Runtime/wechat-default/unity-sdk/share.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 267b414dc43724f9eaf93998a280eea1 +guid: 68db380480c460248d3fcc94e5980401 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/storage.js b/Runtime/wechat-default/unity-sdk/storage.js index 8f5567e32..ed31b20ff 100644 --- a/Runtime/wechat-default/unity-sdk/storage.js +++ b/Runtime/wechat-default/unity-sdk/storage.js @@ -1,3 +1,4 @@ +/* eslint-disable no-underscore-dangle */ const PreLoadKeys = '$PreLoadKeys'; const storage = { _cacheData: {}, diff --git a/Runtime/wechat-default/unity-sdk/storage.js.meta b/Runtime/wechat-default/unity-sdk/storage.js.meta index 6af601276..a488cff54 100644 --- a/Runtime/wechat-default/unity-sdk/storage.js.meta +++ b/Runtime/wechat-default/unity-sdk/storage.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8c778aedeecfbb21cb038be88a129acf +guid: 5ff8df7518d27555ad16c33efe1053bc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/texture.js b/Runtime/wechat-default/unity-sdk/texture.js index 3b58a1a93..3c1445d19 100644 --- a/Runtime/wechat-default/unity-sdk/texture.js +++ b/Runtime/wechat-default/unity-sdk/texture.js @@ -1,3 +1,6 @@ +/* eslint-disable no-param-reassign */ +/* eslint-disable no-restricted-properties */ +/* eslint-disable no-plusplus */ import canvasContext from './canvas-context'; const downloadedTextures = {}; const downloadingTextures = {}; @@ -251,16 +254,13 @@ canvasContext.addCreatedListener(() => { if (GameGlobal.USED_TEXTURE_COMPRESSION) { mod.getSupportedExtensions(); if (GameGlobal.TextureCompressedFormat === '' || GameGlobal.TextureCompressedFormat === 'pvr') { - wx.getSystemInfo({ - success(res) { - if (res.platform === 'ios') { - wx.showModal({ - title: '提示', - content: '当前操作系统版本过低,建议您升级至最新版本。', - }); - } - }, - }); + const { platform } = wx.getDeviceInfo(); + if (platform === 'ios') { + wx.showModal({ + title: '提示', + content: '当前操作系统版本过低,建议您升级至最新版本。', + }); + } } } wx.onNetworkStatusChange((res) => { diff --git a/Runtime/wechat-default/unity-sdk/texture.js.meta b/Runtime/wechat-default/unity-sdk/texture.js.meta index a9317262f..bd4423a06 100644 --- a/Runtime/wechat-default/unity-sdk/texture.js.meta +++ b/Runtime/wechat-default/unity-sdk/texture.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 21d691e0a177db364324720d7d2f7d13 +guid: ba07f9e0fcb6ea38cd2a170a36b7cfa4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/touch/index.js b/Runtime/wechat-default/unity-sdk/touch/index.js index 8af18b717..352e3a0f5 100644 --- a/Runtime/wechat-default/unity-sdk/touch/index.js +++ b/Runtime/wechat-default/unity-sdk/touch/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatTouchEvent, convertOnTouchStartListenerResultToPointer } from '../utils'; let wxOnTouchCancelCallback; let wxOnTouchEndCallback; diff --git a/Runtime/wechat-default/unity-sdk/touch/index.js.meta b/Runtime/wechat-default/unity-sdk/touch/index.js.meta index a604d4c2b..22c103565 100644 --- a/Runtime/wechat-default/unity-sdk/touch/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/touch/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2a74cf64213865271f278be1bbea199a +guid: c43d006a718a052cf9a79756a059cb9f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/upload-file.js.meta b/Runtime/wechat-default/unity-sdk/upload-file.js.meta index 5c1a5c391..7ba93a199 100644 --- a/Runtime/wechat-default/unity-sdk/upload-file.js.meta +++ b/Runtime/wechat-default/unity-sdk/upload-file.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4113e56ad4acab776f82de9ca331cce4 +guid: 6c63b2187c1e68183683fb9915b3e7c3 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/userinfo.js.meta b/Runtime/wechat-default/unity-sdk/userinfo.js.meta index ef3348afd..75405bb23 100644 --- a/Runtime/wechat-default/unity-sdk/userinfo.js.meta +++ b/Runtime/wechat-default/unity-sdk/userinfo.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 64bc43b8f50c44a6582c5137a8014a02 +guid: 443b7ad0bfb906dc992f60a98d382673 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/util.js.meta b/Runtime/wechat-default/unity-sdk/util.js.meta index aa73c5add..a7ae13427 100644 --- a/Runtime/wechat-default/unity-sdk/util.js.meta +++ b/Runtime/wechat-default/unity-sdk/util.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 614cab92ac43e964196807b3ac90e160 +guid: a65298b6e7a184b5929029919a93ec95 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/utils.js b/Runtime/wechat-default/unity-sdk/utils.js index 054b88f16..a8d5da2c0 100644 --- a/Runtime/wechat-default/unity-sdk/utils.js +++ b/Runtime/wechat-default/unity-sdk/utils.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from './module-helper'; import { ResType } from './resType'; import { ResTypeOther } from './resTypeOther'; @@ -106,6 +107,9 @@ export function formatResponse(type, data, id) { else if (conf[key] === 'string' && typeof data[key] === 'number') { data[key] = `${data[key]}`; } + else if (conf[key] === 'string' && typeof data[key] === 'object') { + data[key] = JSON.stringify(data[key]); + } else if (conf[key] === 'bool' && (typeof data[key] === 'number' || typeof data[key] === 'string')) { data[key] = !!data[key]; } @@ -171,6 +175,9 @@ export function formatResponse(type, data, id) { } } }); + if ((type === 'SystemInfo' || type === 'WindowInfo') && data.pixelRatio) { + data.pixelRatio = window.devicePixelRatio; + } return data; } export function formatJsonStr(str, type) { diff --git a/Runtime/wechat-default/unity-sdk/utils.js.meta b/Runtime/wechat-default/unity-sdk/utils.js.meta index a3eee6f53..ac2efd856 100644 --- a/Runtime/wechat-default/unity-sdk/utils.js.meta +++ b/Runtime/wechat-default/unity-sdk/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 72f8b388ea688ddd5c5f90650e41340c +guid: 807c4219d420de8a473cbf5219f8f539 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video.js.meta b/Runtime/wechat-default/unity-sdk/video.js.meta index 9e616220c..7a530d9f8 100644 --- a/Runtime/wechat-default/unity-sdk/video.js.meta +++ b/Runtime/wechat-default/unity-sdk/video.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1fb5363532853f0cae64dd2d18aeeef7 +guid: b2117f3150e02282fe0820cf4260be04 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video/index.js b/Runtime/wechat-default/unity-sdk/video/index.js index 639733761..41885f0ba 100644 --- a/Runtime/wechat-default/unity-sdk/video/index.js +++ b/Runtime/wechat-default/unity-sdk/video/index.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/prefer-for-of */ +/* eslint-disable @typescript-eslint/naming-convention */ import { isH5Renderer, isSupportVideoPlayer, isPc, isDevtools } from '../../check-version'; let FrameworkData = null; const isWebVideo = isH5Renderer || isPc || isDevtools; @@ -26,9 +28,9 @@ function jsVideoEnded() { if (isDebug) { console.log('jsVideoEnded'); } - + // @ts-ignore if (this.onendedCallback) { - + // @ts-ignore dynCall_vi(this.onendedCallback, this.onendedRef); } } @@ -41,9 +43,9 @@ function _JS_Video_Create(url) { console.log('_JS_Video_Create', source); } if (isWebVideo) { - + // @ts-ignore const video = GameGlobal.manager.createWKVideo(source, FrameworkData.GLctx); - + // eslint-disable-next-line no-plusplus videoInstances[++videoInstanceIdCounter] = video; } else { @@ -52,12 +54,12 @@ function _JS_Video_Create(url) { videoDecoder = cacheVideoDecoder.pop(); } else { - + // @ts-ignore 8.0.38客户端+3.0.0基础库,才能正常使用type参数 videoDecoder = wx.createVideoDecoder({ type: 'wemedia', }); } - + // eslint-disable-next-line no-plusplus const videoInstance = { videoDecoder, videoWidth: 0, @@ -68,7 +70,7 @@ function _JS_Video_Create(url) { seeking: false, duration: 1, }; - + // eslint-disable-next-line no-plusplus videoInstances[++videoInstanceIdCounter] = videoInstance; videoDecoder.on('start', (res) => { if (isDebug) { @@ -111,10 +113,10 @@ function _JS_Video_Create(url) { videoInstance.onended?.(); } }); - + // @ts-ignore videoDecoder.on('frame', (res) => { - + // @ts-ignore videoInstance.currentTime = res.pts / 1000; videoInstance.frameData = new Uint8ClampedArray(res.data); }); @@ -125,7 +127,7 @@ function _JS_Video_Create(url) { videoDecoder.stop(); }; videoInstance.seek = (time) => { - + // @ts-ignore videoDecoder.avSync.seek({ stamp: time }); }; videoInstance.play(); diff --git a/Runtime/wechat-default/unity-sdk/video/index.js.meta b/Runtime/wechat-default/unity-sdk/video/index.js.meta index 7fdf253fd..a894e68cc 100644 --- a/Runtime/wechat-default/unity-sdk/video/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/video/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a16a7bc4911996b8b83b49bf08f4afc5 +guid: 0bcc64f8d742efdde00a537553db1b67 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/wasmcode/game.js.meta b/Runtime/wechat-default/wasmcode/game.js.meta index a4f158a56..edd15cab3 100644 --- a/Runtime/wechat-default/wasmcode/game.js.meta +++ b/Runtime/wechat-default/wasmcode/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d66e18696fbb68262e0656f7ef5695eb +guid: ed5eccc8123e9750b0c795f4493438ef DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/weapp-adapter.js b/Runtime/wechat-default/weapp-adapter.js index 10dc9aaf5..c9ca42b75 100644 --- a/Runtime/wechat-default/weapp-adapter.js +++ b/Runtime/wechat-default/weapp-adapter.js @@ -76,8 +76,7 @@ const isWK = false; _window.canvas.addEventListener = _window.addEventListener; _window.canvas.removeEventListener = _window.removeEventListener; } - const _wx$getSystemInfoSync = wx.getSystemInfoSync(); - const { platform } = _wx$getSystemInfoSync; + const { platform } = wx.getDeviceInfo(); // 开发者工具无法重定义 window if (platform === 'devtools') { for (const key in _window) { @@ -223,13 +222,10 @@ const isWK = false; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - const _wx$getSystemInfoSync = wx.getSystemInfoSync(); - const { screenWidth } = _wx$getSystemInfoSync; - const { screenHeight } = _wx$getSystemInfoSync; - const { devicePixelRatio } = _wx$getSystemInfoSync; + const { screenWidth, screenHeight, pixelRatio } = wx.getWindowInfo(); const innerWidth = exports.innerWidth = screenWidth; const innerHeight = exports.innerHeight = screenHeight; - exports.devicePixelRatio = devicePixelRatio; + exports.devicePixelRatio = pixelRatio; const screen = exports.screen = { availWidth: innerWidth, availHeight: innerHeight, @@ -247,9 +243,18 @@ const isWK = false; value: true, }); let performance = void 0; + let ori_performance = wx.getPerformance(); const initTime = Date.now(); + const ori_initTime = ori_performance.now(); const clientPerfAdapter = Object.assign({}, { now: function now() { + if (GameGlobal.unityNamespace.isDevelopmentBuild + && GameGlobal.unityNamespace.isProfilingBuild + && !GameGlobal.unityNamespace.isDevtools + && !GameGlobal.isIOSHighPerformanceMode) { + // 由于wx.getPerformance()获取到的是微秒级,因此这里需要/1000.0,进行单位的统一 + return (ori_performance.now() - ori_initTime) * 0.001; + } return (Date.now() - initTime); }, }); @@ -1216,8 +1221,7 @@ const isWK = false; }); const _util = __webpack_require__(9); // TODO 需要 wx.getSystemInfo 获取更详细信息 - const _wx$getSystemInfoSync = wx.getSystemInfoSync(); - const { platform } = _wx$getSystemInfoSync; + const { platform } = wx.getDeviceInfo(); const navigator = { platform, language: 'zh-cn', diff --git a/Runtime/wechat-default/weapp-adapter.js.meta b/Runtime/wechat-default/weapp-adapter.js.meta index e6427ee25..3ddad53f9 100644 --- a/Runtime/wechat-default/weapp-adapter.js.meta +++ b/Runtime/wechat-default/weapp-adapter.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f5a74eb5249c5850909df5137399217b +guid: 0b5db98a5dfa7901396e46810a193e49 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/workers/response/index.js.meta b/Runtime/wechat-default/workers/response/index.js.meta index 3283325f3..7ff41b86d 100644 --- a/Runtime/wechat-default/workers/response/index.js.meta +++ b/Runtime/wechat-default/workers/response/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1b58ed04ec942a2c30461b37131996e7 +guid: 837ec9cafe5fda438bf18308df2f6cdc DefaultImporter: externalObjects: {} userData: diff --git a/WebGLTemplates/WXTemplate/index.html b/WebGLTemplates/WXTemplate/index.html index 033790f21..2d4378230 100644 --- a/WebGLTemplates/WXTemplate/index.html +++ b/WebGLTemplates/WXTemplate/index.html @@ -209,9 +209,6 @@ WXUnlinkSync() {}, WXUnlink() {}, WXReportUserBehaviorBranchAnalytics() {}, - WXCallFunction() {}, - WXCallFunctionInit() {}, - WXCloudID() {}, WXWriteFile() {}, WXWriteStringFile() {}, WXAppendFile() {}, @@ -355,7 +352,8 @@ WX_UDPSocketSendString() {}, WX_UDPSocketSendBuffer() {}, WX_UDPSocketSetTTL() {}, - WX_UDPSocketWrite() {}, + WX_UDPSocketWriteString() {}, + WX_UDPSocketWriteBuffer() {}, WX_UDPSocketBind() {}, WX_RegisterUDPSocketOnMessageCallback() {}, WX_OnBLECharacteristicValueChange() {}, @@ -368,6 +366,15 @@ WX_RegisterStartGyroscopeCallback() {}, WX_RegisterStopGyroscopeCallback() {}, WX_RegisterOnGyroscopeChangeCallback() {}, + WX_CloudCloud() {}, + WX_CloudInit() {}, + WX_CloudCallFunction() {}, + WX_CloudCloudID() {}, + WX_CloudCallContainer() {}, + WX_CloudUploadFile() {}, + WX_CloudDownloadFile() {}, + WX_CloudGetTempFileURL() {}, + WX_CloudDeleteFile() {}, WX_AddCard(conf, callbackId){}, WX_AuthPrivateMessage(conf, callbackId){}, @@ -400,6 +407,7 @@ WX_GetChannelsLiveNoticeInfo(conf, callbackId){}, WX_GetClipboardData(conf, callbackId){}, WX_GetConnectedBluetoothDevices(conf, callbackId){}, + WX_GetDeviceBenchmarkInfo(conf, callbackId){}, WX_GetExtConfig(conf, callbackId){}, WX_GetFuzzyLocation(conf, callbackId){}, WX_GetGameClubData(conf, callbackId){}, @@ -449,6 +457,7 @@ WX_ReportScene(conf, callbackId){}, WX_RequestMidasFriendPayment(conf, callbackId){}, WX_RequestMidasPayment(conf, callbackId){}, + WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeMessage(conf, callbackId){}, WX_RequestSubscribeSystemMessage(conf, callbackId){}, WX_RequirePrivacyAuthorize(conf, callbackId){}, @@ -500,7 +509,6 @@ WX_GetUserGameLiveDetails(conf, callbackId){}, WX_OpenChannelsLiveCollection(conf, callbackId){}, WX_OpenPage(conf, callbackId){}, - WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeLiveActivity(conf, callbackId){}, WX_OpenBusinessView(conf, callbackId){}, @@ -508,7 +516,6 @@ WX_OperateGameRecorderVideo() {}, WX_RemoveStorageSync() {}, WX_ReportEvent() {}, - WX_ReportMonitor() {}, WX_ReportPerformance() {}, WX_ReportUserBehaviorBranchAnalytics() {}, WX_RequestPointerLock() {}, @@ -566,6 +573,8 @@ WX_OffKeyboardInput() {}, WX_OnMemoryWarning() {}, WX_OffMemoryWarning() {}, + WX_OnMenuButtonBoundingClientRectWeightChange() {}, + WX_OffMenuButtonBoundingClientRectWeightChange() {}, WX_OnMessage() {}, WX_OnMouseDown() {}, WX_OffMouseDown() {}, @@ -660,7 +669,7 @@ WX_GetWindowInfo(){ return JSON.stringify({}); }, - WX_CreateImageData(){ + WX_CreateImageData(width, height){ return JSON.stringify({}); }, WX_CreatePath2D(){ diff --git a/WebGLTemplates/WXTemplate2020/index.html b/WebGLTemplates/WXTemplate2020/index.html index fbe967a85..402a7573d 100644 --- a/WebGLTemplates/WXTemplate2020/index.html +++ b/WebGLTemplates/WXTemplate2020/index.html @@ -281,9 +281,6 @@ WXUnlinkSync() {}, WXUnlink() {}, WXReportUserBehaviorBranchAnalytics() {}, - WXCallFunction() {}, - WXCallFunctionInit() {}, - WXCloudID() {}, WXWriteFile() {}, WXWriteStringFile() {}, WXAppendFile() {}, @@ -427,7 +424,8 @@ WX_UDPSocketSendString() {}, WX_UDPSocketSendBuffer() {}, WX_UDPSocketSetTTL() {}, - WX_UDPSocketWrite() {}, + WX_UDPSocketWriteString() {}, + WX_UDPSocketWriteBuffer() {}, WX_UDPSocketBind() {}, WX_RegisterUDPSocketOnMessageCallback() {}, WX_OnBLECharacteristicValueChange() {}, @@ -440,6 +438,15 @@ WX_RegisterStartGyroscopeCallback() {}, WX_RegisterStopGyroscopeCallback() {}, WX_RegisterOnGyroscopeChangeCallback() {}, + WX_CloudCloud() {}, + WX_CloudInit() {}, + WX_CloudCallFunction() {}, + WX_CloudCloudID() {}, + WX_CloudCallContainer() {}, + WX_CloudUploadFile() {}, + WX_CloudDownloadFile() {}, + WX_CloudGetTempFileURL() {}, + WX_CloudDeleteFile() {}, WX_AddCard(conf, callbackId){}, WX_AuthPrivateMessage(conf, callbackId){}, @@ -472,6 +479,7 @@ WX_GetChannelsLiveNoticeInfo(conf, callbackId){}, WX_GetClipboardData(conf, callbackId){}, WX_GetConnectedBluetoothDevices(conf, callbackId){}, + WX_GetDeviceBenchmarkInfo(conf, callbackId){}, WX_GetExtConfig(conf, callbackId){}, WX_GetFuzzyLocation(conf, callbackId){}, WX_GetGameClubData(conf, callbackId){}, @@ -521,6 +529,7 @@ WX_ReportScene(conf, callbackId){}, WX_RequestMidasFriendPayment(conf, callbackId){}, WX_RequestMidasPayment(conf, callbackId){}, + WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeMessage(conf, callbackId){}, WX_RequestSubscribeSystemMessage(conf, callbackId){}, WX_RequirePrivacyAuthorize(conf, callbackId){}, @@ -572,7 +581,6 @@ WX_GetUserGameLiveDetails(conf, callbackId){}, WX_OpenChannelsLiveCollection(conf, callbackId){}, WX_OpenPage(conf, callbackId){}, - WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeLiveActivity(conf, callbackId){}, WX_OpenBusinessView(conf, callbackId){}, @@ -580,7 +588,6 @@ WX_OperateGameRecorderVideo() {}, WX_RemoveStorageSync() {}, WX_ReportEvent() {}, - WX_ReportMonitor() {}, WX_ReportPerformance() {}, WX_ReportUserBehaviorBranchAnalytics() {}, WX_RequestPointerLock() {}, @@ -638,6 +645,8 @@ WX_OffKeyboardInput() {}, WX_OnMemoryWarning() {}, WX_OffMemoryWarning() {}, + WX_OnMenuButtonBoundingClientRectWeightChange() {}, + WX_OffMenuButtonBoundingClientRectWeightChange() {}, WX_OnMessage() {}, WX_OnMouseDown() {}, WX_OffMouseDown() {}, @@ -732,7 +741,7 @@ WX_GetWindowInfo(){ return JSON.stringify({}); }, - WX_CreateImageData(){ + WX_CreateImageData(width, height){ return JSON.stringify({}); }, WX_CreatePath2D(){ diff --git a/WebGLTemplates/WXTemplate2022/index.html b/WebGLTemplates/WXTemplate2022/index.html index 9e00e44c3..9bdb3d71e 100755 --- a/WebGLTemplates/WXTemplate2022/index.html +++ b/WebGLTemplates/WXTemplate2022/index.html @@ -358,9 +358,6 @@ WXUnlinkSync() {}, WXUnlink() {}, WXReportUserBehaviorBranchAnalytics() {}, - WXCallFunction() {}, - WXCallFunctionInit() {}, - WXCloudID() {}, WXWriteFile() {}, WXWriteStringFile() {}, WXAppendFile() {}, @@ -504,7 +501,8 @@ WX_UDPSocketSendString() {}, WX_UDPSocketSendBuffer() {}, WX_UDPSocketSetTTL() {}, - WX_UDPSocketWrite() {}, + WX_UDPSocketWriteString() {}, + WX_UDPSocketWriteBuffer() {}, WX_UDPSocketBind() {}, WX_RegisterUDPSocketOnMessageCallback() {}, WX_OnBLECharacteristicValueChange() {}, @@ -517,6 +515,15 @@ WX_RegisterStartGyroscopeCallback() {}, WX_RegisterStopGyroscopeCallback() {}, WX_RegisterOnGyroscopeChangeCallback() {}, + WX_CloudCloud() {}, + WX_CloudInit() {}, + WX_CloudCallFunction() {}, + WX_CloudCloudID() {}, + WX_CloudCallContainer() {}, + WX_CloudUploadFile() {}, + WX_CloudDownloadFile() {}, + WX_CloudGetTempFileURL() {}, + WX_CloudDeleteFile() {}, WX_AddCard(conf, callbackId){}, WX_AuthPrivateMessage(conf, callbackId){}, @@ -549,6 +556,7 @@ WX_GetChannelsLiveNoticeInfo(conf, callbackId){}, WX_GetClipboardData(conf, callbackId){}, WX_GetConnectedBluetoothDevices(conf, callbackId){}, + WX_GetDeviceBenchmarkInfo(conf, callbackId){}, WX_GetExtConfig(conf, callbackId){}, WX_GetFuzzyLocation(conf, callbackId){}, WX_GetGameClubData(conf, callbackId){}, @@ -598,6 +606,7 @@ WX_ReportScene(conf, callbackId){}, WX_RequestMidasFriendPayment(conf, callbackId){}, WX_RequestMidasPayment(conf, callbackId){}, + WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeMessage(conf, callbackId){}, WX_RequestSubscribeSystemMessage(conf, callbackId){}, WX_RequirePrivacyAuthorize(conf, callbackId){}, @@ -649,7 +658,6 @@ WX_GetUserGameLiveDetails(conf, callbackId){}, WX_OpenChannelsLiveCollection(conf, callbackId){}, WX_OpenPage(conf, callbackId){}, - WX_RequestMidasPaymentGameItem(conf, callbackId){}, WX_RequestSubscribeLiveActivity(conf, callbackId){}, WX_OpenBusinessView(conf, callbackId){}, @@ -657,7 +665,6 @@ WX_OperateGameRecorderVideo() {}, WX_RemoveStorageSync() {}, WX_ReportEvent() {}, - WX_ReportMonitor() {}, WX_ReportPerformance() {}, WX_ReportUserBehaviorBranchAnalytics() {}, WX_RequestPointerLock() {}, @@ -715,6 +722,8 @@ WX_OffKeyboardInput() {}, WX_OnMemoryWarning() {}, WX_OffMemoryWarning() {}, + WX_OnMenuButtonBoundingClientRectWeightChange() {}, + WX_OffMenuButtonBoundingClientRectWeightChange() {}, WX_OnMessage() {}, WX_OnMouseDown() {}, WX_OffMouseDown() {}, @@ -809,7 +818,7 @@ WX_GetWindowInfo(){ return JSON.stringify({}); }, - WX_CreateImageData(){ + WX_CreateImageData(width, height){ return JSON.stringify({}); }, WX_CreatePath2D(){ diff --git a/package.json b/package.json index e0611fb42..3d5a630c3 100644 --- a/package.json +++ b/package.json @@ -1 +1 @@ -{"name":"com.qq.weixin.minigame","displayName":"WXSDK","description":"WeChat Mini Game Tuanjie Engine Adapter SDK Package.","version":"0.1.18","unity":"2019.4","unityRelease":"29f1","keywords":["Tuanjie","WX"],"dependencies":{}} +{"name":"com.qq.weixin.minigame","displayName":"WXSDK","description":"WeChat Mini Game Tuanjie Engine Adapter SDK Package.","version":"0.1.19","unity":"2019.4","unityRelease":"29f1","keywords":["Tuanjie","WX"],"dependencies":{}}