diff --git a/.DS_Store.meta b/.DS_Store.meta new file mode 100644 index 00000000..e657f46c --- /dev/null +++ b/.DS_Store.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 5e0c24fa575f4498a37298e963ed4a1f +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 760f15c8..e10a8861 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/MiniGameConfig.asset b/Editor/MiniGameConfig.asset index 3f2ac660..0abf1245 100644 --- a/Editor/MiniGameConfig.asset +++ b/Editor/MiniGameConfig.asset @@ -13,13 +13,13 @@ MonoBehaviour: m_Name: MiniGameConfig m_EditorClassIdentifier: ProjectConf: - projectName: - Appid: + projectName: sdkadminup + Appid: wx7a727ff7d940bb3f CDN: - assetLoadType: 0 + assetLoadType: 1 compressDataPackage: 0 VideoUrl: - DST: + DST: /Users/hongtianyun/Documents/GitProjects/unity-wasm/SDKAdminUP/wxbuild StreamCDN: bundleHashLength: 32 bundlePathIdentifier: StreamingAssets; @@ -46,7 +46,7 @@ MonoBehaviour: UseMiniGameChat: 0 PreloadWXFont: 0 CompileOptions: - DevelopBuild: 0 + DevelopBuild: 1 AutoProfile: 0 ScriptOnly: 0 Il2CppOptimizeSize: 1 @@ -57,7 +57,8 @@ MonoBehaviour: ProfilingMemory: 0 CleanBuild: 0 CustomNodePath: - showMonitorSuggestModal: 1 + autoAdaptScreen: 0 + showMonitorSuggestModal: 0 enableProfileStats: 0 enableRenderAnalysis: 0 iOSAutoGCInterval: 10000 diff --git a/Editor/MiniGameConfig.asset.meta b/Editor/MiniGameConfig.asset.meta index 53e38aac..5c3573fa 100644 --- a/Editor/MiniGameConfig.asset.meta +++ b/Editor/MiniGameConfig.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fe134d53b5bcc45a2a2cde4341229134 +guid: 4db329984aff24f9aa2a98b2b0080d58 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/Editor/WXConvertCore.cs b/Editor/WXConvertCore.cs index ccd3c06d..6ad692df 100644 --- a/Editor/WXConvertCore.cs +++ b/Editor/WXConvertCore.cs @@ -1310,16 +1310,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(); } diff --git a/Editor/WXEditorSettingHelper.cs b/Editor/WXEditorSettingHelper.cs index a188dc15..3cca3898 100644 --- a/Editor/WXEditorSettingHelper.cs +++ b/Editor/WXEditorSettingHelper.cs @@ -107,7 +107,7 @@ namespace WeChatWASM { if (!formInputData[targetDst].Trim().Equals(string.Empty)) { - EditorUtility.RevealInFinder(formInputData[targetDst]); + EditorUtility.RevealInFinder(GetAbsolutePath(formInputData[targetDst])); } GUIUtility.ExitGUI(); } @@ -488,7 +488,7 @@ namespace WeChatWASM config.ProjectConf.compressDataPackage = this.getDataCheckbox("compressDataPackage"); config.ProjectConf.VideoUrl = this.getDataInput("videoUrl"); config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation"); - config.ProjectConf.DST = this.getDataInput("dst"); + config.ProjectConf.DST = GetAbsolutePath(this.getDataInput("dst")); config.ProjectConf.bundleHashLength = int.Parse(this.getDataInput("bundleHashLength")); config.ProjectConf.bundlePathIdentifier = this.getDataInput("bundlePathIdentifier"); config.ProjectConf.bundleExcludeExtensions = this.getDataInput("bundleExcludeExtensions"); @@ -670,7 +670,37 @@ namespace WeChatWASM GUILayout.EndHorizontal(); } + public static bool IsAbsolutePath(string path) + { + // 检查是否为空或空白 + if (string.IsNullOrWhiteSpace(path)) + { + return false; + } + + // 在 Windows 上,检查驱动器字母或网络路径 + if (Path.IsPathRooted(path)) + { + return true; + } + + // 在 Unix/Linux 和 macOS 上,检查是否以 '/' 开头 + if (path.StartsWith("/")) + { + return true; + } + + return false; // 否则为相对路径 + } + + public static string GetAbsolutePath(string path) + { + if (IsAbsolutePath(path)) + { + return path; + } + + return Path.Combine(Application.dataPath, path); + } } - - } diff --git a/Editor/WXPluginVersion.cs b/Editor/WXPluginVersion.cs index 173d2680..97deb89c 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 = "202409020328"; // 这一行不要改他,导出的时候会自动替换 } public class WXPluginConf diff --git a/Editor/wx-editor.dll b/Editor/wx-editor.dll index 1c88402a..58f0f30d 100644 Binary files a/Editor/wx-editor.dll and b/Editor/wx-editor.dll differ diff --git a/Editor/wx-editor.xml.meta b/Editor/wx-editor.xml.meta old mode 100644 new mode 100755 index 6f1c9288..50371aeb --- a/Editor/wx-editor.xml.meta +++ b/Editor/wx-editor.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1719462b86bf92b2183f2a29654d14bc +guid: ee1ea461b8c7903a1cf2142aff3e6bfe DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/.DS_Store.meta b/Runtime/.DS_Store.meta new file mode 100644 index 00000000..2b57e9b2 --- /dev/null +++ b/Runtime/.DS_Store.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: c3dd1616370eb2aa6b9db9f990c9c33e +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/Plugins.meta b/Runtime/Plugins.meta index 53b88058..ed00fb1e 100644 --- a/Runtime/Plugins.meta +++ b/Runtime/Plugins.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 286898b0c16c642bd8c6d58655b56db7 +guid: 7f9a0d6ca72d248589c57ea4377d485c folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/Plugins/SDK-Call-JS-Old.jslib b/Runtime/Plugins/SDK-Call-JS-Old.jslib index 4161b453..70eec440 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; @@ -999,5 +986,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 23e4c315..17a85e0b 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 fd092e99..7e7f9125 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/wx-runtime-editor.dll b/Runtime/Plugins/wx-runtime-editor.dll index eace04a2..eebcca5e 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 d1a77d77..cd7cc8de 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 old mode 100644 new mode 100755 index 4aee1873..7eb1051b --- 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: c301e9f29dbf55c57af66df4238d29a7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/Plugins/wx-runtime.dll b/Runtime/Plugins/wx-runtime.dll index 8bf9e84b..495c4c2b 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 88f72f01..052c8601 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 old mode 100644 new mode 100755 index 215621fb..a68ba3b5 --- a/Runtime/Plugins/wx-runtime.xml.meta +++ b/Runtime/Plugins/wx-runtime.xml.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a059cf8813f306b3aab52c161b8307af +guid: de423af855aafb3345848a7a99fd7719 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/WX.cs b/Runtime/WX.cs index fdb84166..046d53e3 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 589bc7ee..d82b1092 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/WXTouchInputOverride.cs b/Runtime/WXTouchInputOverride.cs index e081f196..ca48d174 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 73f554b6..705fd97e 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) { diff --git a/Runtime/wechat-default/check-version.js.meta b/Runtime/wechat-default/check-version.js.meta index f9c0db89..af9816f4 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: dfff26b194fcccc4836285fa0d9c0d98 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/data-package/game.js.meta b/Runtime/wechat-default/data-package/game.js.meta index a3ec106f..6ad48957 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: 0049d0f6061b1e8a1d11e3c8a6f51c58 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/events.js.meta b/Runtime/wechat-default/events.js.meta index 1c0ff687..2a784eb0 100644 --- a/Runtime/wechat-default/events.js.meta +++ b/Runtime/wechat-default/events.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 59cfd066f14f854efa857ecb2fadcf4f +guid: 78b4f9b66b4ef54343f8210d1d7dcf37 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.js b/Runtime/wechat-default/game.js index 74a5bd10..7df58beb 100644 --- a/Runtime/wechat-default/game.js +++ b/Runtime/wechat-default/game.js @@ -27,7 +27,7 @@ const managerConfig = { '$PRELOAD_LIST', ], contextConfig: { - contextType: $WEBGL_VERSION, // 1=>webgl1 2=>webgl2 3=>auto + contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2 }, }; GameGlobal.managerConfig = managerConfig; diff --git a/Runtime/wechat-default/game.js.meta b/Runtime/wechat-default/game.js.meta index d9a29457..675cf73b 100644 --- a/Runtime/wechat-default/game.js.meta +++ b/Runtime/wechat-default/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ec0c02137f9d2e4044b68f37374cd7d +guid: 346bd4ce2b7e4fcdaaf65746ccfe18b8 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.json.meta b/Runtime/wechat-default/game.json.meta index 2b13e930..ac55bcb4 100644 --- a/Runtime/wechat-default/game.json.meta +++ b/Runtime/wechat-default/game.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4a9ed3cdd5ee4249a9a0e9d362af10f1 +guid: 024ca1065c8725c7da91d414adeaebcc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/background.jpg.meta b/Runtime/wechat-default/images/background.jpg.meta index 69f093a8..e01b0acd 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: e153810f3d908c09402b1de52a2c23b7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/unity_logo.png.meta b/Runtime/wechat-default/images/unity_logo.png.meta index c3423893..7c5a77a7 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: 11dd176fc1f5763a66b9cf6e96766e1a 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 508f0b3b..2934cd65 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: 275b9053c1217c6fb339ddf01a70fe97 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 0a7a9ce1..27410cb5 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: 4abc0a85963dbc9c44ab415846d2d819 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/index.js.meta b/Runtime/wechat-default/open-data/index.js.meta index c3348fab..27156987 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: 8defb801cbc327f969bb74ab754b1499 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/loading.js.meta b/Runtime/wechat-default/open-data/loading.js.meta index 6a76bb3a..7839f5f0 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: 0554c15248641a77422e4321e87ec5a9 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 4d5f35d3..c6b2e003 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: 2173c453da6f220bbe3f67b0cc688d24 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 a73c028e..d6c239cd 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: 9c84e5670db8ba2d6316748b335fa4f3 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 0aa927d7..400039a5 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: 205163e0430708e6e4e98d238a23bd12 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 ed6e5bc9..3ca7e161 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: d027adf4a47b067b93d92b90e97df14c 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 681d0b97..40e55cc5 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: c9a520b8c082c7c66ab3c9ed7e2592e8 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 499b4cb3..c11b7c70 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: f286400bf5a5dd464e32679edbfdf870 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 edd79e8e..e09d9eb8 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: be48d8d78bf5fe4f9b2bb61326ceb68f 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 530a071e..9cbe7878 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: 2619a7f06552fc01b5a8514b099e7d95 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 d89fa70a..c8ccfa76 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: ecb963dac01198dcbd821061e80d2644 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 6ef84a56..1fc6bf45 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: 83c829342257482611520c070088a416 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 84a596d0..10e4c7fc 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: 330c15ba312b59cacf402404167dafd2 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 c4988707..b903b64e 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: 936ded143a689e661e4ac8ea9a1cdec5 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 0a69266a..85112957 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: 11fac6e9e0484229c4658ba15ef7fccf 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 8474fc67..0c8e3b0c 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: b080a050fe6ddf4f0b4196e8307dab15 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugin-config.js.meta b/Runtime/wechat-default/plugin-config.js.meta index ec1e871b..71493052 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: f3384687b60f40f3286651d6c5cb27f9 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/check-update.js.meta b/Runtime/wechat-default/plugins/check-update.js.meta index bd716efd..5182cc27 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: 5872a7ef8cecb95ddf48fbcdc8dd6a92 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/screen-adapter.js.meta b/Runtime/wechat-default/plugins/screen-adapter.js.meta index a4ddfb0c..4708e09f 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: 59696b55e9ee3fa501d2201508f1f1df DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/project.config.json.meta b/Runtime/wechat-default/project.config.json.meta index ce493cda..cf338536 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: 78690af98535c4021782890b8928bcb3 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/texture-config.js.meta b/Runtime/wechat-default/texture-config.js.meta index a5278daa..14400b85 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: 339bab12edc7add74458b1d74d10fd19 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-namespace.js b/Runtime/wechat-default/unity-namespace.js index 34f32e00..e063df21 100644 --- a/Runtime/wechat-default/unity-namespace.js +++ b/Runtime/wechat-default/unity-namespace.js @@ -131,62 +131,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 c8097260..c66d7534 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: 279fffcbffaf497fd5f57b40c10216ce DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta index 3c6a502d..ee4e618b 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: fcc0095aea70befe56bd21c25383a8ea DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js index a0955f1a..53141543 100644 --- a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js +++ b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js @@ -150,12 +150,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 +205,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 d45f4e56..e2b9591d 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: 5994681562af0b3d9ba702001f65a00a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/ad.js b/Runtime/wechat-default/unity-sdk/ad.js index 280878f8..4bcac819 100644 --- a/Runtime/wechat-default/unity-sdk/ad.js +++ b/Runtime/wechat-default/unity-sdk/ad.js @@ -34,7 +34,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 44ac0484..70e124a0 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: 94dd20feb7ffba1bcb5c02b813700aa3 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 578c5ebc..16c17dae 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: aedcacd4afcfea4164d7355d187bbc96 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 533ac42a..fd668b4f 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: 032114c13bfb8f6613f984d9aa25a900 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 24a0a431..6957af80 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: 6080dba0dbe45662337ab5a5d3f29c01 DefaultImporter: externalObjects: {} userData: 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 7fb1ed53..ddc77301 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: 3bf2aca4b5c8b57bf921b0b8ec8c6ca0 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 b269b1cd..be3d61ab 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: 24a9b606b3d3def8f1eca8a584fc8017 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 4afc7c74..4ed5b959 100644 --- a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js +++ b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js @@ -1033,12 +1033,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 +1061,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); 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 6ff2d036..a941392d 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: d62706452a9b364af672a89f565e6189 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/utils.js.meta b/Runtime/wechat-default/unity-sdk/audio/utils.js.meta index 4e7c781f..c2017f21 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: 2d8dd05752a3ed24b64e7a3226d8fae4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/authorize.js.meta b/Runtime/wechat-default/unity-sdk/authorize.js.meta index 0934e77f..5027e0d0 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: 586bcbf250349c2742923940a95827f4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta b/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta index 5f51608b..64d210aa 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: 903da1af9a2f041bc456493bf2bb8a80 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/camera.js.meta b/Runtime/wechat-default/unity-sdk/camera.js.meta index b6e4cc40..ba151602 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: 5a22d9ae11fe1d03e8fc02ce1b219499 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 9ef2bf9f..cf50d99f 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: b669305590280dd077c797b5986c8d0a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/canvas.js.meta b/Runtime/wechat-default/unity-sdk/canvas.js.meta index e613c7ca..15d35882 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: 41cefd8e4c8eaa5d2f5c52b8aaf291ea DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/chat.js.meta b/Runtime/wechat-default/unity-sdk/chat.js.meta index 0f14c3e2..4aa9813c 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: 633fe153e1c65ad8d0c75415d1848594 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/cloud.js b/Runtime/wechat-default/unity-sdk/cloud.js index 7c6c4654..33ea9387 100644 --- a/Runtime/wechat-default/unity-sdk/cloud.js +++ b/Runtime/wechat-default/unity-sdk/cloud.js @@ -1,37 +1,252 @@ -import response from './response'; -import { formatJsonStr } from './utils'; +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); + + 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 5e27c860..a6319b14 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: bc8a42b76b381bb423b206cc95301761 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/conf.js.meta b/Runtime/wechat-default/unity-sdk/conf.js.meta index eea2d9db..f9ea5eee 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: b4cc9296a05b74874d773488f23ece5a 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 0ad8eebf..3225984c 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: 8387f0fcd20a51d177ea6f1da97bfa70 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fix.js.meta b/Runtime/wechat-default/unity-sdk/fix.js.meta index 59f563f9..46df20bc 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: 92e9820405a8303355da16006cf91450 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 4f3676f5..6edfc5c9 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: 87f6e81a4e617b443689f7cc1d611b84 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/index.js b/Runtime/wechat-default/unity-sdk/font/index.js index ec05a51a..3cbae297 100644 --- a/Runtime/wechat-default/unity-sdk/font/index.js +++ b/Runtime/wechat-default/unity-sdk/font/index.js @@ -5,7 +5,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; diff --git a/Runtime/wechat-default/unity-sdk/font/index.js.meta b/Runtime/wechat-default/unity-sdk/font/index.js.meta index 551ed519..96103494 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: 039aba3e4ee90180bf1126e4bc34abb0 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 5ef4edd8..6dfdd0b9 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: 6cf0b4ff0cfb9d4662dab3290ffc2221 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 663e7c03..258baead 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: ae6c4c3248d96ca83dfe72e0ac2a91b0 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 500315cc..9083246c 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: 516a9c608a6b0cdeff14dd9a207ebab3 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fs.js.meta b/Runtime/wechat-default/unity-sdk/fs.js.meta index 9cf3fe4d..b176bb53 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: 1a991e31383756599751889fb9c404f7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-club.js.meta b/Runtime/wechat-default/unity-sdk/game-club.js.meta index ea5fd636..7a41cf23 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: 20357736c763503aa6f1d3a48227d1be DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-recorder.js.meta b/Runtime/wechat-default/unity-sdk/game-recorder.js.meta index b29c3929..69fc8c9a 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: ba5fccd991f10e42aebf38afd82eb4e8 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta b/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta index 0ab54ecc..5d7004c1 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: 83aad5234578f52ed2d2da3d34f177d2 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/index.js.meta b/Runtime/wechat-default/unity-sdk/index.js.meta index 7fb94c06..37d5e23e 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: e433c9369e52fdaca3d1526ced6ed808 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/logger.js.meta b/Runtime/wechat-default/unity-sdk/logger.js.meta index a7deabd8..0d28ed59 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: 952337abf708e6b9f1df102d6dcc9846 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 71a0d49c..89939b01 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: d92a6a7a341dedfad56626109e33935f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/module-helper.js.meta b/Runtime/wechat-default/unity-sdk/module-helper.js.meta index 9b607e6d..df74bfc5 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: 0760eca82c7171ec53c660aef33797df 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 7b912618..313443b1 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: a75ccb83bb7fb25e8cc00384f7d711a3 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/recorder.js.meta b/Runtime/wechat-default/unity-sdk/recorder.js.meta index 1457bc9d..5ce0ba34 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: 579a83880705aab1f0127e15f90ae1dc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resType.js b/Runtime/wechat-default/unity-sdk/resType.js index 6c96c1f4..9235347b 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 be8e4409..644dda03 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: 7b0e1156a986ceab8ecb72304878fc4c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resTypeOther.js b/Runtime/wechat-default/unity-sdk/resTypeOther.js index 3e50c1cb..9ca8b5a4 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 5d4642eb..e5331f86 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: 105791af4a567b09a3d2ffedb04d8859 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/response.js b/Runtime/wechat-default/unity-sdk/response.js index 9377fd1b..4251b7dc 100644 --- a/Runtime/wechat-default/unity-sdk/response.js +++ b/Runtime/wechat-default/unity-sdk/response.js @@ -48,31 +48,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 d2a0f31a..f29afe78 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: 3b25b865365b95d71e5c94ba66e8bb8b DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/sdk.js b/Runtime/wechat-default/unity-sdk/sdk.js index c6787c20..c0de7e82 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 5c47a07e..eacaf4c2 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: 9823c6ae92b8306b170b69f228a72e14 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/share.js.meta b/Runtime/wechat-default/unity-sdk/share.js.meta index 331ec81a..00e9f533 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: 7e3b5b8553d4b33711358a5bdf250021 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/storage.js.meta b/Runtime/wechat-default/unity-sdk/storage.js.meta index 6af60127..49c1db13 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: 0c728c83938e3b881aeb585379d6bafc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/texture.js b/Runtime/wechat-default/unity-sdk/texture.js index 3b58a1a9..47e884bc 100644 --- a/Runtime/wechat-default/unity-sdk/texture.js +++ b/Runtime/wechat-default/unity-sdk/texture.js @@ -251,16 +251,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 a9317262..133be644 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: 1a7a15ccddf243631368da0106c8ae74 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/touch/index.js.meta b/Runtime/wechat-default/unity-sdk/touch/index.js.meta index a604d4c2..358aa990 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: d01cd19ed4f2af8bd7b016375e2c542b 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 5c1a5c39..a703be82 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: eb1dbd7597276f4f93fa501769103a93 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/userinfo.js.meta b/Runtime/wechat-default/unity-sdk/userinfo.js.meta index ef3348af..06c9de33 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: a474bf84f85eada4f7ae834d5b56febf DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/util.js.meta b/Runtime/wechat-default/unity-sdk/util.js.meta index aa73c5ad..6f105ff2 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: c46738f59bf30011883f553566d5e9ae DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/utils.js b/Runtime/wechat-default/unity-sdk/utils.js index 054b88f1..a47a2eb3 100644 --- a/Runtime/wechat-default/unity-sdk/utils.js +++ b/Runtime/wechat-default/unity-sdk/utils.js @@ -106,6 +106,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 +174,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 a3eee6f5..4295ae94 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: 1a51114fc68f79c38b7ba9431a5ec55a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video.js.meta b/Runtime/wechat-default/unity-sdk/video.js.meta index 9e616220..c7621047 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: d6fa4c15aba99c78d015e25af60751d2 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video/index.js.meta b/Runtime/wechat-default/unity-sdk/video/index.js.meta index 7fdf253f..198892fe 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: 65c7bf2d7af0b3646375a18fccfc3f9b DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/wasmcode/game.js.meta b/Runtime/wechat-default/wasmcode/game.js.meta index a4f158a5..a5882c9a 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: fe945564b19170f944e9fa5e4465941c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/weapp-adapter.js b/Runtime/wechat-default/weapp-adapter.js index 10dc9aaf..344bb4fa 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, @@ -1216,8 +1212,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 e6427ee2..f97de111 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: d8964b58589fdb00adf31549550cab73 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/workers/response/index.js.meta b/Runtime/wechat-default/workers/response/index.js.meta index 3283325f..4fd601ad 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: 4d89f0baf5eadfb0491f8ed0a94ec1fc DefaultImporter: externalObjects: {} userData: diff --git a/WebGLTemplates/WXTemplate/index.html b/WebGLTemplates/WXTemplate/index.html index 033790f2..2d437823 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 fbe967a8..402a7573 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 9e00e44c..9bdb3d71 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 e0611fb4..650163cc 100644 --- a/package.json +++ b/package.json @@ -1 +1,14 @@ -{"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.1", + "unity": "2019.4", + "unityRelease": "29f1", + "keywords": [ + "Tuanjie", + "WX" + ], + "dependencies": { + } +} \ No newline at end of file