提交 4d1611c7 作者: 闫永超

合并分支 'release' 到 'master'

fix: 更新UnitySDK对接文档中的图片链接&&SDK对接文档增加导出目录的说明

查看合并请求 zwwl/zw_game_sdk!250
...@@ -14,7 +14,7 @@ MonoBehaviour: ...@@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
tag: 0 tag: 0
wasmResourceUrl: http:// wasmResourceUrl: http://
OutputDir: E:\UnityProject\UnityTrunckPro_SDK\tt_miniGame OutputDir: E:\UnitySDKTrunck_Comm\UnityTrunckPro_SDK\MiniGameExport\Tiktok
useByteAudioAPI: 0 useByteAudioAPI: 0
wasmMemorySize: 128 wasmMemorySize: 128
isWebGL2: 0 isWebGL2: 0
...@@ -52,7 +52,7 @@ MonoBehaviour: ...@@ -52,7 +52,7 @@ MonoBehaviour:
_appId: ttb5fdc3402aff253307 _appId: ttb5fdc3402aff253307
version: version:
autoVersion: 0 autoVersion: 0
_webglPackagePath: E:\UnityProject\UnityTrunckPro_SDK\tt_miniGame\webgl_package-20251125_113539.zip _webglPackagePath: E:\UnitySDKTrunck_Comm\UnityTrunckPro_SDK\MiniGameExport\Tiktok\webgl_package-20251125_151148.zip
_orientation: 0 _orientation: 0
_iOSPerformancePlus: 0 _iOSPerformancePlus: 0
_menuButtonStyle: 0 _menuButtonStyle: 0
......
# UnitySDK 对接文档 # UnitySDK  对接文档
# UnitySDK 对接文档 # UnitySDK  对接文档
# 拉取项目注意点(这一步必须做) # 拉取项目注意点(这一步必须做)
刚开始拉取下来会有报错如下: 刚开始拉取下来会有报错如下:
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/943a496b-0dec-422c-a7e7-075eefc8c8a3.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405362569255279f1d79.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/bfa0c8bb-8e81-4df8-9d26-1d6e1e4510c3.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764054247692554e7cb827.jpg)
这是因为微信跟抖音小游戏在同一工程内,内置PlayerPrefs命名空间冲突,需要本地手动改下,打开报错的当前脚本,Ctrl+F,搜索当前脚本里面的PlayerPrefs,然后把PlayerPrefs替换成UnityEngine.PlayerPrefs 即可 这是因为微信跟抖音小游戏在同一工程内,内置 PlayerPrefs 命名空间冲突,需要本地手动改下,打开报错的当前脚本,Ctrl+F,搜索当前脚本里面的 PlayerPrefs,然后把 PlayerPrefs 替换成 UnityEngine.PlayerPrefs  即可
# 1.安卓 # 1.安卓
## 1.主要目录介绍 ## 1.主要目录介绍
1. AndroidClass.cs 是实现安卓的回调接口,AndroidSdk 是unity层Sdk的桥接代码 1. AndroidClass.cs  是实现安卓的回调接口,AndroidSdk  是 unity 层 Sdk 的桥接代码
![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640542846925550c1be0f.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/d60627e1-c50f-443f-bc72-bbe28991eb19.png) 2.该文件夹存放安卓端的一些 Sdk 打包所需配置(包括拉取远端仓库等。)
2.该文件夹存放安卓端的一些Sdk打包所需配置(包括拉取远端仓库等。) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405428869255510267db.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/dbf10ca6-f391-4e61-a1e5-9fedf04929bc.png)
## 2.调用流程介绍 ## 2.调用流程介绍
ps:可以先看下SDKExample.cs 里面包含了安卓、ios等调用 ps:可以先看下 SDKExample.cs  里面包含了安卓、ios 等调用
1. ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/c98ed441-633d-4e3b-ad80-1c1c20626efc.png),需要放到Awake里,最优先调用
1. ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640542926925551490637.jpg),需要放到 Awake 里,最优先调用
2.调用![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/bf683ace-1e9a-4191-9105-b7b9901d4b9c.png) 这个是获取游戏配置,第一次会拉起隐私协议。 2.调用![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640542956925551776d02.jpg)  这个是获取游戏配置,第一次会拉起隐私协议。
3.SDKManager里包含了集成SDK的所有方法,里面有标注,集合方法是所有平台都有的方法,做了封装处理,因为有独有的方法,请注意甄别使用。 3.SDKManager 里包含了集成 SDK 的所有方法,里面有标注,集合方法是所有平台都有的方法,做了封装处理,因为有独有的方法,请注意甄别使用。
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/02f198c0-c69e-4881-9d1f-0d1a29ac161d.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640544076925558734b99.jpg)
4.回调处理,json的具体参数请查看安卓文档说明  ps: "status\_code" :1 成功回调,”status\_code“:0 失败回调 4.回调处理,json 的具体参数请查看安卓文档说明   ps: "status_code" :1  成功回调,”status_code“:0  失败回调
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/7ec356b4-a319-4dd1-8a60-b862fde3f42e.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764054803692557134ab93.jpg)
## 3.出包(空项目的情况下): ## 3.出包(空项目的情况下):
切换到安卓环境=>build,直接能导出,可以参考打包luncher场景。 切换到安卓环境=>build,直接能导出,可以参考打包 luncher 场景。
## 4.方法对应参数: ## 4.方法对应参数:
[Android游戏广告媒体对接说明文档.md · Android · zwwl / zw\_game\_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/Android/Android%E6%B8%B8%E6%88%8F%E5%B9%BF%E5%91%8A%E5%AA%92%E4%BD%93%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) [Android 游戏广告媒体对接说明文档.md · Android · zwwl / zw_game_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/Android/Android%E6%B8%B8%E6%88%8F%E5%B9%BF%E5%91%8A%E5%AA%92%E4%BD%93%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md)
# 2.IOS  # 2.IOS 
## 1.主要目录介绍 ## 1.主要目录介绍
1. IOSSdk 是unity层Sdk的代码,ZYouBridge.mm是桥接代码 通过Unity的\[DllImport("\_\_Internal")\] 来调用。 1. IOSSdk  是 unity 层 Sdk 的代码,ZYouBridge.mm 是桥接代码   通过 Unity 的\[DllImport("\_\_Internal")\]  来调用。
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/401c3d0a-3154-477d-9206-c7446da60b6f.png)![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/610d1096-ef58-4ef8-90b4-779880121795.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640544146925558e212e7.jpg)![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764054418692555920e3e8.jpg)
2.该文件夹存放ios的库和原生SDK文件,表格等 2.该文件夹存放 ios 的库和原生 SDK 文件,表格等
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/5f8c6af5-ca06-4f11-b084-e8f8e14fc9a8.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764054883692557632b205.jpg)
## 2.调用流程介绍 ## 2.调用流程介绍
ps:可以先看下SDKExample.cs 里面包含了安卓、ios等调用 ps:可以先看下 SDKExample.cs  里面包含了安卓、ios 等调用
1. ![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/c98ed441-633d-4e3b-ad80-1c1c20626efc.png),需要放到Awake里,最优先调用 1. ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488369255763299f4.jpg),需要放到 Awake 里,最优先调用
2.调用![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405536769255947bd1ad.jpg)  这个是获取游戏配置,第一次会拉起隐私协议。
2.调用![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/bf683ace-1e9a-4191-9105-b7b9901d4b9c.png) 这个是获取游戏配置,第一次会拉起隐私协议 3.SDKManager 里包含了集成 SDK 的所有方法,里面有标注,集合方法是所有平台都有的方法,做了封装处理,因为有独有的方法,请注意甄别使用
3.SDKManager里包含了集成SDK的所有方法,里面有标注,集合方法是所有平台都有的方法,做了封装处理,因为有独有的方法,请注意甄别使用。 ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640548836925576329512.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/02f198c0-c69e-4881-9d1f-0d1a29ac161d.png) 4.回调处理,json 的具体参数请查看 ios 文档说明
4.回调处理,json的具体参数请查看ios文档说明  ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640548836925576300cae.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/ed9d0216-7af2-4bba-91bb-da4aa9c19395.png)
## 3.出包(空项目的情况下): ## 3.出包(空项目的情况下):
切换到ios环境=>build,直接能导出,可以参考打包luncher场景。 切换到 ios 环境=>build,直接能导出,可以参考打包 luncher 场景。
## 4.相关配置参数 ## 4.相关配置参数
[iossdk\_appstore\_bridge对接说明文档.md · ios\_zlj · zwwl / zw\_game\_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/ios_zlj/iOSSDK%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) [iossdk_appstore_bridge 对接说明文档.md · ios_zlj · zwwl / zw_game_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/ios_zlj/iOSSDK%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md)
## 5.打包Unity项目到Xcode ## 5.打包 Unity 项目到 Xcode
切换到ios环境=>build,直接能导出Xcode工程,可以参考打包luncher场景。 切换到 ios 环境=>build,直接能导出 Xcode 工程,可以参考打包 luncher 场景。
Xcode相关配置:[iossdk\_appstore\_bridge对接说明文档.md · ios\_zlj · zwwl / zw\_game\_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/ios_zlj/iossdk_appstore_bridge%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md) Xcode 相关配置:[iossdk_appstore_bridge 对接说明文档.md · ios_zlj · zwwl / zw_game_sdk · GitLab](https://git.wozhangwan.com/zwwl/zw_game_sdk/blob/ios_zlj/iossdk_appstore_bridge%E5%AF%B9%E6%8E%A5%E8%AF%B4%E6%98%8E%E6%96%87%E6%A1%A3.md)
# 3.微信小游戏 # 3.微信小游戏
## 1.主要目录介绍 ## 1.主要目录介绍
1. sdk.js原文件位置跟wxSdkBridge.js桥接代码位置如下,默认会被打进包里,wxSdkBridge.js文件的主要作用是封装sdk.js,C#层来调用 1. sdk.js 原文件位置跟 wxSdkBridge.js 桥接代码位置如下,默认会被打进包里,wxSdkBridge.js 文件的主要作用是封装 sdk.js,C#层来调用
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/f3dd8535-ec35-40b3-a7f0-a85c79142364.png)
2. C#跟js桥接文件位置如下,后续开发者层不用维护(做成统一 一套了),只用关心wxSdkBridge.js和C#回调层 ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488269255762e05d9.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/0ae44e4c-f013-44d4-b08d-0c11f162a47f.png) 2. C#跟 js 桥接文件位置如下,后续开发者层不用维护(做成统一   一套了),只用关心 wxSdkBridge.js 和 C#回调层
3. 小游戏(微信+抖音)统一回调处理类(**MiniGameSDKBridge.cs**),主要有两个方法,jsSdk成功返回的回调OnSuccessCallBack,失败返回的回调OnFailureCallBack ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488269255762d847f.jpg)
3. 小游戏(微信+抖音)统一回调处理类(**MiniGameSDKBridge.cs**),主要有两个方法,jsSdk 成功返回的回调 OnSuccessCallBack,失败返回的回调 OnFailureCallBack
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/edc4f355-65e0-412c-8b8d-0209773e0df2.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488269255762dfe5d.jpg)
## 2.调用流程介绍 ## 2.调用流程介绍
1. 场景初始化统一都在**Launch.unity** 场景,所有按钮初始化都是通过Canvas上的SDKExample.cs脚本初始化(里面区分各个平台,启动的时候会自动初始化各个平台的调用触发按钮),如果有新增的方法,自己按照顺序自行绑定即可 1. 场景初始化统一都在**Launch.unity**  场景,所有按钮初始化都是通过 Canvas 上的 SDKExample.cs 脚本初始化(里面区分各个平台,启动的时候会自动初始化各个平台的调用触发按钮),如果有新增的方法,自己按照顺序自行绑定即可
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/41f37818-dcd6-4849-a507-139e5fe477e6.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488269255762ee9c0.jpg)
2. 各个平台的调用管理,都通过**SDKManager.cs**进行统一分发处理,里面区分了宏定义,以初始化SDK为例子,外层按钮绑定调用只用关心InitSdk()方法即可,方法内部会进行各个平台的区分(具体可自行看代码) 2. 各个平台的调用管理,都通过**SDKManager.cs**进行统一分发处理,里面区分了宏定义,以初始化 SDK 为例子,外层按钮绑定调用只用关心 InitSdk()方法即可,方法内部会进行各个平台的区分(具体可自行看代码)
![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405488269255762e593f.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/de80c6ad-0411-445f-a251-4ffe1565205e.png)
## 3.出包 ## 3.出包
### 1.导出微信小游戏 ### 1.导出微信小游戏
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/ab66e1b8-c64b-4f17-b819-31e3a427dc63.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586ac18d1.jpg)
![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586aa7443.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/80086988-de5a-4f70-bc04-9ff273d86aa7.png) 导出目录可以统一指定到跟 Asset 目录平级的 MiniGameExport/WeChat
导出包文件: 导出包文件:
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/917a37dd-72f4-4bd5-8e19-a216efd2133f.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586a86443.jpg)
### 2.导入微信小游戏开发者工具 ### 2.导入微信小游戏开发者工具
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/1cc8f0b2-4a99-455a-85d1-badf5dd130d4.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586abcbf8.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/98a632ef-39ed-482f-a313-f3b35eaa7118.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586a5c4ff.jpg)
1.   点击创建即可打开,如下所示,分别点击按钮(按钮名跟接入文档中的方法接口名字一致),Console面板中能成功显示回调回调成功即可, 1.    点击创建即可打开,如下所示,分别点击按钮(按钮名跟接入文档中的方法接口名字一致),Console 面板中能成功显示回调回调成功即可,
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/9502bf33-a10d-4916-b38e-8761cf9a6c0f.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586aa0f89.jpg)
2. 如果需要处理回调成功之后的业务逻辑,可以在MiniGameSDKBridge.cs的回调成功方法OnSuccessCallBack中处理各个方法的回调,也可根据需求新增Case和逻辑处理方法,如下: 2.  如果需要处理回调成功之后的业务逻辑,可以在 MiniGameSDKBridge.cs 的回调成功方法 OnSuccessCallBack 中处理各个方法的回调,也可根据需求新增 Case 和逻辑处理方法,如下:
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/f59469b1-c885-4396-a900-3c5c06a0ec83.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586a6ade3.jpg)
# 4.抖音小游戏 # 4.抖音小游戏
## 1.主要目录介绍 ## 1.主要目录介绍
1. dySdk.js原文件位置跟dySdkBridge.js桥接代码位置如下,默认会被打进包里,dySdkBridge.js文件的主要作用是封装sdk.js,C#层来调用 1. dySdk.js 原文件位置跟 dySdkBridge.js 桥接代码位置如下,默认会被打进包里,dySdkBridge.js 文件的主要作用是封装 sdk.js,C#层来调用
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/304f06fe-427e-4cbe-a744-c7f9834a6fe3.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586a1a811.jpg)
2.  C#跟js桥接文件位置如下,后续开发者层不用维护(做成统一 一套了),只用关心dySdkBridge.js和C#回调层,这个跟微信是一致的,不做过多赘述 2.  C#跟 js 桥接文件位置如下,后续开发者层不用维护(做成统一   一套了),只用关心 dySdkBridge.js 和 C#回调层,这个跟微信是一致的,不做过多赘述
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/823dd4b1-2cf2-4bf8-bc0a-861e35c2ef4b.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551456925586981c4f.jpg)
## 2.调用流程介绍 ## 2.调用流程介绍
...@@ -167,23 +162,24 @@ Xcode相关配置:[iossdk\_appstore\_bridge对接说明文档.md · ios\_zlj ...@@ -167,23 +162,24 @@ Xcode相关配置:[iossdk\_appstore\_bridge对接说明文档.md · ios\_zlj
1. 导出抖音小游戏 1. 导出抖音小游戏
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/70e994a0-c3fe-482f-84ae-c9ea4e4c1041.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405514569255869bc29f.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/2c451bde-9d6f-4c6d-b0fb-031b576beb47.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764055145692558698e6ff.jpg)
最下层,选中开发者工具路径,然后点击构建webGL,构建成功之后,会自动弹出在开发者工具打开 此处的导出目录可以选择 Asset 目录平级的 MiniGameExport/Tiktok
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/feacf7de-882a-4e61-9972-4515e18ee82b.png) 最下层,选中开发者工具路径,然后点击构建 webGL,构建成功之后,会自动弹出在开发者工具打开
导出之后跟Unity Assets 平级目录会打出tt-minigame的文件夹 ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/1764055145692558697fc76.jpg)
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/302bd804-b378-4002-876c-e5fbf3f097f9.png) 导出之后跟 Unity Assets  平级目录会打出 tt-minigame 的文件夹
2. 抖音开发者工具运行,回调成功即可, ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405514469255868bf8d2.jpg)
2. 抖音开发者工具运行,回调成功即可,
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/c3c07c5b-fed3-43e1-a9bc-0a111826bf5b.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/17640551466925586a1d25d.jpg)
3.如果需要处理回调成功之后的业务逻辑,可以在MiniGameSDKBridge.cs的回调成功方法OnSuccessCallBack中处理各个方法的回调(已经做了平台区分),也可根据需求新增Case和逻辑处理方法,如下: 3.如果需要处理回调成功之后的业务逻辑,可以在 MiniGameSDKBridge.cs 的回调成功方法 OnSuccessCallBack 中处理各个方法的回调(已经做了平台区分),也可根据需求新增 Case 和逻辑处理方法,如下:
![image.png](https://alidocs.oss-cn-zhangjiakou.aliyuncs.com/res/4maOgXbm5g37mlWN/img/59239872-4243-4ddd-9b3d-4e99dff0baf9.png) ![image.png](https://zyouapk.zwnet.cn/zhangsheng/staging/image/wangeditor/176405514569255869497ef.jpg)
\ No newline at end of file
...@@ -19,8 +19,8 @@ MonoBehaviour: ...@@ -19,8 +19,8 @@ MonoBehaviour:
assetLoadType: 1 assetLoadType: 1
compressDataPackage: 0 compressDataPackage: 0
VideoUrl: VideoUrl:
relativeDST: E:/MiniGame/WeChatDaoChu relativeDST: E:/UnitySDKTrunck_Comm/UnityTrunckPro_SDK/MiniGameExport/WeChat
DST: E:/MiniGame/WeChatDaoChu DST: E:/UnitySDKTrunck_Comm/UnityTrunckPro_SDK/MiniGameExport/WeChat
StreamCDN: StreamCDN:
bundleHashLength: 32 bundleHashLength: 32
bundlePathIdentifier: StreamingAssets; bundlePathIdentifier: StreamingAssets;
......
/**
* @dn-sdk/minigame v1.5.5
* (c) 2025
* @license ISC
*/function t(t,e,n){return(e=p(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t;}function e(t){return function(t){if(Array.isArray(t))return r(t);}(t)||function(t){if('undefined'!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t['@@iterator'])return Array.from(t);}(t)||n(t)||function(){throw new TypeError('Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');}();}function n(t,e){if(t){if('string'==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return'Object'===n&&t.constructor&&(n=t.constructor.name),'Map'===n||'Set'===n?Array.from(t):'Arguments'===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0;}}function r(t,e){;(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r;}function i(t,e){if('function'!=typeof e&&null!==e)throw new TypeError('Super expression must either be null or a function');t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,'prototype',{writable:!1}),e&&o(t,e);}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},o(t,e);}function a(t){var e=function(){if('undefined'==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if('function'==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0;}catch(t){return!1;}}();return function(){var n,r=s(t);if(e){var i=s(this).constructor;n=Reflect.construct(r,arguments,i);}else n=r.apply(this,arguments);return u(this,n);};}function u(t,e){if(e&&('object'===l(e)||'function'==typeof e))return e;if(void 0!==e)throw new TypeError('Derived constructors may only return object or undefined');return c(t);}function c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t;}function s(t){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},s(t);}function l(t){return l='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(t){return typeof t;}:function(t){return t&&'function'==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?'symbol':typeof t;},l(t);}function f(t,e){if(!(t instanceof e))throw new TypeError('Cannot call a class as a function');}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,'value'in r&&(r.writable=!0),Object.defineProperty(t,p(r.key),r);}}function v(t,e,n){return e&&d(t.prototype,e),n&&d(t,n),Object.defineProperty(t,'prototype',{writable:!1}),t;}function p(t){var e=function(t,e){if('object'!==l(t)||null===t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||'default');if('object'!==l(r))return r;throw new TypeError('@@toPrimitive must return a primitive value.');}return('string'===e?String:Number)(t);}(t,'string');return'symbol'===l(e)?e:String(e);}var h,y,_='LOCAL_ID',g='QUEUE_ACTIONS',m='CLICK_ID',A='QUEUE_LOST_MAP',R='REMOTE_CONFIG',k='REMOTE_COMMON_CONFIG',T='OPENID',E={init:'init',reporting:'reporting',fail:'fail'},S={maxSdkInstance:4,maxQueueLength:500,actionParamMaxLength:1e4,autoTrack:!0,reportThreshold:5,reportDelay:1,inspectDelay:30,cgiBatchSize:50,requestConcurrency:4,requestTimeout:1e4,signVersion:'1.0',realTimeActionList:['START_APP','REGISTER','PURCHASE']},b={JS_RUN_ERROR:'JS_RUN_ERROR',REQUEST_ERROR:'REQUEST_ERROR',REQUEST_CONFIG_ERROR:'REQUEST_CONFIG_ERROR',JS_QUEUE_LOG:'JS_QUEUE_LOG',PROXY_ERROR:'PROXY_ERROR',PROXY_POLYFILL:'PROXY_POLYFILL',QUEUE_LOST_NUM:'QUEUE_LOST_NUM',REQ_TOTAL:'REQ_TOTAL',SIGN_ERROR:'SIGN_ERROR'},O='ANDROID',I='IOS',w='WINDOWS',C='OSX',x='UNKNOWN',N=1e3,L=100,P=10,M='START_APP',D='ENTER_FOREGROUND',U='ENTER_BACKGROUND',q='ADD_TO_WISHLIST',j='PURCHASE',F='APP_QUIT',B='REGISTER',V='CREATE_ROLE',G='TUTORIAL_FINISH',K='TRUE',Q='FALSE',Y='TENCENT',W='BYTEDANCE',J='KUAISHOU',H='ALIBABA',z='BAIDU',$='OTHERS',X='UNKNOWN',Z='TICKET_INTERVAL_CHANGE',tt=(y=function(t){return''.concat('@dn-sdk/minigame','_').concat('production','_').concat(t);},{getSync:function(t){var e;try{e=wx.getStorageSync(y(t));}catch(t){return console.error('storage get error',t),e;}return e;},setSync:function(t,e){try{wx.setStorageSync(y(t),e);}catch(t){return console.error('storage set error',t),!1;}return!0;}}),et=function(){if(h)return h;try{return h=wx.getSystemInfoSync();}catch(t){return{};}},nt=function(){var t;return function(){if(!t){var e=et(),n=e.system,r=void 0===n?'':n,i=(null==r?void 0:r.split(' '))||[],o=function(t){if(!t)return x;var e=(null==t?void 0:t.toUpperCase())||'';return e.indexOf('ANDROID')>-1?O:e.indexOf('IOS')>-1?I:e.indexOf('MAC')>-1?C:e.indexOf('WINDOWS')>-1?w:x;}(i[0]),a=function(t){return!t||t.length<=0?'':2===t.length?t[1]:3===t.length&&'Windows'===t[0]?''.concat(t[1],' ').concat(t[2]):t[t.length-1];}(i);t={benchmark_level:e.benchmarkLevel,device_brand:e.brand,screen_height:Math.floor(e.screenHeight),screen_width:Math.floor(e.screenWidth),wx_lib_version:e.SDKVersion,wx_version:e.version,wx_platform:e.platform,device_model:e.model,os:o,os_version:a};}return t;};}(),rt=function(){var t;return function(){try{if(t)return t;t||(t=tt.getSync(_)||''),t||(t=mt(),tt.setSync(_,t));}catch(t){}return t;};}();var it=function(){var t='unknown',e=!1;return function(){if(!e)try{wx.getNetworkType({success:function(e){t=e.networkType;},fail:function(){t='unknown';}}),wx.onNetworkStatusChange(function(e){t=e.networkType;}),e=!0;}catch(t){}return t;};}();it();var ot=function(){var t='';return function(){return t||(t=tt.getSync(T)||''),t;};}(),at=function(){var t;return function(){if(t)return t;try{var e=wx.getAccountInfoSync();return ht(e.miniProgram)?t=e.miniProgram:{};}catch(e){return{};}};}();function ut(t){var e=null==t?void 0:t.query;if(!ht(e))return'';var n='';return e.gdt_vid||[1045,1046,1084].indexOf(null==t?void 0:t.scene)>-1?n=Y:e.clue_token||e.clickid&&e.item_id?n=W:e.callback&&'kuaishou'===e.ksChannel?n=J:e.bd_vid||e.ai&&e.d&&e.q&&e.c?n=z:e.uctrackid?n=H:(e.trackid||e.imp||[1065,1069,1194].indexOf(null==t?void 0:t.scene)>-1&&(e.callback||e.u))&&(n=$),n;}function ct(t,e){try{var n=nt(),r={sdk_version:'1.5.5',sdk_name:'@dn-sdk/minigame',device_brand:null==n?void 0:n.device_brand,device_model:null==n?void 0:n.device_model,wx_version:null==n?void 0:n.wx_version,wx_lib_version:null==n?void 0:n.wx_lib_version,wx_platform:null==n?void 0:n.wx_platform,os:null==n?void 0:n.os,os_version:null==n?void 0:n.os_version,local_id:rt()},i=Object.assign(r,t);wx.request({url:'https://api.datanexus.qq.com/data-nexus-trace/log',data:i,method:'POST',timeout:S.requestTimeout,success:function(t){'function'==typeof e&&200===(null==t?void 0:t.statusCode)&&e();}});}catch(n){xt.error(n);}}var st=function(){function t(){f(this,t);}return v(t,null,[{key:'revise',value:function(t){t>0&&!this.isRevised&&(this.offsetTime=t-Date.now(),this.isRevised=!0);}},{key:'getRevisedcurrentTimeMillis',value:function(){return this.isRevised?Date.now()+this.offsetTime:-1;}}]),t;}();function lt(t){return new Promise(function(e,n){wx.request({method:'POST',url:'https://api.datanexus.qq.com/data-nexus-config/v1/sdk/config/get',data:t,timeout:S.requestTimeout,success:function(t){ft(t,e,'config/get',n),vt(t);},fail:function(t){dt(t,'config/get',n);}});});}function ft(t,e,n,r){var i,o,a,u,c=null==t?void 0:t.statusCode,s=null==(i=null==t?void 0:t.data)?void 0:i.code;if(200!==c||0!==s){var l=s;200!==c&&(l='number'==typeof c?-1*c:-888),ct({log_type:b.REQUEST_CONFIG_ERROR,message:'cgiName: '.concat(n,', statusCode: ').concat(c,', code: ').concat(s,', traceid: ').concat(null==(a=null==t?void 0:t.data)?void 0:a.trace_id),code:l}),null==r||r(null==(u=null==t?void 0:t.data)?void 0:u.data);}else e(null==(o=t.data)?void 0:o.data);}function dt(t,e,n){ct({log_type:b.REQUEST_CONFIG_ERROR,message:'cgiName: '.concat(e,' , message: ').concat(null==t?void 0:t.errMsg,' '),code:'number'==typeof(null==t?void 0:t.errno)?-1*t.errno:-999}),null==n||n(t);}function vt(t){var e,n=1*(null==(e=null==t?void 0:t.header)?void 0:e['Server-Time']);n>17266752e5&&st.revise(n);};st.offsetTime=0,st.isRevised=!1;var pt=Object.prototype.toString,ht=function(t){return'[object Object]'===pt.call(t);},yt=function(t){return'[object Array]'===pt.call(t);},_t=function(t){return'[object Function]'===pt.call(t);},gt=new Date().getTime();function mt(){var t=new Date().getTime(),e=Math.abs(1e3*(t-gt));return'xxxxxxxxxxxx4xxxyxxxxxxxxxxxxxxx'.replace(/[xy]/g,function(n){var r=16*Math.random();return t>0?(r=(t+r)%16|0,t=Math.floor(t/16)):(r=(e+r)%16|0,e=Math.floor(e/16)),('x'===n?r:3&r|8).toString(16).replace(/-/g,'');});}var At=/^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+))?(?:-[\da-z\-]+(?:\.[\da-z\-]+)*)?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,Rt=function(t){if('string'!=typeof t)throw new TypeError('Invalid argument expected string');if(!At.test(t))throw new Error("Invalid argument not valid semver ('".concat(t,"' received)"));},kt=function(t){return isNaN(Number(t))?t:Number(t);},Tt=function(t){var e=t.replace(/^v/,'').replace(/\+.*$/,''),n=function(t,e){return-1===t.indexOf(e)?t.length:t.indexOf(e);}(e,'-'),r=e.substring(0,n).split('.');return r.push(e.substring(n+1)),r;},Et=function(t,e){;[t,e].forEach(Rt);for(var n=Tt(t),r=Tt(e),i=0;i<Math.max(n.length-1,r.length-1);i++){var o=parseInt(n[i]||'0',10),a=parseInt(r[i]||'0',10);if(o>a)return 1;if(a>o)return-1;}var u=n[n.length-1],c=r[r.length-1];if(u&&c)for(var s=u.split('.').map(kt),l=c.split('.').map(kt),f=0;f<Math.max(s.length,l.length);f++){if(void 0===s[f]||'string'==typeof l[f]&&'number'==typeof s[f])return-1;if(void 0===l[f]||'string'==typeof s[f]&&'number'==typeof l[f]||s[f]>l[f])return 1;if(l[f]>s[f])return-1;}else if(u||c)return u?-1:1;return 0;},St=function(t){return ht(t)?(function(t){var e=['user_action_set_id','secret_key','appid','openid','unionid','user_unique_id','auto_track','auto_attr'];for(var n in t)e.includes(n)||xt.warn("Invalid property '".concat(n,"' found in config"));}(t),'number'!=typeof t.user_action_set_id?'user_action_set_id 参数需为 number 类型':t.user_action_set_id<=0?'user_action_set_id 参数需大于 0':'string'!=typeof t.secret_key?'secret_key 参数需为 string 类型':''===t.secret_key.trim()?'缺少 secret_key 参数':32!==t.secret_key.length?'secret_key 参数需为 32 位字符串':'string'!=typeof t.appid?'appid 参数需为 string 类型':''!==t.appid.trim()||'缺少 appid'):'初始化参数需为 object 类型';};function bt(t){return Ot()[t];}function Ot(){return S;}function It(t,e){return Object.prototype.hasOwnProperty.call(t,e);}var wt=function(t){try{return t&&'string'==typeof t?-1===(t=t.replace(/\s/g,'')).indexOf('.')?t:t.split('.').slice(0,2).join('.'):'';}catch(e){return t;}},Ct=function(){function t(){f(this,t);}return v(t,null,[{key:'error',value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(e=console).error.apply(e,[''.concat('[@dn-sdk/minigame v1.5.5]',': ').concat(t)].concat(r));}},{key:'info',value:function(e){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];t.debug&&(n=console).info.apply(n,[''.concat('[@dn-sdk/minigame v1.5.5]',': ').concat(e)].concat(i));}},{key:'log',value:function(e){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];t.debug&&(n=console).log.apply(n,[''.concat('[@dn-sdk/minigame v1.5.5]',': ').concat(e)].concat(i));}},{key:'warn',value:function(t){for(var e,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];(e=console).warn.apply(e,[''.concat('[@dn-sdk/minigame v1.5.5]',': ').concat(t)].concat(r));}},{key:'devLog',value:function(e){for(var n,r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];t.isDev&&(n=console).log.apply(n,[''.concat('[@dn-sdk/minigame v1.5.5]',': ').concat(e)].concat(i));}}]),t;}(),xt=Ct;xt.debug=!1,xt.isDev=!1;var Nt=function(){var t;return function(){if(!t)try{var e=wx.getLaunchOptionsSync(),n=e.query.gdt_vid||'';n?tt.setSync(m,n):n=tt.getSync(m)||'';var r=JSON.stringify(e);r.length>1e4&&(r=JSON.stringify({cut:1,scene:e.scene})),t={source_scene:e.scene,pkg_channel_id:e.query.wxgamepro||'',ad_trace_id:n,launch_options:r,channel:ut(e)};}catch(e){;t={},xt.log('获取场景值和渠道号失败',e);}return t;};}();function Lt(t,e,n){var r=n.value;return n.value=function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];try{return r.apply(this,i);}catch(n){try{xt.error.apply(xt,['calling '.concat(t.constructor.name,'.').concat(e,' error with arguments')].concat(i)),xt.error(n);var a={log_type:b.JS_RUN_ERROR,message:'[safeExcutable] '.concat(t.constructor.name,'.').concat(e,': ').concat(null==n?void 0:n.message),err_stack:null==n?void 0:n.stack};_t(this.reportLog)?this.reportLog(a):ct(a);}catch(a){}}},n;}var Pt=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Dt=function(t,e,n,r){for(var i,o=r>1?void 0:r?Mt(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,n,o):i(o))||o);return r&&o&&Pt(e,n,o),o;},Ut=function(){function t(e){var n=e.userActionSetId,r=e.maxLength,i=void 0===r?500:r;f(this,t),this.lostActionMaps={},this.stack=[],this.localStorageKey='',this.localStorageKey=''.concat(g,'_').concat(null==n?void 0:n.toString()),this.maxLength=i,this.userActionSetId=n,this.setTimeStamp(),this.init();}return v(t,[{key:'getItems',value:function(){return this.stack;}},{key:'getStorage',value:function(){var t,e=(null==(t=tt)?void 0:t.getSync(this.localStorageKey))||'[]';return JSON.parse(e);}},{key:'reportLostNum',value:function(){var t=this,e=Object.assign({},this.lostActionMaps),n=[];for(var r in e){var i=null==r?void 0:r.split('_');n.push({queue_lost_session_id:i[0],queue_lost_timestamp:i[1],queue_lost_num:e[r]});}n.length&&(this.setTimeStamp(),n.forEach(function(e){var n=Object.assign({},{user_action_set_id:t.userActionSetId,log_type:b.QUEUE_LOST_NUM},e),r=null==e?void 0:e.queue_lost_session_id,i=null==e?void 0:e.queue_lost_timestamp,o=''.concat(r,'_').concat(i);ct(n,function(){It(t.lostActionMaps,o)&&(delete t.lostActionMaps[o],tt.setSync(A,JSON.stringify(t.lostActionMaps)));});}));}},{key:'getLostMaps',value:function(){return this.lostActionMaps;}},{key:'init',value:function(){var t=this,e=this.getStorage(),n=null==e?void 0:e.map(function(t){var e,n;return t.inner_status===(null==(e=E)?void 0:e.reporting)?Object.assign({},t,{inner_status:null==(n=E)?void 0:n.fail,is_retry:!0,retry_count:t.retry_count+1}):t;});this.stack=n,this.lostActionMaps=JSON.parse(tt.getSync(A)||'{}'),setTimeout(function(){t.reportLostNum();},1e3);}},{key:'addItem',value:function(t){var e;null==(e=null==this?void 0:this.stack)||e.push(t);}},{key:'removeItems',value:function(t){var e,n=null==(e=null==this?void 0:this.stack)?void 0:e.filter(function(e){return!(null!=t&&t.includes(null==e?void 0:e.action_id));});this.stack=n;}},{key:'updateForReportFail',value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map(function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=E)?void 0:n.fail,retry_count:e.retry_count+1,is_retry:!0}):e;});}},{key:'updateForReporting',value:function(t){var e;this.stack=null==(e=this.stack)?void 0:e.map(function(e){var n;return null!=t&&t.includes(null==e?void 0:e.action_id)?Object.assign({},e,{inner_status:null==(n=E)?void 0:n.reporting}):e;});}},{key:'updateAllStack',value:function(t){this.stack=t;}},{key:'updateToStorage',value:function(){tt.setSync(this.localStorageKey,JSON.stringify(this.stack));}},{key:'updateLostAction',value:function(t){if(t){var e=''.concat(t,'_').concat(this.timeStamp),n=this.lostActionMaps[e]||0;this.lostActionMaps[e]=n+1,tt.setSync(A,JSON.stringify(this.lostActionMaps));}}},{key:'setTimeStamp',value:function(){this.timeStamp=Date.now().toString();}}]),t;}();Dt([Lt],Ut.prototype,'getItems',1),Dt([Lt],Ut.prototype,'getStorage',1),Dt([Lt],Ut.prototype,'reportLostNum',1),Dt([Lt],Ut.prototype,'getLostMaps',1),Dt([Lt],Ut.prototype,'init',1),Dt([Lt],Ut.prototype,'addItem',1),Dt([Lt],Ut.prototype,'removeItems',1),Dt([Lt],Ut.prototype,'updateForReportFail',1),Dt([Lt],Ut.prototype,'updateForReporting',1),Dt([Lt],Ut.prototype,'updateAllStack',1),Dt([Lt],Ut.prototype,'updateToStorage',1),Dt([Lt],Ut.prototype,'updateLostAction',1);var qt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Ft=function(t,e,n,r){for(var i,o=r>1?void 0:r?jt(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,n,o):i(o))||o);return r&&o&&qt(e,n,o),o;},Bt=function(t){i(n,Ut);var e=a(n);function n(t){var r,i=t.userActionSetId,o=t.maxLength,a=void 0===o?500:o,u=t.ogEvents,c=void 0===u?[]:u;return f(this,n),(r=e.call(this,{userActionSetId:i,maxLength:a})).ogEvents=c,r;}return v(n,[{key:'getReportableActions',value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100,e=this.getItems(),n=[];return null==e||e.forEach(function(e){var r;(null==n?void 0:n.length)<t&&(null==e?void 0:e.inner_status)!==(null==(r=E)?void 0:r.reporting)&&(null==n||n.push(e));}),n;}},{key:'addAction',value:function(t){var e={code:0,msg:'成功',actionId:t.action_id},n=this.getItems();if((null==n?void 0:n.length)>=this.maxLength){var r='队列长度超过最大限制'.concat(this.maxLength,'条,SDK将按照行为优先级排序,丢弃优先级最低的行为事件');xt.warn(r),ct({user_action_set_id:this.userActionSetId,log_type:b.JS_QUEUE_LOG,message:r});var i=this.sortQueue(t,n);xt.debug&&xt.info('超过'.concat(this.maxLength,'条按优先级排序的队列:'),i.concat([]));var o=i.pop();this.updateAllStack(i),this.updateLostAction((null==o?void 0:o.session_id)||''),(null==o?void 0:o.action_id)===t.action_id&&(e={code:104,msg:'缓存队列已满,主动丢弃行为'});}else this.addItem(t);return this.updateToStorage(),e;}},{key:'removeActions',value:function(t){this.removeItems(t),this.updateToStorage();}},{key:'updateActionsForReportFail',value:function(t){this.updateForReportFail(t),this.updateToStorage();}},{key:'updateActionsForReporting',value:function(t){this.updateForReporting(t),this.updateToStorage();}},{key:'getReportableActionsLength',value:function(){var t=this.getItems().filter(function(t){var e;return(null==t?void 0:t.inner_status)!==(null==(e=E)?void 0:e.reporting);});return null==t?void 0:t.length;}},{key:'sortQueue',value:function(t,e){var n=this,r={},i=null==t?void 0:t.action_time,o=e.concat([t]),a=function(t){return r[t.action_id]||(r[t.action_id]=n.caculateWeight(i,t)),r[t.action_id];};return o.sort(function(t,e){return a(e)-a(t);});}},{key:'caculateWeight',value:function(t,e){var n,r=0,i=this.formatWeight(t,null==e?void 0:e.action_time),o=i.ogWeight,a=i.sdkWeight,u=i.userWeight;null!=(n=this.ogEvents)&&n.includes(null==e?void 0:e.action_type)&&(r+=o),null!=e&&e.is_sdk_auto_track?r+=a:r+=u;var c=t-(null==e?void 0:e.action_time)+1;return r=c>0?r+1/c:r;}},{key:'formatWeight',value:function(t,e){var n=N,r=P,i=L;return t-e>2592e6&&(n/=100,r/=100,i/=100),{ogWeight:n,sdkWeight:r,userWeight:i};}}]),n;}();Ft([Lt],Bt.prototype,'getReportableActions',1),Ft([Lt],Bt.prototype,'addAction',1),Ft([Lt],Bt.prototype,'removeActions',1),Ft([Lt],Bt.prototype,'updateActionsForReportFail',1),Ft([Lt],Bt.prototype,'updateActionsForReporting',1),Ft([Lt],Bt.prototype,'getReportableActionsLength',1),Ft([Lt],Bt.prototype,'sortQueue',1),Ft([Lt],Bt.prototype,'caculateWeight',1),Ft([Lt],Bt.prototype,'formatWeight',1);var Vt=function(){function t(){f(this,t),this.events={};}return v(t,[{key:'subscribe',value:function(e,n){t.checkCallback(n),yt(this.events[e])?this.events[e].push(n):this.events[e]=[n];}},{key:'once',value:function(e,n){t.checkCallback(n),this.subscribe(this.onceEventName(e),n);}},{key:'unsubscribe',value:function(e,n){t.checkCallback(n),yt(this.events[e])&&(this.events[e]=this.events[e].filter(function(t){return t!==n;})),yt(this.events[this.onceEventName(e)])&&(this.events[this.onceEventName(e)]=this.events[this.onceEventName(e)].filter(function(t){return t!==n;}));}},{key:'publish',value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];var i=Date.now();yt(this.events[t])&&this.events[t].forEach(function(t){return t.apply(void 0,[i].concat(n));}),yt(this.events[this.onceEventName(t)])&&(this.events[this.onceEventName(t)].forEach(function(t){return t.apply(void 0,[i].concat(n));}),this.events[this.onceEventName(t)]=[]);}},{key:'onceEventName',value:function(t){return'once_event_prefix_'.concat(t);}}],[{key:'checkCallback',value:function(e){_t(e)||xt.error(t.ERROR_CALLBACK_IS_NOT_A_FUNCTION);}}]),t;}(),Gt=Vt;Gt.ERROR_CALLBACK_IS_NOT_A_FUNCTION='callback 不是函数';var Kt=new Gt(),Qt=['REGISTER','VIEW_CONTENT','ADD_TO_CART','PURCHASE','COMPLETE_ORDER','ADD_TO_WISHLIST','START_APP','CREATE_ROLE','AUTHORIZE','TUTORIAL_FINISH','START_PAY','FINISH_PAY'],Yt='START_APP',Wt='TICKET',Jt='ENTER_FOREGROUND',Ht='ENTER_BACKGROUND',zt='LOGIN',$t='SHARE',Xt='TAP_GAME_CLUB',Zt='CREATE_GAME_CLUB',te='CREATE_GAME_ROOM',ee='JOIN_GAME_ROOM',ne='FINISH_PAY',re='START_PAY',ie='ADD_TO_WISHLIST',oe=['REGISTER','START_APP','RE_ACTIVE'],ae=['TICKET','ENTER_FOREGROUND','ENTER_BACKGROUND'],ue=function(){function t(){f(this,t),this.channelClaimActionList=oe,this.noClaimActionList=ae,this.realTimeActionList=S.realTimeActionList,this.ticketInterval=60,this.requestTimeout=S.requestTimeout,this.loadConfig();}return v(t,[{key:'getChannelClaimActionList',value:function(){return this.channelClaimActionList;}},{key:'getNoClaimActionList',value:function(){return this.noClaimActionList;}},{key:'getRealTimeActionList',value:function(){return this.realTimeActionList;}},{key:'getTicketInterval',value:function(){return this.ticketInterval;}},{key:'getRequestTimeout',value:function(){return this.requestTimeout;}},{key:'loadConfig',value:function(){var t=this;try{if('undefined'==typeof wx)return;var e=tt.getSync(k);e&&this.updateConfig(e),lt({conf_name:'mini_game_sdk_common',conf_key:'config'}).then(function(e){e&&ht(e)&&(t.updateConfig(e),tt.setSync(k,e));});}catch(e){console.error(e);}}},{key:'updateConfig',value:function(t){t.channelClaimActionList&&yt(t.channelClaimActionList)&&(this.channelClaimActionList=t.channelClaimActionList),t.noClaimActionList&&yt(t.noClaimActionList)&&(this.noClaimActionList=t.noClaimActionList),t.realTimeActionList&&yt(t.realTimeActionList)&&(this.realTimeActionList=t.realTimeActionList),t.ticketInterval&&'number'==typeof t.ticketInterval&&t.ticketInterval>1&&t.ticketInterval!==this.ticketInterval&&(this.ticketInterval=t.ticketInterval,Kt.publish(Z)),t.requestTimeout&&'number'==typeof t.requestTimeout&&t.requestTimeout>5e3&&(this.requestTimeout=t.requestTimeout);}}]),t;}(),ce=new ue(),se=Yt,le=Wt,fe=Jt,de=Ht,ve=function(){var t=!1,e=!1,n=!0,r=!0,i=!0,o=!1;return function(){if(!o){o=!0;var a=tt.getSync(R);if((null==a?void 0:a.bg)===K?t=!0:(null==a?void 0:a.bg)===Q&&(t=!1),(null==a?void 0:a.fg)===K?e=!0:(null==a?void 0:a.fg)===Q&&(e=!1),(null==a?void 0:a.st)===K?n=!0:(null==a?void 0:a.st)===Q&&(n=!1),(null==a?void 0:a.ti)===K?r=!0:(null==a?void 0:a.ti)===Q&&(r=!1),xt.devLog('当前缓存开关 bgOn,fgOn,stOn,tiOn:',t,e,n,r),n&&Kt.publish(se),r){var u=function(){i&&Kt.publish(le);},c=setInterval(u,1e3*ce.getTicketInterval());Kt.subscribe(Z,function(){c&&clearInterval(c),c=setInterval(u,1e3*ce.getTicketInterval());});}wx.onShow(function(t){if(i=!0,e){var n='';try{;(n=JSON.stringify(t)).length>1e4&&(n=JSON.stringify({cut:1,scene:t.scene}));}catch(t){}Kt.publish(fe,{enter_options:n});}}),wx.onHide(function(){;i=!1,t&&Kt.publish(de);});}};}(),pe='undefined'!=typeof globalThis?globalThis:'undefined'!=typeof window?window:'undefined'!=typeof global?global:'undefined'!=typeof self?self:{};wx.$adqSdkReport=Kt;function he(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,'default')?t.default:t;}var ye,_e=he(function(){var t,e=null;function n(t){return!!t&&('object'==l(t)||'function'==typeof t);}function r(t){if(null!==t&&!n(t))throw new TypeError('Object prototype may only be an Object or null: '+t);}var i=Object,o=!(!i.create&&{__proto__:null}instanceof i),a=i.create||(o?function(t){return r(t),{__proto__:t};}:function(t){if(r(t),null===t)throw new SyntaxError('Native Object.create is required to create objects with null prototype');var e=function(){};return e.prototype=t,new e();}),u=function(){return null;},c=i.getPrototypeOf||([].__proto__===Array.prototype?function(t){var e=t.__proto__;return n(e)?e:null;}:u);return t=function(s,l){if(void 0===(this&&this instanceof t?this.constructor:void 0))throw new TypeError("Constructor Proxy requires 'new'");if(!n(s)||!n(l))throw new TypeError('Cannot create proxy with a non-object as target or handler');var f=function(){};e=function(){;s=null,f=function(t){throw new TypeError("Cannot perform '".concat(t,"' on a proxy that has been revoked"));};},setTimeout(function(){e=null;},0);var d=l;for(var v in l={get:null,set:null,apply:null,construct:null},d){if(!(v in l))throw new TypeError("Proxy polyfill does not support trap '".concat(v,"'"));l[v]=d[v];}'function'==typeof d&&(l.apply=d.apply.bind(d));var p,h=c(s),y=!1,_=!1;'function'==typeof s?(p=function(){var t=this&&this.constructor===p,e=Array.prototype.slice.call(arguments);return f(t?'construct':'apply'),t&&l.construct?l.construct.call(this,s,e):!t&&l.apply?l.apply(s,this,e):t?(e.unshift(s),new(s.bind.apply(s,e))()):s.apply(this,e);},y=!0):s instanceof Array?(p=[],_=!0):p=o||null!==h?a(h):{};var g=l.get?function(t){return f('get'),l.get(this,t,p);}:function(t){return f('get'),this[t];},m=l.set?function(t,e){f('set'),l.set(this,t,e,p);}:function(t,e){f('set'),this[t]=e;},A=i.getOwnPropertyNames(s),R={};A.forEach(function(t){if(!y&&!_||!(t in p)){var e={enumerable:!!i.getOwnPropertyDescriptor(s,t).enumerable,get:g.bind(s,t),set:m.bind(s,t)};i.defineProperty(p,t,e),R[t]=!0;}});var k=!0;if(y||_){var T=i.setPrototypeOf||([].__proto__===Array.prototype?function(t,e){return r(e),t.__proto__=e,t;}:u);h&&T(p,h)||(k=!1);}if(l.get||!k)for(var E in s)R[E]||i.defineProperty(p,E,{get:g.bind(s,E)});return i.seal(s),i.seal(p),p;},t.revocable=function(n,r){return{proxy:new t(n,r),revoke:e};},t;}),ge={};try{ye||(ye=_e());}catch(h){Te(h);}function me(t,n,r,i){try{if(!ye||null==t||!t[n])return;t[n]=new ye(t[n],{apply:function(t,n,o){var a,u;i&&ke(function(){return i.apply(void 0,e(o));});var c=!!(null!=(a=o[0])&&a.success||null!=(u=o[0])&&u.fail);c&&['success','fail'].forEach(function(t){if(o[0][t])try{o[0][t]=new ye(o[0][t],{apply:function(n,i,a){return ke(function(){return r.apply(void 0,[t,o[0]].concat(e(a)));}),n.apply(i,a);}});}catch(t){Te(t);}});var s=t.apply(n,o);return!c&&s&&'[object Promise]'===Object.prototype.toString.call(s)?s.then(function(t){return ke(function(){return r('success',o[0],t);}),t;}).catch(function(t){throw ke(function(){return r('fail',o[0],t);}),t;}):s;}});}catch(t){Te(t);}}function Ae(t,n,r){try{if(!ye||null==t||!t[n])return;t[n]=new ye(t[n],{apply:function(t,n,i){var o='function'==typeof i[0];if(o)try{i[0]=new ye(i[0],{apply:function(t,n,i){var o=t.call.apply(t,[n].concat(e(i)));return ke(function(){return r(o);}),o;}});}catch(t){Te(t);}var a=t.call.apply(t,[n].concat(e(i)));return o||ke(function(){return r(a);}),a;}});}catch(t){Te(t);}}function Re(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:'',r=arguments.length>2?arguments[2]:void 0,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[],o=arguments.length>4?arguments[4]:void 0;try{if(!ye||null==t||!t[n])return;t[n]=new ye(t[n],{apply:function(t,a,u){var c=t.call.apply(t,[a].concat(e(u)));return(!r||!ge[n])&&(ke(function(){return null==o?void 0:o(c);}),i.forEach(function(t){var e=t.eventName,n=t.isAsync,r=t.proxyEvent;n?me(c,e,r):Ae(c,e,r);})),r&&(ge[n]=!0),c;}});}catch(t){Te(t);}}function ke(t){try{t();}catch(t){Te(t);}}function Te(t){ct({log_type:b.PROXY_ERROR,message:null==t?void 0:t.message,err_stack:null==t?void 0:t.stack});}var Ee=zt,Se=ie,be=$t,Oe=Xt,Ie=Zt,we=ee,Ce=re,xe=ne,Ne=function(){var t=!1;return function(){t||(t=!0,me(wx,'login',function(t){'success'===t&&Kt.publish(Ee);}),Ae(wx,'onAddToFavorites',function(){Kt.publish(Se);}),Ae(wx,'onShareTimeline',function(){Kt.publish(be,{target:'TIME_LINE',trigger:'MENU'});}),Ae(wx,'onShareAppMessage',function(){Kt.publish(be,{target:'APP_MESSAGE',trigger:'MENU'});}),Ae(wx,'shareAppMessage',function(){Kt.publish(be,{target:'APP_MESSAGE',trigger:'BUTTON'});}),Re(wx,'createGameClubButton',!1,[{isAsync:!1,eventName:'onTap',proxyEvent:function(){Kt.publish(Oe);}}],function(){Kt.publish(Ie);}),Re(wx,'getGameServerManager',!0,[{isAsync:!0,eventName:'createRoom',proxyEvent:function(t){'success'===t&&Kt.publish('CREATE_GAME_ROOM');}},{isAsync:!0,eventName:'joinRoom',proxyEvent:function(t){'success'===t&&Kt.publish(we);}}]),me(wx,'requestMidasPaymentGameItem',function(t,e){var n=(e||{}).signData;Kt.publish(xe,{status:'success'===t?'SUCCESS':'FAIL',quantity:(null==n?void 0:n.buyQuantity)||0,mode:(null==n?void 0:n.mode)||'',platform:(null==n?void 0:n.platform)||'',no:(null==n?void 0:n.outTradeNo)||'',p:(null==n?void 0:n.goodsPrice)||0,productId:(null==n?void 0:n.productId)||'',payType:'MidasGameItem'});},function(t){var e=(t||{}).signData;Kt.publish(Ce,{quantity:(null==e?void 0:e.buyQuantity)||0,mode:(null==e?void 0:e.mode)||'',platform:(null==e?void 0:e.platform)||'',no:(null==e?void 0:e.outTradeNo)||'',p:(null==e?void 0:e.goodsPrice)||0,productId:(null==e?void 0:e.productId)||'',payType:'MidasGameItem'});}));};}(),Le=function(){function t(){f(this,t);}return v(t,null,[{key:'isEmpty',value:function(t){return!t||''===t.trim();}},{key:'format',value:function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.replace(/\${(\d+)}/g,function(t,e){return n[e];});}},{key:'customStringify',value:function(t){var e=[];try{return JSON.stringify(t,function(t,n){if(void 0===n)return'undefined';if('object'==l(n)&&null!==n){if(-1!==e.indexOf(n))return'[Circular]';e.push(n);}return'bigint'==typeof n?n.toString():n;});}catch(t){return'[Param Error]';}}}]),t;}(),Pe=/^([a-zA-Z][a-zA-Z\d_]{0,63})$/i,Me=/^ams_reserved_(.*)/i,De=function(){function t(){f(this,t);}return v(t,null,[{key:'validateActionType',value:function(e){return Le.isEmpty(e)?(xt.error(t.ERROR_ACTION_TYPE_NULL),!1):!!Pe.test(e)||(xt.error(t.ERROR_ACTION_TYPE_INVALID),!1);}},{key:'validateActionParam',value:function(e){if(!e)return!0;if(!ht(e))return xt.error(t.ERROR_ACTION_PARAM_IS_NOT_OBJECT),!1;for(var n in e){if(Le.isEmpty(n))return xt.error(t.ERROR_ACTION_PARAM_KEY_NULL),!1;if(!Pe.test(n))return xt.error(t.ERROR_ACTION_PARAM_KEY_INVALID),!1;Me.test(n)&&xt.warn(t.WARN_ACTION_PARAM_KEY_RESERVED);var r=e[n];if(!t.isValidValue(r))return xt.error(Le.format(t.ERROR_ACTION_PARAM_VALUE_INVALID,n,r)),!1;if(yt(r)){if(!t.isValidArrayValue(r)){for(var i=0;i<r.length;i++)xt.error(Le.format(t.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID,n,Le.customStringify(r),i,r[i]));return!1;}if(!t.checkArrayElementTypes(r))return xt.error(t.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE),!1;}}return!0;}},{key:'isValidValue',value:function(t){return null==t||'string'==typeof t||'number'==typeof t||'boolean'==typeof t||yt(t);}},{key:'isValidArrayValue',value:function(t){for(var e=0;e<t.length;e++){var n=t[e];if('string'!=typeof n&&'number'!=typeof n&&'boolean'!=typeof n)return!1;}return!0;}},{key:'checkArrayElementTypes',value:function(t){if(!t||t.length<=1)return!0;for(var e=l(t[0]),n=1;n<t.length;n++)if(l(t[n])!==e)return!1;return!0;}}]),t;}(),Ue=De;Ue.ERROR_ACTION_TYPE_NULL='在track方法中,action_type参数不能为空!',Ue.ERROR_ACTION_TYPE_INVALID='在track方法中,action_type参数只能包含字母、数字和下划线,且只能以字母开头,长度不能超过64个字符!',Ue.ERROR_ACTION_PARAM_KEY_NULL='在track方法中,action_param参数的key不能为空!',Ue.ERROR_ACTION_PARAM_KEY_INVALID='在track方法中,action_param参数的key只能包含字母、数字和下划线,且不能以数字开头,长度不能超过64个字符!',Ue.WARN_ACTION_PARAM_KEY_RESERVED="SDK内部预留参数的key均以'ams_reserved_'开头,该参数的值会被SDK内部覆盖,请不要使用!",Ue.ERROR_ACTION_PARAM_VALUE_INVALID='在track方法中,action_param参数的value必须是String/Number/Boolean/Array中的一种![key=${0}, value=${1}]',Ue.ERROR_ACTION_PARAM_VALUE_ARRAY_INVALID='在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中的每个元素必须是String/Number/Boolean中的一种![key=${0}, value=${1}, 数组的第${2}个元素为${3}]',Ue.ERROR_ACTION_PARAM_VALUE_ARRAY_TYPE_UNUNIQUE='在track方法中,如果action_param参数中的某个元素的value是Array,那么这个Array中所有元素的类型必须是同一种!',Ue.ERROR_ACTION_PARAM_IS_NOT_OBJECT='action_param 参数不是Object';var qe={exports:{}};!function(t){!function(e){function n(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n;}function r(t,e,r,i,o,a){return n(function(t,e){return t<<e|t>>>32-e;}(n(n(e,t),n(i,a)),o),r);}function i(t,e,n,i,o,a,u){return r(e&n|~e&i,t,e,o,a,u);}function o(t,e,n,i,o,a,u){return r(e&i|n&~i,t,e,o,a,u);}function a(t,e,n,i,o,a,u){return r(e^n^i,t,e,o,a,u);}function u(t,e,n,i,o,a,u){return r(n^(e|~i),t,e,o,a,u);}function c(t,e){;t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;var r,c,s,l,f,d=1732584193,v=-271733879,p=-1732584194,h=271733878;for(r=0;r<t.length;r+=16)c=d,s=v,l=p,f=h,d=i(d,v,p,h,t[r],7,-680876936),h=i(h,d,v,p,t[r+1],12,-389564586),p=i(p,h,d,v,t[r+2],17,606105819),v=i(v,p,h,d,t[r+3],22,-1044525330),d=i(d,v,p,h,t[r+4],7,-176418897),h=i(h,d,v,p,t[r+5],12,1200080426),p=i(p,h,d,v,t[r+6],17,-1473231341),v=i(v,p,h,d,t[r+7],22,-45705983),d=i(d,v,p,h,t[r+8],7,1770035416),h=i(h,d,v,p,t[r+9],12,-1958414417),p=i(p,h,d,v,t[r+10],17,-42063),v=i(v,p,h,d,t[r+11],22,-1990404162),d=i(d,v,p,h,t[r+12],7,1804603682),h=i(h,d,v,p,t[r+13],12,-40341101),p=i(p,h,d,v,t[r+14],17,-1502002290),d=o(d,v=i(v,p,h,d,t[r+15],22,1236535329),p,h,t[r+1],5,-165796510),h=o(h,d,v,p,t[r+6],9,-1069501632),p=o(p,h,d,v,t[r+11],14,643717713),v=o(v,p,h,d,t[r],20,-373897302),d=o(d,v,p,h,t[r+5],5,-701558691),h=o(h,d,v,p,t[r+10],9,38016083),p=o(p,h,d,v,t[r+15],14,-660478335),v=o(v,p,h,d,t[r+4],20,-405537848),d=o(d,v,p,h,t[r+9],5,568446438),h=o(h,d,v,p,t[r+14],9,-1019803690),p=o(p,h,d,v,t[r+3],14,-187363961),v=o(v,p,h,d,t[r+8],20,1163531501),d=o(d,v,p,h,t[r+13],5,-1444681467),h=o(h,d,v,p,t[r+2],9,-51403784),p=o(p,h,d,v,t[r+7],14,1735328473),d=a(d,v=o(v,p,h,d,t[r+12],20,-1926607734),p,h,t[r+5],4,-378558),h=a(h,d,v,p,t[r+8],11,-2022574463),p=a(p,h,d,v,t[r+11],16,1839030562),v=a(v,p,h,d,t[r+14],23,-35309556),d=a(d,v,p,h,t[r+1],4,-1530992060),h=a(h,d,v,p,t[r+4],11,1272893353),p=a(p,h,d,v,t[r+7],16,-155497632),v=a(v,p,h,d,t[r+10],23,-1094730640),d=a(d,v,p,h,t[r+13],4,681279174),h=a(h,d,v,p,t[r],11,-358537222),p=a(p,h,d,v,t[r+3],16,-722521979),v=a(v,p,h,d,t[r+6],23,76029189),d=a(d,v,p,h,t[r+9],4,-640364487),h=a(h,d,v,p,t[r+12],11,-421815835),p=a(p,h,d,v,t[r+15],16,530742520),d=u(d,v=a(v,p,h,d,t[r+2],23,-995338651),p,h,t[r],6,-198630844),h=u(h,d,v,p,t[r+7],10,1126891415),p=u(p,h,d,v,t[r+14],15,-1416354905),v=u(v,p,h,d,t[r+5],21,-57434055),d=u(d,v,p,h,t[r+12],6,1700485571),h=u(h,d,v,p,t[r+3],10,-1894986606),p=u(p,h,d,v,t[r+10],15,-1051523),v=u(v,p,h,d,t[r+1],21,-2054922799),d=u(d,v,p,h,t[r+8],6,1873313359),h=u(h,d,v,p,t[r+15],10,-30611744),p=u(p,h,d,v,t[r+6],15,-1560198380),v=u(v,p,h,d,t[r+13],21,1309151649),d=u(d,v,p,h,t[r+4],6,-145523070),h=u(h,d,v,p,t[r+11],10,-1120210379),p=u(p,h,d,v,t[r+2],15,718787259),v=u(v,p,h,d,t[r+9],21,-343485551),d=n(d,c),v=n(v,s),p=n(p,l),h=n(h,f);return[d,v,p,h];}function s(t){var e,n='',r=32*t.length;for(e=0;e<r;e+=8)n+=String.fromCharCode(t[e>>5]>>>e%32&255);return n;}function l(t){var e,n=[];for(n[(t.length>>2)-1]=void 0,e=0;e<n.length;e+=1)n[e]=0;var r=8*t.length;for(e=0;e<r;e+=8)n[e>>5]|=(255&t.charCodeAt(e/8))<<e%32;return n;}function f(t){var e,n,r='0123456789abcdef',i='';for(n=0;n<t.length;n+=1)e=t.charCodeAt(n),i+=r.charAt(e>>>4&15)+r.charAt(15&e);return i;}function d(t){return unescape(encodeURIComponent(t));}function v(t){return function(t){return s(c(l(t),8*t.length));}(d(t));}function p(t,e){return function(t,e){var n,r,i=l(t),o=[],a=[];for(o[15]=a[15]=void 0,i.length>16&&(i=c(i,8*t.length)),n=0;n<16;n+=1)o[n]=909522486^i[n],a[n]=1549556828^i[n];return r=c(o.concat(l(e)),512+8*e.length),s(c(a.concat(r),640));}(d(t),d(e));}function h(t,e,n){return e?n?p(e,t):function(t,e){return f(p(t,e));}(e,t):n?v(t):function(t){return f(v(t));}(t);}t.exports?t.exports=h:e.md5=h;}(pe);}(qe);var je=he(qe.exports),Fe='function'==typeof btoa,Be='function'==typeof Buffer;'function'==typeof TextDecoder&&new TextDecoder();var Ve,Ge='function'==typeof TextEncoder?new TextEncoder():void 0,Ke=Array.prototype.slice.call('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=');Ve={},Ke.forEach(function(t,e){return Ve[t]=e;});var Qe=String.fromCharCode.bind(String);'function'==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array);var Ye=Fe?function(t){return btoa(t);}:Be?function(t){return Buffer.from(t,'binary').toString('base64');}:function(t){for(var e,n,r,i,o='',a=t.length%3,u=0;u<t.length;){if((n=t.charCodeAt(u++))>255||(r=t.charCodeAt(u++))>255||(i=t.charCodeAt(u++))>255)throw new TypeError('invalid character found');o+=Ke[(e=n<<16|r<<8|i)>>18&63]+Ke[e>>12&63]+Ke[e>>6&63]+Ke[63&e];}return a?o.slice(0,a-3)+'==='.substring(a):o;},We=Be?function(t){return Buffer.from(t).toString('base64');}:function(t){for(var e=[],n=0,r=t.length;n<r;n+=4096)e.push(Qe.apply(null,t.subarray(n,n+4096)));return Ye(e.join(''));},Je=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?Qe(192|e>>>6)+Qe(128|63&e):Qe(224|e>>>12&15)+Qe(128|e>>>6&63)+Qe(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return Qe(240|e>>>18&7)+Qe(128|e>>>12&63)+Qe(128|e>>>6&63)+Qe(128|63&e);},He=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,ze=Be?function(t){return Buffer.from(t,'utf8').toString('base64');}:Ge?function(t){return We(Ge.encode(t));}:function(t){return Ye(function(t){return t.replace(He,Je);}(t));};var $e=Object.defineProperty,Xe=Object.getOwnPropertyDescriptor,Ze=function(t,e,n,r){for(var i,o=r>1?void 0:r?Xe(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,n,o):i(o))||o);return r&&o&&$e(e,n,o),o;},tn=function(){function t(e){var n=this;f(this,t),this.cgiBatchSize=S.cgiBatchSize,this.reportThreshold=S.reportThreshold,this.reportDelay=S.reportDelay,this.triggerExecuteSend=function(t){var e,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=[];return function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return clearTimeout(e),e=setTimeout(function(){var e=t.apply(void 0,o);r.forEach(function(t){return t(e);}),r=[];},n),new Promise(function(t){return r.push(t);});};}(function(){n.executeSend();},1e3*this.reportDelay),this.inspectDelay=S.inspectDelay,this.inspectTimer=void 0,this.isNeedContinueSend=!1,this.getBaseInfo=e.getBaseInfo,this.reportLog=e.reportLog,this.queueManager=e.queueManager,this.configManager=e.configManager,this.flushSend(),this.startInspectTimer();}return v(t,[{key:'batchSend',value:function(){var t,e=this.queueManager.getReportableActions(this.reportThreshold);if(e.length>=this.reportThreshold)this.executeSend();else{var n=(null==(t=this.configManager)?void 0:t.getRealTimeActionList())||S.realTimeActionList;e.some(function(t){return n.indexOf(t.action_type)>-1&&!t.is_retry;})?this.executeSend():this.triggerExecuteSend();}this.startInspectTimer();}},{key:'flushSend',value:function(){this.executeSend();}},{key:'executeSend',value:function(){var e=this;if(t.currentRequestCount>=t.requestConcurrency)this.isNeedContinueSend=!0;else{this.isNeedContinueSend=!1;var n=(t.requestConcurrency-t.currentRequestCount)*this.cgiBatchSize,r=this.queueManager.getReportableActions(n),i=this.getBaseInfo();if(!i.openid&&!i.unionid&&(xt.warn('请尽快调用 setOpenId 或 setUnionId 方法设置用户ID!'),r=r.filter(function(t){return null==t?void 0:t.ad_trace_id;})),!(r.length<=0)){n<this.queueManager.getReportableActionsLength()&&(this.isNeedContinueSend=!0),t.currentRequestCount+=Math.ceil(r.length/this.cgiBatchSize);for(var o=[],a=0;a<r.length;a+=this.cgiBatchSize){var u=this.generateActionReportParams(r.slice(a,a+this.cgiBatchSize));o.push(this.report(u));}Promise.all(o).then(function(t){var n=t.some(function(t){return t>=0;});e.isNeedContinueSend&&n&&e.executeSend();}).catch(function(t){xt.error(t),e.reportLog({message:'executeSend catch: '.concat(t.message),log_type:b.JS_RUN_ERROR,err_stack:t.stack});});}}}},{key:'generateActionReportParams',value:function(t){var e=[],n=[],r=this.getBaseInfo();return t.forEach(function(t){n.push(t.action_id);var r=Object.assign({},t);delete r.inner_status,e.push(r);}),{data:{info:r,actions:e},actionIdList:n};}},{key:'dealSuccessData',value:function(t,e){;[51001,51003].indexOf(null==t?void 0:t.code)>-1?this.queueManager.updateActionsForReportFail(e):this.queueManager.removeActions(e),0!==(null==t?void 0:t.code)&&(this.reportLog({log_type:b.REQUEST_ERROR,code:null==t?void 0:t.code,message:'trace_id: '.concat(null==t?void 0:t.trace_id,',msg: ').concat(null==t?void 0:t.message)}),xt.error('上报失败:',t));}},{key:'dealFailData',value:function(t,e){this.queueManager.updateActionsForReportFail(e),this.reportLog({log_type:b.REQUEST_ERROR,code:t.code,message:t.message}),xt.error('上报失败:',t);}},{key:'report',value:function(e){var n=this,r=e.data,i=e.actionIdList;return this.queueManager.updateActionsForReporting(i),xt.debug&&(xt.info('上报行为类型: ','【'.concat(r.actions.map(function(t){return t.action_type;}).join('、'),'】')),xt.info('上报请求参数: ',r)),new Promise(function(e){var o,a,u,c,s,f,d,v,p=Date.now();try{var h=function(t){var e='',n=null==t?void 0:t.appid,r=null==t?void 0:t.secret_key,i=null==t?void 0:t.sdk_version,o=null==t?void 0:t.timestamp;if(!(n&&r&&i&&o&&32===r.length))return e;for(var a=je(i+n+o),u=0;u<32;u++)e+=u%2==0?r[u]:a[u];return e;}({appid:null==(o=null==r?void 0:r.info)?void 0:o.appid,secret_key:null==(a=null==r?void 0:r.info)?void 0:a.secret_key,sdk_version:null==(u=null==r?void 0:r.info)?void 0:u.sdk_version,timestamp:p}),y=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?function(t){return t.replace(/=/g,'').replace(/[+\/]/g,function(t){return'+'==t?'-':'_';});}(ze(t)):ze(t);}(JSON.stringify(r));d={'Client-Time':p,'Sign-Value':je(y+(null==(c=null==r?void 0:r.info)?void 0:c.user_action_set_id)+(null==(s=null==r?void 0:r.info)?void 0:s.secret_key)+h),'Sign-Version':S.signVersion,'content-type':'text/plain;charset=UTF-8'},v=y;}catch(h){;d={'Client-Time':p},v=r,n.reportLog({log_type:b.SIGN_ERROR,message:'sign error msg: '.concat(null==h?void 0:h.message),err_stack:null==h?void 0:h.stack}),xt.error(h);}wx.request({url:'https://api.datanexus.qq.com/data-nexus-cgi/miniprogram',method:'POST',timeout:(null==(f=n.configManager)?void 0:f.getRequestTimeout())||S.requestTimeout,header:d,data:v,success:function(r){var o,a;xt.devLog('上报接口返回码:',null==(o=null==r?void 0:r.data)?void 0:o.code);var u=(null==(a=null==r?void 0:r.header)?void 0:a['Server-Time'])||-1;if(st.revise(u),t.currentRequestCount-=1,200===(null==r?void 0:r.statusCode))return n.dealSuccessData(null==r?void 0:r.data,i),void e((null==r?void 0:r.data).code);var c='';try{c='object'==l(null==r?void 0:r.data)?JSON.stringify(null==r?void 0:r.data):null==r?void 0:r.data;}catch(t){xt.error(t);}var s={code:'number'==typeof(null==r?void 0:r.statusCode)?-1*r.statusCode:-888,message:'statusCode: '.concat(null==r?void 0:r.statusCode,', data: ').concat(c)};n.dealFailData(s,i),e(s.code);},fail:function(r){xt.devLog('上报失败:',r),t.currentRequestCount-=1;var o={code:'number'==typeof(null==r?void 0:r.errno)?-1*r.errno:-999,message:null==r?void 0:r.errMsg};n.dealFailData(o,i),e(o.code);}});});}},{key:'startInspectTimer',value:function(){var e=this;clearTimeout(this.inspectTimer),this.inspectTimer=setTimeout(function(){t.currentRequestCount>=t.requestConcurrency&&(t.currentRequestCount=t.requestConcurrency-1),e.executeSend(),e.startInspectTimer();},1e3*this.inspectDelay);}}],[{key:'setRequestConcurrency',value:function(e){'number'==typeof e?e<1?xt.error('网络请求最大并发量不能小于1'):e>10?xt.error('网络请求最大并发量不能大于10'):t.requestConcurrency=e:xt.error('网络请求最大并发量需设置为数字');}}]),t;}(),en=tn;en.currentRequestCount=0,en.requestConcurrency=S.requestConcurrency,Ze([Lt],en.prototype,'batchSend',1),Ze([Lt],en.prototype,'flushSend',1),Ze([Lt],en.prototype,'executeSend',1);var nn=Yt,rn=Wt,on=Jt,an=Ht,un=zt,cn=ie,sn=$t,ln=Xt,fn=Zt,dn=ee,vn=re,pn=ne,hn=te,yn=function(){function e(){f(this,e);}return v(e,[{key:'install',value:function(e,n){var r=function(n){Kt.subscribe(n,function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return function(i){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e.track(n,Object.assign(r||{},o,t(t({},In,!0),wn,i)));};}(n));};r(rn),r(nn),r(on),r(an),'all'===n&&(r(un),r(cn),r(sn),r(fn),r(ln),r(hn),r(dn),r(vn),r(pn));}}]),e;}(),_n=function(){function e(){f(this,e),this.special_method_symbol=Symbol('special_method_symbol');}return v(e,[{key:'onPurchase',value:function(t){return'number'!=typeof t&&xt.warn('付费金额需要为数字'),t<=0&&xt.warn('付费金额需要大于0'),this.wrapTrack(j,{value:t});}},{key:'onEnterForeground',value:function(){return this.wrapTrack(D);}},{key:'onEnterBackground',value:function(){return this.wrapTrack(U);}},{key:'onAppStart',value:function(){return this.wrapTrack(M);}},{key:'onAppQuit',value:function(){return this.wrapTrack(F);}},{key:'onAddToWishlist',value:function(){return this.wrapTrack(q);}},{key:'wrapTrack',value:function(e,n){return this.track(e,Object.assign(n||{},t({},this.special_method_symbol,1)));}}]),e;}(),gn=function(t){i(n,_n);var e=a(n);function n(){return f(this,n),e.apply(this,arguments);}return v(n,[{key:'onRegister',value:function(){return this.wrapTrack(B);}},{key:'onCreateRole',value:function(t){return t&&'string'!=typeof t&&xt.warn('角色名称需要为字符串'),this.wrapTrack(V,t?{name:t}:{});}},{key:'onTutorialFinish',value:function(){return this.wrapTrack(G);}}]),n;}(),mn='(如果确认无误,请忽略该提示)',An=function(){var t=[];return{requestActionList:function(){try{lt({conf_name:'data_nexus_common',conf_key:'action_types'}).then(function(e){yt(e)&&(t=e);});}catch(t){xt.error(t);}},getActionList:function(){return t;}};}();function Rn(t,e){try{t.is_sdk_auto_track||(function(t){try{var e=An.getActionList();if(!e.includes(t)){var r,i=function(t,e){var r='undefined'!=typeof Symbol&&t[Symbol.iterator]||t['@@iterator'];if(!r){if(Array.isArray(t)||(r=n(t))||e&&t&&'number'==typeof t.length){r&&(t=r);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]};},e:function(t){throw t;},f:o};}throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');}var a,u=!0,c=!1;return{s:function(){r=r.call(t);},n:function(){var t=r.next();return u=t.done,t;},e:function(t){;c=!0,a=t;},f:function(){try{u||null==r.return||r.return();}finally{if(c)throw a;}}};}(e);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(kn(o,t)<=parseInt((0.3*o.length).toString())){xt.warn('通过SDK上报的'.concat(t,'行为名称可能有误,请检查该行为类型是否为腾讯广告提供的标准行为!').concat(mn));break;}}}catch(t){i.e(t);}finally{i.f();}}}catch(e){xt.error(e);}}(t.action_type),'minigame'===e?function(t,e){var n,r,i;try{;['PURCHASE','ADD_TO_CART'].includes(t.action_type)&&t.action_param&&It(t.action_param,'value')&&('number'!=typeof(null==(n=t.action_param)?void 0:n.value)?xt.warn('通过SDK上报的'.concat(t.action_type,'行为携带的金额参数需要为数字!')):(null==(r=t.action_param)?void 0:r.value)<=0?xt.warn('通过SDK上报的'.concat(t.action_type,'行为携带的金额参数需要大于0!')):'minigame'===e&&(null==(i=t.action_param)?void 0:i.value)<100&&xt.warn('通过SDK上报的'.concat(t.action_type,'行为携带的金额参数可能有误,金额的单位为‘分’,请检查金额是否正确!').concat(mn)));}catch(t){xt.error(t);}}(t,e):'miniprogram'===e&&function(t){try{var e=null==t?void 0:t.action_type,n=(null==t?void 0:t.action_param)||{};'PURCHASE'===e&&It(n,'value')&&('number'!=typeof(null==n?void 0:n.value)?xt.warn('通过SDK上报的'.concat(e,'行为携带的金额参数需要为数字!')):(null==n?void 0:n.value)<=0&&xt.warn('通过SDK上报的'.concat(e,'行为携带的金额参数需要大于0!')));}catch(e){xt.error(e);}}(t));}catch(t){xt.error(t);}}function kn(t,e){try{if(0===t.length)return e.length;if(0===e.length)return t.length;for(var n=[],r=0;r<=e.length;r++)n[r]=[r];for(var i=0;i<=t.length;i++)n[0][i]=i;for(var o=1;o<=e.length;o++)for(var a=1;a<=t.length;a++)e.charAt(o-1)===t.charAt(a-1)?n[o][a]=n[o-1][a-1]:n[o][a]=Math.min(n[o-1][a-1]+1,n[o][a-1]+1,n[o-1][a]+1);return n[e.length][t.length];}catch(n){xt.error(n);}}function Tn(t){try{t&&!/^[a-zA-Z0-9_\-]+$/.test(t)&&xt.warn('通过SDK上报的openid:'.concat(t,'可能有误,请检查openid是否正确!').concat(mn));}catch(t){xt.error(t);}}var En=Object.defineProperty,Sn=Object.getOwnPropertyDescriptor,bn=function(t,e,n,r){for(var i,o=r>1?void 0:r?Sn(e,n):e,a=t.length-1;a>=0;a--)(i=t[a])&&(o=(r?i(e,n,o):i(o))||o);return r&&o&&En(e,n,o),o;},On=Symbol('initializedInstance'),In=Symbol('autoTrack'),wn=Symbol('actionTime'),Cn=function(e){i(r,gn);var n=a(r);function r(t){var e;if(f(this,r),(e=n.call(this)).env='production',e.sdk_version='1.5.5',e.sdk_name='@dn-sdk/minigame',e.deviceInfo={},e.gameInfo={},e.session_id='',e.log_id=0,e.inited=!1,e.initErrMsg='',null==wx||!wx.createCanvas)return e.initErrMsg='不支持非微信小游戏中使用',xt.error(e.initErrMsg),u(e);var i=Ot();if(r[On].length>=i.maxSdkInstance)return e.initErrMsg='初始化超过上限',xt.error(e.initErrMsg),u(e);var o=St(t),a=at();if(!0!==o)return e.initErrMsg=o,xt.error(o),u(e);var s=null==a?void 0:a.appId;if(s&&s!==t.appid)return e.initErrMsg='初始化传入的appid与当前小游戏appid不一致',xt.error(e.initErrMsg),u(e);e.config=t,It(t,'auto_track')||(e.config.auto_track=bt('autoTrack')),e.openid=t.openid,e.unionid=t.unionid,e.user_unique_id=t.user_unique_id,e.saveValidOpenidToStorage();var l=t.user_action_set_id;return r[On].includes(l)?(e.initErrMsg='重复初始化导致初始化失败',xt.error(e.initErrMsg),u(e)):(e.reportLog=e.reportLog.bind(c(e)),e.getTrackBaseInfo=e.getTrackBaseInfo.bind(c(e)),e.deviceInfo=nt(),e.gameInfo=Nt(),e.session_id=mt(),e.queueManage=new Bt({userActionSetId:l,maxLength:i.maxQueueLength,ogEvents:Qt}),e.actionReporter=new en({getBaseInfo:e.getTrackBaseInfo,reportLog:e.reportLog,queueManager:e.queueManage,configManager:ce}),e.inited=!0,r[On].push(l),e.useAutoTrack(),e.doReportOnEnterBackground(),'release'===(null==a?void 0:a.envVersion)?(xt.info('初始化成功'),u(e)):(function(t){var e=t.conf_name,n=t.conf_key,r=t.sdk_version,i=t.default_download_url,o=t.fail_handler;lt({conf_name:e,conf_key:n}).then(function(t){if(ht(t)){var e=null==t?void 0:t.blackVersions,n=null==t?void 0:t.minVersion,a=null==t?void 0:t.bestVersion,u=null==t?void 0:t.downloadUrl,c=i;return u&&/^https/.test(u)&&(c=u),yt(e)&&(null==e?void 0:e.indexOf(r))>-1?(null==o||o(),void xt.error('初始化失败!当前SDK版本存在兼容问题,请尽快升级至最新版!下载地址:'.concat(c))):n&&Et(r,n)<0?(null==o||o(),void xt.error('初始化失败!当前SDK版本过低,请尽快升级至最新版!下载地址:'.concat(c))):(a&&Et(r,a)<0&&xt.warn('新版本SDK已上线,强烈建议您升级至最新版,尽早享受新特性!下载地址:'.concat(c)),void xt.info('初始化成功'));}xt.info('初始化成功');}).catch(function(){xt.info('初始化成功');});}({conf_name:'mini_game_sdk_common',conf_key:'version',sdk_version:e.sdk_version,default_download_url:'https://sr-home-1257214331.cos.ap-guangzhou.myqcloud.com/sdk/dn-sdk-minigame/dn-sdk-minigame.zip',fail_handler:function(){e.inited=!1;}}),An.requestActionList(),Tn(t.openid),u(e)));}return v(r,[{key:'getInitResult',value:function(){return{inited:this.inited,initErrMsg:this.initErrMsg};}},{key:'track',value:function(t,e){var n,r;if(!this.inited||!this.queueManage)return xt.error('上报失败,请先完成初始化'),{code:100,msg:'未完成初始化或重复初始化导致初始化失败'};var i=Ue.validateActionType(t),o=Ue.validateActionParam(e);if(i&&o){!this.openid&&!this.unionid&&xt.warn('缺少 openid 或 unionid');var a=bt('actionParamMaxLength');if(JSON.stringify(e||{}).length>a)return xt.error('监测到超过'.concat(a,'的上报日志:').concat(t,' ').concat(e)),{code:102,msg:'action_param 参数过大,不能超过 10000 字符'};var u=!(null==e||!e[In]),c=this.createAction(t,e||{},u);'release'!==(null==(n=at())?void 0:n.envVersion)&&Rn(c,'minigame');var s=this.queueManage.addAction(c);return null==(r=this.actionReporter)||r.batchSend(),s;}return{code:101,msg:'action_type 或 action_param 参数错误'};}},{key:'flush',value:function(){var t;null==(t=this.actionReporter)||t.flushSend();}},{key:'setOpenId',value:function(t){var e;t&&'string'==typeof t?(this.openid=t,this.gameInfo.ad_trace_id&&!tt.getSync(T)&&Kt.publish('START_APP'),this.flush(),this.saveValidOpenidToStorage(),'release'!==(null==(e=at())?void 0:e.envVersion)&&Tn(t)):xt.error('openid 格式错误');}},{key:'setUnionId',value:function(t){t&&'string'==typeof t?(this.unionid=t,this.flush()):xt.error('unionid 格式错误');}},{key:'setUserUniqueId',value:function(t){t&&'string'==typeof t?this.user_unique_id=t:xt.error('user_unique_id 格式错误');}},{key:'doReportOnEnterBackground',value:function(){var t=this;wx.onHide(function(){var e,n;null==(e=t.actionReporter)||e.flushSend(),null==(n=t.queueManage)||n.reportLostNum();});}},{key:'getTrackBaseInfo',value:function(){var t=at();return Object.assign({},this.deviceInfo,function(t,e){var n={};return e.forEach(function(e){It(t,e)&&(n[e]=t[e]);}),n;}(this.config,['user_action_set_id','appid','openid','secret_key','user_unique_id','unionid']),{local_id:rt(),sdk_name:this.sdk_name,sdk_version:this.sdk_version,openid:this.openid||ot(),unionid:this.unionid,user_unique_id:this.user_unique_id,inner_param:{app_env_version:t.envVersion,app_version:t.version}});}},{key:'createAction',value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];null!=e&&e[In]&&delete e[In];var r=Date.now();null!=e&&e[wn]&&(r=null==e?void 0:e[wn],delete e[wn]);var i={action_id:mt(),action_param:e,action_time:r,action_type:t,is_retry:!1,is_sdk_auto_track:n,retry_count:0,revised_action_time:st.getRevisedcurrentTimeMillis(),log_id:++this.log_id,session_id:this.session_id,pkg_channel_id:this.gameInfo.pkg_channel_id,source_scene:this.gameInfo.source_scene,network_type:it(),ad_trace_id:this.gameInfo.ad_trace_id,channel:this.getChannelByActionType(t)};return null!=e&&e[this.special_method_symbol]&&(this.addActionInnerParam(i,'is_special_method',!0),delete e[this.special_method_symbol]),ce.getChannelClaimActionList().indexOf(t)>-1&&this.gameInfo.launch_options&&this.addActionInnerParam(i,'launch_options',this.gameInfo.launch_options),i;}},{key:'addActionInnerParam',value:function(e,n,r){e.inner_param&&ht(e.inner_param)?e.inner_param[n]=r:e.inner_param=t({},n,r);}},{key:'getChannelByActionType',value:function(t){var e='';return ce.getChannelClaimActionList().indexOf(t)>-1?e=this.gameInfo.channel||'':ce.getNoClaimActionList().indexOf(t)>-1&&(e=X),e;}},{key:'reportLog',value:function(t){var e,n,r={user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,appid:null==(n=this.config)?void 0:n.appid,session_id:this.session_id};ct(Object.assign(r,t));}},{key:'useAutoTrack',value:function(){var t;if(null!=(t=this.config)&&t.auto_track){var e=!0,n=tt.getSync(R);(null==n?void 0:n.ap)===K?e=!0:(null==n?void 0:n.ap)===Q&&(e=!1),'devtools'===nt().wx_platform&&(e=!0),new yn().install(this,e?'all':'lifecycle'),ve(),e&&Ne(),this.getAutoProxyRemoteConfig();}}},{key:'getAutoProxyRemoteConfig',value:function(){var t,e,n=nt();n.os&&n.os_version&&null!=(t=this.config)&&t.user_action_set_id&&function(t){return new Promise(function(e){wx.request({method:'POST',url:'https://api.datanexus.qq.com/data-nexus-config/v1/sdk/minigame/get',data:t,timeout:S.requestTimeout,success:function(t){ft(t,e,'minigame/get'),vt(t);},fail:function(t){dt(t,'minigame/get');}});});}({conf_name:'MG',conf_param:{user_action_set_id:null==(e=this.config)?void 0:e.user_action_set_id,sdk_version:this.sdk_version,os_type:(null==n?void 0:n.os)||'',os_version:wt(n.os_version),device_brand:(null==n?void 0:n.device_brand)||'',weixin_lib_version:(null==n?void 0:n.wx_lib_version)||'',weixin_version:(null==n?void 0:n.wx_version)||''}}).then(function(t){ht(t)&&tt.setSync(R,t);});}},{key:'saveValidOpenidToStorage',value:function(){this.openid&&function(t){return /^[a-zA-Z0-9_-]{28,30}$/.test(t);}(this.openid)&&tt.setSync(T,this.openid);}}],[{key:'setRequestConcurrency',value:function(t){en.setRequestConcurrency(t);}},{key:'setDebug',value:function(t){xt.debug=t;}}]),r;}(),xn=Cn;xn[On]=[],bn([Lt],xn.prototype,'track',1),bn([Lt,function(t,e,n){var r=n.value;return n.value=function(){if(this.inited){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return r.apply(this,e);}xt.error('上报失败,请先完成初始化');},n;}],xn.prototype,'flush',1),bn([Lt],xn.prototype,'setOpenId',1),bn([Lt],xn.prototype,'setUnionId',1),bn([Lt],xn.prototype,'setUserUniqueId',1),bn([Lt],xn.prototype,'doReportOnEnterBackground',1),bn([Lt],xn.prototype,'getTrackBaseInfo',1),bn([Lt],xn.prototype,'useAutoTrack',1);module.exports={SDK:xn};
\ No newline at end of file
/* eslint-disable no-multi-assign */
/* eslint-disable @typescript-eslint/naming-convention */
const { version, SDKVersion } = wx.getAppBaseInfo ? wx.getAppBaseInfo() : wx.getSystemInfoSync();
const { platform, system } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
const accountInfo = wx.getAccountInfoSync();
const envVersion = accountInfo?.miniProgram?.envVersion;
function compareVersion(v1, v2) {
if (!v1 || !v2) {
return false;
}
return (v1
.split('.')
.map(v => v.padStart(2, '0'))
.join('')
>= v2
.split('.')
.map(v => v.padStart(2, '0'))
.join(''));
}
export const isDebug = false;
export const isPc = platform === 'windows' || platform === 'mac';
export const isIOS = platform === 'ios';
export const isAndroid = platform === 'android';
export const isDevtools = platform === 'devtools';
export const isMobile = !isPc && !isDevtools;
export const isDevelop = envVersion === 'develop';
// 是否禁止**开通了高性能模式**的小游戏在不支持的iOS设备上回退成普通模式,回退可能导致无法正常体验游戏
// @ts-ignore
const disableHighPerformanceFallback = false && isIOS;
// 是否iOS高性能模式
export const isH5Renderer = GameGlobal.isIOSHighPerformanceMode;
// 操作系统版本号
const systemVersionArr = system ? system.split(' ') : [];
const systemVersion = systemVersionArr.length ? systemVersionArr[systemVersionArr.length - 1] : '';
// pc微信版本号不一致,需要>=3.3
const isPcWeChatVersionValid = compareVersion(version, '3.3');
// 支持unity小游戏,需要基础库>=2.14.0,但低版本基础库iOS存在诸多问题,将版本最低版本提高到2.17.0
const isLibVersionValid = compareVersion(SDKVersion, '2.17.0');
// 如果是iOS高性能模式,基础库需要>=2.23.1
const isH5LibVersionValid = compareVersion(SDKVersion, '2.23.1');
// 压缩纹理需要iOS系统版本>=14.0,检测到不支持压缩纹理时会提示升级系统
const isIOSH5SystemVersionValid = compareVersion(systemVersion, '14.0');
// iOS系统版本>=15支持webgl2,高性能模式+无此系统要求
const isIOSWebgl2SystemVersionValid = compareVersion(systemVersion, '15.0') || GameGlobal.isIOSHighPerformanceModePlus;
// Android客户端版本>=8.0.19支持webgl2
const isAndroidWebGL2ClientVersionValid = compareVersion(version, '8.0.19');
// 是否用了webgl2
const isWebgl2 = () => GameGlobal.managerConfig.contextConfig.contextType === 2;
// 是否支持BufferURL
export const isSupportBufferURL = !isPc
&& (isH5Renderer
? compareVersion(SDKVersion, '2.29.1') && compareVersion(version, '8.0.30')
: typeof wx.createBufferURL === 'function');
// 安卓innerAudio支持playbackRate
export const isSupportPlayBackRate = !isAndroid || compareVersion(version, '8.0.23');
// IOS innerAudio支持复用时再次触发onCanplay
export const isSupportCacheAudio = !isIOS || compareVersion(version, '8.0.31');
// // 安卓旧客户端版本innerAudio偶现会导致闪退,大于等于8.0.38才使用innerAudio减少内存
export const isSupportInnerAudio = compareVersion(version, '8.0.38');
// 检查是否支持brotli压缩,pc基础库>=2.29.2,真机基础库>=2.21.1
// @ts-ignore
const isPcBrotliInvalid = isPc && !compareVersion(SDKVersion, true ? '2.29.2' : '2.32.3');
const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1');
// @ts-ignore
const isBrotliInvalid = false && (isPcBrotliInvalid || isMobileBrotliInvalid);
// iOS系统版本>=17.5时,小游戏退后台会导致异常
export const isIOS175 = compareVersion(systemVersion, '17.5') && isH5Renderer;
// 是否支持开放数据域渲染模式,使用ScreenCanvas模式可以优化ToTempFilePath的使用,PC 上 ScreenCanvas 模式事件处理有问题,PC 先禁止这个模式
export const isSupportSharedCanvasMode = compareVersion(SDKVersion, '3.6.6') && !isPc;
// 是否能以iOS高性能模式运行
// 请勿修改GameGlobal.canUseH5Renderer赋值!!!
GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid;
// iOS高性能模式定期GC
GameGlobal.canUseiOSAutoGC = isH5Renderer && compareVersion(SDKVersion, '2.32.1');
// pc微信版本不满足要求
const isPcInvalid = isPc && !isPcWeChatVersionValid;
// 移动设备基础库版本或客户端版本不支持运行unity小游戏
const isMobileInvalid = isMobile && !isLibVersionValid;
// 基础库/客户端不支持iOS高性能模式
const isIOSH5Invalid = (isH5Renderer && !isH5LibVersionValid) || (!isH5Renderer && disableHighPerformanceFallback);
// 是否支持VideoPlayer组件,注意:开发者工具需要1.06.2310312以上版本
export const isSupportVideoPlayer = (isIOS && compareVersion(SDKVersion, '3.1.1')) || (isAndroid && compareVersion(SDKVersion, '3.0.0')) || ((isPc || isDevtools) && compareVersion(SDKVersion, '3.2.1'));
// 视情况添加,没用到对应能力就不需要判断
// 是否支持webgl2
const isWebgl2SystemVersionInvalid = () => isWebgl2() && ((!isIOSWebgl2SystemVersionValid && isIOS) || (isAndroid && !isAndroidWebGL2ClientVersionValid));
// IOS高性能模式2.25.3以上基础库需要手动启动webAudio
export const webAudioNeedResume = compareVersion(SDKVersion, '2.25.3') && isH5Renderer;
// 满足iOS高性能条件,但未开通高性能模式
const needToastEnableHpMode = isDevelop && isIOS && isH5LibVersionValid && isIOSH5SystemVersionValid && !isH5Renderer;
/**
* 判断环境是否可使用coverview
* coverview实际需要基础库版本>=2.16.1,但因为移动端要>=2.17.0才能运行,所以移动端基本都支持coverview
*
* @export
* @returns
*/
export function canUseCoverview() {
return isMobile || isDevtools;
}
if (needToastEnableHpMode) {
console.error('此AppID未开通高性能模式\n请前往mp后台-能力地图-开发提效包-高性能模式开通\n可大幅提升游戏运行性能');
// setTimeout(() => {
// wx.showModal({
// title: '[开发版提示]建议',
// content: '此AppID未开通高性能模式\n请前往mp后台-能力地图-开发提效包-高性能模式开通\n可大幅提升游戏运行性能',
// showCancel: false,
// })
// }, 10000);
}
// @ts-ignore
if (isIOS && typeof 0 === 'number' && 0 > 0) {
// @ts-ignore
window.devicePixelRatio = 0;
}
else if (isPc) {
try {
if (window.devicePixelRatio < 2) {
window.devicePixelRatio = 2;
}
}
catch (e) {
console.warn(e);
}
}
export default () => new Promise((resolve) => {
if (!isDevtools) {
if (isPcInvalid
|| isMobileInvalid
|| isIOSH5Invalid
|| isWebgl2SystemVersionInvalid()
|| isBrotliInvalid) {
let updateWechat = true;
let content = '当前微信版本过低\n请更新微信后进行游戏';
if (isIOS) {
if (!isIOSH5SystemVersionValid || (isWebgl2SystemVersionInvalid() && isIOS)) {
content = '当前操作系统版本过低\n请更新iOS系统后进行游戏';
updateWechat = false;
}
}
wx.showModal({
title: '提示',
content,
showCancel: false,
confirmText: updateWechat ? '更新微信' : '确定',
success(res) {
if (res.confirm) {
const showUpdateWechat = updateWechat && typeof wx.createBufferURL === 'function';
if (showUpdateWechat) {
wx.updateWeChatApp();
}
else {
wx.exitMiniProgram({
success: () => { },
});
}
}
},
});
return resolve(false);
}
}
return resolve(true);
});
const events = [];
const EventsManager = {
/**
* 注册一个事件并持续监听
* @param eventName 事件名称
* @param callback 事件的触发函数
*/
on(eventName, callback) {
events.push({
eventName,
callback,
once: false,
});
},
/**
* 注册一个事件并最多只触发一次
* @param eventName 事件名称
* @param callback 事件的触发函数
*/
once(eventName, callback) {
events.push({
eventName,
callback,
once: true,
});
},
/**
* 卸载一个事件
* @param eventName 事件名称
* @param callback 事件句柄,若缺省将卸载所有同名事件
*/
off(eventName, callback) {
events.forEach((item, index) => {
if (item.eventName === eventName) {
if (!callback || item.callback === callback) {
events.splice(index, 1);
}
}
});
},
emit(eventName, ...args) {
const res = [];
const indexs = [];
events.forEach((item, index) => {
if (item.eventName === eventName) {
res.push(item.callback(...args));
if (item.once) {
indexs.unshift(index);
}
}
});
indexs.forEach((value) => {
events.splice(value, 1);
});
return res;
},
};
GameGlobal.events = EventsManager;
// @ts-nocheck
import './wxSdkBridge'
import './weapp-adapter';
import './events';
import './texture-config';
import unityNamespace from './unity-namespace';
import './webgl.wasm.framework.unityweb';
import './unity-sdk/index';
import checkVersion from './check-version';
import {
launchEventType,
scaleMode
} from './plugin-config';
import {
preloadWxCommonFont
} from './unity-sdk/font/index';
const managerConfig = {
DATA_FILE_MD5: 'd5b2de52b4fa5ee7',
CODE_FILE_MD5: '0a580504c5172fc9',
GAME_NAME: 'webgl',
APPID: 'wx8533d0cf626f6059',
DATA_FILE_SIZE: '4799297',
OPT_DATA_FILE_SIZE: '$OPT_DATA_FILE_SIZE',
DATA_CDN: '',
// 资源包是否作为小游戏分包加载
loadDataPackageFromSubpackage: true,
// 资源包放小游戏分包加载时,是否br压缩
compressDataPackage: false,
// 需要在网络空闲时预加载的资源,支持如下形式的路径
preloadDataList: [
// 'DATA_CDN/StreamingAssets/WebGL/textures_8d265a9dfd6cb7669cdb8b726f0afb1e',
// '/WebGL/sounds_97cd953f8494c3375312e75a29c34fc2'
,
],
contextConfig: {
contextType: 1,
contextExt: {
enableGLX: false,
enableMetal: false,
}
},
PROFILER_UPLOAD_URL: '',
};
GameGlobal.managerConfig = managerConfig;
// 版本检查
checkVersion().then((enable) => {
if (enable) {
// eslint-disable-next-line @typescript-eslint/naming-convention
let UnityManager;
try {
// @ts-ignore
UnityManager = requirePlugin('UnityPlugin', {
enableRequireHostModule: true,
customEnv: {
wx,
unityNamespace,
document,
canvas,
events: GameGlobal.events,
WXWASMSDK: GameGlobal.WXWASMSDK,
},
}).default;
} catch (error) {
GameGlobal.realtimeLogManager.error(error);
// logManager不支持自动处理错误对象
GameGlobal.logmanager.warn(error.stack);
console.error('requirePlugin:', error);
if (error.message.indexOf('not defined') !== -1) {
console.error('!!!插件需要申请才可使用\n请勿使用测试AppID,并登录 https://mp.weixin.qq.com/ 并前往:能力地图-开发提效包-快适配 开通\n阅读文档获取详情:https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/Transform.md');
}
}
// JS堆栈能显示更完整
Error.stackTraceLimit = Infinity;
Object.assign(managerConfig, {
// callmain结束后立即隐藏封面视频
hideAfterCallmain: true,
loadingPageConfig: {
// 以下是默认值
totalLaunchTime: 7000,
animationDuration: 100,
/**
* !!注意:修改设计宽高和缩放模式后,需要修改文字和进度条样式。默认设计尺寸为667*375
*/
designWidth: 0,
designHeight: 0,
scaleMode: scaleMode.default,
// 以下配置的样式,尺寸相对设计宽高
textConfig: {
firstStartText: '首次加载请耐心等待',
downloadingText: ['正在加载资源'],
compilingText: '编译中',
initText: '初始化中',
completeText: '开始游戏',
textDuration: 1500,
// 文字样式
style: {
bottom: 64,
height: 24,
width: 240,
lineHeight: 24,
color: '#ffffff',
fontSize: 12,
},
},
// 进度条样式
barConfig: {
style: {
width: 240,
height: 24,
padding: 2,
bottom: 64,
backgroundColor: '#07C160',
},
},
// 一般不修改,控制icon样式
iconConfig: {
visible: true,
style: {
width: 64,
height: 23,
bottom: 20,
},
},
// 加载页的素材配置
materialConfig: {
// 背景图或背景视频,两者都填时,先展示背景图,视频可播放后,播放视频
backgroundImage: 'images/background.jpg',
backgroundVideo: '',
iconImage: 'images/unity_logo.png', // icon图片,一般不更换
},
},
});
GameGlobal.managerConfig = managerConfig;
// 显示启动封面
const gameManager = new UnityManager(managerConfig);
gameManager.onLaunchProgress((e) => {
// interface LaunchEvent {
// type: LaunchEventType;
// data: {
// costTimeMs: number; // 阶段耗时
// runTimeMs: number; // 总耗时
// loadDataPackageFromSubpackage: boolean; // 首包资源是否通过小游戏分包加载
// isVisible: boolean; // 当前是否处于前台,onShow/onHide
// useCodeSplit: boolean; // 是否使用代码分包
// isHighPerformance: boolean; // 是否iOS高性能模式
// needDownloadDataPackage: boolean; // 本次启动是否需要下载资源包
// };
// }
if (e.type === launchEventType.launchPlugin) {}
if (e.type === launchEventType.loadWasm) {}
if (e.type === launchEventType.compileWasm) {}
if (e.type === launchEventType.loadAssets) {}
if (e.type === launchEventType.readAssets) {}
if (e.type === launchEventType.prepareGame) {}
});
gameManager.onModulePrepared(() => {
// eslint-disable-next-line no-restricted-syntax
for (const key in unityNamespace) {
// 动态修改DATA_CDN后,同步修改全局对象
if (!GameGlobal.hasOwnProperty(key) || key === 'DATA_CDN') {
GameGlobal[key] = unityNamespace[key];
} else {}
}
managerConfig.DATA_CDN = GameGlobal.DATA_CDN;
gameManager.assetPath = `${(managerConfig.DATA_CDN || '').replace(/\/$/, '')}/Assets`;
preloadWxCommonFont();
});
// 插件捕获到引擎错误后,会通过此事件抛给游戏
gameManager.onLogError = function(err) {
GameGlobal.realtimeLogManager.error(err);
const isErrorObj = err && err.stack;
GameGlobal.logmanager.warn(isErrorObj ? err.stack : err);
};
// iOS高性能模式定期GC
if (GameGlobal.canUseiOSAutoGC && unityNamespace.iOSAutoGCInterval !== 0) {
setInterval(() => {
wx.triggerGC();
}, unityNamespace.iOSAutoGCInterval);
}
// 开始执行游戏启动流程
gameManager.startGame();
GameGlobal.manager = gameManager;
GameGlobal.events.on('launchOperaPushMsgToWasm', (callback, args) => GameGlobal.WXWASMSDK.WXLaunchOperaBridgeToC(callback, args));
// eslint-disable-next-line @typescript-eslint/no-unused-vars
GameGlobal.events.on('createWorker', (worker) => {
// worker created
});
}
});
\ No newline at end of file
{
"deviceOrientation" : "portrait",
"iOSHighPerformance" : true,
"iOSHighPerformance+" : false,
"subpackages" : [
{
"name" : "wasmcode",
"root" : "wasmcode/"
},
{
"name" : "data-package",
"root" : "data-package/"
}
],
"parallelPreloadSubpackages" : [
{
"name" : "wasmcode"
},
{
"name" : "data-package"
}
],
"plugins" : {
"UnityPlugin" : {
"version" : "1.2.84",
"provider" : "wxe5a48f1ed5f544b7",
"contexts" : [
{
"type" : "isolatedContext"
}
]
}
},
"workers" : "workers"
}
\ No newline at end of file
export const launchEventType = {
launchPlugin: 0,
loadWasm: 1,
compileWasm: 2,
loadAssets: 3,
readAssets: 5,
prepareGame: 6, // 初始化引擎
};
// https://docs.egret.com/engine/docs/screenAdaptation/zoomMode
export const scaleMode = {
default: '',
noBorder: 'NO_BORDER',
exactFit: 'EXACT_FIT',
fixedHeight: 'FIXED_HEIGHT',
fixedWidth: 'FIXED_WIDTH',
showAll: 'SHOW_ALL',
fixedNarrow: 'FIXED_NARROW',
fixedWide: 'FIXED_WIDE',
};
{
"description": "项目配置文件",
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": false,
"disableUseStrict": false,
"babelSetting": {
"ignore": [
"webgl.wasm.framework.unityweb.js"
],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": [],
"compileWorklet": false,
"minifyWXSS": true,
"minifyWXML": true,
"localPlugins": false,
"useCompilerPlugins": false,
"condition": false,
"swc": false,
"disableSWC": true
},
"compileType": "game",
"libVersion": "latest",
"appid": "wx8533d0cf626f6059",
"projectname": "wxSdk",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"packOptions": {
"ignore": [
{
"value": ".plugincache",
"type": "folder"
},
{
"value": ".symbols.unityweb",
"type": "suffix"
},
{
"value": ".symbols.unityweb.br",
"type": "suffix"
}
],
"include": []
},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
},
"isGameTourist": false,
"editorSetting": {}
}
\ No newline at end of file
{
"libVersion": "3.11.2",
"projectname": "wxSdk",
"condition": {},
"setting": {
"urlCheck": false,
"coverView": true,
"lazyloadPlaceholderEnable": false,
"skylineRenderEnable": false,
"preloadBackgroundData": false,
"autoAudits": false,
"useApiHook": false,
"useApiHostProcess": true,
"showShadowRootInWxmlPanel": true,
"useStaticServer": false,
"useLanDebug": false,
"showES6CompileOption": false,
"compileHotReLoad": false,
"checkInvalidKey": true,
"ignoreDevUnusedFiles": true,
"bigPackageSizeSupport": false,
"useIsolateContext": true
}
}
\ No newline at end of file
"use strict";var _0xb9de2c=(332633^332636)+(217285^217285);var __awaiter=this&&this['\u005F\u005F\u0061\u0077\u0061\u0069\u0074\u0065\u0072']||function(thisArg,_arguments,P,generator){function _0x0ae(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}return new(P||(P=Promise))(function(resolve,reject){function _0xbf_0xfbf(value){try{_0x9c69a(generator['\u006E\u0065\u0078\u0074'](value));}catch(e){reject(e);}}function _0xa_0x746(value){try{_0x9c69a(generator["throw"](value));}catch(e){reject(e);}}function _0x9c69a(result){result['\u0064\u006F\u006E\u0065']?resolve(result['\u0076\u0061\u006C\u0075\u0065']):_0x0ae(result['\u0076\u0061\u006C\u0075\u0065'])['\u0074\u0068\u0065\u006E'](_0xbf_0xfbf,_0xa_0x746);}_0x9c69a((generator=generator['\u0061\u0070\u0070\u006C\u0079'](thisArg,_arguments||[]))['\u006E\u0065\u0078\u0074']());});};_0xb9de2c=(147456^147460)+(376630^376628);var __generator=this&&this['\u005F\u005F\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u006F\u0072']||function(thisArg,body){var _={'\u006C\u0061\u0062\u0065\u006C':0,'\u0073\u0065\u006E\u0074':function(){if(t[354162^354162]&(559674^559675))throw t[825604^825605];return t[782545^782544];},'\u0074\u0072\u0079\u0073':[],"ops":[]},f,y,t,g;return g={"next":_0xa544bc(397301^397301),"\u0074\u0068\u0072\u006F\u0077":_0xa544bc(340085^340084),"return":_0xa544bc(688472^688474)},typeof Symbol==="noitcnuf".split("").reverse().join("")&&(g[Symbol['\u0069\u0074\u0065\u0072\u0061\u0074\u006F\u0072']]=function(){return this;}),g;function _0xa544bc(n){return function(v){return _0x9b418f([n,v]);};}function _0x9b418f(op){if(f)throw new TypeError("\u0047\u0065\u006E\u0065\u0072\u0061\u0074\u006F\u0072\u0020\u0069\u0073\u0020\u0061\u006C\u0072\u0065\u0061\u0064\u0079\u0020\u0065\u0078\u0065\u0063\u0075\u0074\u0069\u006E\u0067\u002E");while(g&&(g=505265^505265,op[864740^864740]&&(_=452741^452741)),_)try{if(f=614249^614248,y&&(t=op[229343^229343]&(632898^632896)?y["return"]:op[407204^407204]?y["throw"]||((t=y["return"])&&t['\u0063\u0061\u006C\u006C'](y),698774^698774):y['\u006E\u0065\u0078\u0074'])&&!(t=t['\u0063\u0061\u006C\u006C'](y,op[405753^405752]))['\u0064\u006F\u006E\u0065'])return t;if(y=847787^847787,t)op=[op[369496^369496]&(538715^538713),t['\u0076\u0061\u006C\u0075\u0065']];switch(op[728403^728403]){case 428877^428877:case 120820^120821:t=op;break;case 895974^895970:_['\u006C\u0061\u0062\u0065\u006C']++;return{'\u0076\u0061\u006C\u0075\u0065':op[173079^173078],"done":false};case 340272^340277:_['\u006C\u0061\u0062\u0065\u006C']++;y=op[516177^516176];op=[725399^725399];continue;case 245612^245611:op=_['\u006F\u0070\u0073']['\u0070\u006F\u0070']();_['\u0074\u0072\u0079\u0073']['\u0070\u006F\u0070']();continue;default:if(!(t=_['\u0074\u0072\u0079\u0073'],t=t['\u006C\u0065\u006E\u0067\u0074\u0068']>(397197^397197)&&t[t['\u006C\u0065\u006E\u0067\u0074\u0068']-(859196^859197)])&&(op[276624^276624]===(834921^834927)||op[743433^743433]===(797779^797777))){_=141802^141802;continue;}if(op[777956^777956]===(997542^997541)&&(!t||op[906883^906882]>t[437430^437430]&&op[159345^159344]<t[657895^657892])){_['\u006C\u0061\u0062\u0065\u006C']=op[391736^391737];break;}if(op[192539^192539]===(615969^615975)&&_['\u006C\u0061\u0062\u0065\u006C']<t[303714^303715]){_['\u006C\u0061\u0062\u0065\u006C']=t[458618^458619];t=op;break;}if(t&&_['\u006C\u0061\u0062\u0065\u006C']<t[178160^178162]){_['\u006C\u0061\u0062\u0065\u006C']=t[728468^728470];_['\u006F\u0070\u0073']['\u0070\u0075\u0073\u0068'](op);break;}if(t[467543^467541])_['\u006F\u0070\u0073']['\u0070\u006F\u0070']();_['\u0074\u0072\u0079\u0073']['\u0070\u006F\u0070']();continue;}op=body['\u0063\u0061\u006C\u006C'](thisArg,_);}catch(e){op=[269030^269024,e];y=189972^189972;}finally{f=t=581737^581737;}if(op[982376^982376]&(944816^944821))throw op[492589^492588];return{'\u0076\u0061\u006C\u0075\u0065':op[728328^728328]?op[488308^488309]:void(667167^667167),'\u0064\u006F\u006E\u0065':!![]};}};Object['\u0064\u0065\u0066\u0069\u006E\u0065\u0050\u0072\u006F\u0070\u0065\u0072\u0074\u0079'](exports,"\u005F\u005F\u0065\u0073\u004D\u006F\u0064\u0075\u006C\u0065",{'\u0076\u0061\u006C\u0075\u0065':!![]});var _0x01f=(850533^850533)+(516272^516280);var zwsdk=function(){function _0x512c(){this['\u0056\u0045\u0052\u0053\u0049\u004F\u004E']=_0x512c['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];var _0xad_0xee9=(278008^278013)+(156194^156195);var _0x71917g=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(666495^666495)&&void(679681^679681)!==arguments[613888^613888]?arguments[853719^853719]:null;_0xad_0xee9=319272^319276;_0x512c['\u0056\u0045\u0052\u0053\u0049\u004F\u004E']=this['\u0056\u0045\u0052\u0053\u0049\u004F\u004E'];var _0xcec44e=wx['\u0067\u0065\u0074\u004C\u0061\u0075\u006E\u0063\u0068\u004F\u0070\u0074\u0069\u006F\u006E\u0073\u0053\u0079\u006E\u0063'](),_0xe1964b=_0xcec44e['\u0071\u0075\u0065\u0072\u0079'],_0x7afd=_0xcec44e['\u0073\u0063\u0065\u006E\u0065'];if(_0x71917g){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']=_0x71917g['\u0061\u0070\u0070\u005F\u0069\u0064'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064']=_0x71917g['\u0067\u0061\u006D\u0065\u005F\u0069\u0064'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073']=_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004F\u0053']();_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']=_0x71917g['\u0064\u0065\u0076']?"\u0068\u0074\u0074\u0070\u0073\u003A\u002F\u002F\u007A\u0073\u0061\u0070\u0069\u002E\u007A\u0077\u0077\u006C\u006B\u006A\u0030\u0033\u002E\u0074\u006F\u0070":"\u0068\u0074\u0074\u0070\u0073\u003A\u002F\u002F\u007A\u0079\u006F\u0075\u0061\u0070\u0069\u002E\u0077\u006F\u007A\u0068\u0061\u006E\u0067\u0077\u0061\u006E\u002E\u0063\u006F\u006D";_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076']=_0x71917g['\u0064\u0065\u0076']||false;_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0071\u0075\u0065\u0072\u0079']=_0xe1964b;_0x7afd&&(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0071\u0075\u0065\u0072\u0079']['\u0061\u0070\u0070\u005F\u0073\u0063\u0065\u006E\u0065']=_0x7afd);_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0074\u0061\u0074\u0065']=_0x512c['\u0067\u0065\u0074\u0053\u0074\u0061\u0074\u0065'](_0xe1964b);var _0x6g_0xde6;var _0xac3fa=wx['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];_0x6g_0xde6=(100337^100342)+(585115^585117);console['\u006C\u006F\u0067'](":noisrev bil".split("").reverse().join("")+_0xac3fa);if(_0x512c['\u0073\u0065\u006C\u0066\u0043\u006F\u006D\u0070\u0061\u0072\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E'](_0xac3fa,"\u0031\u002E\u0034\u002E\u0030")>=(518631^518631)){wx['\u0073\u0065\u0074\u004B\u0065\u0065\u0070\u0053\u0063\u0072\u0065\u0065\u006E\u004F\u006E']({'\u006B\u0065\u0065\u0070\u0053\u0063\u0072\u0065\u0065\u006E\u004F\u006E':!![]});console['\u006C\u006F\u0067']("\u5C4F\u606F\u4E0D\u7F6E\u8BBE".split("").reverse().join(""));}else{}}}_0x512c['\u0073\u0065\u006C\u0066\u0043\u006F\u006D\u0070\u0061\u0072\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E']=function(v1,v2){v1=v1['\u0073\u0070\u006C\u0069\u0074']("\u002E");v2=v2['\u0073\u0070\u006C\u0069\u0074']("\u002E");var _0x3e885c;var _0xaa4bg=Math['\u006D\u0061\u0078'](v1['\u006C\u0065\u006E\u0067\u0074\u0068'],v2['\u006C\u0065\u006E\u0067\u0074\u0068']);_0x3e885c=(113146^113149)+(303843^303851);while(v1['\u006C\u0065\u006E\u0067\u0074\u0068']<_0xaa4bg){v1['\u0070\u0075\u0073\u0068']("\u0030");}while(v2['\u006C\u0065\u006E\u0067\u0074\u0068']<_0xaa4bg){v2['\u0070\u0075\u0073\u0068']("\u0030");}for(var i=684193^684193;i<_0xaa4bg;i++){var _0x48ab3f=parseInt(v1[i]);var _0xee1bd=parseInt(v2[i]);if(_0x48ab3f>_0xee1bd){return 561360^561361;}else if(_0x48ab3f<_0xee1bd){return-(504481^504480);}}return 202237^202237;};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u0047\u0061\u006D\u0065\u0043\u006F\u006E\u0066']=function(){return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0067\u0061\u006D\u0065\u002F\u0067\u0065\u0074\u0043\u006F\u006E\u0066",{'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0076\u0065\u0072\u0073\u0069\u006F\u006E':"\u0031\u002E\u0031"})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(275802^275803)){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006F\u006E\u0066\u0069\u0067']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006F\u006E\u0066\u0069\u0067']['\u0067\u0061\u006D\u0065\u005F\u0063\u006C\u0075\u0062']&&_0x512c['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0049\u006E\u0069\u0074']();}resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u006C\u006F\u0067\u0069\u006E']=function(){var _0x9b9f=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(992037^992037)&&void(170968^170968)!==arguments[154801^154801]?arguments[847927^847927]:{};return new Promise(function(resolve,rej){wx['\u006C\u006F\u0067\u0069\u006E']({'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(_a){var _0xd_0x523=_a['\u0063\u006F\u0064\u0065'];_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0061\u0075\u0074\u0068\u002F\u006C\u006F\u0067\u0069\u006E",{'\u0063\u006F\u0064\u0065':_0xd_0x523,"state":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0074\u0061\u0074\u0065'],'\u0071\u0075\u0065\u0072\u0079':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0071\u0075\u0065\u0072\u0079'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006F\u0073':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],"device_brand":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064']})['\u0074\u0068\u0065\u006E'](function(res){var _0x69287a=res;if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(113444^113445)){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0075\u0073\u0065\u0072\u005F\u0074\u006F\u006B\u0065\u006E'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072\u004E\u0075\u006D\u0062\u0065\u0072']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u006D\u0065']||202984^258696;_0x512c['\u0069\u006E\u0069\u0074\u0053\u0068\u0061\u0072\u0065']();_0x512c['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073']();_0x512c['\u0069\u006E\u0069\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']();_0x512c['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0063\u0068\u0065\u0064\u0075\u006C\u0065\u0064']();resolve(_0x69287a);_0x512c['\u006C\u006F\u0067']("sseccus-nigol:kds".split("").reverse().join(""),{'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064']});}else{wx['\u0073\u0068\u006F\u0077\u004D\u006F\u0064\u0061\u006C']({'\u0074\u0069\u0074\u006C\u0065':'异常',"content":res['\u006D\u0073\u0067'],'\u0063\u006F\u006E\u0066\u0069\u0072\u006D\u0054\u0065\u0078\u0074':'我知道了',"showCancel":false});_0x512c['\u006C\u006F\u0067']("\u0073\u0064\u006B\u003A\u006C\u006F\u0067\u0069\u006E\u002D\u0065\u0072\u0072\u006F\u0072",{"res":res});}});}});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0075\u0070\u0064\u0061\u0074\u0065\u0055\u0073\u0065\u0072\u0049\u006E\u0066\u006F']=function(){var _0x1b_0xfdf=(177882^177885)+(403908^403905);var _0x744e=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(304206^304206)&&void(582488^582488)!==arguments[424486^424486]?arguments[672825^672825]:{};_0x1b_0xfdf=(220858^220860)+(296641^296647);return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("ofnIetadpu/rebmem/kds_inim/".split("").reverse().join(""),{"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0072\u0061\u0077\u005F\u0064\u0061\u0074\u0061':_0x744e['\u0072\u0061\u0077\u005F\u0064\u0061\u0074\u0061']||'','\u0073\u0069\u0067\u006E\u0061\u0074\u0075\u0072\u0065':_0x744e['\u0073\u0069\u0067\u006E\u0061\u0074\u0075\u0072\u0065']||'',"encrypted_data":_0x744e['\u0065\u006E\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u005F\u0064\u0061\u0074\u0061']||'',"iv":_0x744e['\u0069\u0076']||'','\u0075\u0073\u0065\u0072\u005F\u0069\u006E\u0066\u006F':_0x744e['\u0075\u0073\u0065\u0072\u005F\u0069\u006E\u0066\u006F']||''})['\u0074\u0068\u0065\u006E'](function(res){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0072\u006F\u006C\u0065\u0049\u0064']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'';resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065\u004F\u0072\u0064\u0065\u0072']=function(){var _0x61d=(787531^787532)+(955041^955049);var _this=this;_0x61d=(458023^458022)+(914145^914153);var _0x4116eg=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(497479^497479)&&void(660884^660884)!==arguments[439527^439527]?arguments[614858^614858]:{};return new Promise(function(resolve,rej){return __awaiter(_this,void(847464^847464),void(678515^678515),function(){var _0x404dbe,_0x13879g,_a,_0x641gff,_0x83b,_0xa5d4e,_0x02aff,_0xeb_0xd31,_0xb4c68c,_0x50ac1e,_0xcbe,_0xg2e0af,_0x5b41ba;var _0x3ffffc=this;var _b,_0xbg98fb,_0x3d4b;return __generator(this,function(_e){switch(_e['\u006C\u0061\u0062\u0065\u006C']){case 866414^866414:return[821819^821823,_0x512c['\u0061\u006A\u0061\u0078']("etaerc/redro/kds_inim/".split("").reverse().join(""),{'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"os":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],"order":_0x4116eg['\u006F\u0072\u0064\u0065\u0072']||{},'\u0072\u006F\u006C\u0065':_0x4116eg['\u0072\u006F\u006C\u0065']||{},"role_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0072\u006F\u006C\u0065\u0049\u0064']})];case 775599^775598:_0x404dbe=_e['\u0073\u0065\u006E\u0074']();if(_0x404dbe['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(880438^880439)){resolve({'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':_0x404dbe['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065'],'\u006D\u0073\u0067':_0x404dbe['\u006D\u0073\u0067'],'\u0064\u0061\u0074\u0061':{"data":{'\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']}}});_0x13879g=_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0070\u0061\u0079\u005F\u0074\u0079\u0070\u0065'];if(_0x13879g==="\u0063\u0075\u0073\u0074\u006F\u006D\u0065\u0072"){wx['\u0073\u0068\u006F\u0077\u004D\u006F\u0064\u0061\u006C']({'\u0074\u0069\u0074\u006C\u0065':'充值教程',"content":"\u5373\u5C06\u8DF3\u8F6C\u5B98\u65B9\u3010\u5BA2\u670D\u4F1A\u8BDD\u3011\u5145\u503C\uFF0C\u7ED9\u5BA2\u670D\u56DE\u590D\u201C\u0031\u201D\u83B7\u53D6\u5145\u503C\u94FE\u63A5",'\u0063\u006F\u006E\u0066\u0069\u0072\u006D\u0054\u0065\u0078\u0074':'客服充值',"showCancel":false,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){if(res['\u0063\u006F\u006E\u0066\u0069\u0072\u006D']){console['\u006C\u006F\u0067']("\u0072\u0065\u0073");_0x3ffffc['\u0063\u0075\u0073\u0074\u006F\u006D\u004D\u0065\u0073\u0073\u0061\u0067\u0065']();}},'\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065':function(res){console['\u006C\u006F\u0067']("\uD83D\uDE80\u0020\u007E\u0020\u007A\u0077\u0073\u0064\u006B\u0020\u007E\u0020\u0072\u0065\u0074\u0075\u0072\u006E\u006E\u0065\u0077\u0050\u0072\u006F\u006D\u0069\u0073\u0065\u0020\u007E\u0020\u0072\u0065\u0073\u003A",res);}});}if(_0x13879g==="yapinim".split("").reverse().join("")){wx['\u006E\u0061\u0076\u0069\u0067\u0061\u0074\u0065\u0054\u006F\u004D\u0069\u006E\u0069\u0050\u0072\u006F\u0067\u0072\u0061\u006D']({'\u0061\u0070\u0070\u0049\u0064':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006D\u0069\u006E\u0069\u005F\u0070\u0061\u0079']['\u0061\u0070\u0070\u005F\u0069\u0064'],"path":_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006D\u0069\u006E\u0069\u005F\u0070\u0061\u0079']['\u0070\u0061\u0074\u0068']});}if(_0x13879g==="yapm".split("").reverse().join("")){_a=_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006D\u0070\u0061\u0079'],_0x641gff=_a['\u006D\u006F\u0064\u0065'],_0x83b=_a['\u0065\u006E\u0076'],_0xa5d4e=_a['\u006F\u0066\u0066\u0065\u0072\u005F\u0069\u0064'],_0x02aff=_a['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065'],_0xeb_0xd31=_a['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'],_0xb4c68c=_a['\u0062\u0075\u0079\u005F\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079'],_0x50ac1e=_a['\u007A\u006F\u006E\u0065\u005F\u0069\u0064'];_0xcbe=_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0072\u0075\u006C\u0065'];_0xg2e0af=((_b=_0x4116eg===null||_0x4116eg===void(588669^588669)?void(901071^901071):_0x4116eg['\u006F\u0072\u0064\u0065\u0072'])===null||_b===void(483440^483440)?void(970748^970748):_b['\u0061\u006D\u006F\u0075\u006E\u0074'])+'';_0x5b41ba=_0xg2e0af;if((_0xcbe===null||_0xcbe===void(121074^121074)?void(656472^656472):_0xcbe['\u0061\u006C\u006C\u006F\u0077\u0065\u0064'])&&(_0xcbe===null||_0xcbe===void(263457^263457)?void(365285^365285):_0xcbe['\u0061\u006D\u006F\u0075\u006E\u0074\u004D\u0061\u0070'])){_0x5b41ba=_0xcbe['\u0061\u006D\u006F\u0075\u006E\u0074\u004D\u0061\u0070'][_0xg2e0af]||_0xg2e0af;}(_0x3d4b=(_0xbg98fb=wx['\u0024\u0061\u0064\u0071\u0053\u0064\u006B\u0052\u0065\u0070\u006F\u0072\u0074'])===null||_0xbg98fb===void(234961^234961)?void(590477^590477):_0xbg98fb['\u0070\u0075\u0062\u006C\u0069\u0073\u0068'])===null||_0x3d4b===void(110787^110787)?void(244434^244434):_0x3d4b['\u0063\u0061\u006C\u006C'](_0xbg98fb,"YAP_TRATS".split("").reverse().join(""),{'\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079':_0x5b41ba,"mode":"\u0067\u0061\u006D\u0065",'\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D':_0xeb_0xd31,'\u006E\u006F':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],'\u0070\u0061\u0079\u0054\u0079\u0070\u0065':'Midas'});wx['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u004D\u0069\u0064\u0061\u0073\u0050\u0061\u0079\u006D\u0065\u006E\u0074']({'\u006D\u006F\u0064\u0065':_0x641gff,"env":_0x83b,'\u006F\u0066\u0066\u0065\u0072\u0049\u0064':_0xa5d4e,"currencyType":_0x02aff,"buyQuantity":_0xb4c68c,'\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D':_0xeb_0xd31,'\u007A\u006F\u006E\u0065\u0049\u0064':_0x50ac1e,"outTradeNo":_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],"success":function(res){var _0x28b7cg,_0xf5d;_0x512c['\u006C\u006F\u0067']("sseccus tnemyaPsadiMtseuqer:kds-qda".split("").reverse().join(""),{"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u006F\u0072\u0064\u0065\u0072\u0049\u006E\u0066\u006F':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']});(_0xf5d=(_0x28b7cg=wx['\u0024\u0061\u0064\u0071\u0053\u0064\u006B\u0052\u0065\u0070\u006F\u0072\u0074'])===null||_0x28b7cg===void(438419^438419)?void(296625^296625):_0x28b7cg['\u0070\u0075\u0062\u006C\u0069\u0073\u0068'])===null||_0xf5d===void(536046^536046)?void(846049^846049):_0xf5d['\u0063\u0061\u006C\u006C'](_0x28b7cg,"\u0046\u0049\u004E\u0049\u0053\u0048\u005F\u0050\u0041\u0059",{'\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079':_0x5b41ba,"mode":"\u0067\u0061\u006D\u0065",'\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D':_0xeb_0xd31,"no":_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],"payType":"\u004D\u0069\u0064\u0061\u0073","status":"\u0053\u0055\u0043\u0043\u0045\u0053\u0053"});_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']({"call_back":{'\u0061\u0063\u0074\u0069\u006F\u006E':'on','\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065':'onPurchase',"action_param":_0x5b41ba},'\u0072\u0065\u0073\u005F\u0072\u0065\u0070\u006F\u0072\u0074':{'\u006C\u006F\u0067\u005F\u0069\u0064':'',"call_back_status":2,'\u0065\u0076\u0065\u006E\u0074':'PURCHASE',"event_type":2,'\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],"res":''}});},"fail":function(res){var _0x8d1e9d,_0xd23e2f;_0x512c['\u006C\u006F\u0067']("\u0061\u0064\u0071\u002D\u0073\u0064\u006B\u003A\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u004D\u0069\u0064\u0061\u0073\u0050\u0061\u0079\u006D\u0065\u006E\u0074\u0020\u0066\u0061\u0069\u006C",{'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"orderInfo":_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']});(_0xd23e2f=(_0x8d1e9d=wx['\u0024\u0061\u0064\u0071\u0053\u0064\u006B\u0052\u0065\u0070\u006F\u0072\u0074'])===null||_0x8d1e9d===void(245242^245242)?void(583700^583700):_0x8d1e9d['\u0070\u0075\u0062\u006C\u0069\u0073\u0068'])===null||_0xd23e2f===void(326127^326127)?void(915133^915133):_0xd23e2f['\u0063\u0061\u006C\u006C'](_0x8d1e9d,"\u0046\u0049\u004E\u0049\u0053\u0048\u005F\u0050\u0041\u0059",{'\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079':_0x5b41ba,"mode":'game','\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D':_0xeb_0xd31,'\u006E\u006F':_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],'\u0070\u0061\u0079\u0054\u0079\u0070\u0065':"\u004D\u0069\u0064\u0061\u0073",'\u0073\u0074\u0061\u0074\u0075\u0073':'FAIL'});},'\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065':function(mdspayInfo){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u006D\u0064\u0073\u005F\u0070\u0061\u0079\u002F\u0063\u0061\u006C\u006C\u0062\u0061\u0063\u006B",{"order_id":_0x404dbe['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'','\u0073\u0074\u0061\u0074\u0075\u0073':mdspayInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065']?false:!![],'\u0063\u006F\u0064\u0065':mdspayInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065'],'\u006D\u0073\u0067':mdspayInfo['\u0065\u0072\u0072\u004D\u0073\u0067']})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](":yap/yap_sdm/kds_inim/".split("").reverse().join(""),res);});}});}}else{resolve(_0x404dbe);}return[974634^974632];}});});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u004F\u0072\u0064\u0065\u0072']=function(){var _0xddg46e=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(700505^700505)&&void(225400^225400)!==arguments[926156^926156]?arguments[829848^829848]:{};return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u006F\u0072\u0064\u0065\u0072\u002F\u0067\u0065\u0074\u0050\u0061\u0079\u0053\u0074\u0061\u0074\u0075\u0073",{"order":_0xddg46e['\u006F\u0072\u0064\u0065\u0072']})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073']=function(){if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']){clearTimeout(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']);}var _0xe36bda=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072\u004E\u0075\u006D\u0062\u0065\u0072']||711622^668070;_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']=setTimeout(function check(){_0x512c['\u0061\u006A\u0061\u0078']("sutatSnigoLkcehc/rebmem/kds_inim/".split("").reverse().join(""),{})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===-(254886^254887)){wx['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067']({"title":"\u8BF7\u91CD\u65B0\u767B\u5F55\u0021",'\u006D\u0061\u0073\u006B':!![],"complete":function(complete){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067\u002C\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065",complete);}});wx['\u0063\u006C\u006F\u0073\u0065\u0053\u006F\u0063\u006B\u0065\u0074']();wx['\u006F\u006E\u0053\u006F\u0063\u006B\u0065\u0074\u004F\u0070\u0065\u006E'](function(res){wx['\u0063\u006C\u006F\u0073\u0065\u0053\u006F\u0063\u006B\u0065\u0074']();});clearTimeout(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']);}else{_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']=setTimeout(check,_0xe36bda);}})['\u0063\u0061\u0074\u0063\u0068'](function(_){clearTimeout(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']);_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072']=setTimeout(check,_0xe36bda);});},651979^651969);};_0x512c['\u0069\u006E\u0069\u0074\u0053\u0068\u0061\u0072\u0065']=function(){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F",{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(222149^222148)){wx['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x512c['\u006C\u006F\u0067']("\u7CFB\u7EDF\u8F6C\u53D1\u003A\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0070\u0061\u0072\u0061\u006D\u0073':{"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']},'\u0072\u0065\u0073\u0075\u006C\u0074':res});_0x512c['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});return{'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],'\u0069\u006D\u0061\u0067\u0065\u0055\u0072\u006C':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],"query":"state="['\u0063\u006F\u006E\u0063\u0061\u0074'](res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0065'])};});wx['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({"withShareTicket":!![],"menus":["\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065","\u0073\u0068\u0061\u0072\u0065\u0054\u0069\u006D\u0065\u006C\u0069\u006E\u0065"]});}});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0072\u0065\u0074\u0075\u0072\u006E\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F']=function(){return new Promise(function(resolve,reject){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F",{"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(443583^443582)){resolve({"title":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],"imageUrl":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':"\u0073\u0074\u0061\u0074\u0065\u003D"['\u0063\u006F\u006E\u0063\u0061\u0074'](res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0065'])});}else{resolve({});}});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F']=function(){var _0x4ad=(760003^760002)+(887235^887238);var _0xc861b=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(451300^451300)&&void(429494^429494)!==arguments[505421^505421]?arguments[320461^320461]:{};_0x4ad=(293277^293277)+(632913^632916);_0x512c['\u0061\u006A\u0061\u0078']("ofnIerahSteg/erahs/kds_inim/".split("").reverse().join(""),{"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0xc861b['\u0070\u0061\u0074\u0068']||''})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(841724^841725)){wx['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x512c['\u006C\u006F\u0067']("\u7CFB\u7EDF\u8F6C\u53D1\u003A\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{"params":{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0xc861b['\u0070\u0061\u0074\u0068']||''},'\u0072\u0065\u0073\u0075\u006C\u0074':res});_0x512c['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({"share_id":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});return{"title":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],"imageUrl":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':"state="['\u0063\u006F\u006E\u0063\u0061\u0074'](res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0065'])};});wx['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({"withShareTicket":!![],'\u006D\u0065\u006E\u0075\u0073':["\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065","enilemiTerahs".split("").reverse().join("")]});if(_0xc861b['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||_0xc861b['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']===undefined){wx['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']({'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],"imageUrl":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':"\u0073\u0074\u0061\u0074\u0065\u003D"['\u0063\u006F\u006E\u0063\u0061\u0074'](res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0065'])});_0x512c['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});_0x512c['\u006C\u006F\u0067']("egasseMppAerahs:\u53D1\u8F6C\u52A8\u4E3B".split("").reverse().join(""),{'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});}}});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=function(){var _0x2bge=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(592655^592655)&&void(978172^978172)!==arguments[123360^123360]?arguments[783764^783764]:{};wx['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](_0x2bge);_0x512c['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']();};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0068\u0061\u0072\u0065\u0052\u0065\u0070\u006F\u0072\u0074']=function(){var _0x5f36a=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(545129^545129)&&void(457856^457856)!==arguments[268668^268668]?arguments[184345^184345]:{};_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']({'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':{'\u0061\u0063\u0074\u0069\u006F\u006E':'track','\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065':"\u0053\u0048\u0041\u0052\u0045","action_param":{"target":"\u0041\u0050\u0050\u005F\u004D\u0045\u0053\u0053\u0041\u0047\u0045"}},'\u0072\u0065\u0073\u005F\u0072\u0065\u0070\u006F\u0072\u0074':{"log_id":'',"call_back_status":2,'\u0065\u0076\u0065\u006E\u0074':"\u0053\u0048\u0041\u0052\u0045\u005F\u0041\u0050\u0050\u005F\u004D\u0045\u0053\u0053\u0041\u0047","res":"\u007B\u0020\u0022\u0074\u0061\u0072\u0067\u0065\u0074\u0022\u003A\u0020\u0022\u0041\u0050\u0050\u005F\u004D\u0045\u0053\u0053\u0041\u0047\u0045\u0020\u007D"}});_0x512c['\u0061\u006A\u0061\u0078']("troper/erahs/kds_inim/".split("").reverse().join(""),{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"share_id":_0x5f36a['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']||'','\u0065\u0078\u0074':_0x5f36a['\u0065\u0078\u0074']||''})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](res);});};_0x512c['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']=function(){var _0xa4c=(171748^171744)+(654176^654176);var _0x9g7dc=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(563397^563397)&&void(907430^907430)!==arguments[334969^334969]?arguments[647856^647856]:{};_0xa4c='\u0064\u0062\u0064\u006D\u006B\u006C';_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']({'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':{'\u0061\u0063\u0074\u0069\u006F\u006E':'track','\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065':'SHARE','\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D':{'\u0074\u0061\u0072\u0067\u0065\u0074':"\u0041\u0050\u0050\u005F\u004D\u0045\u0053\u0053\u0041\u0047\u0045"}},"res_report":{"log_id":'','\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B\u005F\u0073\u0074\u0061\u0074\u0075\u0073':2,'\u0065\u0076\u0065\u006E\u0074':"\u0053\u0048\u0041\u0052\u0045\u005F\u0041\u0050\u0050\u005F\u004D\u0045\u0053\u0053\u0041\u0047",'\u0072\u0065\u0073':'{ "target": "APP_MESSAGE }'}});_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0072\u0065\u0070\u006F\u0072\u0074",{"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"share_id":_0x9g7dc['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']||'',"ext":_0x9g7dc['\u0065\u0078\u0074']||''})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](res);});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0075\u0070\u0064\u0061\u0074\u0065\u0052\u006F\u006C\u0065']=function(){var _0x07dc7g=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(476730^476730)&&void(302579^302579)!==arguments[153166^153166]?arguments[713522^713522]:{};return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("troper/elor/kds_inim/".split("").reverse().join(""),{'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u006F\u0073':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072'],"device_brand":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],'\u0072\u006F\u006C\u0065':_0x07dc7g['\u0072\u006F\u006C\u0065']||{}})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u004D\u0073\u0067']=function(){var _0x3_0xdf9=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(405412^405412)&&void(725651^725651)!==arguments[656093^656093]?arguments[337506^337506]:{};return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("egassem/kcehc/kds_inim/".split("").reverse().join(""),{"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"content":_0x3_0xdf9['\u0063\u006F\u006E\u0074\u0065\u006E\u0074']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u0049\u006D\u0067']=function(){var _0xeg36ea=(194545^194549)+(594049^594052);var _0xd5e29a=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(647988^647988)&&void(524883^524883)!==arguments[717643^717643]?arguments[507457^507457]:{};_0xeg36ea=(834477^834474)+(125278^125273);return new Promise(function(resolve,rej){wx['\u0075\u0070\u006C\u006F\u0061\u0064\u0046\u0069\u006C\u0065']({"url":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']+"\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0063\u0068\u0065\u0063\u006B\u002F\u0069\u006D\u0061\u0067\u0065","filePath":_0xd5e29a['\u0066\u0069\u006C\u0065\u0050\u0061\u0074\u0068'],'\u006E\u0061\u006D\u0065':"\u0069\u006D\u0061\u0067\u0065",'\u0068\u0065\u0061\u0064\u0065\u0072':{'User-Token':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']},'\u0066\u006F\u0072\u006D\u0044\u0061\u0074\u0061':{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"user_token":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']},"success":function(res){resolve(res);}});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u004D\u0073\u0067\u0057\u0069\u0074\u0068\u0041\u0049']=function(){var _0x7b1ebd=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(326763^326763)&&void(216234^216234)!==arguments[921217^921217]?arguments[474883^474883]:{};return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0063\u0068\u0065\u0063\u006B\u002F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u0057\u0069\u0074\u0068\u0041\u0049\u0043\u0068\u0065\u0063\u006B",{'\u0075\u0073\u0065\u0072\u005F\u0074\u006F\u006B\u0065\u006E':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E'],"game_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0063\u006F\u006E\u0074\u0065\u0078\u0074':_0x7b1ebd['\u0063\u006F\u006E\u0074\u0065\u0078\u0074']||'',"context_type":_0x7b1ebd['\u0063\u006F\u006E\u0074\u0065\u0078\u0074\u005F\u0074\u0079\u0070\u0065']||"\u0063\u0068\u0061\u0074","zw_app_id":_0x7b1ebd['\u007A\u0077\u005F\u0061\u0070\u0070\u005F\u0069\u0064'],"cp_role_id":_0x7b1ebd['\u0063\u0070\u005F\u0072\u006F\u006C\u0065\u005F\u0069\u0064'],'\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0069\u006D\u0065':_0x7b1ebd['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0069\u006D\u0065'],'\u0072\u006F\u006F\u006D\u005F\u0069\u0064':_0x7b1ebd['\u0072\u006F\u006F\u006D\u005F\u0069\u0064'],'\u0072\u006F\u006F\u006D\u005F\u006E\u0061\u006D\u0065':_0x7b1ebd['\u0072\u006F\u006F\u006D\u005F\u006E\u0061\u006D\u0065'],"server_id":_0x7b1ebd['\u0073\u0065\u0072\u0076\u0065\u0072\u005F\u0069\u0064'],'\u0063\u0068\u0061\u006E\u006E\u0065\u006C\u005F\u0069\u0064':_0x7b1ebd['\u0063\u0068\u0061\u006E\u006E\u0065\u006C\u005F\u0069\u0064'],'\u0075\u0073\u0065\u0072\u005F\u0069\u0064':_0x7b1ebd['\u0075\u0073\u0065\u0072\u005F\u0069\u0064'],'\u0069\u0070':_0x7b1ebd['\u0069\u0070']})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0075\u0073\u0074\u006F\u006D\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=function(){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0063\u0075\u0073\u0074\u006F\u006D\u005F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u002F\u0063\u006F\u006E\u0066\u0069\u0067",{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064']})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(529502^529503)){wx['\u006F\u0070\u0065\u006E\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065\u0043\u006F\u006E\u0076\u0065\u0072\u0073\u0061\u0074\u0069\u006F\u006E']({'\u0073\u0065\u0073\u0073\u0069\u006F\u006E\u0046\u0072\u006F\u006D':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0065\u0073\u0073\u0069\u006F\u006E\u005F\u0066\u0072\u006F\u006D'],'\u0073\u0068\u006F\u0077\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u0061\u0072\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u006F\u0077\u005F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u005F\u0063\u0061\u0072\u0064'],'\u0073\u0065\u006E\u0064\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0065\u006E\u0064\u005F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u005F\u0074\u0069\u0074\u006C\u0065'],'\u0073\u0065\u006E\u0064\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0050\u0061\u0074\u0068':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0065\u006E\u0064\u005F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u005F\u0070\u0061\u0074\u0068'],'\u0073\u0065\u006E\u0064\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0049\u006D\u0067':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0065\u006E\u0064\u005F\u006D\u0065\u0073\u0073\u0061\u0067\u0065\u005F\u0069\u006D\u0067'],"complete":function(res){_0x512c['\u006C\u006F\u0067']("noitasrevnoCecivreSremotsuCnepo:\u8BDD\u4F1A\u670D\u5BA2".split("").reverse().join(""),res);}});}});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0065\u006E\u0064\u0043\u0061\u0070\u0074\u0063\u0068\u0061']=function(){var _0xd47dc=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(320113^320113)&&void(861672^861672)!==arguments[319162^319162]?arguments[936001^936001]:{};return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("dnes/ahctpac/kds_inim/".split("").reverse().join(""),{'\u006D\u006F\u0062\u0069\u006C\u0065':_0xd47dc['\u006D\u006F\u0062\u0069\u006C\u0065']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0062\u0069\u006E\u0064\u004D\u006F\u0062\u0069\u006C\u0065']=function(){var _0x8ab8bf=(205972^205971)+(910254^910249);var _0x739e3c=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(417396^417396)&&void(541182^541182)!==arguments[437161^437161]?arguments[781122^781122]:{};_0x8ab8bf=(682304^682308)+(387674^387674);return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("eliboMdnib/rebmem/kds_inim/".split("").reverse().join(""),{'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"mobile":_0x739e3c['\u006D\u006F\u0062\u0069\u006C\u0065']||'','\u0063\u006F\u0064\u0065':_0x739e3c['\u0063\u006F\u0064\u0065']||'','\u006B\u0065\u0079':_0x739e3c['\u006B\u0065\u0079']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=function(){return __awaiter(this,void(677340^677340),void(164525^164525),function(){return __generator(this,function(_a){return[584989^584991,new Promise(function(resolve,rej){wx['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']({'\u0074\u006D\u0070\u006C\u0049\u0064\u0073':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004C\u0069\u0073\u0074']||[],"fail":function(err){console['\u006C\u006F\u0067']("\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0066\u0061\u0069\u006C\u003A",err);resolve({'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':-(478868^478869),'\u0064\u0061\u0074\u0061':err});},'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){console['\u006C\u006F\u0067']("\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0020\u0073\u0075\u0063\u0063\u0065\u0073\u0073\u003A",res);resolve({"status_code":1,"data":res});}});})];});});};_0x512c['\u0069\u006E\u0069\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']=function(){_0x512c['\u0061\u006A\u0061\u0078']("tsiLetalpmeTksat/ksat_inim/kds_inim/".split("").reverse().join(""),{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064']})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(507720^507721)){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004C\u0069\u0073\u0074']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']||[];if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u006D\u0065\u0072']){clearInterval(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u006D\u0065\u0072']);_0x512c['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0063\u0068\u0065\u0064\u0075\u006C\u0065\u0064']();}}});};_0x512c['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0053\u0063\u0068\u0065\u0064\u0075\u006C\u0065\u0064']=function(){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u006D\u0065\u0072']=setTimeout(function(){_0x512c['\u0069\u006E\u0069\u0074\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065']();},3600000);};_0x512c['\u0061\u006A\u0061\u0078']=function(url,data){var _0x6f665c={'content-type':"\u0061\u0070\u0070\u006C\u0069\u0063\u0061\u0074\u0069\u006F\u006E\u002F\u006A\u0073\u006F\u006E"};if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']){_0x6f665c["\u0055\u0073\u0065\u0072\u002D\u0054\u006F\u006B\u0065\u006E"]=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E'];}_0x6f665c['Sdk-Version']=_0x512c['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];var _0xf3aa2b=data['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067'],_0x353f3b=data['\u006C\u006F\u0061\u0064\u0069\u006E\u0067\u0050\u0061\u0072\u0061\u006D\u0073'],_0x39b60d=data['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'],_0x64a3c=data['\u0074\u006F\u0061\u0073\u0074\u0050\u0061\u0072\u0061\u006D\u0073'];_0xf3aa2b&&wx['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067'](_0x353f3b);return new Promise(function(resolve,rej){wx['\u0072\u0065\u0071\u0075\u0065\u0073\u0074']({'\u006D\u0065\u0074\u0068\u006F\u0064':"\u0050\u004F\u0053\u0054",'\u0075\u0072\u006C':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']+url,'\u0064\u0061\u0074\u0061':data,'\u0068\u0065\u0061\u0064\u0065\u0072':_0x6f665c,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){if(res['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===-(458493^458492)){wx['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067']({"title":"\u8BF7\u91CD\u65B0\u767B\u5F55\u0021",'\u006D\u0061\u0073\u006B':!![],'\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065':function(complete){console['\u006C\u006F\u0067']("etelpmoc,gnidaoLwohs".split("").reverse().join(""),complete);}});wx['\u0063\u006C\u006F\u0073\u0065\u0053\u006F\u0063\u006B\u0065\u0074']({"complete":function(complete){console['\u006C\u006F\u0067']("etelpmoc,tekcoSesolc".split("").reverse().join(""),complete);}});wx['\u006F\u006E\u0053\u006F\u0063\u006B\u0065\u0074\u004F\u0070\u0065\u006E'](function(res){wx['\u0063\u006C\u006F\u0073\u0065\u0053\u006F\u0063\u006B\u0065\u0074']();});console['\u006C\u006F\u0067']("\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u002E\u0072\u0065\u006C\u006F\u0061\u0064\u0028\u0029");location['\u0072\u0065\u006C\u006F\u0061\u0064']();}_0xf3aa2b&&wx['\u0068\u0069\u0064\u0065\u004C\u006F\u0061\u0064\u0069\u006E\u0067']();if(_0x39b60d){_0x64a3c['\u0074\u0069\u0074\u006C\u0065']=res['\u0064\u0061\u0074\u0061']['\u006D\u0073\u0067'];wx['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'](_0x64a3c);}resolve(res['\u0064\u0061\u0074\u0061']);if(res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']&&res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0069\u006E\u0069\u0074']){setTimeout(function(){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B\u0049\u006E\u0069\u0074'](res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0069\u006E\u0069\u0074']);},702774^702780);}if(res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']&&res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0072\u0065\u0070\u006F\u0072\u0074']&&res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0072\u0065\u0070\u006F\u0072\u0074']['\u006C\u0065\u006E\u0067\u0074\u0068']){if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']){res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0072\u0065\u0070\u006F\u0072\u0074']['\u006D\u0061\u0070'](function(item){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074'](item);});}else{setTimeout(function(){res['\u0064\u0061\u0074\u0061']['\u0065\u0078\u0074\u0072\u0061']['\u006D\u0065\u0064\u0069\u0061\u005F\u0072\u0065\u0070\u006F\u0072\u0074']['\u006D\u0061\u0070'](function(item){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074'](item);});},708777^709441);}}},"fail":function(res){_0xf3aa2b&&wx['\u0068\u0069\u0064\u0065\u004C\u006F\u0061\u0064\u0069\u006E\u0067']();if(_0x39b60d){_0x64a3c['\u0074\u0069\u0074\u006C\u0065']=res['\u0065\u0072\u0072\u004D\u0073\u0067'];wx['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'](_0x64a3c);}resolve(res);}});});};_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004F\u0053']=function(){var _0x7d_0x597=wx['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063'](),_0xfg_0x0g1=_0x7d_0x597['\u0073\u0079\u0073\u0074\u0065\u006D'],_0x3847c=_0x7d_0x597['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'];if(_0xfg_0x0g1['\u0074\u006F\u004C\u006F\u0063\u0061\u006C\u0065\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("\u0061\u006E\u0064\u0072\u006F\u0069\u0064")>-(814011^814010))return"diordna".split("").reverse().join("");if(_0xfg_0x0g1['\u0074\u006F\u004C\u006F\u0063\u0061\u006C\u0065\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("\u0069\u006F\u0073")>-(102138^102139))return"\u0069\u006F\u0073";if(_0xfg_0x0g1['\u0074\u006F\u004C\u006F\u0063\u0061\u006C\u0065\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("\u0077\u0069\u006E\u0064\u006F\u0077\u0073")>-(430316^430317))return"swodniw".split("").reverse().join("");if(_0xfg_0x0g1['\u0074\u006F\u004C\u006F\u0063\u0061\u006C\u0065\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']()['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("\u006D\u0061\u0063\u006F\u0073")>-(864972^864973))return"socam".split("").reverse().join("");if(_0x3847c==="\u0064\u0065\u0076\u0074\u006F\u006F\u006C\u0073")return"\u006F\u0074\u0068\u0065\u0072";return _0x3847c;};_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0042\u0072\u0061\u006E\u0064']=function(){var _0x746f6f=wx['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u0062\u0072\u0061\u006E\u0064'];return _0x746f6f;};_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004E\u0075\u006D\u0062\u0065\u0072']=function(){var _0xb8g=wx['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u006D\u006F\u0064\u0065\u006C'];return _0xb8g;};_0x512c['\u006D\u0069\u0064\u0061\u0073\u0050\u0061\u0079']=function(params){return wx['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u004D\u0069\u0064\u0061\u0073\u0050\u0061\u0079\u006D\u0065\u006E\u0074'](params);};_0x512c['\u0067\u0065\u0074\u0051\u0075\u0065\u0072\u0079\u0056\u0061\u0072\u0069\u0061\u0062\u006C\u0065']=function(url,variable){var _0x510e=(198607^198606)+(549326^549320);var _0xe0b0c=url;_0x510e=(315250^315248)+(551639^551635);var _0x3bd=_0xe0b0c['\u0073\u0070\u006C\u0069\u0074']("\u0026");for(var i=168330^168330;i<_0x3bd['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){var _0x503d=_0x3bd[i]['\u0073\u0070\u006C\u0069\u0074']("\u003D");if(_0x503d[774886^774886]===variable){return _0x503d[327634^327635];}}return'';};_0x512c['\u0067\u0065\u0074\u0053\u0074\u0061\u0074\u0065']=function(query){if(query['\u0073\u0074\u0061\u0074\u0065']){return query['\u0073\u0074\u0061\u0074\u0065'];}if(query['\u0073\u0063\u0065\u006E\u0065']&&query['\u0073\u0063\u0065\u006E\u0065']['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("etats".split("").reverse().join(""))>-(720122^720123)){return _0x512c['\u0067\u0065\u0074\u0051\u0075\u0065\u0072\u0079\u0056\u0061\u0072\u0069\u0061\u0062\u006C\u0065'](decodeURIComponent(query['\u0073\u0063\u0065\u006E\u0065']),"etats".split("").reverse().join(""));}return'';};_0x512c['\u006C\u006F\u0067']=function(name,value){setTimeout(function(){_0x512c['\u0061\u006A\u0061\u0078']("goLinim/gol_kds/kds_inim/".split("").reverse().join(""),{'\u006E\u0061\u006D\u0065':name,'\u0076\u0061\u006C\u0075\u0065':value});console['\u006C\u006F\u0067'](":]goLinim-kdswz[".split("").reverse().join(""),name,value);},358754^358662);};_0x512c['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0049\u006E\u0069\u0074']=function(){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']=wx['\u0063\u0072\u0065\u0061\u0074\u0065\u0047\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']({"style":{'\u006C\u0065\u0066\u0074':0,'\u0074\u006F\u0070':0,"width":0,'\u0068\u0065\u0069\u0067\u0068\u0074':0}});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0053\u0068\u006F\u0077']=function(){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']&&_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']['\u0073\u0068\u006F\u0077']();};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0048\u0069\u0064\u0065']=function(){_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']&&_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']['\u0068\u0069\u0064\u0065']();};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0053\u0065\u0074\u0053\u0074\u0079\u006C\u0065']=function(style){if(!_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E'])return;_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']['\u0073\u0074\u0079\u006C\u0065']=Object['\u0061\u0073\u0073\u0069\u0067\u006E'](_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E']['\u0073\u0074\u0079\u006C\u0065'],style);};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0044\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061']=function(){var _0x0341e=(795229^795229)+(404838^404833);var _0x85ae=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(176692^176692)&&void(606557^606557)!==arguments[395548^395548]?arguments[207718^207718]:{};_0x0341e=452039^452039;return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u006D\u0065\u006D\u0062\u0065\u0072\u002F\u0064\u0065\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061",{'\u0065\u006E\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u005F\u0064\u0061\u0074\u0061':_0x85ae['\u0065\u006E\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u0044\u0061\u0074\u0061']||'','\u0069\u0076':_0x85ae['\u0069\u0076']||'',"signature":_0x85ae['\u0073\u0069\u0067\u006E\u0061\u0074\u0075\u0072\u0065']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0072\u006F\u006C\u0065\u0045\u0076\u0065\u006E\u0074\u0052\u0065\u0070\u006F\u0072\u0074']=function(){var _0xg_0x9ba=(777263^777258)+(945557^945557);var _0x7b9d8b=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(129032^129032)&&void(425867^425867)!==arguments[531338^531338]?arguments[995178^995178]:{};_0xg_0x9ba="eogcqo".split("").reverse().join("");return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("\u002F\u006D\u0069\u006E\u0069\u005F\u0073\u0064\u006B\u002F\u0072\u006F\u006C\u0065\u002F\u0067\u0061\u006D\u0065\u0052\u0065\u0070\u006F\u0072\u0074",{"role_name":_0x7b9d8b['\u0072\u006F\u006C\u0065\u005F\u006E\u0061\u006D\u0065']||'',"cp_role_id":_0x7b9d8b['\u0063\u0070\u005F\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'',"event":_0x7b9d8b['\u0065\u0076\u0065\u006E\u0074']||'','\u0071\u0075\u0065\u0072\u0079\u0073':_0x7b9d8b['\u0071\u0075\u0065\u0072\u0079\u0073']||[]})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);})['\u0063\u0061\u0074\u0063\u0068'](function(err){rej(err);});});};_0x512c['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0061\u0064\u0052\u0065\u0070\u006F\u0072\u0074']=function(){var _0xdg_0x7e3=(609498^609503)+(859505^859509);var _0x67f=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(976666^976666)&&void(412393^412393)!==arguments[851862^851862]?arguments[906378^906378]:{};_0xdg_0x7e3=(670253^670251)+(377098^377098);return new Promise(function(resolve,rej){_0x512c['\u0061\u006A\u0061\u0078']("troper/resitrevda/kds_inim/".split("").reverse().join(""),{'\u0065\u0076\u0065\u006E\u0074':_0x67f['\u0065\u0076\u0065\u006E\u0074'],'\u0074\u0079\u0070\u0065':_0x67f['\u0074\u0079\u0070\u0065'],"is_over":_0x67f['\u0069\u0073\u005F\u006F\u0076\u0065\u0072']||577867^577867,'\u0064\u0075\u0072\u0061\u0074\u0069\u006F\u006E':_0x67f['\u0064\u0075\u0072\u0061\u0074\u0069\u006F\u006E']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);})['\u0063\u0061\u0074\u0063\u0068'](function(err){rej(err);});});};_0x512c['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B\u0049\u006E\u0069\u0074']=function(mediaConfig){return __awaiter(this,void(547966^547966),void(293894^293894),function(){var _0x_0x381,_0x40aa1f,_0x1476a,_0x7a3ca,_0x74594c;return __generator(this,function(_a){if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']){return[562249^562251];}_0x_0x381=mediaConfig['\u006D\u0065\u0064\u0069\u0061'],_0x40aa1f=mediaConfig['\u006D\u0065\u0064\u0069\u0061\u005F\u0063\u006F\u006E\u0066'],_0x1476a=mediaConfig['\u006D\u0065\u0064\u0069\u0061\u005F\u0072\u0065\u0070\u006F\u0072\u0074'];_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0049\u0064']=_0x_0x381;if(_0x_0x381===(198518^198517)){try{_0x7a3ca=require("\u002E\u002F\u0061\u0064\u0071\u002E\u006A\u0073")['\u0053\u0044\u004B'];if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076']){_0x7a3ca['\u0073\u0065\u0074\u0044\u0065\u0062\u0075\u0067'](!![]);}_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']=new _0x7a3ca({'\u0075\u0073\u0065\u0072\u005F\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0073\u0065\u0074\u005F\u0069\u0064':_0x40aa1f['\u0075\u0073\u0065\u0072\u005F\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0073\u0065\u0074\u005F\u0069\u0064'],'\u0073\u0065\u0063\u0072\u0065\u0074\u005F\u006B\u0065\u0079':_0x40aa1f['\u0073\u0065\u0063\u0072\u0065\u0074\u005F\u006B\u0065\u0079'],'\u0061\u0070\u0070\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']});_0x74594c=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']['\u0067\u0065\u0074\u0049\u006E\u0069\u0074\u0052\u0065\u0073\u0075\u006C\u0074']();_0x512c['\u006C\u006F\u0067']("sseccus tini:kds-qda".split("").reverse().join(""),{'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"adq_result":_0x74594c});_0x512c['\u0061\u0064\u0071\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072']();if(_0x74594c===null||_0x74594c===void(863610^863610)?void(297835^297835):_0x74594c['\u0069\u006E\u0069\u0074\u0065\u0064']){if(_0x1476a&&_0x1476a['\u006C\u0065\u006E\u0067\u0074\u0068']){_0x1476a['\u006D\u0061\u0070'](function(item){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074'](item);});}}}catch(err){_0x512c['\u006C\u006F\u0067']("\u0061\u0064\u0071\u002D\u0073\u0064\u006B\u003A\u0069\u006E\u0069\u0074\u0020\u0020\u0065\u0072\u0072\u006F\u0072",{"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0065\u0072\u0072\u006F\u0072':err['\u006D\u0065\u0073\u0073\u0061\u0067\u0065']});}}return[435795^435793];});});};_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']=function(data){if(!_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']){console['\u006C\u006F\u0067']("\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B\u0020\u006E\u006F\u0074\u0020\u0069\u006E\u0069\u0074");return;}if(_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0049\u0064']===(355902^355901)&&data['\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B']){_0x512c['\u0061\u0064\u0071\u0052\u0065\u0070\u006F\u0072\u0074'](data['\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B']);}if(data['\u0072\u0065\u0073\u005F\u0072\u0065\u0070\u006F\u0072\u0074']){_0x512c['\u007A\u0079\u006F\u0075\u0052\u0065\u0070\u006F\u0072\u0074'](data['\u0072\u0065\u0073\u005F\u0072\u0065\u0070\u006F\u0072\u0074']);}};_0x512c['\u0067\u0065\u0074\u0044\u0061\u0074\u0065\u0054\u0069\u006D\u0065\u0050\u0061\u0072\u0074\u0073']=function(){var _0x6d4edf=new Date();var _0x4g_0xb6b=(275507^275507)+(346003^346010);var _0xa57b=_0x6d4edf['\u0067\u0065\u0074\u0046\u0075\u006C\u006C\u0059\u0065\u0061\u0072']();_0x4g_0xb6b=(319749^319744)+(513888^513896);var _0xface=String(_0x6d4edf['\u0067\u0065\u0074\u004D\u006F\u006E\u0074\u0068']()+(933788^933789))['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](759990^759988,"\u0030");var _0xf_0x439=(346744^346746)+(833737^833737);var _0x7edab=String(_0x6d4edf['\u0067\u0065\u0074\u0044\u0061\u0074\u0065']())['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](704669^704671,"\u0030");_0xf_0x439=171224^171225;var _0x1f1g=String(_0x6d4edf['\u0067\u0065\u0074\u0048\u006F\u0075\u0072\u0073']())['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](650042^650040,"\u0030");var _0xe973c=(236690^236698)+(420700^420700);var _0x14db7f=String(_0x6d4edf['\u0067\u0065\u0074\u004D\u0069\u006E\u0075\u0074\u0065\u0073']())['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](143225^143227,"\u0030");_0xe973c=558462^558461;var _0x4525d=String(_0x6d4edf['\u0067\u0065\u0074\u0053\u0065\u0063\u006F\u006E\u0064\u0073']())['\u0070\u0061\u0064\u0053\u0074\u0061\u0072\u0074'](749747^749745,"\u0030");return""['\u0063\u006F\u006E\u0063\u0061\u0074'](_0xa57b,"\u002D")['\u0063\u006F\u006E\u0063\u0061\u0074'](_0xface,"\u002D")['\u0063\u006F\u006E\u0063\u0061\u0074'](_0x7edab,"\u0020")['\u0063\u006F\u006E\u0063\u0061\u0074'](_0x1f1g,"\u003A")['\u0063\u006F\u006E\u0063\u0061\u0074'](_0x14db7f,"\u003A")['\u0063\u006F\u006E\u0063\u0061\u0074'](_0x4525d);};_0x512c['\u007A\u0079\u006F\u0075\u0052\u0065\u0070\u006F\u0072\u0074']=function(res_report){return __awaiter(this,void(307104^307104),void(471262^471262),function(){var _0x4c36db;return __generator(this,function(_a){switch(_a['\u006C\u0061\u0062\u0065\u006C']){case 374681^374681:_0x4c36db=Object['\u0061\u0073\u0073\u0069\u0067\u006E']({},res_report);if(!_0x4c36db['\u006D\u0065\u0064\u0069\u0061']){_0x4c36db['\u006D\u0065\u0064\u0069\u0061']=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0049\u0064'];}if(!_0x4c36db['\u0065\u0076\u0065\u006E\u0074\u005F\u0074\u0069\u006D\u0065']){_0x4c36db['\u0065\u0076\u0065\u006E\u0074\u005F\u0074\u0069\u006D\u0065']=_0x512c['\u0067\u0065\u0074\u0044\u0061\u0074\u0065\u0054\u0069\u006D\u0065\u0050\u0061\u0072\u0074\u0073']();}return[640544^640548,_0x512c['\u0061\u006A\u0061\u0078']("troper/aidem/kds_inim/".split("").reverse().join(""),_0x4c36db)];case 551721^551720:_a['\u0073\u0065\u006E\u0074']();return[676532^676534];}});});};_0x512c['\u0061\u0064\u0071\u0052\u0065\u0070\u006F\u0072\u0074']=function(call_back){try{var _0xebfb=(222966^222975)+(984703^984695);var _0xe6b5f=null;_0xebfb=(785700^785708)+(123705^123706);if(call_back['\u0061\u0063\u0074\u0069\u006F\u006E']==="\u006F\u006E"){if(call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D']){_0xe6b5f=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B'][call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065']](call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D']);}else{_0xe6b5f=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B'][call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065']]();}}if(call_back['\u0061\u0063\u0074\u0069\u006F\u006E']==="kcart".split("").reverse().join("")){if(call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D']){_0xe6b5f=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']['\u0074\u0072\u0061\u0063\u006B'](call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065'],call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D']);}else{_0xe6b5f=_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B']['\u0074\u0072\u0061\u0063\u006B'](call_back['\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065']);}}_0x512c['\u006C\u006F\u0067']("\u0061\u0064\u0071\u002D\u0073\u0064\u006B\u003A\u0061\u0064\u0071\u0052\u0065\u0070\u006F\u0072\u0074\u0020\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065",{"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':call_back,'\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B\u005F\u0072\u0065\u0073\u0075\u006C\u0074':_0xe6b5f});}catch(error){_0x512c['\u006C\u006F\u0067']("rorre tropeRqda:kds-qda".split("").reverse().join(""),{"member_id":_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':call_back,"mediaSdk_result":error});}};_0x512c['\u0061\u0064\u0071\u004C\u0069\u0073\u0074\u0065\u006E\u0065\u0072']=function(){wx['\u006F\u006E\u0041\u0064\u0064\u0054\u006F\u0046\u0061\u0076\u006F\u0072\u0069\u0074\u0065\u0073'](function(){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']({'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':{'\u0061\u0063\u0074\u0069\u006F\u006E':"\u0074\u0072\u0061\u0063\u006B",'\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0074\u0079\u0070\u0065':'ADD_TO_WISHLIST',"action_param":{'\u0074\u0079\u0070\u0065':"\u0064\u0065\u0066\u0061\u0075\u006C\u0074"}},'\u0072\u0065\u0073\u005F\u0072\u0065\u0070\u006F\u0072\u0074':{'\u006C\u006F\u0067\u005F\u0069\u0064':'',"call_back_status":2,'\u0065\u0076\u0065\u006E\u0074':'ADD_TO_WISHLIST',"res":'{ "type": "default" }'}});});wx['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0054\u0069\u006D\u0065\u006C\u0069\u006E\u0065'](function(){_0x512c['\u006D\u0065\u0064\u0069\u0061\u0052\u006F\u0070\u0072\u0074']({'\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B':{"action":'track',"action_type":"\u0053\u0048\u0041\u0052\u0045",'\u0061\u0063\u0074\u0069\u006F\u006E\u005F\u0070\u0061\u0072\u0061\u006D':{"target":'TIME_LINE'}},"res_report":{"log_id":'','\u0063\u0061\u006C\u006C\u005F\u0062\u0061\u0063\u006B\u005F\u0073\u0074\u0061\u0074\u0075\u0073':2,'\u0065\u0076\u0065\u006E\u0074':"\u0053\u0048\u0041\u0052\u0045\u005F\u0054\u0049\u004D\u0045\u005F\u004C\u0049\u004E\u0045",'\u0072\u0065\u0073':'{ "target": "TIME_LINE" }'}});});};_0x512c['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E']="\u0031\u002E\u0031\u0032\u002E\u0035";_0x512c['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']={'\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072\u004E\u0075\u006D\u0062\u0065\u0072':60000,'\u0063\u0068\u0065\u0063\u006B\u004C\u006F\u0067\u0069\u006E\u0053\u0074\u0061\u0074\u0075\u0073\u0054\u0069\u006D\u0065\u0072':null,"gameConfig":{},'\u0061\u0070\u0070\u0049\u0064':'',"gameId":'','\u006F\u0073':_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004F\u0053'](),'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004E\u0075\u006D\u0062\u0065\u0072'](),'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064':_0x512c['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0042\u0072\u0061\u006E\u0064'](),"memberId":'','\u0072\u006F\u006C\u0065\u0049\u0064':'','\u0070\u006C\u0061\u0079\u0065\u0072\u0049\u0064':'','\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E':'','\u0062\u0061\u0073\u0065\u0055\u0072\u006C':'',"subscribeMessageList":[],'\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u006D\u0065\u0072':null,'\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E':null,'\u006D\u0065\u0064\u0069\u0061\u0053\u0064\u006B':null,'\u006D\u0065\u0064\u0069\u0061\u0049\u0064':0,"dev":false};return _0x512c;}();_0x01f=622001^622004;exports['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']=zwsdk;
\ No newline at end of file
GameGlobal.USED_TEXTURE_COMPRESSION = false;
GameGlobal.TEXTURE_PARALLEL_BUNDLE = false;
GameGlobal.TEXTURE_BUNDLES = '';
// @ts-nocheck
const unityNamespace = {
canvas: GameGlobal.canvas,
// cache width
canvas_width: GameGlobal.canvas.width,
// cache height
canvas_height: GameGlobal.canvas.height,
navigator: GameGlobal.navigator,
XMLHttpRequest: GameGlobal.XMLHttpRequest,
// 是否显示耗时的弹框,默认开发版时显示弹出耗时弹框
hideTimeLogModal: true,
// 是否打印详细日志
enableDebugLog: false,
// 自定义bundle中的hash长度
bundleHashLength: 32,
// 单位Bytes, 1MB = 1024 KB = 1024*1024Bytes
releaseMemorySize: 31457280,
unityVersion: '2022.3.62f2c1',
// Color Space: Gamma、Linear、Uninitialized(未初始化的颜色空间)
unityColorSpace: 'Gamma',
convertPluginVersion: '202511060320',
// 拼在StreamingAssets前面的path,DATA_CDN + streamingUrlPrefixPath + StreamingAssets
streamingUrlPrefixPath: '',
// DATA_CDN + dataFileSubPrefix + datafilename
dataFileSubPrefix: '',
// 当前appid扩容后,通过本字段告知插件本地存储最大容量,单位MB
maxStorage: 200,
// 纹理中的hash长度
texturesHashLength: 8,
// 纹理存放路径
texturesPath: 'Assets/Textures',
// 是否需要缓存纹理,
needCacheTextures: true,
// AssetBundle在内存中的存活时间
ttlAssetBundle: 5,
// 是否显示性能面板
enableProfileStats: false,
// 是否预载微信系统字体
preloadWXFont: false,
// iOS高性能模式定期GC间隔
iOSAutoGCInterval: 10000,
// 是否使用微信压缩纹理
usedTextureCompression: GameGlobal.USED_TEXTURE_COMPRESSION,
// 是否使用autostreaming
usedAutoStreaming: false,
// 是否显示渲染日志(dev only)
enableRenderAnalysisLog: false,
// 是否dotnet runtime
useDotnetRuntime: false,
// 是否用了多线程brotli压缩
useBrotliMT: true,
// Boot config配置,包含例如wait-for-native-debugger、player-connection-ip等信息
bootConfig: 'player-connection-ip=192.168.55.194',
// 是否以Development Build构建
isDevelopmentBuild: false,
// 是否以Profiling Build导出
isProfilingBuild: false,
// 预留的堆内存
unityHeapReservedMemory: 256,
// 是否向Perfstream上报数据
sendData2PerfStream: false,
};
// 最佳实践检测配置
unityNamespace.monitorConfig = {
// 显示优化建议弹框
showSuggestModal: true,
// 是否开启检测(只影响开发版/体验版,线上版本不会检测)
enableMonitor: true,
// 帧率低于此值的帧会被记录,用于分析长耗时帧,做了限帧的游戏应该适当调低
fps: 10,
// 是否一直检测到游戏可交互完成
showResultAfterLaunch: true,
// 仅当showResultAfterLaunch=false时有效, 在引擎初始化完成(即callmain)后多长时间停止检测
monitorDuration: 30000,
};
// 判断是否需要自动缓存的文件,返回true自动缓存;false不自动缓存
unityNamespace.isCacheableFile = function (path) {
// 判定为下载bundle的路径标识符,此路径下的下载,会自动缓存
const cacheableFileIdentifier = ["StreamingAssets"];
// 命中路径标识符的情况下,并不是所有文件都有必要缓存,过滤下不需要缓存的文件
const excludeFileIdentifier = ["json"];
if (cacheableFileIdentifier.some(identifier => path.includes(identifier)
&& excludeFileIdentifier.every(excludeIdentifier => !path.includes(excludeIdentifier)))) {
return true;
}
return false;
};
// 是否上报此条网络异常, 返回true则上报, 返回false则忽略
unityNamespace.isReportableHttpError = function (_info) {
// const { url, error } = _info;
return true;
};
// 判断是否是AssetBundle
unityNamespace.isWXAssetBundle = function (path) {
return unityNamespace.WXAssetBundles.has(unityNamespace.PathInFileOS(path));
};
unityNamespace.PathInFileOS = function (path) {
return path.replace(`${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE`, '');
};
unityNamespace.WXAssetBundles = new Map();
// 清理缓存时是否可被自动清理;返回true可自动清理;返回false不可自动清理
unityNamespace.isErasableFile = function (info) {
// 用于特定AssetBundle的缓存保持
if (unityNamespace.WXAssetBundles.has(info.path)) {
return false;
}
// 达到缓存上限时,不会被自动清理的文件
const inErasableIdentifier = [];
if (inErasableIdentifier.some(identifier => info.path.includes(identifier))) {
return false;
}
return true;
};
GameGlobal.WebAssembly = GameGlobal.WXWebAssembly;
GameGlobal.unityNamespace = GameGlobal.unityNamespace || unityNamespace;
GameGlobal.realtimeLogManager = wx.getRealtimeLogManager();
GameGlobal.logmanager = wx.getLogManager({ level: 0 });
GameGlobal.disableMultiTouch = false;
// 提前监听错误并打日志
function bindGloblException() {
// 默认上报小游戏实时日志与用户反馈日志(所有error日志+小程序框架异常)
wx.onError((result) => {
// 若manager已初始化,则直接用manager打日志即可
if (GameGlobal.manager) {
GameGlobal.manager.printErr(result.message);
}
else {
GameGlobal.realtimeLogManager.error(result);
const isErrorObj = result && result.stack;
GameGlobal.logmanager.warn(isErrorObj ? result.stack : result);
console.error('onError:', result);
}
});
wx.onUnhandledRejection((result) => {
GameGlobal.realtimeLogManager.error(result);
const isErrorObj = result && result.reason && result.reason.stack;
GameGlobal.logmanager.warn(isErrorObj ? result.reason.stack : result.reason);
console.error('unhandledRejection:', result.reason);
});
// 上报初始信息
function printSystemInfo(appBaseInfo, deviceInfo) {
// eslint-disable-next-line @typescript-eslint/naming-convention
const { version, SDKVersion } = appBaseInfo;
const { platform, system } = deviceInfo;
unityNamespace.version = version;
unityNamespace.SDKVersion = SDKVersion;
unityNamespace.platform = platform;
unityNamespace.system = system;
unityNamespace.isPc = platform === 'windows' || platform === 'mac';
unityNamespace.isDevtools = platform === 'devtools';
unityNamespace.isMobile = !unityNamespace.isPc && !unityNamespace.isDevtools;
unityNamespace.isH5Renderer = GameGlobal.isIOSHighPerformanceMode;
unityNamespace.isIOS = platform === 'ios';
unityNamespace.isAndroid = platform === 'android';
const bootinfo = {
renderer: GameGlobal.isIOSHighPerformanceMode ? 'h5' : '',
isH5Plus: GameGlobal.isIOSHighPerformanceModePlus || false,
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 appBaseInfo = wx.getAppBaseInfo ? wx.getAppBaseInfo() : wx.getSystemInfoSync();
const deviceInfo = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
printSystemInfo(appBaseInfo, deviceInfo);
}
bindGloblException();
// eslint-disable-next-line no-multi-assign
GameGlobal.onCrash = GameGlobal.unityNamespace.onCrash = function () {
GameGlobal.manager.showAbort();
const windowInfo = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync();
wx.createFeedbackButton({
type: 'text',
text: '提交反馈',
style: {
left: (windowInfo.screenWidth - 184) / 2,
top: windowInfo.screenHeight / 3 + 140,
width: 184,
height: 40,
lineHeight: 40,
backgroundColor: '#07C160',
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
borderRadius: 4,
},
});
};
export default GameGlobal.unityNamespace;
/* eslint-disable @typescript-eslint/naming-convention */
import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertInfoToPointer, formatResponse, convertDataToPointer } from '../utils';
const TCPSocketList = {};
const wxTCPSocketBindWifiList = {};
const wxTCPSocketCloseList = {};
const wxTCPSocketConnectList = {};
const wxTCPSocketErrorList = {};
const wxTCPSocketMessageList = {};
const getTCPSocketObject = getListObject(TCPSocketList, 'TCPSocket');
let wxTCPSocketOnMessageCallback;
function WX_CreateTCPSocket() {
const obj = wx.createTCPSocket({ type: 'ipv4' });
const key = uid();
TCPSocketList[key] = obj;
return key;
}
function WX_TCPSocketBindWifi(id, option) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
obj.bindWifi(formatJsonStr(option));
}
function WX_TCPSocketClose(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
obj.close();
delete TCPSocketList[id];
}
function WX_TCPSocketConnect(id, option) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
obj.connect(formatJsonStr(option));
}
function WX_TCPSocketWriteString(id, data) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
obj.write(data);
}
function WX_TCPSocketWriteBuffer(id, dataPtr, dataLength) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
obj.write(GameGlobal.Module.HEAPU8.buffer.slice(dataPtr, dataPtr + dataLength));
}
function WX_TCPSocketOffBindWifi(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxTCPSocketBindWifiList, (v) => {
obj.offBindWifi(v);
}, id);
}
function WX_TCPSocketOffClose(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxTCPSocketCloseList, (v) => {
obj.offClose(v);
}, id);
}
function WX_TCPSocketOffConnect(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxTCPSocketConnectList, (v) => {
obj.offConnect(v);
}, id);
}
function WX_TCPSocketOffError(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxTCPSocketErrorList, (v) => {
obj.offError(v);
}, id);
}
function WX_TCPSocketOffMessage(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxTCPSocketMessageList, (v) => {
obj.offMessage(v);
}, id);
}
function WX_TCPSocketOnBindWifi(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxTCPSocketBindWifiList, '_TCPSocketOnBindWifiCallback', id, id);
obj.onBindWifi(callback);
}
function WX_TCPSocketOnClose(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxTCPSocketCloseList, '_TCPSocketOnCloseCallback', id, id);
obj.onClose(callback);
}
function WX_TCPSocketOnConnect(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxTCPSocketConnectList, '_TCPSocketOnConnectCallback', id, id);
obj.onConnect(callback);
}
function WX_TCPSocketOnError(id) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxTCPSocketErrorList, '_TCPSocketOnErrorCallback', id, id);
obj.onError(callback);
}
function WX_TCPSocketOnMessage(id, needInfo) {
const obj = getTCPSocketObject(id);
if (!obj) {
return;
}
if (!wxTCPSocketMessageList[id]) {
wxTCPSocketMessageList[id] = [];
}
const callback = (res) => {
formatResponse('TCPSocketOnMessageListenerResult', res);
const idPtr = convertDataToPointer(id);
const messagePtr = convertDataToPointer(res.message);
if (needInfo) {
const localInfoPtr = convertInfoToPointer(res.localInfo);
const remoteInfoPtr = convertInfoToPointer(res.remoteInfo);
GameGlobal.Module.dynCall_viiiii(wxTCPSocketOnMessageCallback, idPtr, messagePtr, res.message.length || res.message.byteLength, localInfoPtr, remoteInfoPtr);
GameGlobal.Module._free(localInfoPtr);
GameGlobal.Module._free(remoteInfoPtr);
}
else {
GameGlobal.Module.dynCall_viiiii(wxTCPSocketOnMessageCallback, idPtr, messagePtr, res.message.length || res.message.byteLength, 0, 0);
}
GameGlobal.Module._free(idPtr);
GameGlobal.Module._free(messagePtr);
};
wxTCPSocketMessageList[id].push(callback);
obj.onMessage(callback);
}
function WX_RegisterTCPSocketOnMessageCallback(callback) {
wxTCPSocketOnMessageCallback = callback;
}
export default {
WX_CreateTCPSocket,
WX_TCPSocketBindWifi,
WX_TCPSocketClose,
WX_TCPSocketConnect,
WX_TCPSocketWriteString,
WX_TCPSocketWriteBuffer,
WX_TCPSocketOffBindWifi,
WX_TCPSocketOffClose,
WX_TCPSocketOffConnect,
WX_TCPSocketOffError,
WX_TCPSocketOffMessage,
WX_TCPSocketOnBindWifi,
WX_TCPSocketOnClose,
WX_TCPSocketOnConnect,
WX_TCPSocketOnError,
WX_TCPSocketOnMessage,
WX_RegisterTCPSocketOnMessageCallback,
};
/* eslint-disable @typescript-eslint/naming-convention */
import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertDataToPointer, convertInfoToPointer, formatResponse } from '../utils';
const UDPSocketList = {};
const wxUDPSocketCloseList = {};
const wxUDPSocketErrorList = {};
const wxUDPSocketListeningList = {};
const wxUDPSocketMessageList = {};
const getUDPSocketObject = getListObject(UDPSocketList, 'UDPSocket');
let wxUDPSocketOnMessageCallback;
function WX_CreateUDPSocket() {
const obj = wx.createUDPSocket();
const key = uid();
UDPSocketList[key] = obj;
return key;
}
function WX_UDPSocketClose(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
obj.close();
delete UDPSocketList[id];
}
function WX_UDPSocketConnect(id, option) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
obj.connect(formatJsonStr(option));
}
function WX_UDPSocketOffClose(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxUDPSocketCloseList, (v) => {
obj.offClose(v);
}, id);
}
function WX_UDPSocketOffError(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxUDPSocketErrorList, (v) => {
obj.offError(v);
}, id);
}
function WX_UDPSocketOffListening(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxUDPSocketListeningList, (v) => {
obj.offListening(v);
}, id);
}
function WX_UDPSocketOffMessage(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
offEventCallback(wxUDPSocketMessageList, (v) => {
obj.offMessage(v);
}, id);
}
function WX_UDPSocketOnClose(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxUDPSocketCloseList, '_UDPSocketOnCloseCallback', id, id);
obj.onClose(callback);
}
function WX_UDPSocketOnError(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxUDPSocketErrorList, '_UDPSocketOnErrorCallback', id, id);
obj.onError(callback);
}
function WX_UDPSocketOnListening(id) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxUDPSocketListeningList, '_UDPSocketOnListeningCallback', id, id);
obj.onListening(callback);
}
function WX_UDPSocketOnMessage(id, needInfo) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
if (!wxUDPSocketMessageList[id]) {
wxUDPSocketMessageList[id] = [];
}
const callback = (res) => {
formatResponse('UDPSocketOnMessageListenerResult', res);
const idPtr = convertDataToPointer(id);
const messagePtr = convertDataToPointer(res.message);
if (needInfo) {
const localInfoPtr = convertInfoToPointer(res.localInfo);
const remoteInfoPtr = convertInfoToPointer(res.remoteInfo);
GameGlobal.Module.dynCall_viiiii(wxUDPSocketOnMessageCallback, idPtr, messagePtr, res.message.length || res.message.byteLength, localInfoPtr, remoteInfoPtr);
GameGlobal.Module._free(localInfoPtr);
GameGlobal.Module._free(remoteInfoPtr);
}
else {
GameGlobal.Module.dynCall_viiiii(wxUDPSocketOnMessageCallback, idPtr, messagePtr, res.message.length || res.message.byteLength, 0, 0);
}
GameGlobal.Module._free(idPtr);
GameGlobal.Module._free(messagePtr);
};
wxUDPSocketMessageList[id].push(callback);
obj.onMessage(callback);
}
function WX_UDPSocketSendString(id, data, param) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
const config = formatJsonStr(param);
obj.send({
address: config.address,
message: data,
port: config.port,
setBroadcast: config.setBroadcast,
});
}
function WX_UDPSocketSendBuffer(id, dataPtr, dataLength, param) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
const config = formatJsonStr(param);
obj.send({
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_UDPSocketSetTTL(id, ttl) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
obj.setTTL(ttl);
}
function WX_UDPSocketWriteString(id, data, param) {
const obj = getUDPSocketObject(id);
if (!obj) {
return;
}
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);
if (!obj) {
return 0;
}
const config = formatJsonStr(param);
return obj.bind(config.port);
}
function WX_RegisterUDPSocketOnMessageCallback(callback) {
wxUDPSocketOnMessageCallback = callback;
}
export default {
WX_CreateUDPSocket,
WX_UDPSocketBind,
WX_UDPSocketClose,
WX_UDPSocketConnect,
WX_UDPSocketOffClose,
WX_UDPSocketOffError,
WX_UDPSocketOffListening,
WX_UDPSocketOffMessage,
WX_UDPSocketOnClose,
WX_UDPSocketOnError,
WX_UDPSocketOnListening,
WX_UDPSocketOnMessage,
WX_UDPSocketSendString,
WX_UDPSocketSendBuffer,
WX_UDPSocketSetTTL,
WX_UDPSocketWriteString,
WX_UDPSocketWriteBuffer,
WX_RegisterUDPSocketOnMessageCallback,
};
/* eslint-disable no-param-reassign */
import moduleHelper from './module-helper';
import response from './response';
import { formatJsonStr, uid } from './utils';
import { resumeWebAudio } from './audio/utils';
const ads = {};
export default {
WXCreateBannerAd(conf) {
const config = formatJsonStr(conf);
config.style = JSON.parse(config.styleRaw || '{}');
const ad = wx.createBannerAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onResize((res) => {
moduleHelper.send('ADOnResizeCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
return key;
},
WXCreateFixedBottomMiddleBannerAd(adUnitId, adIntervals, height) {
const info = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync();
const ad = wx.createBannerAd({
adUnitId,
adIntervals,
style: {
left: 0,
top: info.windowHeight - height,
height,
width: info.windowWidth,
},
});
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
const oldWidth = info.windowWidth;
ad.onResize((res) => {
if (Math.abs(res.height - height) > 1 || Math.abs(res.width - oldWidth) > 1) {
ad.style.left = Math.round((info.windowWidth - res.width) / 2);
ad.style.top = Math.round(info.windowHeight - res.height);
}
moduleHelper.send('ADOnResizeCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
return key;
},
WXCreateRewardedVideoAd(conf) {
const config = formatJsonStr(conf);
const ad = wx.createRewardedVideoAd(config);
const key = uid();
ads[key] = ad;
if (!config.multiton) {
// 单例模式要处理一下
ad.offLoad();
ad.offError();
ad.offClose();
}
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad((res) => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
ad.onClose((res) => {
moduleHelper.send('ADOnVideoCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
setTimeout(() => {
resumeWebAudio();
}, 0);
});
return key;
},
WXCreateInterstitialAd(conf) {
const config = formatJsonStr(conf);
const ad = wx.createInterstitialAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onClose(() => {
moduleHelper.send('ADOnCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
return key;
},
WXCreateCustomAd(conf) {
const config = formatJsonStr(conf);
config.style = JSON.parse(config.styleRaw || '{}');
const ad = wx.createCustomAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onClose(() => {
moduleHelper.send('ADOnCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onHide(() => {
moduleHelper.send('ADOnHideCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
return key;
},
WXADStyleChange(id, key, value) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].style === 'undefined') {
return;
}
ads[id].style[key] = value;
},
WXShowAd(id, succ, fail) {
if (!ads[id]) {
return false;
}
ads[id]
.show()
.then(() => {
response.textFormat(succ, {
errMsg: 'show:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
},
WXShowAd2(id, branchId, branchDim, succ, fail) {
if (!ads[id]) {
return false;
}
ads[id]
.show({ branchId, branchDim })
.then(() => {
response.textFormat(succ, {
errMsg: 'show:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
},
WXHideAd(id, succ, fail) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].hide === 'undefined') {
return;
}
if (succ || fail) {
const promise = ads[id].hide();
if (promise) {
promise
.then(() => {
response.textFormat(succ, {
errMsg: 'hide:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
}
else {
response.textFormat(succ, {
errMsg: 'hide:ok',
});
}
}
else {
ads[id].hide();
}
},
WXADGetStyleValue(id, key) {
if (!ads[id]) {
return -1;
}
if (typeof ads[id].style === 'undefined') {
return;
}
return ads[id].style[key];
},
WXADDestroy(id) {
if (!ads[id]) {
return false;
}
ads[id].destroy();
delete ads[id];
},
WXADLoad(id, succ, fail) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].load === 'undefined') {
return;
}
ads[id]
.load()
.then(() => {
response.textFormat(succ, {});
})
.catch((res) => {
moduleHelper.send('ADLoadErrorCallback', JSON.stringify({
callbackId: fail,
...res,
}));
});
},
WXReportShareBehavior(id, conf) {
if (!ads[id]) {
return '{}';
}
if (typeof ads[id].reportShareBehavior === 'undefined') {
return '{}';
}
const config = formatJsonStr(conf);
return JSON.stringify(ads[id].reportShareBehavior(config));
},
};
import { WEBAudio, audios, unityAudioVolume, innerAudioVolume } from './store';
import { resumeWebAudio, mkCacheDir } from './utils';
mkCacheDir();
export default {
WXGetAudioCount() {
return {
innerAudio: Object.keys(audios).length,
webAudio: WEBAudio.bufferSourceNodeLength,
buffer: WEBAudio.audioBufferLength,
};
},
WXSetAudioMute(value) {
if (typeof value !== 'boolean') {
return;
}
if (WEBAudio.isMute === value) {
return;
}
WEBAudio.isMute = value;
for (const channelInstance of Object.keys(WEBAudio.audioInstances)) {
const channel = WEBAudio.audioInstances[+channelInstance];
if (channel.source) {
channel.setVolume?.(value ? 0 : unityAudioVolume.get(channel) ?? 1);
}
}
for (const innerAudio of Object.values(audios)) {
innerAudio.volume = value ? 0 : innerAudioVolume.get(innerAudio) ?? 1;
}
},
};
const HandleInterruption = {
init() {
let INTERRUPT_LIST = {};
wx.onHide(() => {
Object.keys(audios).forEach((key) => {
if (!audios[key].paused !== false) {
INTERRUPT_LIST[key] = true;
}
});
});
wx.onShow(() => {
Object.keys(audios).forEach((key) => {
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
audios[key].play();
}
});
INTERRUPT_LIST = {};
});
wx.onAudioInterruptionBegin(() => {
Object.keys(audios).forEach((key) => {
if (!audios[key].paused !== false) {
INTERRUPT_LIST[key] = true;
}
});
});
wx.onAudioInterruptionEnd(() => {
Object.keys(audios).forEach((key) => {
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
audios[key].play();
}
});
INTERRUPT_LIST = {};
resumeWebAudio();
});
},
};
HandleInterruption.init();
export const INNER_AUDIO_UNDEFINED_MSG = 'InnerAudioContext does not exist!';
export const IGNORE_ERROR_MSG = 'audio is playing, don\'t play again';
export const TEMP_DIR_PATH = `${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE/audios`;
import innerAudio from './inner-audio';
import unityAudio from './unity-audio';
import common from './common';
export default {
...innerAudio,
...unityAudio,
...common,
};
/* eslint-disable no-param-reassign */
import moduleHelper from '../module-helper';
import { isSupportPlayBackRate } from '../../check-version';
import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store';
import { createInnerAudio, destroyInnerAudio, printErrMsg } from './utils';
import { IGNORE_ERROR_MSG, INNER_AUDIO_UNDEFINED_MSG } from './const';
const funs = {
getFullUrl(v) {
if (!/^https?:\/\//.test(v) && !/^wxfile:\/\//.test(v)) {
const cdnPath = GameGlobal.manager.assetPath;
v = `${cdnPath.replace(/\/$/, '')}/${v.replace(/^\//, '').replace(/^Assets\//, '')}`;
}
return v;
},
downloadAudios(paths) {
const list = paths.split(',');
return Promise.all(list.map((v) => {
const src = funs.getFullUrl(v);
return new Promise((resolve, reject) => {
if (!downloadingAudioMap[src]) {
downloadingAudioMap[src] = [
{
resolve,
reject,
},
];
if (funs.checkLocalFile(src)) {
funs.handleDownloadEnd(src, true);
}
else if (!GameGlobal.unityNamespace.isCacheableFile(src)) {
wx.downloadFile({
url: src,
success(res) {
if (res.statusCode === 200 && res.tempFilePath) {
localAudioMap[src] = res.tempFilePath;
funs.handleDownloadEnd(src, true);
}
else {
funs.handleDownloadEnd(src, false);
}
},
fail(e) {
funs.handleDownloadEnd(src, false);
printErrMsg(e);
},
});
}
else {
const xmlhttp = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
xmlhttp.open('GET', src, true);
xmlhttp.responseType = 'arraybuffer';
xmlhttp.onsave = () => {
localAudioMap[src] = GameGlobal.manager.getCachePath(src);
funs.handleDownloadEnd(src, true);
};
xmlhttp.onsavefail = () => {
funs.handleDownloadEnd(src, false);
};
xmlhttp.onerror = () => {
funs.handleDownloadEnd(src, false);
};
xmlhttp.send();
}
}
else {
downloadingAudioMap[src].push({
resolve,
reject,
});
}
});
}));
},
handleDownloadEnd(src, succeeded) {
if (!downloadingAudioMap[src]) {
return;
}
while (downloadingAudioMap[src] && downloadingAudioMap[src].length > 0) {
const item = downloadingAudioMap[src].shift();
if (!succeeded) {
item?.reject();
}
else {
item?.resolve('');
}
}
delete downloadingAudioMap[src];
},
// 是否存在本地文件
checkLocalFile(src) {
if (localAudioMap[src]) {
return true;
}
const path = GameGlobal.manager.getCachePath(src);
if (path) {
localAudioMap[src] = path;
return true;
}
return false;
},
// 设置路径
setAudioSrc(audio, getSrc) {
return new Promise((resolve, reject) => {
const src = funs.getFullUrl(getSrc);
// 设置原始路径,后面用此路径作为key值
audio.isLoading = src;
if (funs.checkLocalFile(src)) {
audio.src = localAudioMap[src];
delete audio.isLoading;
funs.handleDownloadEnd(src, true);
resolve(localAudioMap[src]);
}
else if (audio.needDownload) {
funs
.downloadAudios(src)
.then(() => {
if (audio) {
audio.src = localAudioMap[src];
delete audio.isLoading;
resolve(localAudioMap[src]);
}
else {
console.warn('资源已被删除:', src);
reject({
errCode: -1,
errMsg: '资源已被删除',
});
}
})
.catch(() => {
console.warn('资源下载失败:', src);
if (audio) {
audio.src = src;
delete audio.isLoading;
}
reject({
errCode: -1,
errMsg: '资源下载失败',
});
});
}
else {
// 不推荐这样处理,建议优先下载再使用,除非是需要立即播放的长音频文件或一次性播放音频
// console.warn('建议优先下载再使用:', src);
audio.src = src;
delete audio.isLoading;
resolve(src);
}
});
},
};
function checkHasAudio(id) {
if (audios[id]) {
return true;
}
console.error(INNER_AUDIO_UNDEFINED_MSG, id);
return false;
}
export default {
// 创建audio对象
WXCreateInnerAudioContext(src, loop, startTime, autoplay, volume, playbackRate, needDownload) {
const { audio: getAudio, id } = createInnerAudio();
getAudio.needDownload = needDownload;
if (src) {
// 设置原始src
funs.setAudioSrc(getAudio, src).catch((e) => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: 'onError',
result: JSON.stringify(e),
}));
});
}
if (loop) {
getAudio.loop = true;
}
if (autoplay) {
getAudio.autoplay = true;
}
if (typeof startTime === 'undefined') {
startTime = 0;
}
if (startTime > 0) {
getAudio.startTime = +startTime.toFixed(2);
}
let volumeValue;
if (typeof volume === 'undefined') {
volumeValue = 1;
}
else {
volumeValue = +volume.toFixed(2);
}
innerAudioVolume.set(getAudio, volumeValue);
if (WEBAudio.isMute) {
volumeValue = 0;
}
if (volumeValue !== 1) {
getAudio.volume = volumeValue;
}
if (!isSupportPlayBackRate) {
playbackRate = 1;
}
if (typeof playbackRate !== 'undefined' && playbackRate !== 1) {
getAudio.playbackRate = +playbackRate.toFixed(2);
}
return id;
},
WXInnerAudioContextSetBool(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
audios[id][k] = Boolean(+v);
},
WXInnerAudioContextSetString(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
if (k === 'src') {
funs.setAudioSrc(audios[id], v);
}
else if (k === 'needDownload') {
audios[id].needDownload = !!v;
}
else {
audios[id][k] = v;
}
},
WXInnerAudioContextSetFloat(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
let value = +v.toFixed(2);
if (k === 'volume') {
innerAudioVolume.set(audios[id], value);
if (WEBAudio.isMute) {
value = 0;
}
}
audios[id][k] = value;
},
WXInnerAudioContextGetFloat(id, k) {
if (!checkHasAudio(id)) {
return 0;
}
return audios[id][k];
},
WXInnerAudioContextGetBool(id, k) {
if (!checkHasAudio(id)) {
return false;
}
return audios[id][k];
},
WXInnerAudioContextPlay(id) {
if (!checkHasAudio(id)) {
return;
}
const url = audios[id].isLoading;
if (url) {
if (downloadingAudioMap[url]) {
downloadingAudioMap[url].push({
resolve: () => {
if (typeof audios[id] !== 'undefined') {
audios[id].play();
}
},
reject: () => { },
});
}
else {
audios[id].src = url;
audios[id].play();
}
}
else {
audios[id].play();
}
},
WXInnerAudioContextPause(id) {
if (!checkHasAudio(id)) {
return;
}
audios[id].pause();
},
WXInnerAudioContextStop(id) {
if (!checkHasAudio(id)) {
return;
}
audios[id].stop();
},
WXInnerAudioContextDestroy(id) {
if (!checkHasAudio(id)) {
return;
}
destroyInnerAudio(id, false);
},
WXInnerAudioContextSeek(id, position) {
if (!checkHasAudio(id)) {
return;
}
audios[id].seek(+position.toFixed(3));
},
WXInnerAudioContextAddListener(id, key) {
if (!checkHasAudio(id)) {
return;
}
if (key === 'onCanplay') {
audios[id][key](() => {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration, buffered, referrerPolicy, volume } = audios[id];
setTimeout(() => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
}));
}, 0);
});
}
else if (key === 'onError') {
audios[id][key]((e) => {
if (key === 'onError') {
console.error(e);
if (e.errMsg && e.errMsg.indexOf(IGNORE_ERROR_MSG) > -1) {
return;
}
}
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
result: JSON.stringify(e),
}));
});
}
else {
audios[id][key](() => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
}));
});
}
},
WXInnerAudioContextRemoveListener(id, key) {
if (!checkHasAudio(id)) {
return;
}
audios[id][key]();
},
WXPreDownloadAudios(paths, id) {
funs
.downloadAudios(paths)
.then(() => {
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
callbackId: id.toString(),
errMsg: '0',
}));
})
.catch(() => {
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
callbackId: id.toString(),
errMsg: '1',
}));
});
},
};
export const WEBAudio = {
audioInstanceIdCounter: 0,
audioInstances: {},
audioContext: null,
audioWebEnabled: 0,
audioCache: [],
lOrientation: {
x: 0,
y: 0,
z: 0,
xUp: 0,
yUp: 0,
zUp: 0,
},
lPosition: { x: 0, y: 0, z: 0 },
audio3DSupport: 0,
audioWebSupport: 0,
bufferSourceNodeLength: 0,
audioBufferLength: 0,
isMute: false,
FAKEMOD_SAMPLERATE: 44100,
};
export const audios = {};
export const localAudioMap = {};
export const downloadingAudioMap = {};
export const unityAudioVolume = new WeakMap();
export const innerAudioVolume = new WeakMap();
/* eslint-disable no-param-reassign */
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayBackRate, isSupportInnerAudio, isIOS175, } from '../../check-version';
import { WEBAudio, unityAudioVolume } from './store';
import { TEMP_DIR_PATH } from './const';
import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils';
import { debugLog } from '../utils';
const defaultSoundLength = 441000;
const needGetLength = true;
function jsAudioCreateUncompressedSoundClip(buffer, error, length) {
const soundClip = {
buffer,
error,
release() {
this.buffer = null;
WEBAudio.audioBufferLength -= length;
},
resetGain() { },
getLength() {
if (!this.buffer) {
return 0;
}
const sampleRateRatio = 44100 / this.buffer.sampleRate;
return this.buffer.length * sampleRateRatio;
},
getData(ptr, length) {
if (!this.buffer) {
console.log('Trying to get data of sound which is not loaded.');
return 0;
}
const startOutputBuffer = ptr >> 2;
const output = GameGlobal.unityNamespace.Module.HEAPF32.subarray(startOutputBuffer, startOutputBuffer + (length >> 2));
const numMaxSamples = Math.floor((length >> 2) / this.buffer.numberOfChannels);
const numReadSamples = Math.min(this.buffer.length, numMaxSamples);
for (let i = 0; i < this.buffer.numberOfChannels; i++) {
const channelData = this.buffer.getChannelData(i).subarray(0, numReadSamples);
output.set(channelData, i * numReadSamples);
}
return numReadSamples * this.buffer.numberOfChannels * 4;
},
getNumberOfChannels() {
if (!this.buffer) {
console.log('Trying to get metadata of sound which is not loaded.');
return 0;
}
return this.buffer.numberOfChannels;
},
getFrequency() {
if (!this.buffer) {
console.log('Trying to get metadata of sound which is not loaded.');
return 0;
}
return this.buffer.sampleRate;
},
};
return soundClip;
}
function jsAudioCreateUncompressedSoundClipFromCompressedAudio(audioData, ptr, length) {
const soundClip = jsAudioCreateUncompressedSoundClip(null, false, length);
WEBAudio.audioContext?.decodeAudioData(audioData, (buffer) => {
soundClip.buffer = buffer;
WEBAudio.audioBufferLength += length;
}, (error) => {
soundClip.error = true;
console.log(`Decode error: ${error}`);
});
return soundClip;
}
function getSoundLength(getAudio, retryCount = 3) {
return new Promise((resolve, reject) => {
const { duration } = getAudio;
if (duration > 0) {
resolve(duration);
}
else {
if (retryCount > 0) {
setTimeout(() => {
resolve(getSoundLength(getAudio, retryCount - 1));
}, 100);
}
else {
reject('getAudio.duration is 0');
}
}
});
}
function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
const soundClip = {
error: false,
length: needGetLength ? 0 : defaultSoundLength,
url: undefined,
release() {
WEBAudio.audioBufferLength -= length;
if (isSupportBufferURL && this.url) {
wx.revokeBufferURL(this.url);
}
delete this.url;
},
resetGain() { },
getLength() {
return this.length || 0;
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getData(ptr, length) {
console.warn('getData() is not supported for compressed sound.');
return 0;
},
getNumberOfChannels() {
console.warn('getNumberOfChannels() is not supported for compressed sound.');
return 0;
},
getFrequency() {
console.warn('getFrequency() is not supported for compressed sound.');
return 0;
},
};
if (isSupportBufferURL) {
const url = wx.createBufferURL(audioData);
soundClip.url = url;
setSoundLength();
WEBAudio.audioBufferLength += length;
}
else {
const tempFilePath = `${TEMP_DIR_PATH}/temp-audio${ptr + length}.mp3`;
if (GameGlobal.manager.getCachePath(tempFilePath)) {
soundClip.url = tempFilePath;
setSoundLength();
WEBAudio.audioBufferLength += length;
}
else {
GameGlobal.manager
.writeFile(tempFilePath, audioData)
.then(() => {
soundClip.url = tempFilePath;
setSoundLength();
WEBAudio.audioBufferLength += length;
})
.catch((res) => {
soundClip.error = true;
printErrMsg(res);
});
}
}
function setSoundLength() {
if (needGetLength && soundClip.url) {
const { audio: getAudio } = createInnerAudio();
getAudio.src = soundClip.url;
getAudio.onCanplay(() => {
getSoundLength(getAudio).then((duration) => {
soundClip.length = duration * 44100;
getAudio.destroy();
})
.catch((e) => {
if (soundClip.length === 0) {
soundClip.error = true;
printErrMsg(e);
}
getAudio.destroy();
});
});
}
}
return soundClip;
}
function jsAudioCreateUncompressedSoundClipFromPCM(channels, length, sampleRate, ptr) {
if (WEBAudio.audioContext) {
const buffer = WEBAudio.audioContext.createBuffer(channels, length, sampleRate);
for (let i = 0; i < channels; i++) {
const offs = (ptr >> 2) + length * i;
const copyToChannel = buffer.copyToChannel
|| function (source, channelNumber, startInChannel) {
const clipped = source.subarray(0, Math.min(source.length, buffer.length - (startInChannel | 0)));
buffer.getChannelData(channelNumber | 0).set(clipped, startInChannel | 0);
};
copyToChannel.apply(buffer, [GameGlobal.unityNamespace.Module.HEAPF32.subarray(offs, offs + length), i, 0]);
}
return jsAudioCreateUncompressedSoundClip(buffer, false, length);
}
return jsAudioCreateUncompressedSoundClip(null, false, length);
}
export class AudioChannelInstance {
threeD = false;
source;
gain;
callback = 0;
userData = 0;
loop = false;
loopStart = 0;
loopEnd = 0;
deleyTime = 0;
deleyOffset = 0;
constructor(callback, userData) {
if (WEBAudio.audioContext) {
this.gain = WEBAudio.audioContext.createGain();
this.gain?.connect(WEBAudio.audioContext.destination);
}
this.callback = callback;
this.userData = userData;
}
resetGain() {
if (WEBAudio.audioContext && this.gain) {
this.gain.disconnect();
this.gain = WEBAudio.audioContext.createGain();
this.gain?.connect(WEBAudio.audioContext.destination);
}
}
release() {
this.disconnectSource();
if (this.gain) {
this.gain.disconnect();
}
}
setLoop(loop) {
this.loop = loop;
if (!this.source || this.source.loop == loop) {
return;
}
this.source.loop = loop;
}
setLoopPoints(loopStart, loopEnd) {
this.loopStart = loopStart;
this.loopEnd = loopEnd;
if (!this.source) {
return;
}
if (this.source.loopStart !== loopStart) {
this.source.loopStart = loopStart;
}
if (this.source.loopEnd !== loopEnd) {
this.source.loopEnd = loopEnd;
}
}
playUrl(startTime, url, startOffset, volume, soundClip) {
debugLog('playUrl: ', url, startTime, startOffset, volume, soundClip);
try {
this.setup(url);
if (!this.source || !this.source.mediaElement) {
return;
}
if (typeof volume !== 'undefined') {
this.source.mediaElement.volume = volume;
}
if (WEBAudio.isMute) {
this.source.mediaElement.volume = 0;
}
this.source.mediaElement.onPlay(() => {
debugLog('this.source.mediaElement.onPlay');
if (typeof this.source !== 'undefined') {
this.source.isPlaying = true;
if (!this.source.loop && this.source.mediaElement) {
const { duration } = this.source.mediaElement;
if (duration > 0) {
if (this.source.stopTicker) {
clearTimeout(this.source.stopTicker);
this.source.stopTicker = undefined;
}
const time = Math.floor(duration * 1000) + 1000;
this.source.stopTicker = setTimeout(() => {
if (this.source && this.source.mediaElement) {
this.source.mediaElement.stop();
}
}, time);
}
}
}
});
this.source.mediaElement.onPause(() => {
debugLog('this.source.mediaElement.onPause');
if (typeof this.source !== 'undefined') {
this.source.isPlaying = false;
if (this.source.stopTicker) {
clearTimeout(this.source.stopTicker);
this.source.stopTicker = undefined;
}
}
});
this.source.mediaElement.onStop(() => {
debugLog('this.source.mediaElement.onStop');
if (typeof this.source !== 'undefined') {
if (this.source.playAfterStop) {
this.source._reset();
if (typeof this.source.mediaElement !== 'undefined') {
this.source.mediaElement.play();
}
return;
}
this.source._reset();
this.disconnectSource();
}
if (this.callback) {
GameGlobal.unityNamespace.Module.dynCall_vi(this.callback, [this.userData]);
}
});
this.source.mediaElement.onEnded(() => {
debugLog('this.source.mediaElement.onEnded');
if (typeof this.source !== 'undefined') {
this.source._reset();
this.disconnectSource();
}
if (this.callback) {
GameGlobal.unityNamespace.Module.dynCall_vi(this.callback, [this.userData]);
}
});
this.source.mediaElement.onError((e) => {
debugLog('this.source.mediaElement.onError', e);
printErrMsg(e);
const { errMsg } = e;
if (errMsg && errMsg.indexOf('play audio fail') < 0) {
return;
}
if (typeof this.source !== 'undefined' && this.source.mediaElement) {
this.source._reset();
this.source.mediaElement.stop();
}
});
const fn = () => {
debugLog('this.source.mediaElement.onCanplay');
if (typeof this.source !== 'undefined' && this.source.mediaElement) {
getSoundLength(this.source.mediaElement).then((duration) => {
soundClip.length = duration * 44100;
})
.catch((e) => {
if (soundClip.length === 0) {
soundClip.error = true;
printErrMsg(e);
}
});
}
};
if (!this.source.canPlayFnList) {
this.source.canPlayFnList = [];
}
this.source.canPlayFnList.push(fn);
this.source.mediaElement.onCanplay(fn);
this.source.mediaElement.loop = this.loop;
this.deleyTime = startTime;
this.deleyOffset = startOffset;
this.source.start(startTime, startOffset);
this.source.playbackStartTime = startTime - startOffset / this.source.playbackRateValue;
}
catch (e) {
printErrMsg(`playUrl error. Exception: ${e}`);
}
}
playBuffer(startTime, buffer, startOffset, channel) {
try {
this.setup();
if (!this.source) {
return;
}
this.source.buffer = buffer;
this.source.onended = () => {
this.disconnectSource();
if (this.callback) {
GameGlobal.unityNamespace.Module.dynCall_vi(this.callback, [this.userData]);
}
};
if (this.gain && channel) {
let volume;
if (WEBAudio.isMute) {
unityAudioVolume.set(channel, this.gain.gain.value || 1);
volume = 0;
}
else {
volume = unityAudioVolume.get(channel);
}
if (this.gain.gain.value !== volume && typeof volume === 'number') {
this.gain.gain.value = volume;
}
}
this.source.loop = this.loop;
this.source.loopStart = this.loopStart;
this.source.loopEnd = this.loopEnd;
this.source.start(startTime, startOffset);
this.source.playbackStartTime = startTime - startOffset / this.source.playbackRateValue;
}
catch (e) {
printErrMsg(`playBuffer error. Exception: ${e}`);
}
}
disconnectSource() {
if (this.source) {
if (this.source.mediaElement) {
if (this.source.stopTimeout) {
clearTimeout(this.source.stopTimeout);
delete this.source.stopTimeout;
}
destroyInnerAudio(this.source.instanceId, false);
delete this.source.mediaElement;
delete this.source;
}
else if (!this.source.isPausedMockNode) {
this.source.onended = null;
if (this.source.disconnect) {
this.source.disconnect();
}
if (GameGlobal.isIOSHighPerformanceMode) {
this.source.buffer = null;
}
WEBAudio.bufferSourceNodeLength -= 1;
delete this.source;
}
else {
this.source.buffer = null;
}
}
}
stop(delay) {
if (!WEBAudio.audioContext) {
return;
}
if (this.source) {
if (this.source.buffer) {
try {
this.source.stop(WEBAudio.audioContext.currentTime + delay);
}
catch (e) { }
if (delay == 0) {
this.disconnectSource();
}
}
else if (this.source.mediaElement) {
this.source.stop(delay);
}
}
}
isPaused() {
if (!this.source) {
return true;
}
if (this.source.isPausedMockNode) {
return true;
}
if (this.source.mediaElement) {
return (!this.source.isPlaying || this.source.pauseRequested) ?? true;
}
return false;
}
pause() {
const { source } = this;
if (!source) {
return;
}
if (source.mediaElement) {
source._pauseMediaElement?.();
return;
}
if (source.isPausedMockNode) {
return;
}
const pausedSource = {
isPausedMockNode: true,
loop: this.loop,
loopStart: this.loopStart,
loopEnd: this.loopEnd,
buffer: source.buffer,
playbackRate: source.playbackRateValue,
playbackPausedAtPosition: source.estimatePlaybackPosition(),
setPitch(v) {
this.playbackRate = v;
},
_reset() { },
};
this.stop(0);
this.disconnectSource();
this.source = pausedSource;
}
resume() {
if (!WEBAudio.audioContext) {
return;
}
if (!this.source) {
return;
}
if (this.source.mediaElement) {
this.source.start(this.deleyTime, this.deleyOffset);
delete this.deleyTime;
delete this.deleyOffset;
return;
}
const pausedSource = this.source;
if (!pausedSource.isPausedMockNode) {
return;
}
delete this.source;
if (!pausedSource.buffer) {
return;
}
this.playBuffer(WEBAudio.audioContext.currentTime - Math.min(0, pausedSource.playbackPausedAtPosition), pausedSource.buffer, Math.max(0, pausedSource.playbackPausedAtPosition));
const getSource = this.source;
if (getSource) {
getSource.loop = pausedSource.loop;
getSource.loopStart = pausedSource.loopStart;
getSource.loopEnd = pausedSource.loopEnd;
getSource.setPitch(pausedSource.playbackRate);
}
}
setVolume(volume, isDefault) {
if (!WEBAudio.audioContext) {
return;
}
if (WEBAudio.isMute) {
volume = 0;
}
if (isDefault && volume == 1) {
return;
}
if (this.source) {
if (this.source.buffer && this.gain) {
this.gain.gain.value = volume;
}
else if (this.source.mediaElement) {
this.source.mediaElement.volume = volume;
}
}
}
setup(url) {
if (!WEBAudio.audioContext) {
return;
}
if (this.source && !this.source.isPausedMockNode) {
if (!this.source.url) {
if (typeof url !== 'undefined') {
this.stop(0);
}
else {
}
}
else if (typeof url === 'undefined') {
if (typeof this.source !== 'undefined') {
this.source._reset();
}
this.disconnectSource();
}
else {
this.source._reset();
this.disconnectSource();
}
}
if (!url) {
this.source = WEBAudio.audioContext.createBufferSource();
WEBAudio.bufferSourceNodeLength += 1;
const { source } = this;
Object.defineProperty(this.source, 'playbackRateValue', {
get() {
return source?.playbackRate?.value ?? 0;
},
set(v) {
if (!source) {
return;
}
if (typeof source.playbackRate === 'undefined') {
return;
}
source.playbackRate.value = v;
},
});
}
else {
const { audio: getAudio, id: instanceId } = createInnerAudio();
getAudio.src = url;
const innerFixPlay = () => {
if (!this.source) {
return;
}
this.source.needCanPlay = true;
if (this.source.fixPlayTicker) {
clearTimeout(this.source.fixPlayTicker);
delete this.source.fixPlayTicker;
}
this.source.fixPlayTicker = setTimeout(() => {
if (this.source && this.source.mediaElement && this.source.needCanPlay && !this.source.isPlaying) {
this.source.mediaElement.play();
}
}, 100);
};
const innerPlay = (callback) => {
if (this.source && this.source.mediaElement) {
if (isSupportBufferURL && this.source.readyToPlay) {
if (this.source.stopCache) {
this.source.stopCache = false;
this.source.playAfterStop = true;
}
else if (!this.source.isPlaying) {
if (isAndroid) {
innerFixPlay();
}
this.source.mediaElement.play();
callback?.();
}
}
else {
const fn = () => {
if (!this.source) {
return;
}
this.source.needCanPlay = false;
this.source.readyToPlay = true;
if (typeof this.source.mediaElement !== 'undefined') {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration } = this.source.mediaElement;
this.source.canPlayFnList.forEach((fn) => {
this.source?.mediaElement?.offCanplay(fn);
});
this.source.canPlayFnList = [];
}
if (this.source.stopCache) {
this.source.stopCache = false;
this.source.playAfterStop = true;
}
else if (!this.source.isPlaying) {
if (isAndroid) {
innerFixPlay();
}
if (typeof this.source.mediaElement !== 'undefined') {
this.source.mediaElement.play();
callback?.();
}
}
};
if (!this.source.canPlayFnList) {
this.source.canPlayFnList = [];
}
this.source.canPlayFnList.push(fn);
this.source.mediaElement.onCanplay(fn);
innerFixPlay();
}
}
};
// eslint-disable-next-line @typescript-eslint/naming-convention
const _reset = () => {
if (!this.source) {
return;
}
this.source.readyToPlay = false;
this.source.isPlaying = false;
this.source.stopCache = false;
this.source.playAfterStop = false;
this.source.needCanPlay = false;
if (this.source.stopTicker) {
clearTimeout(this.source.stopTicker);
this.source.stopTicker = undefined;
}
};
// eslint-disable-next-line @typescript-eslint/naming-convention
const _pauseMediaElement = () => {
if (typeof this.source === 'undefined') {
return;
}
if (this.source.playTimeout) {
this.source.pauseRequested = true;
}
else if (this.source.isPlaying && this.source.mediaElement) {
this.source.mediaElement.pause();
}
};
// eslint-disable-next-line @typescript-eslint/naming-convention
const _startPlayback = (offset) => {
if (typeof this.source === 'undefined' || !this.source.mediaElement) {
return;
}
if (this.source.playTimeout) {
this.source.mediaElement.seek(offset);
this.source.pauseRequested = false;
return;
}
innerPlay(() => {
if (this.source && this.source.mediaElement) {
this.source.mediaElement.seek(offset);
}
});
};
const start = (startTime, offset) => {
if (typeof this.source === 'undefined') {
return;
}
if (typeof startTime === 'undefined' && typeof offset === 'undefined') {
innerPlay();
return;
}
if (typeof startTime === 'undefined') {
startTime = 0;
}
if (typeof offset === 'undefined') {
offset = 0;
}
const startDelayThresholdMS = 4;
const startDelayMS = startTime * 1e3;
if (startDelayMS > startDelayThresholdMS) {
if (this.source.playTimeout) {
clearTimeout(this.source.playTimeout);
delete this.source.playTimeout;
}
this.source.playTimeout = setTimeout(() => {
if (typeof this.source !== 'undefined') {
delete this.source.playTimeout;
this.source._startPlayback?.(offset || 0);
}
}, startDelayMS);
}
else {
this.source._startPlayback?.(offset);
}
};
const stop = (stopTime) => {
if (typeof this.source === 'undefined') {
return;
}
if (typeof stopTime === 'undefined') {
stopTime = 0;
}
const stopDelayThresholdMS = 4;
const stopDelayMS = stopTime * 1e3;
if (stopDelayMS > stopDelayThresholdMS) {
if (this.source.stopTimeout) {
clearTimeout(this.source.stopTimeout);
delete this.source.stopTimeout;
}
this.source.stopTimeout = setTimeout(() => {
if (this.source && this.source.mediaElement) {
this.source.stopCache = true;
this.source.mediaElement.stop();
}
}, stopDelayMS);
}
else if (this.source.mediaElement) {
this.source.stopCache = true;
this.source.mediaElement.stop();
}
};
this.source = {
instanceId,
mediaElement: getAudio,
url,
playbackStartTime: 0,
playbackRate: 1,
pauseRequested: false,
_reset,
_pauseMediaElement,
_startPlayback,
start,
stop,
};
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { buffered, referrerPolicy, volume } = getAudio;
const { source } = this;
Object.defineProperty(this.source, 'loopStart', {
get() {
return 0;
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
set(v) { },
});
Object.defineProperty(source, 'loopEnd', {
get() {
return 0;
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
set(v) { },
});
Object.defineProperty(source, 'loop', {
get() {
return source?.mediaElement?.loop ?? false;
},
set(v) {
if (!source || !source.mediaElement) {
return;
}
source.mediaElement.loop = v;
},
});
Object.defineProperty(source, 'playbackRateValue', {
get() {
return source?.playbackRate ?? 1;
},
set(v) {
if (!source || !source.mediaElement) {
return;
}
if (!isSupportPlayBackRate) {
source.mediaElement.playbackRate = 1;
}
else {
source.playbackRate = v;
source.mediaElement.playbackRate = v;
}
},
});
Object.defineProperty(source, 'currentTime', {
get() {
return source?.mediaElement?.currentTime ?? 0;
},
set(v) {
if (!source || !source.mediaElement) {
return;
}
if (typeof source.mediaElement.seek === 'function') {
source.mediaElement.seek(v);
}
else {
source.mediaElement.currentTime = v;
}
},
});
}
if (!this.source) {
return;
}
this.source.estimatePlaybackPosition = () => {
if (!this.source) {
return 0;
}
let t;
if (WEBAudio.audioContext) {
t = (WEBAudio.audioContext.currentTime - this.source.playbackStartTime) * this.source.playbackRateValue;
}
else {
t = -this.source.playbackStartTime * this.source.playbackRateValue;
}
if (typeof this.source.loopStart !== 'undefined' && typeof this.source.loopEnd !== 'undefined') {
if (this.source.loop && t >= this.source.loopStart) {
t = ((t - this.source.loopStart) % (this.source.loopEnd - this.source.loopStart)) + this.source.loopStart;
}
}
return t;
};
this.source.setPitch = (newPitch) => {
if (!this.source) {
return 0;
}
const curPosition = this.source.estimatePlaybackPosition();
if (curPosition >= 0) {
if (WEBAudio.audioContext) {
this.source.playbackStartTime = WEBAudio.audioContext.currentTime - curPosition / newPitch;
}
}
this.source.playbackRateValue = newPitch;
};
this.setupPanning();
}
setupPanning() {
if (typeof this.source === 'undefined') {
return;
}
if (this.source.isPausedMockNode) {
return;
}
if (this.source.disconnect && this.source.connect) {
this.source.disconnect();
if (this.gain) {
this.source.connect(this.gain);
}
}
}
isStopped() {
return !this.source;
}
}
export default {
_JS_Sound_Create_Channel(callback, userData) {
if (!WEBAudio.audioContext || WEBAudio.audioWebEnabled === 0) {
return 0;
}
const channel = new AudioChannelInstance(callback, userData);
WEBAudio.audioInstances[++WEBAudio.audioInstanceIdCounter] = channel;
return WEBAudio.audioInstanceIdCounter;
},
_JS_Sound_GetLength(bufferInstance) {
if (WEBAudio.audioWebEnabled === 0) {
return defaultSoundLength;
}
const soundClip = WEBAudio.audioInstances[bufferInstance];
if (!soundClip) {
return defaultSoundLength;
}
const length = soundClip.getLength();
return length;
},
_JS_Sound_GetLoadState(bufferInstance) {
if (WEBAudio.audioWebEnabled === 0) {
return 2;
}
const soundClip = WEBAudio.audioInstances[bufferInstance];
if (!soundClip || soundClip.error) {
return 2;
}
if (soundClip.buffer) {
return 0;
}
if (soundClip.url && soundClip.length) {
return 0;
}
return 1;
},
_JS_Sound_Init() {
try {
if (wx && wx.createWebAudioContext) {
WEBAudio.audioContext = wx.createWebAudioContext();
console.log('use wx WebAudio');
}
if (!WEBAudio.audioContext) {
printErrMsg('Minigame Web Audio API not suppoted');
return;
}
WEBAudio.audioWebSupport = 1;
WEBAudio.audioWebEnabled = 1;
let webAutoResumeTicker = null;
wx.onHide(() => {
if (webAutoResumeTicker) {
clearTimeout(webAutoResumeTicker);
webAutoResumeTicker = null;
}
WEBAudio.audioContext?.suspend();
});
wx.onShow(() => {
if (isIOS175) {
WEBAudio.audioContext?.close();
WEBAudio.audioContext = wx.createWebAudioContext();
Object.values(WEBAudio.audioInstances).forEach((it) => it.resetGain());
}
else {
WEBAudio.audioContext?.resume();
}
});
if (webAudioNeedResume) {
webAutoResumeTicker = setTimeout(() => {
resumeWebAudio();
}, 2000);
}
}
catch (e) {
printErrMsg('Web Audio API is not supported in this browser');
}
},
_JS_Sound_IsStopped(channelInstance) {
if (WEBAudio.audioWebEnabled == 0) {
return true;
}
const channel = WEBAudio.audioInstances[channelInstance];
if (!channel) {
return true;
}
return channel.isStopped();
},
_JS_Sound_Load(ptr, length, decompress) {
if (!WEBAudio.audioContext || WEBAudio.audioWebEnabled === 0) {
return 0;
}
const audioData = GameGlobal.unityNamespace.Module.HEAPU8.buffer.slice(ptr, ptr + length);
if (length > 131072) {
decompress = 0;
}
else {
decompress = 1;
}
if (isPc) {
decompress = 1;
}
if (isAndroid && !isSupportInnerAudio) {
decompress = 1;
}
let soundClip;
if (decompress && WEBAudio.audioWebSupport) {
soundClip = jsAudioCreateUncompressedSoundClipFromCompressedAudio(audioData, ptr, length);
}
else {
soundClip = jsAudioCreateCompressedSoundClip(audioData, ptr, length);
}
WEBAudio.audioInstances[++WEBAudio.audioInstanceIdCounter] = soundClip;
return WEBAudio.audioInstanceIdCounter;
},
_JS_Sound_Load_PCM(channels, length, sampleRate, ptr) {
if (!WEBAudio.audioContext || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return 0;
}
const sound = jsAudioCreateUncompressedSoundClipFromPCM(channels, length, sampleRate, ptr);
WEBAudio.audioInstances[++WEBAudio.audioInstanceIdCounter] = sound;
return WEBAudio.audioInstanceIdCounter;
},
_JS_Sound_Play(bufferInstance, channelInstance, offset, delay) {
if (!WEBAudio.audioContext || WEBAudio.audioWebEnabled === 0) {
return;
}
debugLog('_JS_Sound_Play', bufferInstance, channelInstance, offset, delay);
WXWASMSDK._JS_Sound_Stop(channelInstance, 0);
const soundClip = WEBAudio.audioInstances[bufferInstance];
const channel = WEBAudio.audioInstances[channelInstance];
if (soundClip && soundClip.url) {
try {
channel.playUrl(delay, soundClip.url, offset, unityAudioVolume.get(channel), soundClip);
}
catch (e) {
printErrMsg(`playUrl error. Exception: ${e}`);
}
}
else if (soundClip && soundClip.buffer) {
try {
channel.playBuffer(WEBAudio.audioContext.currentTime + delay, soundClip.buffer, offset, channel);
}
catch (e) {
printErrMsg(`playBuffer error. Exception: ${e}`);
}
}
else {
console.log('Trying to play sound which is not loaded.');
}
},
_JS_Sound_ReleaseInstance(instance) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
const object = WEBAudio.audioInstances[instance];
if (object) {
object.release();
}
delete WEBAudio.audioInstances[instance];
},
_JS_Sound_ResumeIfNeeded() {
if (WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return;
}
if (WEBAudio.audioContext && WEBAudio.audioContext.state !== 'suspended') {
return;
}
resumeWebAudio();
},
_JS_Sound_Set3D(channelInstance, threeD) {
if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return;
}
const channel = WEBAudio.audioInstances[channelInstance];
if (channel.threeD != threeD) {
channel.threeD = threeD;
if (!channel.source) {
channel.setup();
}
channel.setupPanning();
}
},
_JS_Sound_SetListenerOrientation(x, y, z, xUp, yUp, zUp) {
if (!WEBAudio.audioContext
|| WEBAudio.audio3DSupport === 0
|| WEBAudio.audioWebSupport === 0
|| WEBAudio.audioWebEnabled === 0) {
return;
}
x = x > 0 ? 0 : x;
y = y > 0 ? 0 : y;
z = z > 0 ? 0 : z;
xUp = xUp < 0 ? 0 : xUp;
yUp = yUp < 0 ? 0 : yUp;
zUp = zUp < 0 ? 0 : zUp;
if (x == WEBAudio.lOrientation.x
&& y == WEBAudio.lOrientation.y
&& z == WEBAudio.lOrientation.z
&& xUp == WEBAudio.lOrientation.xUp
&& yUp == WEBAudio.lOrientation.yUp
&& zUp == WEBAudio.lOrientation.zUp) {
return;
}
WEBAudio.lOrientation.x = x;
WEBAudio.lOrientation.y = y;
WEBAudio.lOrientation.z = z;
WEBAudio.lOrientation.xUp = xUp;
WEBAudio.lOrientation.yUp = yUp;
WEBAudio.lOrientation.zUp = zUp;
if (WEBAudio.audioContext.listener.forwardX) {
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);
}
},
_JS_Sound_SetListenerPosition(x, y, z) {
if (!WEBAudio.audioContext
|| WEBAudio.audio3DSupport === 0
|| WEBAudio.audioWebSupport === 0
|| WEBAudio.audioWebEnabled === 0) {
return;
}
x = x < 0 ? 0 : x;
y = y < 0 ? 0 : y;
z = z < 0 ? 0 : z;
if (x == WEBAudio.lPosition.x && y == WEBAudio.lPosition.y && z == WEBAudio.lPosition.z) {
return;
}
WEBAudio.lPosition.x = x;
WEBAudio.lPosition.y = y;
WEBAudio.lPosition.z = z;
if (WEBAudio.audioContext.listener.positionX) {
WEBAudio.audioContext.listener.positionX = x;
WEBAudio.audioContext.listener.positionY = y;
WEBAudio.audioContext.listener.positionZ = z;
}
else {
WEBAudio.audioContext.listener.setPosition(x, y, z);
}
},
_JS_Sound_SetLoop(channelInstance, loop) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
const channel = WEBAudio.audioInstances[channelInstance];
if (!channel.source) {
channel.setup();
}
if (!channel.source) {
return;
}
channel.setLoop(loop > 0);
},
_JS_Sound_SetLoopPoints(channelInstance, loopStart, loopEnd) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
const channel = WEBAudio.audioInstances[channelInstance];
if (!channel.source) {
channel.setup();
}
if (!channel.source) {
return;
}
channel.setLoopPoints(loopStart, loopEnd);
},
_JS_Sound_SetPaused(channelInstance, paused) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
debugLog('_JS_Sound_SetPaused', channelInstance, paused);
const channel = WEBAudio.audioInstances[channelInstance];
if (!!paused !== channel.isPaused()) {
if (paused) {
channel.pause();
}
else {
channel.resume();
}
}
},
_JS_Sound_SetPitch(channelInstance, v) {
if (WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return;
}
try {
WEBAudio.audioInstances[channelInstance].source?.setPitch(v);
}
catch (e) {
printErrMsg(`Invalid audio pitch ${v} specified to WebAudio backend!`);
}
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_JS_Sound_SetPosition(channelInstance, x, y, z) {
if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return;
}
console.error('不支持3d音效');
},
_JS_Sound_SetVolume(channelInstance, v) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
try {
const volume = Number(v.toFixed(2));
const channel = WEBAudio.audioInstances[channelInstance];
const cur = unityAudioVolume.get(channel);
if (cur === volume) {
return;
}
unityAudioVolume.set(channel, volume);
channel.setVolume(volume, cur == undefined);
}
catch (e) {
printErrMsg(`Invalid audio volume ${v} specified to WebAudio backend!`);
}
},
_JS_Sound_Stop(channelInstance, delay) {
if (WEBAudio.audioWebEnabled === 0) {
return;
}
debugLog('_JS_Sound_Stop', channelInstance, delay);
const channel = WEBAudio.audioInstances[channelInstance];
channel.stop(delay);
},
_JS_Sound_GetData(bufferInstance, ptr, length) {
if (WEBAudio.audioWebEnabled === 0) {
return 0;
}
const soundClip = WEBAudio.audioInstances[bufferInstance];
if (!soundClip) {
return 0;
}
return soundClip.getData(ptr, length) ?? 0;
},
_JS_Sound_GetMetaData(buffer, bufferInstance, metaData) {
if (WEBAudio.audioWebEnabled === 0) {
buffer[metaData >> 2] = 0;
buffer[(metaData >> 2) + 1] = 0;
return false;
}
const soundClip = WEBAudio.audioInstances[bufferInstance];
if (!soundClip) {
buffer[metaData >> 2] = 0;
buffer[(metaData >> 2) + 1] = 0;
return false;
}
buffer[metaData >> 2] = soundClip.getNumberOfChannels() ?? 0;
buffer[(metaData >> 2) + 1] = soundClip.getFrequency() ?? 0;
return true;
},
_JS_Sound_GetAudioBufferSampleRate(soundInstance) {
if (WEBAudio.audioWebEnabled === 0) {
return WEBAudio.FAKEMOD_SAMPLERATE;
}
const audioInstance = WEBAudio.audioInstances[soundInstance];
if (!audioInstance) {
return WEBAudio.FAKEMOD_SAMPLERATE;
}
// eslint-disable-next-line no-nested-ternary
const buffer = audioInstance.buffer
? audioInstance.buffer
: audioInstance.source
? audioInstance.source?.buffer
: null;
if (!buffer) {
return WEBAudio.FAKEMOD_SAMPLERATE;
}
return buffer.sampleRate;
},
_JS_Sound_GetAudioContextSampleRate() {
if (WEBAudio.audioWebEnabled === 0 || !WEBAudio.audioContext) {
return WEBAudio.FAKEMOD_SAMPLERATE;
}
return WEBAudio.audioContext.sampleRate;
},
_JS_Sound_GetPosition(channelInstance) {
if (WEBAudio.audioWebEnabled == 0) {
return 0;
}
const channel = WEBAudio.audioInstances[channelInstance];
if (!channel) {
return 0;
}
const { source } = channel;
if (!source) {
return 0;
}
return source.estimatePlaybackPosition ? source.estimatePlaybackPosition() : 0;
},
};
import { uid } from '../utils';
import { isSupportCacheAudio } from '../../check-version';
import { WEBAudio, audios } from './store';
import { TEMP_DIR_PATH } from './const';
export const resumeWebAudio = () => {
WEBAudio.audioContext?.resume();
GameGlobal.Module.mContext?.resume();
GameGlobal.Module.context?.resume();
};
export const createInnerAudio = () => {
const id = uid();
const audio = (isSupportCacheAudio && WEBAudio.audioCache.length ? WEBAudio.audioCache.shift() : wx.createInnerAudioContext());
if (audio) {
audios[id] = audio;
}
return {
id,
audio,
};
};
export const destroyInnerAudio = (id, useCache) => {
if (!id) {
return;
}
if (!useCache || !isSupportCacheAudio || WEBAudio.audioCache.length > 32) {
audios[id].destroy();
}
else {
['Play', 'Pause', 'Stop', 'Canplay', 'Error', 'Ended', 'Waiting', 'Seeking', 'Seeked', 'TimeUpdate'].forEach((eventName) => {
audios[id][`off${eventName}`]();
});
const state = {
startTime: 0,
obeyMuteSwitch: true,
volume: 1,
autoplay: false,
loop: false,
referrerPolicy: '',
};
Object.keys(state).forEach((key) => {
try {
// @ts-ignore
audios[id][key] = state[key];
}
catch (e) { }
});
audios[id].stop();
const cacheAudio = audios[id];
setTimeout(() => {
WEBAudio.audioCache.push(cacheAudio);
}, 1000);
}
delete audios[id];
};
export const printErrMsg = (msg) => {
GameGlobal.manager.printErr(msg);
};
export function mkCacheDir() {
const fs = wx.getFileSystemManager();
fs.rmdir({
dirPath: TEMP_DIR_PATH,
recursive: true,
complete: () => {
fs.mkdir({
dirPath: TEMP_DIR_PATH,
});
},
});
}
import moduleHelper from './module-helper';
import { formatJsonStr } from './utils';
let resolveFn = null;
export default {
WX_OnNeedPrivacyAuthorization() {
const callback = (resolve) => {
resolveFn = resolve;
moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}');
};
// @ts-ignore
wx.onNeedPrivacyAuthorization(callback);
},
WX_PrivacyAuthorizeResolve(conf) {
const config = formatJsonStr(conf);
config.event = config.eventString;
if (resolveFn) {
resolveFn(config);
if (config.event === 'agree' || config.event === 'disagree') {
resolveFn = null;
}
}
},
};
/* eslint-disable @typescript-eslint/naming-convention */
import { convertDataToPointer } from '../utils';
let wxOnBLECharacteristicValueChangeCallback;
const OnBLECharacteristicValueChange = (res) => {
const deviceIdPtr = convertDataToPointer(res.deviceId);
const serviceIdPtr = convertDataToPointer(res.serviceId);
const characteristicIdPtr = convertDataToPointer(res.characteristicId);
const valuePtr = convertDataToPointer(res.value);
GameGlobal.Module.dynCall_viiiii(wxOnBLECharacteristicValueChangeCallback, deviceIdPtr, serviceIdPtr, characteristicIdPtr, valuePtr, res.value.byteLength);
GameGlobal.Module._free(deviceIdPtr);
GameGlobal.Module._free(serviceIdPtr);
GameGlobal.Module._free(characteristicIdPtr);
GameGlobal.Module._free(valuePtr);
};
function WX_OnBLECharacteristicValueChange() {
wx.onBLECharacteristicValueChange(OnBLECharacteristicValueChange);
}
function WX_OffBLECharacteristicValueChange() {
wx.offBLECharacteristicValueChange();
}
function WX_RegisterOnBLECharacteristicValueChangeCallback(callback) {
wxOnBLECharacteristicValueChangeCallback = callback;
}
export default {
WX_OnBLECharacteristicValueChange,
WX_OffBLECharacteristicValueChange,
WX_RegisterOnBLECharacteristicValueChangeCallback,
};
import moduleHelper from './module-helper';
import { formatJsonStr, cacheArrayBuffer, getListObject } from './utils';
const cameraList = {};
const getObject = getListObject(cameraList, 'camera');
export default {
WXCameraCreateCamera(conf, callbackId) {
const obj = wx.createCamera({
...formatJsonStr(conf),
success(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'success',
res: JSON.stringify(res),
}));
},
fail(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'fail',
res: JSON.stringify(res),
}));
},
complete(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'complete',
res: JSON.stringify(res),
}));
},
});
cameraList[callbackId] = obj;
},
WXCameraCloseFrameChange(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.closeFrameChange();
},
WXCameraDestroy(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.destroy();
},
WXCameraListenFrameChange(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.listenFrameChange();
},
WXCameraOnAuthCancel(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('CameraOnAuthCancelCallback', resStr);
};
obj.onAuthCancel(callback);
},
WXCameraOnCameraFrame(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
cacheArrayBuffer(id, res.data);
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify({
width: res.width,
height: res.height,
}),
});
moduleHelper.send('CameraOnCameraFrameCallback', resStr);
};
obj.onCameraFrame(callback);
},
WXCameraOnStop(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('CameraOnStopCallback', resStr);
};
obj.onStop(callback);
},
};
const callbacks = [];
let isTriggered = false;
export default {
addCreatedListener(callback) {
if (isTriggered) {
callback();
}
else {
callbacks.push(callback);
}
},
_triggerCallback() {
isTriggered = true;
callbacks.forEach(v => v());
},
};
import response from './response';
import moduleHelper from './module-helper';
import { getDefaultData } from './utils';
export default {
WXToTempFilePathSync(conf) {
return canvas.toTempFilePathSync(getDefaultData(canvas, conf));
},
WXToTempFilePath(conf, s, f, c) {
if (conf) {
canvas.toTempFilePath({
...getDefaultData(canvas, conf),
...response.handleText(s, f, c),
success: (res) => {
moduleHelper.send('ToTempFilePathCallback', JSON.stringify({
callbackId: s,
errMsg: res.errMsg,
errCode: res.errCode || 0,
tempFilePath: res.tempFilePath,
}));
},
});
}
},
};
import moduleHelper from './module-helper';
import { formatJsonStr, uid } from './utils';
let MiniGameChat;
let instance;
let onList;
function createMiniGameChat(options, callback) {
try {
if (typeof requirePlugin !== 'undefined') {
if (!MiniGameChat) {
// @ts-ignore
MiniGameChat = requirePlugin('MiniGameChat', {
enableRequireHostModule: true,
customEnv: {
wx,
},
}).default;
}
if (instance) {
return '';
}
instance = new MiniGameChat(options);
if (typeof instance === 'undefined' || typeof instance.on === 'undefined') {
console.error('MiniGameChat create error');
return '';
}
// 等待插件初始化完成
instance.on('ready', () => {
if (!GameGlobal.miniGameChat) {
GameGlobal.miniGameChat = instance;
if (!onList) {
onList = {};
}
Object.keys(onList).forEach((eventType) => {
if (!onList) {
onList = {};
}
Object.values(onList[eventType]).forEach((callback) => {
instance.on(eventType, callback);
});
});
instance.emit('ready');
callback(instance);
}
});
instance.on('error', (err) => {
console.log('插件初始化失败', err);
});
return uid();
}
}
catch (e) {
console.error(e);
return '';
}
}
export default {
WXChatCreate(optionsStr) {
const options = formatJsonStr(optionsStr);
return createMiniGameChat({
x: options.x,
y: options.y,
autoShow: false,
logoUrl: options.logoUrl || '',
movable: options.movable,
enableSnap: options.enableSnap,
scale: options.scale,
}, (instance) => {
instance.on('error', (err) => {
console.error('error', err);
});
});
},
WXChatHide() {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.hide();
},
WXChatShow(optionsStr) {
if (!GameGlobal.miniGameChat) {
return;
}
const options = formatJsonStr(optionsStr);
GameGlobal.miniGameChat.show({
x: options.x,
y: options.y,
});
},
WXChatClose() {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.close();
},
WXChatOpen(key) {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.open(key || '');
},
WXChatSetTabs(keysStr) {
if (!GameGlobal.miniGameChat) {
return;
}
if (!keysStr) {
// eslint-disable-next-line no-param-reassign
keysStr = '[]';
}
const keys = JSON.parse(keysStr);
GameGlobal.miniGameChat.setTabs(keys);
},
WXChatOff(eventType) {
const { miniGameChat } = GameGlobal;
if (!miniGameChat) {
return;
}
if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') {
return;
}
// eslint-disable-next-line no-restricted-syntax
for (const key in Object.keys(onList[eventType])) {
const callback = onList[eventType][key];
if (callback) {
miniGameChat.off(eventType, callback);
}
}
onList[eventType] = {};
},
WXChatOn(eventType) {
const callbackId = uid();
const callback = (res) => {
let result = '';
if (res) {
result = JSON.stringify(res);
}
const resStr = JSON.stringify({
eventType,
result,
});
moduleHelper.send('OnWXChatCallback', resStr);
};
if (!onList) {
onList = {};
}
if (typeof onList[eventType] === 'undefined') {
onList[eventType] = {};
}
if (onList[eventType]) {
onList[eventType][callbackId] = callback;
const { miniGameChat } = GameGlobal;
if (miniGameChat) {
miniGameChat.on(eventType, callback);
}
return callbackId;
}
return '';
},
WXChatSetSignature(signature) {
const { miniGameChat } = GameGlobal;
if (miniGameChat) {
miniGameChat.setChatSignature({ signature });
}
},
};
/* eslint-disable no-param-reassign */
import moduleHelper from './module-helper';
import { uid, formatJsonStr, formatResponse } from './utils';
const CloudIDObject = {};
const CDNObject = {};
function fixCallFunctionData(data) {
Object.keys(data).forEach((key) => {
if (typeof data[key] === 'object') {
fixCallFunctionData(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 {
WX_CloudCloud(option) {
const config = formatJsonStr(option);
// @ts-ignore
const cloud = new wx.cloud.Cloud(config);
CloudList[config.resourceEnv] = cloud;
},
WX_CloudInit(option) {
const config = formatJsonStr(option);
if (config.env === '_default_') {
wx.cloud.init();
}
else {
wx.cloud.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),
}));
},
});
},
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),
}));
},
});
},
};
export const MODULE_NAME = 'WXSDKManagerHandler';
function getObjectSize(data) {
if (data && (typeof data === 'string' || data.byteLength)) {
return data.byteLength || data.length || 0;
}
return 0;
}
export const fileInfoHandler = {
addFileInfo(filePath, data) {
if (GameGlobal.manager.fs && GameGlobal.manager.fs.addFileInfo) {
GameGlobal.manager.fs.addFileInfo({ path: filePath, size: getObjectSize(data), erasable: false });
}
},
modifyFileInfo(filePath, data) {
if (GameGlobal.manager.fs && GameGlobal.manager.fs.modifyFileInfo) {
GameGlobal.manager.fs.modifyFileInfo({ path: filePath, size: getObjectSize(data) });
}
},
removeFileInfo(filePath) {
if (GameGlobal.manager.fs && GameGlobal.manager.fs.removeFileInfo) {
GameGlobal.manager.fs.removeFileInfo(filePath);
}
},
};
export const fileInfoType = {
add: 0,
remove: 1,
modify: 2,
};
export function responseWrapper(responseHandler, info) {
const { filePath, data, type } = info;
return {
success(res) {
if (type === fileInfoType.add) {
fileInfoHandler.addFileInfo(filePath, data);
}
if (type === fileInfoType.remove) {
fileInfoHandler.removeFileInfo(filePath);
}
if (type === fileInfoType.modify) {
fileInfoHandler.modifyFileInfo(filePath, data);
}
responseHandler.success(res);
},
fail: responseHandler.fail,
complete: responseHandler.complete,
};
}
/* eslint-disable prefer-spread */
/* eslint-disable prefer-rest-params */
export default {
init() {
this.fixTimer();
},
fixTimer() {
const wm = {};
const privateSetTimeout = window.setTimeout;
let id = 0;
const getId = function () {
id += 1;
if (id > 100000000) {
id = 0;
}
return id;
};
// @ts-ignore
window.setTimeout = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId();
const t = privateSetTimeout(vCallback instanceof Function
? () => {
// @ts-ignore
vCallback.apply(null, aArgs);
delete wm[id];
}
: vCallback, nDelay);
wm[id] = t;
return id;
};
const privateClearTimeout = window.clearTimeout;
// @ts-ignore
window.clearTimeout = function (id) {
if (id) {
const t = wm[id];
if (t) {
privateClearTimeout(t);
delete wm[id];
}
}
};
const privateSetInterval = window.setInterval;
// @ts-ignore
window.setInterval = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId();
const t = privateSetInterval(vCallback instanceof Function
? () => {
// @ts-ignore
vCallback.apply(null, aArgs);
}
: vCallback, nDelay);
wm[id] = t;
return id;
};
const privateClearInterval = window.clearInterval;
// @ts-ignore
window.clearInterval = function (id) {
if (id) {
const t = wm[id];
if (t) {
privateClearInterval(t);
delete wm[id];
}
}
};
const privateRequestAnimationFrame = window.requestAnimationFrame;
window.requestAnimationFrame = function (vCallback) {
const id = getId();
const t = privateRequestAnimationFrame(() => {
vCallback(0);
delete wm[id];
});
wm[id] = t;
return id;
};
const privateCancelAnimationFrame = window.cancelAnimationFrame;
window.cancelAnimationFrame = function (id) {
const t = wm[id];
if (t) {
privateCancelAnimationFrame(t);
delete wm[id];
}
};
},
};
export default function fixCmapTable(arrayBuffer) {
const font = new DataView(arrayBuffer);
const tableCount = font.getUint16(4);
let cmapOffset = 0;
let cmapLength = 0;
let cmapCheckSumOffset = 0;
let cmapCheckSum = 0;
for (let i = 0; i < tableCount; i++) {
const tag = font.getUint32(12 + i * 16);
if (tag === 0x636D6170) {
cmapCheckSumOffset = 12 + i * 16 + 4;
cmapCheckSum = font.getUint32(cmapCheckSumOffset);
cmapOffset = font.getUint32(12 + i * 16 + 8);
cmapLength = font.getUint32(12 + i * 16 + 12);
GameGlobal.manager.Logger.pluginLog(`[font]cmapCheckSubOffset [${cmapCheckSumOffset}], cmapCheckSum [${cmapCheckSum}], cmapOffset [${cmapOffset}], cmapLength [${cmapLength}]`);
}
}
if (cmapOffset === 0) {
GameGlobal.manager.Logger.pluginError('[font]not found cmap');
return false;
}
const cmap = new DataView(arrayBuffer, cmapOffset, cmapLength);
const numTables = cmap.getUint16(2);
let subtableOffset = 4;
let targetSubtableOffset = 0;
for (let i = 0; i < numTables; i++) {
const platformId = cmap.getUint16(subtableOffset);
const encodingId = cmap.getUint16(subtableOffset + 2);
if (platformId === 0 && encodingId === 5) {
if (i === (numTables - 1)) {
targetSubtableOffset = subtableOffset;
GameGlobal.manager.Logger.pluginLog(`[font]targetSubtableOffset ${targetSubtableOffset}`);
}
break;
}
subtableOffset += 8;
}
if (targetSubtableOffset > 0) {
const newCmapView = new DataView(arrayBuffer, cmapOffset, cmapLength - 8);
newCmapView.setUint16(2, numTables - 1);
let sum = 0;
const lengthInUint32 = (newCmapView.byteLength + 3) / 4;
for (let i = 0; i < lengthInUint32; i++) {
sum += newCmapView.getUint32(i);
}
font.setUint32(cmapCheckSumOffset, sum);
return true;
}
GameGlobal.manager.Logger.pluginLog('[font]not found cmap subtable');
return false;
}
/* eslint-disable no-param-reassign */
import moduleHelper from '../module-helper';
import { formatJsonStr } from '../utils';
import fixCmapTable from './fix-cmap';
import readMetrics from './read-metrics';
import splitTTCToBufferOnlySC from './split-sc';
const { platform } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
const tempCacheObj = {};
let fontDataCache;
let getFontPromise;
let isReadFromCache = false;
const isIOS = platform === 'ios';
const isAndroid = platform === 'android';
const fontOptions = {
CJK_Unified_Ideographs: {
include: true,
unicodeRange: [0x4E00, 0x9FFF],
},
C0_Controls_and_Basic_Latin: {
include: true,
unicodeRange: [0x0000, 0x007F],
},
CJK_Symbols_and_Punctuation: {
include: true,
unicodeRange: [0x3000, 0x303F],
},
General_Punctuation: {
include: true,
unicodeRange: [0x2000, 0x206F],
},
Enclosed_CJK_Letters_and_Months: {
include: true,
unicodeRange: [0x3200, 0x32FF],
},
Vertical_Forms: {
include: true,
unicodeRange: [0xFE10, 0xFE1F],
},
CJK_Compatibility_Forms: {
include: true,
unicodeRange: [0xFE30, 0xFE4F],
},
Miscellaneous_Symbols: {
include: true,
unicodeRange: [0x2600, 0x26FF],
},
CJK_Compatibility: {
include: true,
unicodeRange: [0x3300, 0x33FF],
},
Halfwidth_and_Fullwidth_Forms: {
include: true,
unicodeRange: [0xFF00, 0xFFEF],
},
Dingbats: {
include: true,
unicodeRange: [0x2700, 0x27BF],
},
Letterlike_Symbols: {
include: true,
unicodeRange: [0x2100, 0x214F],
},
Enclosed_Alphanumerics: {
include: true,
unicodeRange: [0x2460, 0x24FF],
},
Number_Forms: {
include: true,
unicodeRange: [0x2150, 0x218F],
},
Currency_Symbols: {
include: true,
unicodeRange: [0x20A0, 0x20CF],
},
Arrows: {
include: true,
unicodeRange: [0x2190, 0x21FF],
},
Geometric_Shapes: {
include: true,
unicodeRange: [0x25A0, 0x25FF],
},
Mathematical_Operators: {
include: true,
unicodeRange: [0x2200, 0x22FF],
},
CustomUnicodeRange: [],
};
function handleGetFontData(config, forceFallback) {
const canGetWxCommonFont = !!GameGlobal.manager?.font?.getCommonFont;
if (!config && !canGetWxCommonFont) {
return Promise.reject('invalid usage');
}
// eslint-disable-next-line @typescript-eslint/no-misused-promises
if (!getFontPromise || forceFallback) {
getFontPromise = new Promise((resolve, reject) => {
if ((!canGetWxCommonFont || forceFallback) && !!config) {
const xhr = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
xhr.open('GET', config.fallbackUrl, true);
xhr.responseType = 'arraybuffer';
xhr.onload = () => {
if ((xhr.status === 200 || xhr.status === 0) && xhr.response) {
const notoFontData = xhr.response;
fontDataCache = notoFontData;
isReadFromCache = xhr.isReadFromCache;
resolve();
}
};
xhr.onerror = reject;
xhr.send();
return;
}
let unicodeRange = [];
Object.keys(fontOptions).forEach((key) => {
if (fontOptions[key].include) {
unicodeRange.push(fontOptions[key].unicodeRange);
}
});
unicodeRange = unicodeRange.concat(fontOptions.CustomUnicodeRange);
GameGlobal.manager.font.getCommonFont({
success(fontData) {
if (isIOS) {
fixCmapTable(fontData);
}
if (isAndroid) {
const tempData = splitTTCToBufferOnlySC(fontData);
if (tempData) {
fontData = tempData;
}
}
fontDataCache = fontData;
resolve();
},
fail: reject,
}, unicodeRange);
});
}
return getFontPromise;
}
function WXGetFontRawData(conf, callbackId, forceFallback = false) {
const config = formatJsonStr(conf);
const loadFromRemote = !GameGlobal.manager?.font?.getCommonFont;
GameGlobal.manager.TimeLogger.timeStart('WXGetFontRawData');
handleGetFontData(config, forceFallback).then(() => {
if (fontDataCache) {
GameGlobal.manager.font.reportGetFontCost(GameGlobal.manager.TimeLogger.timeEnd('WXGetFontRawData'), { loadFromRemote: forceFallback || loadFromRemote, isReadFromCache, preloadWXFont: GameGlobal.unityNamespace.preloadWXFont });
const { ascent, descent, lineGap, unitsPerEm } = readMetrics(fontDataCache) || {};
tempCacheObj[callbackId] = fontDataCache;
moduleHelper.send('GetFontRawDataCallback', JSON.stringify({ callbackId, type: 'success', res: JSON.stringify({ byteLength: fontDataCache.byteLength, ascent, descent, lineGap, unitsPerEm }) }));
GameGlobal.manager.Logger.pluginLog(`[font] load font from ${forceFallback || loadFromRemote ? `network, url=${config.fallbackUrl}` : 'local'}`);
fontDataCache = null;
}
else {
GameGlobal.manager.Logger.pluginError('[font] load font error: empty content');
}
})
.catch((err) => {
if (!loadFromRemote && !!config && forceFallback === false) {
WXGetFontRawData(conf, callbackId, true);
}
else {
GameGlobal.manager.Logger.pluginError('[font] load font error: ', err);
}
});
}
function WXShareFontBuffer(buffer, offset, callbackId) {
if (typeof tempCacheObj[callbackId] === 'string') {
GameGlobal.manager.Logger.pluginError('[font]内存写入异常');
}
buffer.set(new Uint8Array(tempCacheObj[callbackId]), offset);
delete tempCacheObj[callbackId];
}
export function preloadWxCommonFont() {
if (!!GameGlobal.unityNamespace.preloadWXFont && !!GameGlobal.manager?.font?.getCommonFont) {
handleGetFontData();
}
}
export default {
WXGetFontRawData,
WXShareFontBuffer,
};
import { toBytesInt32 } from './util';
export default function readMetrics(arrayBuffer) {
const font = new DataView(arrayBuffer);
const tableCount = font.getUint16(4);
const ppem = 1;
let ascent = 0;
let descent = 0;
let lineGap = 0;
let unitsPerEm;
for (let i = 0; i < tableCount; i++) {
const tag = font.getUint32(12 + i * 16);
const tagStr = toBytesInt32(tag);
if (tagStr === 'hhea') {
const offset = font.getUint32(12 + i * 16 + 8);
const length = font.getUint32(12 + i * 16 + 12);
const hhea = new DataView(arrayBuffer, offset, length);
ascent = hhea.getInt16(4);
descent = hhea.getInt16(6);
lineGap = hhea.getInt16(8);
}
else if (tagStr === 'head') {
const offset = font.getUint32(12 + i * 16 + 8);
const length = font.getUint32(12 + i * 16 + 12);
const head = new DataView(arrayBuffer, offset, length);
unitsPerEm = head.getUint16(18);
}
}
if (!ascent || !descent || !unitsPerEm) {
return undefined;
}
return {
ascent: ascent * ppem / unitsPerEm,
descent: descent * ppem / unitsPerEm,
lineGap: lineGap * ppem / unitsPerEm,
unitsPerEm,
};
}
import { ceil4, toBytesInt32, decodeUnicode } from './util';
function extractTTF(ttcView, tableHeaderOffset) {
const subFontTableCount = ttcView.getUint16(tableHeaderOffset + 0x04);
const subFontHeaderLength = 0x0C + subFontTableCount * 0x10;
let tableLength = 0;
for (let j = 0; j < subFontTableCount; j++) {
const length = ttcView.getUint32(tableHeaderOffset + 0x0C + 0x0C + j * 0x10);
tableLength += ceil4(length);
}
const totalLength = subFontHeaderLength + tableLength;
const newBuf = new ArrayBuffer(totalLength);
const newBufUint = new Uint8Array(newBuf);
const newBufData = new DataView(newBuf);
newBufUint.set(new Uint8Array(ttcView.buffer, tableHeaderOffset, subFontHeaderLength), 0);
let currentOffset = subFontHeaderLength;
for (let j = 0; j < subFontTableCount; j++) {
const offset = ttcView.getUint32(tableHeaderOffset + 0x0C + 0x08 + j * 0x10);
const length = ttcView.getUint32(tableHeaderOffset + 0x0C + 0x0C + j * 0x10);
newBufData.setUint32(0x0C + 0x08 + j * 0x10, currentOffset);
newBufUint.set(new Uint8Array(ttcView.buffer, offset, length), currentOffset);
currentOffset += ceil4(length);
}
return newBufData;
}
function parseTableToDataView(fontDataView, tableName, startOffset = 0) {
const font = fontDataView;
const tableCount = font.getUint16(startOffset + 4);
for (let i = 0; i < tableCount; i++) {
const tag = font.getUint32(startOffset + 12 + i * 16);
const tagStr = toBytesInt32(tag);
if (tagStr === tableName) {
const offset = font.getUint32(startOffset + 12 + i * 16 + 8);
const length = font.getUint32(startOffset + 12 + i * 16 + 12);
return new DataView(fontDataView.buffer, offset, length);
}
}
GameGlobal.manager.Logger.pluginError(`\tTable#${tableName} not found in DataView`);
return undefined;
}
function parseNameTable(fontDataView, startOffset = 0) {
const nameTable = parseTableToDataView(fontDataView, 'name', startOffset);
if (!nameTable) {
return undefined;
}
const result = {};
result.data = nameTable;
result.format = nameTable.getUint16(0);
result.count = nameTable.getUint16(2);
result.stringOffset = nameTable.getUint16(4);
const nameRecords = [];
for (let i = 0; i < result.count; i++) {
const offset = 6 + i * 12;
nameRecords.push({
platformID: nameTable.getUint16(offset),
platformSpecificID: nameTable.getUint16(offset + 2),
languageID: nameTable.getUint16(offset + 4),
nameID: nameTable.getUint16(offset + 6),
length: nameTable.getUint16(offset + 8),
offset: nameTable.getUint16(offset + 10),
});
}
result.nameRecords = nameRecords;
return result;
}
function parseFamilyName(fontDataView, startOffset = 0) {
const nameTable = parseNameTable(fontDataView, startOffset);
if (!nameTable) {
return undefined;
}
if (nameTable.nameRecords) {
for (const record of nameTable.nameRecords) {
const { nameID } = record;
if (nameID === 1) {
const { offset } = record;
const byteLength = record.length;
return decodeUnicode(fontDataView.buffer, (nameTable.data?.byteOffset || 0) + (nameTable.stringOffset || 0) + offset, byteLength);
}
}
}
return undefined;
}
export default function splitTTCToBufferOnlySC(arrayBuffer) {
const ttc = new DataView(arrayBuffer);
const tag = ttc.getUint32(0);
if (toBytesInt32(tag) !== 'ttcf') {
GameGlobal.manager.Logger.pluginError('input not a valid ttc file');
return undefined;
}
const ttfCount = ttc.getInt32(8);
let fontSCHeaderOffset = undefined;
const reg = /S\0?C/;
for (let i = 0; i < ttfCount; i++) {
const tableHeaderOffset = ttc.getUint32(0x0C + i * 4);
const familyName = parseFamilyName(ttc, tableHeaderOffset);
if (typeof familyName === 'string' && reg.test(familyName)) {
fontSCHeaderOffset = tableHeaderOffset;
break;
}
}
if (!fontSCHeaderOffset) {
GameGlobal.manager.Logger.pluginError('SC Font not found in TTC File.');
return undefined;
}
return extractTTF(ttc, fontSCHeaderOffset).buffer;
}
export function toBytesInt32(num) {
let ascii = '';
for (let i = 3; i >= 0; i--) {
ascii += String.fromCharCode((num >> (8 * i)) & 255);
}
return ascii;
}
;
export function ceil4(n) {
return (n + 3) & ~3;
}
export function decodeUnicode(buffer, byteOffset, byteLength) {
const dataview = new Uint8Array(buffer, byteOffset, byteLength);
const ret = String.fromCharCode.apply(null, Array.from(dataview));
return ret;
}
/* eslint-disable no-param-reassign */
import response from './response';
import moduleHelper from './module-helper';
import { cacheArrayBuffer, formatJsonStr, formatResponse } from './utils';
import { fileInfoHandler, fileInfoType, responseWrapper } from './file-info';
function runMethod(method, option, callbackId, isString = false) {
try {
const fs = wx.getFileSystemManager();
let config;
if (typeof option === 'string') {
config = formatJsonStr(option);
}
else {
config = option;
}
if (method === 'readZipEntry' && !config.encoding) {
config.encoding = 'utf-8';
console.error('fs.readZipEntry不支持读取ArrayBuffer,已改为utf-8');
}
fs[method]({
...config,
success(res) {
let returnRes = '';
if (method === 'read') {
cacheArrayBuffer(callbackId, res.arrayBuffer);
returnRes = JSON.stringify({
bytesRead: res.bytesRead,
arrayBufferLength: res.arrayBuffer?.byteLength ?? 0,
});
}
else if (method === 'readCompressedFile') {
cacheArrayBuffer(callbackId, res.data);
returnRes = JSON.stringify({
arrayBufferLength: res.data?.byteLength ?? 0,
});
}
else if (method === 'readFile') {
if (config.encoding) {
returnRes = JSON.stringify({
stringData: res.data || '',
});
}
else {
cacheArrayBuffer(callbackId, res.data);
returnRes = JSON.stringify({
arrayBufferLength: res.data?.byteLength ?? 0,
});
}
}
else {
returnRes = JSON.stringify(res);
}
// console.log(`fs.${method} success:`, res);
moduleHelper.send('FileSystemManagerCallback', JSON.stringify({
callbackId, type: 'success', res: returnRes, method: isString ? `${method}_string` : method,
}));
},
fail(res) {
moduleHelper.send('FileSystemManagerCallback', JSON.stringify({
callbackId, type: 'fail', res: JSON.stringify(res), method: isString ? `${method}_string` : method,
}));
},
complete(res) {
moduleHelper.send('FileSystemManagerCallback', JSON.stringify({
callbackId, type: 'complete', res: JSON.stringify(res), method: isString ? `${method}_string` : method,
}));
},
});
}
catch (e) {
moduleHelper.send('FileSystemManagerCallback', JSON.stringify({
callbackId, type: 'complete', res: 'fail', method: isString ? `${method}_string` : method,
}));
}
}
export default {
WXGetUserDataPath() {
return wx.env.USER_DATA_PATH;
},
WXWriteFileSync(filePath, data, encoding) {
try {
const fs = wx.getFileSystemManager();
// @ts-ignore
fs.writeFileSync(filePath, data, encoding);
fileInfoHandler.addFileInfo(filePath, data);
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
return 'ok';
},
WXAccessFileSync(filePath) {
try {
const fs = wx.getFileSystemManager();
fs.accessSync(filePath);
return 'access:ok';
}
catch (e) {
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXAccessFile(path, s, f, c) {
const fs = wx.getFileSystemManager();
fs.access({
path,
...response.handleText(s, f, c),
});
},
WXCopyFileSync(src, dst) {
try {
const fs = wx.getFileSystemManager();
fs.copyFileSync(src, dst);
return 'copyFile:ok';
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXCopyFile(srcPath, destPath, s, f, c) {
const fs = wx.getFileSystemManager();
fs.copyFile({
srcPath,
destPath,
...response.handleText(s, f, c),
});
},
WXUnlinkSync(filePath) {
try {
const fs = wx.getFileSystemManager();
fs.unlinkSync(filePath);
fileInfoHandler.removeFileInfo(filePath);
return 'unlink:ok';
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXUnlink(filePath, s, f, c) {
const fs = wx.getFileSystemManager();
fs.unlink({
filePath,
...responseWrapper(response.handleText(s, f, c), { filePath, type: fileInfoType.remove }),
});
},
WXWriteFile(filePath, data, encoding, s, f, c) {
const fs = wx.getFileSystemManager();
fs.writeFile({
filePath,
data: data.buffer,
encoding,
...responseWrapper(response.handleTextLongBack(s, f, c), { filePath, data: data.buffer, type: fileInfoType.add }),
});
},
WXWriteStringFile(filePath, data, encoding, s, f, c) {
const fs = wx.getFileSystemManager();
fs.writeFile({
filePath,
data,
encoding,
...responseWrapper(response.handleTextLongBack(s, f, c), { filePath, data, type: fileInfoType.add }),
});
},
WXAppendFile(filePath, data, encoding, s, f, c) {
const fs = wx.getFileSystemManager();
fs.appendFile({
filePath,
data: data.buffer,
encoding,
...response.handleTextLongBack(s, f, c),
});
},
WXAppendStringFile(filePath, data, encoding, s, f, c) {
const fs = wx.getFileSystemManager();
fs.appendFile({
filePath,
data,
encoding,
...response.handleTextLongBack(s, f, c),
});
},
WXWriteBinFileSync(filePath, data, encoding) {
const fs = wx.getFileSystemManager();
try {
fs.writeFileSync(filePath, data.buffer, encoding);
fileInfoHandler.addFileInfo(filePath, data.buffer);
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
return 'ok';
},
WXReadFile(option, callbackId) {
runMethod('readFile', option, callbackId);
},
WXReadFileSync(option) {
const fs = wx.getFileSystemManager();
const config = formatJsonStr(option);
try {
const { filePath } = config;
const res = fs.readFileSync(config.filePath, config.encoding, config.position, config.length);
if (!config.encoding && typeof res !== 'string') {
cacheArrayBuffer(filePath, res);
return `${res.byteLength}`;
}
return res;
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXMkdir(dirPath, recursive, s, f, c) {
const fs = wx.getFileSystemManager();
fs.mkdir({
dirPath,
recursive: Boolean(recursive),
...response.handleText(s, f, c),
});
},
WXMkdirSync(dirPath, recursive) {
try {
const fs = wx.getFileSystemManager();
fs.mkdirSync(dirPath, Boolean(recursive));
return 'mkdir:ok';
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXRmdir(dirPath, recursive, s, f, c) {
const fs = wx.getFileSystemManager();
fs.rmdir({
dirPath,
recursive: Boolean(recursive),
...response.handleText(s, f, c),
});
},
WXRmdirSync(dirPath, recursive) {
try {
const fs = wx.getFileSystemManager();
fs.rmdirSync(dirPath, Boolean(recursive));
return 'rmdirSync:ok';
}
catch (e) {
console.error(e);
if (e.message) {
return e.message;
}
return 'fail';
}
},
WXStat(conf, callbackId) {
const config = formatJsonStr(conf);
wx.getFileSystemManager().stat({
...config,
success(res) {
if (!Array.isArray(res.stats)) {
// @ts-ignore C#中特殊处理
res.one_stat = res.stats;
// @ts-ignore C#中特殊处理
res.stats = null;
}
moduleHelper.send('StatCallback', JSON.stringify({
callbackId,
type: 'success',
res: JSON.stringify(res),
}));
},
fail(res) {
moduleHelper.send('StatCallback', JSON.stringify({
callbackId,
type: 'fail',
res: JSON.stringify(res),
}));
},
complete(res) {
// @ts-ignore C#中特殊处理
if (!Array.isArray(res.stats)) {
// @ts-ignore C#中特殊处理
res.one_stat = res.stats;
// @ts-ignore C#中特殊处理
res.stats = null;
}
moduleHelper.send('StatCallback', JSON.stringify({
callbackId,
type: 'complete',
res: JSON.stringify(res),
}));
},
});
},
WX_FileSystemManagerClose(option, callbackId) {
runMethod('close', option, callbackId);
},
WX_FileSystemManagerFstat(option, callbackId) {
runMethod('fstat', option, callbackId);
},
WX_FileSystemManagerFtruncate(option, callbackId) {
runMethod('ftruncate', option, callbackId);
},
WX_FileSystemManagerGetFileInfo(option, callbackId) {
runMethod('getFileInfo', option, callbackId);
},
WX_FileSystemManagerGetSavedFileList(option, callbackId) {
runMethod('getSavedFileList', option, callbackId);
},
WX_FileSystemManagerOpen(option, callbackId) {
runMethod('open', option, callbackId);
},
WX_FileSystemManagerRead(option, data, callbackId) {
const config = formatJsonStr(option);
config.arrayBuffer = data.buffer;
runMethod('read', config, callbackId);
},
WX_FileSystemManagerReadCompressedFile(option, callbackId) {
runMethod('readCompressedFile', option, callbackId);
},
WX_FileSystemManagerReadZipEntry(option, callbackId) {
runMethod('readZipEntry', option, callbackId);
},
WX_FileSystemManagerReadZipEntryString(option, callbackId) {
runMethod('readZipEntry', option, callbackId, true);
},
WX_FileSystemManagerReaddir(option, callbackId) {
runMethod('readdir', option, callbackId);
},
WX_FileSystemManagerRemoveSavedFile(option, callbackId) {
runMethod('removeSavedFile', option, callbackId);
},
WX_FileSystemManagerRename(option, callbackId) {
runMethod('rename', option, callbackId);
},
WX_FileSystemManagerSaveFile(option, callbackId) {
runMethod('saveFile', option, callbackId);
},
WX_FileSystemManagerTruncate(option, callbackId) {
runMethod('truncate', option, callbackId);
},
WX_FileSystemManagerUnzip(option, callbackId) {
runMethod('unzip', option, callbackId);
},
WX_FileSystemManagerWrite(option, data, callbackId) {
const config = formatJsonStr(option);
config.data = data.buffer;
runMethod('write', config, callbackId);
},
WX_FileSystemManagerWriteString(option, callbackId) {
runMethod('write', option, callbackId, true);
},
WX_FileSystemManagerReaddirSync(dirPath) {
const fs = wx.getFileSystemManager();
try {
return JSON.stringify(fs.readdirSync(dirPath) || []);
}
catch (e) {
console.error(e);
return '[]';
}
},
WX_FileSystemManagerReadCompressedFileSync(option, callbackId) {
const fs = wx.getFileSystemManager();
const res = fs.readCompressedFileSync(formatJsonStr(option));
cacheArrayBuffer(callbackId, res);
return res.byteLength;
},
WX_FileSystemManagerAppendFileStringSync(filePath, data, encoding) {
const fs = wx.getFileSystemManager();
fs.appendFileSync(filePath, data, encoding);
},
WX_FileSystemManagerAppendFileSync(filePath, data, encoding) {
const fs = wx.getFileSystemManager();
fs.appendFileSync(filePath, data.buffer, encoding);
},
WX_FileSystemManagerRenameSync(oldPath, newPath) {
const fs = wx.getFileSystemManager();
fs.renameSync(oldPath, newPath);
return 'ok';
},
WX_FileSystemManagerReadSync(option, callbackId) {
const fs = wx.getFileSystemManager();
const optionConfig = formatJsonStr(option);
optionConfig.arrayBuffer = new ArrayBuffer(optionConfig.arrayBuffer.length);
const res = fs.readSync(optionConfig);
cacheArrayBuffer(callbackId, res.arrayBuffer);
return JSON.stringify({
bytesRead: res.bytesRead,
arrayBufferLength: res.arrayBuffer?.byteLength ?? 0,
});
},
WX_FileSystemManagerFstatSync(option) {
const fs = wx.getFileSystemManager();
const res = fs.fstatSync(formatJsonStr(option));
formatResponse('Stats', res);
return JSON.stringify(res);
},
WX_FileSystemManagerStatSync(path, recursive) {
const fs = wx.getFileSystemManager();
const res = fs.statSync(path, recursive);
let resArray;
if (Array.isArray(res)) {
resArray = res;
}
else {
resArray = [res];
}
return JSON.stringify(resArray);
},
WX_FileSystemManagerWriteSync(option, data) {
const fs = wx.getFileSystemManager();
const optionConfig = formatJsonStr(option);
optionConfig.data = data.buffer;
const res = fs.writeSync(optionConfig);
return JSON.stringify(res);
},
WX_FileSystemManagerWriteStringSync(option) {
const fs = wx.getFileSystemManager();
const res = fs.writeSync(formatJsonStr(option));
return JSON.stringify(res);
},
WX_FileSystemManagerOpenSync(option) {
const fs = wx.getFileSystemManager();
return fs.openSync(formatJsonStr(option));
},
WX_FileSystemManagerSaveFileSync(tempFilePath, filePath) {
const fs = wx.getFileSystemManager();
return fs.saveFileSync(tempFilePath, filePath);
},
WX_FileSystemManagerCloseSync(option) {
const fs = wx.getFileSystemManager();
fs.closeSync(formatJsonStr(option));
return 'ok';
},
WX_FileSystemManagerFtruncateSync(option) {
const fs = wx.getFileSystemManager();
fs.ftruncateSync(formatJsonStr(option));
return 'ok';
},
WX_FileSystemManagerTruncateSync(option) {
const fs = wx.getFileSystemManager();
fs.truncateSync(formatJsonStr(option));
return 'ok';
},
};
import moduleHelper from './module-helper';
import { formatJsonStr, getListObject, uid } from './utils';
const gameClubButtonList = {};
const typeEnum = {
0: 'text',
1: 'image',
};
const iconEnum = {
0: 'green',
1: 'white',
2: 'dark',
3: 'light',
};
const getObject = getListObject(gameClubButtonList, 'gameClubButton');
export default {
WXCreateGameClubButton(conf) {
const config = formatJsonStr(conf);
// @ts-ignore
config.style = JSON.parse(config.styleRaw);
if (config.style.fontSize === 0) {
// @ts-ignore
config.style.fontSize = undefined;
}
// @ts-ignore
config.type = typeEnum[config.type];
// @ts-ignore
config.icon = iconEnum[config.icon];
if (!config.text) {
config.text = '';
}
const id = uid();
gameClubButtonList[id] = wx.createGameClubButton(config);
return id;
},
WXGameClubButtonDestroy(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.destroy();
if (gameClubButtonList) {
delete gameClubButtonList[id];
}
},
WXGameClubButtonHide(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.hide();
},
WXGameClubButtonShow(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.show();
},
WXGameClubButtonAddListener(id, key) {
const obj = getObject(id);
if (!obj) {
return;
}
obj[key](() => {
moduleHelper.send('OnGameClubButtonCallback', JSON.stringify({
callbackId: id,
errMsg: key,
}));
});
},
WXGameClubButtonRemoveListener(id, key) {
const obj = getObject(id);
if (!obj) {
return;
}
obj[key]();
},
WXGameClubButtonSetProperty(id, key, value) {
const obj = getObject(id);
if (!obj) {
return;
}
obj[key] = value;
},
WXGameClubStyleChangeInt(id, key, value) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.style[key] = value;
},
WXGameClubStyleChangeStr(id, key, value) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.style[key] = value;
},
};
import moduleHelper from './module-helper';
import { formatJsonStr, getListObject, uid } from './utils';
const gameRecorderList = {};
let wxGameRecorderList;
const getObject = getListObject(gameRecorderList, 'gameRecorder');
export default {
WX_GetGameRecorder() {
const id = uid();
gameRecorderList[id] = wx.getGameRecorder();
return id;
},
WX_GameRecorderOff(id, eventType) {
const obj = getObject(id);
if (!obj) {
return;
}
if (!obj || typeof wxGameRecorderList === 'undefined' || typeof wxGameRecorderList[eventType] === 'undefined') {
return;
}
// eslint-disable-next-line no-restricted-syntax
for (const key in Object.keys(wxGameRecorderList[eventType])) {
const callback = wxGameRecorderList[eventType][key];
if (callback) {
obj.off(eventType, callback);
}
}
wxGameRecorderList[eventType] = {};
},
WX_GameRecorderOn(id, eventType) {
const obj = getObject(id);
if (!obj) {
return;
}
if (!wxGameRecorderList) {
wxGameRecorderList = {
start: {},
stop: {},
pause: {},
resume: {},
abort: {},
timeUpdate: {},
error: {},
};
}
const callbackId = uid();
const callback = (res) => {
let result = '';
if (res) {
result = JSON.stringify(res);
}
const resStr = JSON.stringify({
id,
res: JSON.stringify({
eventType,
result,
}),
});
moduleHelper.send('_OnGameRecorderCallback', resStr);
};
if (wxGameRecorderList[eventType]) {
wxGameRecorderList[eventType][callbackId] = callback;
obj.on(eventType, callback);
return callbackId;
}
return '';
},
WX_GameRecorderStart(id, option) {
const obj = getObject(id);
if (!obj) {
return;
}
const data = formatJsonStr(option);
obj.start(data);
},
WX_GameRecorderAbort(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.abort();
},
WX_GameRecorderPause(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.pause();
},
WX_GameRecorderResume(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.resume();
},
WX_GameRecorderStop(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.stop();
},
WX_OperateGameRecorderVideo(option) {
if (typeof wx.operateGameRecorderVideo !== 'undefined') {
const data = formatJsonStr(option);
data.fail = (res) => {
console.error(res);
};
wx.operateGameRecorderVideo(data);
}
},
};
/* eslint-disable @typescript-eslint/naming-convention */
import { formatJsonStr, formatResponse, convertDataToPointer } from '../utils';
let wxStartGyroscopeCallback;
let wxStopGyroscopeCallback;
let wxOnGyroscopeChangeCallback;
const OnGyroscopeChange = (res) => {
formatResponse('OnGyroscopeChangeListenerResult', res);
const xPtr = convertDataToPointer(res.x);
const yPtr = convertDataToPointer(res.y);
const zPtr = convertDataToPointer(res.z);
GameGlobal.Module.dynCall_viii(wxOnGyroscopeChangeCallback, xPtr, yPtr, zPtr);
GameGlobal.Module._free(xPtr);
GameGlobal.Module._free(yPtr);
GameGlobal.Module._free(zPtr);
};
function handleCallback(callback, id, callbackType, res) {
formatResponse('GeneralCallbackResult', res);
const idPtr = convertDataToPointer(id);
const msgPtr = convertDataToPointer(res.errMsg);
GameGlobal.Module.dynCall_viii(callback, idPtr, callbackType, msgPtr);
GameGlobal.Module._free(idPtr);
GameGlobal.Module._free(msgPtr);
}
function WX_StartGyroscope(id, conf) {
const config = formatJsonStr(conf);
wx.startGyroscope({
...config,
success(res) {
handleCallback(wxStartGyroscopeCallback, id, 2, res);
},
fail(res) {
handleCallback(wxStartGyroscopeCallback, id, 1, res);
},
complete(res) {
handleCallback(wxStartGyroscopeCallback, id, 0, res);
},
});
}
function WX_StopGyroscope(id, conf) {
const config = formatJsonStr(conf);
wx.stopGyroscope({
...config,
success(res) {
handleCallback(wxStopGyroscopeCallback, id, 2, res);
},
fail(res) {
handleCallback(wxStopGyroscopeCallback, id, 1, res);
},
complete(res) {
handleCallback(wxStopGyroscopeCallback, id, 0, res);
},
});
}
function WX_OnGyroscopeChange() {
wx.onGyroscopeChange(OnGyroscopeChange);
}
function WX_OffGyroscopeChange() {
wx.offGyroscopeChange();
}
function WX_RegisterStartGyroscopeCallback(callback) {
wxStartGyroscopeCallback = callback;
}
function WX_RegisterStopGyroscopeCallback(callback) {
wxStopGyroscopeCallback = callback;
}
function WX_RegisterOnGyroscopeChangeCallback(callback) {
wxOnGyroscopeChangeCallback = callback;
}
export default {
WX_StartGyroscope,
WX_StopGyroscope,
WX_OnGyroscopeChange,
WX_OffGyroscopeChange,
WX_RegisterStartGyroscopeCallback,
WX_RegisterStopGyroscopeCallback,
WX_RegisterOnGyroscopeChangeCallback,
};

import storage from './storage';
import userInfo from './userinfo';
import moduleHelper from './module-helper';
import share from './share';
import ad from './ad';
import canvasHelper from './canvas';
import fs from './fs';
import openData from './open-data';
import util from './util';
import cloud from './cloud';
import audio from './audio/index';
import texture from './texture';
import fix from './fix';
import canvasContext from './canvas-context';
import video from './video';
import logger from './logger';
import gameClub from './game-club';
import sdk from './sdk';
import camera from './camera';
import recorder from './recorder';
import uploadFile from './upload-file';
import gameRecorder from './game-recorder';
import chat from './chat';
import font from './font/index';
import authorize from './authorize';
import videoDecoder from './video/index';
import mobileKeyboard from './mobileKeyboard/index';
import touch from './touch/index';
import TCPSocket from './TCPSocket/index';
import UDPSocket from './UDPSocket/index';
import bluetooth from './bluetooth/index';
import gyroscope from './gyroscope/index';
const unityVersion = '2022.3.62f2c1';
GameGlobal.unityNamespace = GameGlobal.unityNamespace || {};
GameGlobal.unityNamespace.unityVersion = unityVersion;
window._ScaleRate = 1;
if (unityVersion && unityVersion.split('.').slice(0, 2)
.join('') < '20193') {
const width = window.innerWidth * window.devicePixelRatio;
const height = window.innerHeight * window.devicePixelRatio;
canvas.width = width;
canvas.height = height;
window._ScaleRate = window.devicePixelRatio;
}
Object.defineProperty(canvas, 'clientHeight', {
get() {
return window.innerHeight * window._ScaleRate;
},
configurable: true,
});
Object.defineProperty(canvas, 'clientWidth', {
get() {
return window.innerWidth * window._ScaleRate;
},
configurable: true,
});
Object.defineProperty(document.body, 'clientHeight', {
get() {
return window.innerHeight * window._ScaleRate;
},
configurable: true,
});
Object.defineProperty(document.body, 'clientWidth', {
get() {
return window.innerWidth * window._ScaleRate;
},
configurable: true,
});
Object.defineProperty(document, 'fullscreenEnabled', {
get() {
return true;
},
configurable: true,
});
fix.init();
const WXWASMSDK = {
WXInitializeSDK() {
moduleHelper.init();
moduleHelper.send('Inited', 200);
},
...storage,
...userInfo,
...share,
...ad,
...canvasHelper,
...fs,
...openData,
...util,
...cloud,
...audio,
...texture,
...video,
...logger,
...gameClub,
canvasContext,
...sdk,
...camera,
...recorder,
...uploadFile,
...gameRecorder,
...chat,
...font,
...authorize,
...videoDecoder,
...mobileKeyboard,
...touch,
...TCPSocket,
...UDPSocket,
...bluetooth,
...gyroscope,
};
GameGlobal.WXWASMSDK = WXWASMSDK;
let logger;
export default {
WXLogManagerDebug(str) {
if (!logger) {
logger = wx.getLogManager({ level: 0 });
}
logger.debug(str);
},
WXLogManagerInfo(str) {
if (!logger) {
logger = wx.getLogManager({ level: 0 });
}
logger.info(str);
},
WXLogManagerLog(str) {
if (!logger) {
logger = wx.getLogManager({ level: 0 });
}
logger.log(str);
},
WXLogManagerWarn(str) {
if (!logger) {
logger = wx.getLogManager({ level: 0 });
}
logger.warn(str);
},
};
/* eslint-disable @typescript-eslint/naming-convention */
let FrameworkData = null;
const keyboardSetting = {
value: '',
maxLength: 140,
multiple: false,
confirmHold: false,
confirmType: 'done',
};
const keyboardInputlistener = function (res) {
keyboardSetting.value = res.value;
};
const keyboardConfirmlistener = function (res) {
keyboardSetting.value = res.value;
_JS_MobileKeyboard_Hide(false);
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const keyboardCompletelistener = function (res) {
removeKeyboardListeners();
};
let hasExistingMobileInput = false;
let mobile_input_hide_delay = null;
let mobile_input_ignore_blur_event = false;
function _JS_MobileKeybard_GetIgnoreBlurEvent() {
return mobile_input_ignore_blur_event;
}
function _JS_MobileKeyboard_GetKeyboardStatus() {
const kKeyboardStatusVisible = 0;
const kKeyboardStatusDone = 1;
if (!hasExistingMobileInput) {
return kKeyboardStatusDone;
}
return kKeyboardStatusVisible;
}
function _JS_MobileKeyboard_GetText(buffer, bufferSize) {
if (buffer) {
FrameworkData.stringToUTF8(keyboardSetting.value, buffer, bufferSize);
}
return FrameworkData.lengthBytesUTF8(keyboardSetting.value);
}
function _JS_MobileKeyboard_GetTextSelection(outStart, outLength) {
const n = keyboardSetting.value.length;
FrameworkData.HEAP32[outStart >> 2] = n;
FrameworkData.HEAP32[outLength >> 2] = 0;
}
function _JS_MobileKeyboard_Hide(delay) {
if (mobile_input_hide_delay) {
return;
}
mobile_input_ignore_blur_event = true;
function hideMobileKeyboard() {
if (hasExistingMobileInput) {
wx.hideKeyboard();
}
hasExistingMobileInput = false;
mobile_input_hide_delay = null;
setTimeout(() => {
mobile_input_ignore_blur_event = false;
}, 100);
}
if (delay) {
const hideDelay = 200;
mobile_input_hide_delay = setTimeout(hideMobileKeyboard, hideDelay);
}
else {
hideMobileKeyboard();
}
}
function _JS_MobileKeyboard_SetCharacterLimit(limit) {
keyboardSetting.maxLength = limit;
}
function _JS_MobileKeyboard_SetText(text) {
if (!hasExistingMobileInput) {
return;
}
keyboardSetting.value = FrameworkData.UTF8ToString(text);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _JS_MobileKeyboard_SetTextSelection(start, length) {
}
function _JS_MobileKeyboard_Show(text, keyboardType, autocorrection, multiline, secure, alert, placeholder, characterLimit, data) {
if (FrameworkData === null) {
FrameworkData = data;
}
if (mobile_input_hide_delay) {
clearTimeout(mobile_input_hide_delay);
mobile_input_hide_delay = null;
}
if (hasExistingMobileInput) {
if (keyboardSetting.multiple !== !!multiline) {
_JS_MobileKeyboard_Hide(false);
return;
}
}
keyboardSetting.value = FrameworkData.UTF8ToString(text);
keyboardSetting.maxLength = characterLimit > 0 ? characterLimit : 524288;
keyboardSetting.multiple = !!multiline;
wx.showKeyboard({ defaultValue: keyboardSetting.value, maxLength: keyboardSetting.maxLength, multiple: keyboardSetting.multiple, confirmHold: keyboardSetting.confirmHold, confirmType: keyboardSetting.confirmType });
addKeyboardListeners();
hasExistingMobileInput = true;
}
function addKeyboardListeners() {
wx.onKeyboardInput(keyboardInputlistener);
wx.onKeyboardConfirm(keyboardConfirmlistener);
wx.onKeyboardComplete(keyboardCompletelistener);
}
function removeKeyboardListeners() {
wx.offKeyboardInput(keyboardInputlistener);
wx.offKeyboardConfirm(keyboardConfirmlistener);
wx.offKeyboardComplete(keyboardCompletelistener);
}
export default {
_JS_MobileKeybard_GetIgnoreBlurEvent,
_JS_MobileKeyboard_GetKeyboardStatus,
_JS_MobileKeyboard_GetText,
_JS_MobileKeyboard_GetTextSelection,
_JS_MobileKeyboard_Hide,
_JS_MobileKeyboard_SetCharacterLimit,
_JS_MobileKeyboard_SetText,
_JS_MobileKeyboard_SetTextSelection,
_JS_MobileKeyboard_Show,
};
/* eslint-disable no-underscore-dangle */
import { MODULE_NAME } from './conf';
export default {
_send: null,
init() {
this._send = GameGlobal.Module.SendMessage;
},
send(method, str = '') {
if (!this._send) {
this.init();
}
// @ts-ignore
this._send(MODULE_NAME, method, str);
},
};
import response from './response';
import moduleHelper from './module-helper';
import { getDefaultData, debugLog } from './utils';
import { isSupportSharedCanvasMode } from '../check-version';
let cachedOpenDataContext;
let cachedSharedCanvas;
var SharedCanvasMode;
(function (SharedCanvasMode) {
SharedCanvasMode["ScreenCanvas"] = "screenCanvas";
SharedCanvasMode["OffScreenCanvas"] = "offscreenCanvas";
})(SharedCanvasMode || (SharedCanvasMode = {}));
let sharedCanvasMode;
let timerId;
let textureObject = null;
let unityTextureObject = null;
let textureId;
function getOpenDataContext(mode) {
if (cachedOpenDataContext) {
return cachedOpenDataContext;
}
if (!isSupportSharedCanvasMode) {
if (mode === 'ScreenCanvas') {
console.warn('[unity-sdk]: 当前环境不支持 ScreenCanvas 模式');
}
sharedCanvasMode = SharedCanvasMode.OffScreenCanvas;
}
if (!sharedCanvasMode) {
if (typeof mode === 'string' && SharedCanvasMode[mode]) {
sharedCanvasMode = SharedCanvasMode[mode];
}
else {
sharedCanvasMode = SharedCanvasMode.OffScreenCanvas;
}
}
console.log(`[unity-sdk]: 当前开放数据域为 ${sharedCanvasMode} 模式`);
// @ts-ignore
cachedOpenDataContext = wx.getOpenDataContext({
sharedCanvasMode,
});
return cachedOpenDataContext;
}
function getSharedCanvas() {
return cachedSharedCanvas || getOpenDataContext().canvas;
}
function hookUnityRender() {
if (!textureId) {
return;
}
const Module = GameGlobal.manager.gameInstance.Module;
const { GL } = Module;
const gl = GL.currentContext.GLctx;
const isLinearColorSpace = GameGlobal.unityNamespace.unityColorSpace === 'Linear';
if (gl.emscriptenGLX) {
Module.ccall('glxShowOpenData', null, ['number', 'number', 'bool'], [textureId, getSharedCanvas().__uid(), isLinearColorSpace]);
}
else {
const commonTexImage2DHandler = () => {
if (textureId) {
gl.bindTexture(gl.TEXTURE_2D, GL.textures[textureId]);
if (isLinearColorSpace) {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.SRGB8_ALPHA8, gl.RGBA, gl.UNSIGNED_BYTE, getSharedCanvas());
}
else {
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, getSharedCanvas());
}
}
};
if (!textureObject) {
textureObject = gl.createTexture();
unityTextureObject = GL.textures[textureId];
GL.textures[textureId] = textureObject;
commonTexImage2DHandler();
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
}
else {
commonTexImage2DHandler();
}
timerId = requestAnimationFrame(hookUnityRender);
}
}
function stopLastRenderLoop() {
if (typeof timerId !== 'undefined') {
cancelAnimationFrame(timerId);
}
}
function startHookUnityRender() {
stopLastRenderLoop();
hookUnityRender();
}
function stopHookUnityRender() {
stopLastRenderLoop();
const sharedCanvas = getSharedCanvas();
sharedCanvas.width = 1;
sharedCanvas.height = 1;
const Module = GameGlobal.manager.gameInstance.Module;
const { GL } = Module;
const gl = GL.currentContext.GLctx;
if (textureObject) {
gl.deleteTexture(textureObject);
GL.textures[textureId] = unityTextureObject;
textureObject = null;
unityTextureObject = null;
}
if (gl.emscriptenGLX) {
Module.ccall('glxHideOpenData', null, [], []);
}
}
wx.onShow(() => {
if (cachedOpenDataContext) {
getOpenDataContext().postMessage({
type: 'WXShow',
});
}
});
export default {
WXGetOpenDataContext(mode) {
debugLog('WXGetOpenDataContext:', mode);
getOpenDataContext(mode);
},
WXDataContextPostMessage(msg) {
debugLog('WXDataContextPostMessage:', msg);
getOpenDataContext().postMessage(msg);
},
WXShowOpenData(id, x, y, width, height) {
debugLog('WXShowOpenData:', id, x, y, width, height);
if (width <= 0 || height <= 0) {
console.error('[unity-sdk]: WXShowOpenData要求 width 和 height 参数必须大于0');
}
if (!cachedOpenDataContext) {
console.warn('[unity-sdk]: 请先调用 WXGetOpenDataContext');
}
const openDataContext = getOpenDataContext();
const sharedCanvas = openDataContext.canvas;
sharedCanvas.width = width;
sharedCanvas.height = height;
if (sharedCanvasMode === SharedCanvasMode.ScreenCanvas && sharedCanvas.style) {
sharedCanvas.style.left = `${x / window.devicePixelRatio}px`;
sharedCanvas.style.top = `${y / window.devicePixelRatio}px`;
sharedCanvas.style.width = `${width / window.devicePixelRatio}px`;
sharedCanvas.style.height = `${height / window.devicePixelRatio}px`;
}
openDataContext.postMessage({
type: 'WXRender',
x,
y,
width,
height,
devicePixelRatio: window.devicePixelRatio,
});
if (sharedCanvasMode === SharedCanvasMode.OffScreenCanvas) {
textureId = id;
startHookUnityRender();
}
},
WXHideOpenData() {
debugLog('WXHideOpenData');
if (!cachedOpenDataContext) {
console.warn('[unity-sdk]: 请先调用 WXGetOpenDataContext');
return;
}
getOpenDataContext().postMessage({
type: 'WXDestroy',
});
if (sharedCanvasMode === SharedCanvasMode.OffScreenCanvas) {
stopHookUnityRender();
}
else if (sharedCanvasMode === SharedCanvasMode.ScreenCanvas) {
const sharedCanvas = getSharedCanvas();
if (sharedCanvas.style) {
sharedCanvas.style.top = '9999px';
}
}
},
WXOpenDataToTempFilePathSync(conf) {
debugLog('WXOpenDataToTempFilePathSync', conf);
const sharedCanvas = getSharedCanvas();
if (!sharedCanvas) {
return 'Please use WX.GetOpenDataContext() first';
}
return sharedCanvas.toTempFilePathSync(getDefaultData(sharedCanvas, conf));
},
WXOpenDataToTempFilePath(conf, s, f, c) {
debugLog('WXOpenDataToTempFilePath', conf);
if (conf) {
const sharedCanvas = getSharedCanvas();
if (!sharedCanvas) {
console.error('Please use WX.GetOpenDataContext() first');
return;
}
sharedCanvas.toTempFilePath({
...getDefaultData(sharedCanvas, conf),
...response.handleText(s, f, c),
success: (res) => {
moduleHelper.send('ToTempFilePathCallback', JSON.stringify({
callbackId: s,
errMsg: res.errMsg,
errCode: res.errCode || 0,
tempFilePath: res.tempFilePath,
}));
},
});
}
},
};
import moduleHelper from './module-helper';
import { formatJsonStr, cacheArrayBuffer, getListObject, uid } from './utils';
const recorderManagerList = {};
const getObject = getListObject(recorderManagerList, 'video');
export default {
WX_GetRecorderManager() {
const id = uid();
recorderManagerList[id] = wx.getRecorderManager();
return id;
},
WX_OnRecorderError(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderErrorCallback', resStr);
};
obj.onError(callback);
},
WX_OnRecorderFrameRecorded(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
cacheArrayBuffer(id, res.frameBuffer);
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify({
frameBufferLength: res.frameBuffer.byteLength,
isLastFrame: res.isLastFrame,
}),
});
moduleHelper.send('_OnRecorderFrameRecordedCallback', resStr);
};
obj.onFrameRecorded(callback);
},
WX_OnRecorderInterruptionBegin(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderInterruptionBeginCallback', resStr);
};
obj.onInterruptionBegin(callback);
},
WX_OnRecorderInterruptionEnd(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderInterruptionEndCallback', resStr);
};
obj.onInterruptionEnd(callback);
},
WX_OnRecorderPause(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderPauseCallback', resStr);
};
obj.onPause(callback);
},
WX_OnRecorderResume(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderResumeCallback', resStr);
};
obj.onResume(callback);
},
WX_OnRecorderStart(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderStartCallback', resStr);
};
obj.onStart(callback);
},
WX_OnRecorderStop(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('_OnRecorderStopCallback', resStr);
};
obj.onStop(callback);
},
WX_RecorderPause(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.pause();
},
WX_RecorderResume(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.resume();
},
WX_RecorderStart(id, option) {
const obj = getObject(id);
if (!obj) {
return;
}
const conf = formatJsonStr(option);
obj.start(conf);
},
WX_RecorderStop(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.stop();
},
};
export const ResType = {
Gamepad: {
axes: 'IAnyObject[]',
buttons: 'IAnyObject[]',
connected: 'bool',
id: 'string',
index: 'string',
},
AccountInfo: {
miniProgram: 'MiniProgram',
plugin: 'Plugin',
},
MiniProgram: {
appId: 'string',
envVersion: 'string',
version: 'string',
},
Plugin: {
appId: 'string',
version: 'string',
},
AppAuthorizeSetting: {
albumAuthorized: 'string',
bluetoothAuthorized: 'string',
cameraAuthorized: 'string',
locationAuthorized: 'string',
locationReducedAccuracy: 'bool',
microphoneAuthorized: 'string',
notificationAlertAuthorized: 'string',
notificationAuthorized: 'string',
notificationBadgeAuthorized: 'string',
notificationSoundAuthorized: 'string',
phoneCalendarAuthorized: 'string',
},
AppBaseInfo: {
SDKVersion: 'string',
enableDebug: 'bool',
fontSizeScaleFactor: 'number',
fontSizeSetting: 'number',
host: 'AppBaseInfoHost',
language: 'string',
version: 'string',
theme: 'string',
},
AppBaseInfoHost: {
appId: 'string',
},
GetBatteryInfoSyncResult: {
isCharging: 'bool',
isLowPowerModeEnabled: 'bool',
level: 'number',
},
DeviceInfo: {
abi: 'string',
benchmarkLevel: 'number',
brand: 'string',
cpuType: 'string',
deviceAbi: 'string',
memorySize: 'string',
model: 'string',
platform: 'string',
system: 'string',
},
EnterOptionsGame: {
apiCategory: 'string',
query: 'object',
referrerInfo: 'EnterOptionsGameReferrerInfo',
scene: 'number',
chatType: 'number',
shareTicket: 'string',
},
EnterOptionsGameReferrerInfo: {
appId: 'string',
extraData: 'object',
gameLiveInfo: 'GameLiveInfo',
},
GameLiveInfo: {
streamerOpenId: 'string',
feedId: 'string',
},
LaunchOptionsGame: {
query: 'object',
referrerInfo: 'EnterOptionsGameReferrerInfo',
scene: 'number',
chatType: 'number',
shareTicket: 'string',
},
ClientRect: {
bottom: 'number',
height: 'number',
left: 'number',
right: 'number',
top: 'number',
width: 'number',
},
OfficialComponentsInfo: {
notificationComponentInfo: 'OfficialComponentInfo',
},
OfficialComponentInfo: {
boundingClientRect: 'ClientRect',
isVisible: 'bool',
name: 'string',
},
GetStorageInfoSyncOption: {
currentSize: 'number',
keys: 'string[]',
limitSize: 'number',
},
SystemInfo: {
SDKVersion: 'string',
albumAuthorized: 'bool',
benchmarkLevel: 'number',
bluetoothEnabled: 'bool',
brand: 'string',
cameraAuthorized: 'bool',
deviceOrientation: 'string',
enableDebug: 'bool',
fontSizeSetting: 'number',
host: 'SystemInfoHost',
language: 'string',
locationAuthorized: 'bool',
locationEnabled: 'bool',
locationReducedAccuracy: 'bool',
microphoneAuthorized: 'bool',
model: 'string',
notificationAlertAuthorized: 'bool',
notificationAuthorized: 'bool',
notificationBadgeAuthorized: 'bool',
notificationSoundAuthorized: 'bool',
phoneCalendarAuthorized: 'bool',
pixelRatio: 'number',
platform: 'string',
safeArea: 'SafeArea',
screenHeight: 'number',
screenWidth: 'number',
statusBarHeight: 'number',
system: 'string',
version: 'string',
wifiEnabled: 'bool',
windowHeight: 'number',
windowWidth: 'number',
theme: 'string',
},
SystemInfoHost: {
appId: 'string',
},
SafeArea: {
bottom: 'number',
height: 'number',
left: 'number',
right: 'number',
top: 'number',
width: 'number',
},
SystemSetting: {
bluetoothEnabled: 'bool',
deviceOrientation: 'string',
locationEnabled: 'bool',
wifiEnabled: 'bool',
},
WindowInfo: {
pixelRatio: 'number',
safeArea: 'SafeArea',
screenHeight: 'number',
screenTop: 'number',
screenWidth: 'number',
statusBarHeight: 'number',
windowHeight: 'number',
windowWidth: 'number',
},
GeneralCallbackResult: {
errMsg: 'string',
},
DownloadFileSuccessCallbackResult: {
filePath: 'string',
profile: 'RequestProfile',
statusCode: 'number',
tempFilePath: 'string',
errMsg: 'string',
},
RequestProfile: {
SSLconnectionEnd: 'number',
SSLconnectionStart: 'number',
connectEnd: 'number',
connectStart: 'number',
domainLookUpEnd: 'number',
domainLookUpStart: 'number',
downstreamThroughputKbpsEstimate: 'number',
estimate_nettype: 'number',
fetchStart: 'number',
httpDNSDomainLookUpEnd: 'number',
httpDNSDomainLookUpStart: 'number',
httpRttEstimate: 'number',
invokeStart: 'number',
peerIP: 'string',
port: 'number',
protocol: 'string',
queueEnd: 'number',
queueStart: 'number',
receivedBytedCount: 'number',
redirectEnd: 'number',
redirectStart: 'number',
requestEnd: 'number',
requestStart: 'number',
responseEnd: 'number',
responseStart: 'number',
rtt: 'number',
sendBytesCount: 'number',
socketReused: 'bool',
throughputKbps: 'number',
transportRttEstimate: 'number',
usingHighPerformanceMode: 'bool',
},
DownloadTaskOnHeadersReceivedListenerResult: {
header: 'object',
},
DownloadTaskOnProgressUpdateListenerResult: {
progress: 'number',
totalBytesExpectedToWrite: 'number',
totalBytesWritten: 'number',
},
CreateOpenSettingButtonOption: {
style: 'OptionStyle',
type: 'string',
image: 'string',
text: 'string',
},
OptionStyle: {
backgroundColor: 'string',
height: 'number',
left: 'number',
top: 'number',
width: 'number',
borderColor: 'string',
borderRadius: 'number',
borderWidth: 'number',
color: 'string',
fontSize: 'number',
lineHeight: 'number',
textAlign: 'string',
},
ImageData: {
height: 'number',
width: 'number',
},
GetLogManagerOption: {
level: 'number',
},
Path2D: {},
OnCheckForUpdateListenerResult: {
hasUpdate: 'bool',
},
VideoDecoderStartOption: {
source: 'string',
abortAudio: 'bool',
abortVideo: 'bool',
mode: 'number',
},
SetMessageToFriendQueryOption: {
query: 'string',
shareMessageToFriendScene: 'number',
},
AddCardRequestInfo: {
cardExt: 'string',
cardId: 'string',
},
AddCardSuccessCallbackResult: {
cardList: 'AddCardResponseInfo[]',
errMsg: 'string',
},
AddCardResponseInfo: {
cardExt: 'string',
cardId: 'string',
code: 'string',
isSuccess: 'bool',
},
AuthPrivateMessageSuccessCallbackResult: {
encryptedData: 'string',
errMsg: 'string',
iv: 'string',
valid: 'bool',
},
CheckIsAddedToMyMiniProgramSuccessCallbackResult: {
added: 'bool',
errMsg: 'string',
},
ChooseImageSuccessCallbackResult: {
tempFilePaths: 'string[]',
tempFiles: 'ImageFile[]',
errMsg: 'string',
},
ImageFile: {
path: 'string',
size: 'number',
},
ChooseMediaSuccessCallbackResult: {
tempFiles: 'MediaFile[]',
type: 'string',
errMsg: 'string',
},
MediaFile: {
duration: 'number',
fileType: 'string',
height: 'number',
size: 'number',
tempFilePath: 'string',
thumbTempFilePath: 'string',
width: 'number',
},
ChooseMessageFileSuccessCallbackResult: {
tempFiles: 'ChooseFile[]',
errMsg: 'string',
},
ChooseFile: {
name: 'string',
path: 'string',
size: 'number',
time: 'number',
type: 'string',
},
BluetoothError: {
errMsg: 'string',
errCode: 'number',
},
CompressImageSuccessCallbackResult: {
tempFilePath: 'string',
errMsg: 'string',
},
CreateBLEPeripheralServerSuccessCallbackResult: {
server: 'BLEPeripheralServer',
errMsg: 'string',
},
BLEPeripheralService: {
characteristics: 'Characteristic[]',
uuid: 'string',
},
Characteristic: {
uuid: 'string',
descriptors: 'Descriptor[]',
permission: 'CharacteristicPermission',
properties: 'CharacteristicProperties',
value: 'arrayBuffer',
arrayBufferLength: 'number',
},
Descriptor: {
uuid: 'string',
permission: 'DescriptorPermission',
value: 'arrayBuffer',
arrayBufferLength: 'number',
},
DescriptorPermission: {
read: 'bool',
write: 'bool',
},
CharacteristicPermission: {
readEncryptionRequired: 'bool',
readable: 'bool',
writeEncryptionRequired: 'bool',
writeable: 'bool',
},
CharacteristicProperties: {
indicate: 'bool',
notify: 'bool',
read: 'bool',
write: 'bool',
writeNoResponse: 'bool',
},
OnCharacteristicReadRequestListenerResult: {
callbackId: 'number',
characteristicId: 'string',
serviceId: 'string',
},
OnCharacteristicSubscribedListenerResult: {
characteristicId: 'string',
serviceId: 'string',
},
OnCharacteristicWriteRequestListenerResult: {
callbackId: 'number',
characteristicId: 'string',
serviceId: 'string',
value: 'arrayBuffer',
arrayBufferLength: 'number',
},
AdvertiseReqObj: {
beacon: 'BeaconInfoObj',
connectable: 'bool',
deviceName: 'string',
manufacturerData: 'ManufacturerData[]',
serviceUuids: 'string[]',
},
BeaconInfoObj: {
major: 'number',
minor: 'number',
uuid: 'string',
measuredPower: 'number',
},
ManufacturerData: {
manufacturerId: 'string',
manufacturerSpecificData: 'arrayBuffer',
arrayBufferLength: 'number',
},
FaceDetectSuccessCallbackResult: {
angleArray: 'FaceAngel',
confArray: 'FaceConf',
detectRect: 'object',
faceInfo: 'IAnyObject[]',
pointArray: 'IAnyObject[]',
x: 'number',
y: 'number',
errMsg: 'string',
},
FaceAngel: {
pitch: 'number',
roll: 'number',
yaw: 'number',
},
FaceConf: {
global: 'number',
leftEye: 'number',
mouth: 'number',
nose: 'number',
rightEye: 'number',
},
GetAvailableAudioSourcesSuccessCallbackResult: {
errMsg: 'string',
},
GetBLEDeviceCharacteristicsSuccessCallbackResult: {
characteristics: 'BLECharacteristic[]',
errMsg: 'string',
},
BLECharacteristic: {
properties: 'BLECharacteristicProperties',
uuid: 'string',
},
BLECharacteristicProperties: {
indicate: 'bool',
notify: 'bool',
read: 'bool',
write: 'bool',
writeDefault: 'bool',
writeNoResponse: 'bool',
},
GetBLEDeviceRSSISuccessCallbackResult: {
RSSI: 'number',
errMsg: 'string',
},
GetBLEDeviceServicesSuccessCallbackResult: {
services: 'BLEService[]',
errMsg: 'string',
},
BLEService: {
isPrimary: 'bool',
uuid: 'string',
},
GetBLEMTUSuccessCallbackResult: {
mtu: 'number',
errMsg: 'string',
},
GetBackgroundFetchDataSuccessCallbackResult: {
fetchedData: 'string',
path: 'string',
query: 'string',
scene: 'number',
timeStamp: 'long',
errMsg: 'string',
},
GetBackgroundFetchTokenSuccessCallbackResult: {
errMsg: 'string',
token: 'string',
},
GetBatteryInfoSuccessCallbackResult: {
isCharging: 'bool',
isLowPowerModeEnabled: 'bool',
level: 'number',
errMsg: 'string',
},
BeaconError: {
errMsg: 'string',
errCode: 'number',
},
GetBeaconsSuccessCallbackResult: {
beacons: 'BeaconInfo[]',
errMsg: 'string',
},
BeaconInfo: {
accuracy: 'number',
major: 'number',
minor: 'number',
proximity: 'number',
rssi: 'number',
uuid: 'string',
},
GetBluetoothAdapterStateSuccessCallbackResult: {
available: 'bool',
discovering: 'bool',
errMsg: 'string',
},
GetBluetoothDevicesSuccessCallbackResult: {
devices: 'BlueToothDevice[]',
errMsg: 'string',
},
BlueToothDevice: {
RSSI: 'number',
advertisData: 'arrayBuffer',
arrayBufferLength: 'number',
advertisServiceUUIDs: 'string[]',
connectable: 'bool',
deviceId: 'string',
localName: 'string',
name: 'string',
serviceData: 'object',
},
GetChannelsLiveInfoSuccessCallbackResult: {
description: 'string',
feedId: 'string',
headUrl: 'string',
nickname: 'string',
nonceId: 'string',
otherInfos: 'any[]',
replayStatus: 'number',
status: 'number',
errMsg: 'string',
},
GetChannelsLiveNoticeInfoSuccessCallbackResult: {
headUrl: 'string',
nickname: 'string',
noticeId: 'string',
otherInfos: 'any[]',
reservable: 'bool',
startTime: 'string',
status: 'number',
errMsg: 'string',
},
GetChatToolInfoSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
errMsg: 'string',
iv: 'string',
},
GetClipboardDataSuccessCallbackOption: {
data: 'string',
errMsg: 'string',
},
GetConnectedBluetoothDevicesSuccessCallbackResult: {
devices: 'BluetoothDeviceInfo[]',
errMsg: 'string',
},
BluetoothDeviceInfo: {
deviceId: 'string',
name: 'string',
},
GetDeviceBenchmarkInfoSuccessCallbackResult: {
benchmarkLevel: 'number',
modelLevel: 'number',
errMsg: 'string',
},
GetExtConfigSuccessCallbackResult: {
extConfig: 'object',
errMsg: 'string',
},
GetFuzzyLocationSuccessCallbackResult: {
latitude: 'number',
longitude: 'number',
errMsg: 'string',
},
DataType: {
type: 'number',
subKey: 'string',
},
GetGameClubDataSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
iv: 'string',
signature: 'string',
errMsg: 'string',
},
GetGameExptInfoSuccessCallbackResult: {
list: 'object',
errMsg: 'string',
},
GetGroupEnterInfoError: {
errMsg: 'string',
errCode: 'number',
},
GetGroupEnterInfoSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
errMsg: 'string',
iv: 'string',
},
GetGroupMembersInfoSuccessCallbackResult: {
membersInfo: 'ResultOpenDataContextUserInfo[]',
errMsg: 'string',
},
ResultOpenDataContextUserInfo: {
avatarUrl: 'string',
city: 'string',
country: 'string',
gender: 'number',
language: 'string',
nickName: 'string',
openId: 'string',
province: 'string',
},
GetInferenceEnvInfoSuccessCallbackResult: {
ver: 'string',
errMsg: 'string',
},
GetLocalIPAddressSuccessCallbackResult: {
errMsg: 'string',
localip: 'string',
netmask: 'string',
},
GetNetworkTypeSuccessCallbackResult: {
hasSystemProxy: 'bool',
networkType: 'string',
signalStrength: 'number',
weakNet: 'bool',
errMsg: 'string',
},
GetPhoneNumberSuccessCallbackResult: {
code: 'string',
errMsg: 'string',
errno: 'number',
},
GetPrivacySettingSuccessCallbackResult: {
needAuthorization: 'bool',
privacyContractName: 'string',
errMsg: 'string',
},
GetScreenBrightnessSuccessCallbackOption: {
value: 'number',
errMsg: 'string',
},
GetScreenRecordingStateSuccessCallbackResult: {
state: 'string',
errMsg: 'string',
},
GetSettingSuccessCallbackResult: {
authSetting: 'AuthSetting',
subscriptionsSetting: 'SubscriptionsSetting',
miniprogramAuthSetting: 'AuthSetting',
errMsg: 'string',
},
AuthSetting: {},
SubscriptionsSetting: {
mainSwitch: 'bool',
itemSettings: 'object',
},
GetShowSplashAdStatusSuccessCallbackResult: {
status: 'string',
errMsg: 'string',
},
GetStorageInfoSuccessCallbackOption: {
currentSize: 'number',
keys: 'string[]',
limitSize: 'number',
errMsg: 'string',
},
GetUserInfoSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
iv: 'string',
rawData: 'string',
signature: 'string',
userInfo: 'UserInfo',
errMsg: 'string',
},
UserInfo: {
avatarUrl: 'string',
city: 'string',
country: 'string',
gender: 'number',
language: 'string',
nickName: 'string',
province: 'string',
},
GetUserInteractiveStorageFailCallbackResult: {
errCode: 'number',
errMsg: 'string',
},
GetUserInteractiveStorageSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
iv: 'string',
errMsg: 'string',
},
GetWeRunDataSuccessCallbackResult: {
cloudID: 'string',
encryptedData: 'string',
iv: 'string',
errMsg: 'string',
},
JoinVoIPChatError: {
errMsg: 'string',
errCode: 'number',
},
MuteConfig: {
muteEarphone: 'bool',
muteMicrophone: 'bool',
},
JoinVoIPChatSuccessCallbackResult: {
errCode: 'number',
errMsg: 'string',
openIdList: 'string[]',
},
LoginFailCallbackErr: {
errMsg: 'string',
errno: 'number',
},
LoginSuccessCallbackResult: {
code: 'string',
errMsg: 'string',
},
OnAccelerometerChangeListenerResult: {
x: 'number',
y: 'number',
z: 'number',
},
OnAddToFavoritesListenerResult: {
disableForward: 'bool',
imageUrl: 'string',
query: 'string',
title: 'string',
},
OnBLEConnectionStateChangeListenerResult: {
connected: 'bool',
deviceId: 'string',
},
OnBLEMTUChangeListenerResult: {
deviceId: 'string',
mtu: 'number',
},
OnBLEPeripheralConnectionStateChangedListenerResult: {
connected: 'bool',
deviceId: 'string',
serverId: 'string',
},
OnBackgroundFetchDataListenerResult: {
fetchType: 'string',
fetchedData: 'string',
path: 'string',
query: 'string',
scene: 'number',
timeStamp: 'long',
},
OnBeaconServiceChangeListenerResult: {
available: 'bool',
discovering: 'bool',
},
OnBeaconUpdateListenerResult: {
beacons: 'BeaconInfo[]',
},
OnBluetoothAdapterStateChangeListenerResult: {
available: 'bool',
discovering: 'bool',
},
OnBluetoothDeviceFoundListenerResult: {
devices: 'BlueToothDevice[]',
},
OnCompassChangeListenerResult: {
accuracy: 'string',
direction: 'number',
},
OnCopyUrlListenerResult: {
query: 'string',
},
OnDeviceMotionChangeListenerResult: {
alpha: 'number',
beta: 'number',
gamma: 'number',
},
OnDeviceOrientationChangeListenerResult: {
value: 'string',
},
ListenerError: {
message: 'string',
},
OnGamepadConnectedListenerResult: {
gamepad: 'string',
},
OnGamepadDisconnectedListenerResult: {
gamepad: 'string',
},
OnHandoffListenerResult: {
query: 'string',
},
OnKeyDownListenerResult: {
code: 'string',
key: 'string',
timeStamp: 'long',
},
OnKeyboardInputListenerResult: {
value: 'string',
},
OnKeyboardHeightChangeListenerResult: {
height: 'number',
},
OnMemoryWarningListenerResult: {
level: 'number',
},
OnMouseDownListenerResult: {
button: 'number',
timeStamp: 'long',
x: 'number',
y: 'number',
},
OnMouseMoveListenerResult: {
movementX: 'number',
movementY: 'number',
timeStamp: 'long',
x: 'number',
y: 'number',
},
OnNetworkStatusChangeListenerResult: {
isConnected: 'bool',
networkType: 'string',
},
OnNetworkWeakChangeListenerResult: {
networkType: 'string',
weakNet: 'bool',
},
OnOfficialComponentsInfoChangeListenerResult: {
OfficialComponentsInfo: 'OfficialComponentsInfo',
},
OnScreenRecordingStateChangedListenerResult: {
state: 'string',
},
OnShareTimelineListenerResult: {
imageUrl: 'string',
imagePreviewUrl: 'string',
imagePreviewUrlId: 'string',
imageUrlId: 'string',
path: 'string',
query: 'string',
title: 'string',
},
OnShowListenerResult: {
query: 'object',
referrerInfo: 'ResultReferrerInfo',
scene: 'number',
chatType: 'number',
shareTicket: 'string',
},
ResultReferrerInfo: {
appId: 'string',
extraData: 'object',
},
OnUnhandledRejectionListenerResult: {
promise: 'string',
reason: 'string',
},
OnUserCaptureScreenListenerResult: {
query: 'string',
},
OnVoIPChatInterruptedListenerResult: {
errCode: 'number',
errMsg: 'string',
},
OnVoIPChatMembersChangedListenerResult: {
errCode: 'number',
errMsg: 'string',
openIdList: 'string[]',
},
OnVoIPChatSpeakersChangedListenerResult: {
errCode: 'number',
errMsg: 'string',
openIdList: 'string[]',
},
OnVoIPChatStateChangedListenerResult: {
code: 'number',
data: 'object',
errCode: 'number',
errMsg: 'string',
},
OnWheelListenerResult: {
deltaX: 'number',
deltaY: 'number',
deltaZ: 'number',
timeStamp: 'long',
x: 'number',
y: 'number',
},
OnWindowResizeListenerResult: {
windowHeight: 'number',
windowWidth: 'number',
},
OnWindowStateChangeListenerResult: {
state: 'string',
},
OpenCardRequestInfo: {
cardId: 'string',
code: 'string',
},
ExtInfoOption: {
url: 'string',
},
OpenCustomerServiceConversationSuccessCallbackResult: {
path: 'string',
query: 'object',
errMsg: 'string',
},
OpenSettingSuccessCallbackResult: {
authSetting: 'AuthSetting',
subscriptionsSetting: 'SubscriptionsSetting',
errMsg: 'string',
},
MediaSource: {
url: 'string',
poster: 'string',
type: 'string',
},
ReportSceneError: {
errMsg: 'string',
errCode: 'number',
},
ReportSceneFailCallbackErr: {
data: 'object',
errMsg: 'string',
},
ReportSceneSuccessCallbackResult: {
data: 'object',
errMsg: 'string',
},
ReportUserBehaviorBranchAnalyticsOption: {
branchId: 'string',
eventType: 'number',
branchDim: 'string',
},
MidasFriendPaymentError: {
errMsg: 'string',
errCode: 'number',
},
MidasPaymentError: {
errMsg: 'string',
errCode: 'number',
},
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',
},
RequestSubscribeMessageSuccessCallbackResult: {
anyKeyWord: 'string',
errMsg: 'string',
},
RequestSubscribeSystemMessageSuccessCallbackResult: {
anyKeyWord: 'string',
errMsg: 'string',
},
ScanCodeSuccessCallbackResult: {
charSet: 'string',
path: 'string',
rawData: 'string',
result: 'string',
scanType: 'string',
errMsg: 'string',
},
GroupMemberInfo: {
members: 'string[]',
errMsg: 'string',
},
SetBLEMTUFailCallbackResult: {
mtu: 'number',
},
SetBLEMTUSuccessCallbackResult: {
mtu: 'number',
errMsg: 'string',
},
KVData: {
key: 'string',
value: 'string',
},
ShareAppMessageOption: {
imageUrl: 'string',
imageUrlId: 'string',
path: 'string',
query: 'string',
title: 'string',
toCurrentGroup: 'bool',
},
ShowActionSheetSuccessCallbackResult: {
tapIndex: 'number',
errMsg: 'string',
},
ShowModalSuccessCallbackResult: {
cancel: 'bool',
confirm: 'bool',
content: 'string',
errMsg: 'string',
},
UpdatableMessageFrontEndTemplateInfo: {
parameterList: 'UpdatableMessageFrontEndParameter[]',
templateId: 'string',
},
UpdatableMessageFrontEndParameter: {
name: 'string',
value: 'string',
},
VibrateShortFailCallbackResult: {
errMsg: 'string',
},
CheckGameLiveEnabledSuccessCallbackOption: {
errMsg: 'string',
isEnabled: 'bool',
},
OnGameLiveStateChangeCallbackResult: {
state: 'string',
feedId: 'string',
},
OnGameLiveStateChangeCallbackResponse: {
query: 'string',
},
GameLiveState: {
isLive: 'bool',
},
GetUserCurrentGameliveInfoSuccessCallbackOption: {
feedIdList: 'string[]',
},
GetUserGameLiveDetailsSuccessCallbackOption: {
encryptedData: 'string',
iv: 'string',
cloudID: 'string',
feedIdList: 'string[]',
errMsg: 'string',
},
RequestSubscribeLiveActivitySuccessCallbackResult: {
code: 'string',
errMsg: 'string',
},
FrameDataOptions: {
data: 'arrayBuffer',
arrayBufferLength: 'number',
height: 'number',
pkDts: 'number',
pkPts: 'number',
width: 'number',
},
};
export const ResTypeOther = {
Stats: {
lastAccessedTime: 'number',
lastModifiedTime: 'number',
mode: 'number',
size: 'number',
},
TCPSocketOnMessageListenerResult: {
localInfo: 'LocalInfo',
message: 'arrayBuffer',
remoteInfo: 'RemoteInfo',
},
LocalInfo: {
address: 'string',
family: 'string',
port: 'number',
},
RemoteInfo: {
address: 'string',
family: 'string',
port: 'number',
},
UDPSocketConnectOption: {
address: 'string',
port: 'number',
},
UDPSocketOnMessageListenerResult: {
localInfo: 'LocalInfo',
message: 'arrayBuffer',
remoteInfo: 'RemoteInfo',
},
UDPSocketSendOption: {
address: 'string',
message: 'string|arrayBuffer',
port: 'number',
length: 'number',
offset: 'number',
setBroadcast: 'bool',
},
UDPSocketSendParam: {
address: 'string',
port: 'number',
length: 'number',
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',
},
LoadOption: {
openlink: 'string',
query: 'object',
},
ShowOption: {
openlink: 'string',
query: 'object',
},
};
/* eslint-disable @typescript-eslint/no-this-alias */
import moduleHelper from './module-helper';
export default {
handleText(s, f, c) {
const self = this;
return {
success(res) {
self.textFormat(s, res);
},
fail(res) {
self.textFormat(f, res);
},
complete(res) {
self.textFormat(c, res);
},
};
},
handleTextLongBack(s, f, c) {
const self = this;
return {
success(res) {
self.textFormatLongBack(s, res);
},
fail(res) {
self.textFormatLongBack(f, res);
},
complete(res) {
self.textFormatLongBack(c, res);
},
};
},
textFormat(id, res) {
if (!id) {
return false;
}
moduleHelper.send('TextResponseCallback', JSON.stringify({
callbackId: id,
errMsg: res.errMsg,
errCode: res.errCode,
}));
},
textFormatLongBack(id, res) {
if (!id) {
return false;
}
moduleHelper.send('TextResponseLongCallback', JSON.stringify({
callbackId: id,
errMsg: res.errMsg,
errCode: res.errCode,
}));
},
handle(formatFunc, s, f, c) {
return {
success(res) {
if (!s) {
return false;
}
formatFunc(s, res);
},
fail(res) {
if (!f) {
return false;
}
formatFunc(f, res);
},
complete(res) {
if (!c) {
return false;
}
formatFunc(c, res);
},
};
},
};
import moduleHelper from './module-helper';
import { uid, formatResponse, formatJsonStr, stringifyRes } from './utils';
const onEventLists = {};
let wxOnAddToFavoritesResolveConf;
let wxOnCopyUrlResolveConf;
let wxOnHandoffResolveConf;
let wxOnShareTimelineResolveConf;
let wxOnGameLiveStateChangeResolveConf;
const ClassLists = {};
const ClassOnEventLists = {};
function getClassObject(className, id) {
if (!ClassLists[className]) {
ClassLists[className] = {};
}
const obj = ClassLists[className][id];
if (!obj) {
console.error(`${className} 不存在:`, id);
}
return obj;
}
;
// eslint-disable-next-line @typescript-eslint/naming-convention
function WX_OneWayNoFunction(functionName, ...params) {
wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
}
const onlyReadResponse = [
'getSystemSetting',
'getAppAuthorizeSetting',
];
const needParseJson = ['WXMiniReportManagerReport'];
// eslint-disable-next-line @typescript-eslint/naming-convention
function WX_SyncFunction(functionName, ...params) {
return wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
}
// eslint-disable-next-line @typescript-eslint/naming-convention
function WX_ClassOneWayNoFunction(className, functionName, id, ...params) {
const obj = getClassObject(className, id);
if (!obj) {
return;
}
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
}
function classFormatAndSend(id, callbackId, callbackName, callbackType, resType, res) {
formatResponse(resType, res);
moduleHelper.send(callbackName, classGetMsg(id, callbackId, callbackType, res));
}
function classGetMsg(id, callbackId, resType, res) {
return JSON.stringify({
id, callbackId, type: resType, res: JSON.stringify(res) || '',
});
}
export default {
WX_OneWayFunction(functionName, successType, failType, completeType, conf, callbackId) {
const lowerFunctionName = functionName.replace(/^\w/, (a) => a.toLowerCase());
const config = formatJsonStr(conf);
// specialJS
if (lowerFunctionName === 'login') {
if (!config.timeout) {
delete config.timeout;
}
}
else if (lowerFunctionName === 'reportScene') {
if (GameGlobal.manager && GameGlobal.manager.setGameStage) {
GameGlobal.manager.setGameStage(config.sceneId);
}
}
wx[lowerFunctionName]({
...config,
success(res) {
formatResponse(successType, res);
if (lowerFunctionName === 'getGameExptInfo') {
res.list = JSON.stringify(res.list);
}
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'success', res: JSON.stringify(res),
}));
},
fail(res) {
formatResponse(failType, res);
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'fail', res: JSON.stringify(res),
}));
},
complete(res) {
formatResponse(completeType, res);
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'complete', res: JSON.stringify(res),
}));
},
});
},
WX_OneWayNoFunction_v(functionName) {
WX_OneWayNoFunction(functionName);
},
WX_OneWayNoFunction_vs(functionName, param1) {
WX_OneWayNoFunction(functionName, param1);
},
WX_OneWayNoFunction_vt(functionName, param1) {
const formatParam1 = formatJsonStr(param1);
WX_OneWayNoFunction(functionName, formatParam1);
},
WX_OneWayNoFunction_vst(functionName, param1, param2) {
const formatParam2 = formatJsonStr(param2);
WX_OneWayNoFunction(functionName, param1, formatParam2);
},
WX_OneWayNoFunction_vsn(functionName, param1, param2) {
WX_OneWayNoFunction(functionName, param1, param2);
},
WX_OneWayNoFunction_vnns(functionName, param1, param2, param3) {
WX_OneWayNoFunction(functionName, param1, param2, param3);
},
WX_OnEventRegister(functionName, resType) {
if (!onEventLists[functionName]) {
onEventLists[functionName] = [];
}
const callback = (res) => {
formatResponse(resType, res);
const resStr = stringifyRes(res);
moduleHelper.send(`_${functionName}Callback`, resStr);
};
onEventLists[functionName].push(callback);
wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
},
WX_OffEventRegister(functionName) {
(onEventLists[functionName] || []).forEach((v) => {
wx[functionName.replace(/^On/, 'off')](v);
});
},
WX_OnAddToFavorites() {
const callback = (res) => {
const resStr = stringifyRes(res);
moduleHelper.send('_OnAddToFavoritesCallback', resStr);
return wxOnAddToFavoritesResolveConf;
};
wx.onAddToFavorites(callback);
},
WX_OnAddToFavorites_Resolve(conf) {
try {
wxOnAddToFavoritesResolveConf = formatJsonStr(conf);
return;
}
catch (e) {
}
wxOnAddToFavoritesResolveConf = {};
},
WX_OffAddToFavorites() {
wx.offAddToFavorites();
},
WX_OnCopyUrl() {
const callback = (res) => {
const resStr = stringifyRes(res);
moduleHelper.send('_OnCopyUrlCallback', resStr);
return wxOnCopyUrlResolveConf;
};
wx.onCopyUrl(callback);
},
WX_OnCopyUrl_Resolve(conf) {
try {
wxOnCopyUrlResolveConf = formatJsonStr(conf);
return;
}
catch (e) {
}
wxOnCopyUrlResolveConf = {};
},
WX_OffCopyUrl() {
wx.offCopyUrl();
},
WX_OnHandoff() {
const callback = (res) => {
const resStr = stringifyRes(res);
moduleHelper.send('_OnHandoffCallback', resStr);
return wxOnHandoffResolveConf;
};
wx.onHandoff(callback);
},
WX_OnHandoff_Resolve(conf) {
try {
wxOnHandoffResolveConf = formatJsonStr(conf);
return;
}
catch (e) {
}
wxOnHandoffResolveConf = {};
},
WX_OffHandoff() {
wx.offHandoff();
},
WX_OnShareTimeline() {
const callback = (res) => {
const resStr = stringifyRes(res);
moduleHelper.send('_OnShareTimelineCallback', resStr);
return wxOnShareTimelineResolveConf;
};
wx.onShareTimeline(callback);
},
WX_OnShareTimeline_Resolve(conf) {
try {
wxOnShareTimelineResolveConf = formatJsonStr(conf);
return;
}
catch (e) {
}
wxOnShareTimelineResolveConf = {};
},
WX_OffShareTimeline() {
wx.offShareTimeline();
},
WX_OnGameLiveStateChange() {
const callback = (res) => {
formatResponse('OnGameLiveStateChangeCallbackResult', res);
const resStr = stringifyRes(res);
moduleHelper.send('_OnGameLiveStateChangeCallback', resStr);
return wxOnGameLiveStateChangeResolveConf;
};
wx.onGameLiveStateChange(callback);
},
WX_OnGameLiveStateChange_Resolve(conf) {
try {
wxOnGameLiveStateChangeResolveConf = formatJsonStr(conf);
return;
}
catch (e) {
}
wxOnGameLiveStateChangeResolveConf = {};
},
WX_OffGameLiveStateChange() {
wx.offGameLiveStateChange();
},
WX_SyncFunction_bs(functionName, param1) {
const res = WX_SyncFunction(functionName, param1);
return res;
},
WX_SyncFunction_t(functionName, returnType) {
const res = WX_SyncFunction(functionName);
if (onlyReadResponse.includes(functionName.replace(/^\w/, (a) => a.toLowerCase()))) {
formatResponse(returnType, JSON.parse(JSON.stringify(res)));
return JSON.stringify(res);
}
formatResponse(returnType, res);
return JSON.stringify(res);
},
WX_SyncFunction_tt(functionName, returnType, param1) {
const res = WX_SyncFunction(functionName, formatJsonStr(param1));
formatResponse(returnType, res);
return JSON.stringify(res);
},
WX_SyncFunction_b(functionName) {
const res = WX_SyncFunction(functionName);
return res;
},
WX_SyncFunction_bsnn(functionName, param1, param2, param3) {
const res = WX_SyncFunction(functionName, param1, param2, param3);
return res;
},
WX_SyncFunction_bt(functionName, param1) {
const res = WX_SyncFunction(functionName, formatJsonStr(param1));
return res;
},
WX_SyncFunction_nt(functionName, param1) {
const res = WX_SyncFunction(functionName, formatJsonStr(param1));
return res;
},
WX_SyncFunction_ss(functionName, param1) {
const res = WX_SyncFunction(functionName, param1);
return res;
},
WX_SyncFunction_tnn(functionName, returnType, param1, param2) {
const res = WX_SyncFunction(functionName, param1, param2);
formatResponse(returnType, res);
return JSON.stringify(res);
},
WX_ClassConstructor(functionName, returnType, successType, failType, completeType, conf) {
const config = formatJsonStr(conf);
const callbackId = uid();
const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())]({
...config,
success(res) {
formatResponse(successType, res);
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'success', res: JSON.stringify(res),
}));
},
fail(res) {
formatResponse(failType, res);
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'fail', res: JSON.stringify(res),
}));
},
complete(res) {
formatResponse(completeType, res);
moduleHelper.send(`${functionName}Callback`, JSON.stringify({
callbackId, type: 'complete', res: JSON.stringify(res),
}));
},
});
if (!ClassLists[returnType]) {
ClassLists[returnType] = {};
}
ClassLists[returnType][callbackId] = obj;
return callbackId;
},
WX_ClassFunction(functionName, returnType, option) {
const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](formatJsonStr(option));
const id = uid();
if (!ClassLists[returnType]) {
ClassLists[returnType] = {};
}
ClassLists[returnType][id] = obj;
return id;
},
WX_ClassSetProperty(className, id, key, value) {
const obj = getClassObject(className, id);
if (!obj) {
return;
}
if (/^\s*(\{.*\}|\[.*\])\s*$/.test(value)) {
try {
const jsonValue = JSON.parse(value);
Object.assign(obj[key], jsonValue);
}
catch (e) {
obj[key] = value;
}
}
else {
obj[key] = value;
}
},
WX_ClassOnEventFunction(className, functionName, returnType, id, eventName) {
const obj = getClassObject(className, id);
if (!obj) {
return;
}
if (!ClassOnEventLists[className + functionName]) {
ClassOnEventLists[className + functionName] = {};
}
const callback = (res) => {
if (returnType !== 'string') {
formatResponse(returnType, res);
}
if (!eventName) {
// eslint-disable-next-line no-param-reassign
eventName = '';
}
const resStr = JSON.stringify({
callbackId: id + eventName,
res: JSON.stringify(res),
});
moduleHelper.send(`_${className}${functionName}Callback`, resStr);
};
if (!ClassOnEventLists[className + functionName][id + eventName]) {
ClassOnEventLists[className + functionName][id + eventName] = [];
}
ClassOnEventLists[className + functionName][id + eventName].push(callback);
// WXVideoDecoder OnEvent 不规范 特殊处理
// update: 2025.9.27: 严重怀疑之前 WXPageManager 压根没有跑通过事件监听,跑到下面去了
if (className === 'WXVideoDecoder' || className === 'WXPageManager') {
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](eventName, callback);
}
else {
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
}
},
WX_ClassOffEventFunction(className, functionName, id, eventName) {
const obj = getClassObject(className, id);
if (!obj) {
return;
}
if (!eventName) {
// eslint-disable-next-line no-param-reassign
eventName = '';
}
// eslint-disable-next-line no-param-reassign
functionName = functionName.replace(/Off/, 'On');
if (!ClassOnEventLists[className + functionName][id + eventName]) {
return;
}
ClassOnEventLists[className + functionName][id + eventName].forEach((v) => {
if (className === 'WXVideoDecoder' || className === 'WXPageManager') {
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](eventName, v);
}
else {
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](v);
}
});
delete ClassOnEventLists[className + functionName][id + eventName];
},
WX_ClassOneWayNoFunction_v(className, functionName, id) {
WX_ClassOneWayNoFunction(className, functionName, id);
},
WX_ClassOneWayNoFunction_vs(className, functionName, id, param1) {
if (needParseJson.includes(className + functionName)) {
// eslint-disable-next-line no-param-reassign
param1 = JSON.parse(param1);
}
WX_ClassOneWayNoFunction(className, functionName, id, param1);
},
WX_ClassOneWayNoFunction_t(className, functionName, returnType, id) {
const obj = getClassObject(className, id);
if (!obj) {
return JSON.stringify(formatResponse(returnType));
}
const res = obj[functionName.replace(/^\w/, (a) => a.toLowerCase())]();
return JSON.stringify(formatResponse(returnType, res, id));
},
WX_ClassOneWayNoFunction_vt(className, functionName, id, param1) {
const formatParam1 = formatJsonStr(param1);
WX_ClassOneWayNoFunction(className, functionName, id, formatParam1);
},
WX_ClassOneWayNoFunction_vn(className, functionName, id, param1) {
WX_ClassOneWayNoFunction(className, functionName, id, param1);
},
WX_ClassOneWayFunction(className, functionName, id, successType, failType, completeType, conf, callbackId, usePromise = false) {
const obj = getClassObject(className, id);
if (!obj) {
return;
}
const lowerFunctionName = functionName.replace(/^\w/, (a) => a.toLowerCase());
const config = formatJsonStr(conf);
if (usePromise) {
obj[lowerFunctionName]({
...config,
}).then((res) => {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'success', successType, res);
})
.catch((res) => {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'fail', failType, res);
})
.finally((res) => {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'complete', completeType, res);
});
}
else {
obj[lowerFunctionName]({
...config,
success(res) {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'success', successType, res);
},
fail(res) {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'fail', failType, res);
},
complete(res) {
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'complete', completeType, res);
},
});
}
},
};
import moduleHelper from './module-helper';
import { formatJsonStr } from './utils';
let shareResolve;
export default {
WXShareAppMessage(conf) {
wx.shareAppMessage({
...formatJsonStr(conf),
});
},
WXOnShareAppMessage(conf, isPromise) {
wx.onShareAppMessage(() => ({
...formatJsonStr(conf),
promise: isPromise
? new Promise((resolve) => {
shareResolve = resolve;
moduleHelper.send('OnShareAppMessageCallback');
})
: null,
}));
},
WXOnShareAppMessageResolve(conf) {
if (shareResolve) {
shareResolve(formatJsonStr(conf));
}
},
};
wx.showShareMenu({
menus: ['shareAppMessage', 'shareTimeline'],
});
/* eslint-disable no-underscore-dangle */
const PreLoadKeys = [];
const storage = {
_cacheData: {},
_handleList: [],
isRunning: false,
isCallDeletedAll: false,
getData(key, defaultValue) {
let v = this._cacheData[key];
if (v === null) {
return defaultValue;
}
if (typeof v !== 'undefined') {
return v;
}
if (this.isCallDeletedAll) {
return defaultValue;
}
try {
v = wx.getStorageSync(key);
this._cacheData[key] = v !== '' ? v : null;
return v === '' ? defaultValue : v;
}
catch (e) {
// console.error(e);
return defaultValue;
}
},
setData(key, value) {
this._cacheData[key] = value;
this._handleList.push({
type: 'setData',
key,
value,
});
this._doRun();
},
deleteKey(key) {
this._cacheData[key] = null;
this._handleList.push({
type: 'deleteKey',
key,
});
this._doRun();
},
deleteAll() {
Object.keys(this._cacheData).forEach((key) => {
this._cacheData[key] = null;
});
this.isCallDeletedAll = true;
this._handleList.push({
type: 'deleteAll',
});
this._doRun();
},
_doRun() {
if (this.isRunning || this._handleList.length === 0) {
return false;
}
this.isRunning = true;
const task = this._handleList.shift();
if (!task) {
this.isRunning = false;
this._doRun();
return;
}
if (task.type === 'setData') {
wx.setStorage({
key: task.key || 'defaultKey',
data: task.value,
fail({ errMsg }) {
console.error(errMsg);
},
complete: () => {
this.isRunning = false;
this._doRun();
},
});
}
else if (task.type === 'deleteKey') {
wx.removeStorage({
key: task.key || 'defaultKey',
fail({ errMsg }) {
console.error(errMsg);
},
complete: () => {
this.isRunning = false;
this._doRun();
},
});
}
else if (task.type === 'deleteAll') {
wx.clearStorage({
fail({ errMsg }) {
console.error(errMsg);
},
complete: () => {
this.isRunning = false;
this._doRun();
},
});
}
else {
this.isRunning = false;
this._doRun();
}
},
init() {
if (Array.isArray(PreLoadKeys) && PreLoadKeys.length > 0) {
const key = PreLoadKeys.shift();
wx.getStorage({
key,
success(res) {
storage._cacheData[key] = res.data;
storage.init();
},
fail() {
storage._cacheData[key] = null;
storage.init();
},
});
}
},
};
setTimeout(() => {
storage.init();
}, 0);
export default {
WXStorageGetIntSync(key, defaultValue) {
return +(storage.getData(key, defaultValue) || '');
},
WXStorageSetIntSync(key, value) {
storage.setData(key, value);
},
WXStorageGetFloatSync(key, defaultValue) {
return +(storage.getData(key, defaultValue) || '');
},
WXStorageSetFloatSync(key, value) {
storage.setData(key, value);
},
WXStorageGetStringSync(key, defaultValue) {
return storage.getData(key, defaultValue) || '';
},
WXStorageSetStringSync(key, value) {
storage.setData(key, value);
},
WXStorageDeleteAllSync() {
storage.deleteAll();
},
WXStorageDeleteKeySync(key) {
storage.deleteKey(key);
},
WXStorageHasKeySync(key) {
return storage.getData(key, '') !== '';
},
};
/* eslint-disable no-param-reassign */
/* eslint-disable no-restricted-properties */
/* eslint-disable no-plusplus */
import canvasContext from './canvas-context';
const downloadedTextures = {};
const downloadingTextures = {};
const downloadFailedTextures = {};
let hasCheckSupportedExtensions = false;
if (typeof window !== 'undefined' && window.indexedDB) {
Object.defineProperty(window, 'indexedDB', {
get() {
return undefined;
},
set() { },
enumerable: true,
configurable: true,
});
}
const PotList = [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096];
const UseDXT5 = '$UseDXT5$';
const pngPath = GameGlobal.unityNamespace.unityColorSpace && GameGlobal.unityNamespace.unityColorSpace === 'Linear' ? 'lpng' : 'png';
let isStopDownloadTexture = false;
const cachedDownloadTask = [];
wx.stopDownloadTexture = function () {
isStopDownloadTexture = true;
};
wx.starDownloadTexture = function () {
isStopDownloadTexture = false;
while (cachedDownloadTask.length > 0) {
const task = cachedDownloadTask.shift();
if (task) {
mod.WXDownloadTexture(task.path, task.width, task.height, task.callback, task.limitType);
}
}
};
const mod = {
getSupportedExtensions() {
if (hasCheckSupportedExtensions) {
return GameGlobal.TextureCompressedFormat;
}
const isSupportEmscriptenGLX = wx.env.isSuppportEmscriptenGLX || wx.env.isSupportEmscriptenGLX;
const isWebGL2 = GameGlobal.managerConfig.contextConfig.contextType === 2;
let finalContextType = isWebGL2 ? 'webgl2' : 'webgl';
if (isSupportEmscriptenGLX) {
finalContextType = isWebGL2 ? 'wxwebgl2' : 'wxwebgl';
}
const list = canvas
.getContext(finalContextType)
.getSupportedExtensions();
const noneLimitSupportedTextures = ['']; // 兜底采用png
GameGlobal.TextureCompressedFormat = '';
if (list.indexOf('WEBGL_compressed_texture_s3tc') !== -1 && UseDXT5) {
GameGlobal.TextureCompressedFormat = 'dds';
}
if (list.indexOf('WEBGL_compressed_texture_pvrtc') !== -1) {
GameGlobal.TexturePVRTCSupported = true;
GameGlobal.TextureCompressedFormat = 'pvr';
}
if (list.indexOf('WEBGL_compressed_texture_etc') !== -1) {
GameGlobal.TextureEtc2Supported = true;
noneLimitSupportedTextures.push('etc2');
GameGlobal.TextureCompressedFormat = 'etc2';
}
if (list.indexOf('WEBGL_compressed_texture_astc') !== -1) {
noneLimitSupportedTextures.push('astc');
GameGlobal.TextureCompressedFormat = 'astc';
}
hasCheckSupportedExtensions = true;
GameGlobal.NoneLimitSupportedTexture = noneLimitSupportedTextures.pop();
return GameGlobal.TextureCompressedFormat;
},
getRemoteImageFile(path, width, height, limitType) {
let textureFormat = GameGlobal.TextureCompressedFormat;
if (textureFormat && limitType) {
textureFormat = GameGlobal.NoneLimitSupportedTexture;
}
if (!textureFormat
|| (textureFormat === 'pvr' && (width !== height || PotList.indexOf(width) === -1))
|| (textureFormat === 'dds' && (width % 4 !== 0 || height % 4 !== 0))) {
mod.downloadFile(path, width, height);
}
else {
mod.requestFile(path, width, height, textureFormat, limitType);
}
},
reTryRemoteImageFile(path, width, height, limitType = false) {
const cid = path;
if (!downloadFailedTextures[cid]) {
downloadFailedTextures[cid] = {
count: 0,
path,
width,
height,
limitType,
};
}
if (downloadFailedTextures[cid].count > 4) {
return;
}
setTimeout(() => {
mod.getRemoteImageFile(path, width, height, limitType);
}, Math.pow(2, downloadFailedTextures[cid].count) * 250);
downloadFailedTextures[cid].count++;
},
requestFile(path, width, height, format, limitType) {
const cid = path;
const url = `${GameGlobal.manager.assetPath.replace(/\/$/, '')}/Textures/${format}/${width}/${path}.txt`;
const xmlhttp = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
xmlhttp.responseType = 'arraybuffer';
xmlhttp.open('GET', url, true);
xmlhttp.onload = function () {
const res = xmlhttp;
if (res.status === 200) {
downloadedTextures[cid] = {
data: res.response,
tmpFile: '',
};
downloadingTextures[cid].forEach(v => v());
delete downloadingTextures[cid];
delete downloadFailedTextures[cid];
delete downloadedTextures[cid].data;
}
else {
// err("压缩纹理下载失败!url:"+url);
mod.reTryRemoteImageFile(path, width, height, limitType);
}
};
xmlhttp.onerror = function () {
// err("压缩纹理下载失败!url:"+url);
mod.reTryRemoteImageFile(path, width, height, limitType);
};
xmlhttp.setRequestHeader('wechatminigame-skipclean', '1');
xmlhttp.send(null);
},
callbackPngFile(path, cid) {
const image = wx.createImage();
image.crossOrigin = '';
image.src = path;
image.onload = function () {
downloadedTextures[cid] = {
data: image,
tmpFile: '',
};
downloadingTextures[cid].forEach(v => v());
delete downloadingTextures[cid];
delete downloadFailedTextures[cid];
delete downloadedTextures[cid];
};
},
downloadFile(path, width, height) {
const url = `${GameGlobal.manager.assetPath.replace(/\/$/, '')}/Textures/${pngPath}/${width}/${path}.png`;
const cid = path;
const cache = GameGlobal.manager.getCachePath(url);
if (cache) {
mod.callbackPngFile(cache, cid);
}
else {
if (GameGlobal.unityNamespace.needCacheTextures) {
const xmlhttp = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
xmlhttp.responseType = 'arraybuffer';
xmlhttp.open('GET', url, true);
xmlhttp.onsave = function (path) {
mod.callbackPngFile(path, cid);
};
xmlhttp.onerror = function () {
mod.reTryRemoteImageFile(path, width, height);
};
xmlhttp.setRequestHeader('wechatminigame-skipclean', '1');
xmlhttp.send(null);
}
else {
const image = wx.createImage();
image.crossOrigin = '';
image.src = url;
image.onload = function () {
downloadedTextures[cid] = {
data: image,
tmpFile: '',
};
downloadingTextures[cid].forEach(v => v());
delete downloadingTextures[cid];
delete downloadFailedTextures[cid];
delete downloadedTextures[cid];
};
image.onerror = function () {
mod.reTryRemoteImageFile(path, width, height);
};
}
}
},
WXDownloadTexture(path, width, height, callback, limitType = false) {
const width4m = width % 4;
if (width4m !== 0) {
width += 4 - width4m;
}
if (!hasCheckSupportedExtensions) {
mod.getSupportedExtensions();
}
const cid = path;
if (!cid) { // 可能由于瘦身资源发起的下载此处将直接忽略
return;
}
/*
if(downloadedTextures[cid]){
if(downloadedTextures[cid].data){
callback();
}else{
mod.readFile(id,type,callback,width,height);
}
}else */
if (isStopDownloadTexture) {
cachedDownloadTask.push({
path,
width,
height,
callback,
limitType,
});
return;
}
if (downloadingTextures[cid]) {
downloadingTextures[cid].push(callback);
}
else {
downloadingTextures[cid] = [callback];
mod.getRemoteImageFile(path, width, height, limitType);
}
},
};
GameGlobal.DownloadedTextures = downloadedTextures;
GameGlobal.TextureCompressedFormat = ''; // 支持的压缩格式
GameGlobal.ParalleLDownloadTexture = function (filename) {
filename = filename.replace(GameGlobal.managerConfig.DATA_CDN, '').replace(/^\//, '');
filename = `/${filename}`;
if (GameGlobal.TEXTURE_BUNDLES[filename]) {
GameGlobal.TEXTURE_BUNDLES[filename].forEach((v) => {
const f = GameGlobal.TextureCompressedFormat;
if (!f) {
const p = `${GameGlobal.manager.assetPath}/Textures/png/${v.w}/${v.p}.png`;
const image = wx.createImage();
image.crossOrigin = '';
image.src = p;
}
else if (f !== 'pvr') {
const http = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
const p = `${GameGlobal.manager.assetPath}/Textures/${f}/${v.w}/${v.p}.txt`;
http.open('GET', p, true);
http.responseType = 'arraybuffer';
http.setRequestHeader('wechatminigame-skipclean', '1');
http.send();
}
});
}
};
export default {
WXDownloadTexture: mod.WXDownloadTexture,
};
canvasContext.addCreatedListener(() => {
if (GameGlobal.USED_TEXTURE_COMPRESSION) {
mod.getSupportedExtensions();
if (GameGlobal.TextureCompressedFormat === '' || GameGlobal.TextureCompressedFormat === 'pvr') {
const { platform } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
if (platform === 'ios') {
wx.showModal({
title: '提示',
content: '当前操作系统版本过低,建议您升级至最新版本。',
});
}
}
}
wx.onNetworkStatusChange((res) => {
if (res.isConnected) {
Object.keys(downloadFailedTextures).forEach((key) => {
const v = downloadFailedTextures[key];
if (v.count > 4) {
mod.getRemoteImageFile(v.path, v.width, v.height, v.limitType);
}
});
}
});
});
/* eslint-disable @typescript-eslint/naming-convention */
import { formatTouchEvent, convertOnTouchStartListenerResultToPointer } from '../utils';
let wxOnTouchCancelCallback;
let wxOnTouchEndCallback;
let wxOnTouchMoveCallback;
let wxOnTouchStartCallback;
function handleTouchEvent(res, callback) {
const dataPtr = convertOnTouchStartListenerResultToPointer({
touches: res.touches.map(v => formatTouchEvent(v, res.type)),
changedTouches: res.changedTouches.map(v => formatTouchEvent(v, res.type, 1)),
timeStamp: parseInt(res.timeStamp.toString(), 10),
});
GameGlobal.Module.dynCall_viii(callback, dataPtr, res.touches.length, res.changedTouches.length);
GameGlobal.Module._free(dataPtr);
}
const OnTouchCancel = (res) => {
handleTouchEvent(res, wxOnTouchCancelCallback);
};
const OnTouchEnd = (res) => {
handleTouchEvent(res, wxOnTouchEndCallback);
};
const OnTouchMove = (res) => {
handleTouchEvent(res, wxOnTouchMoveCallback);
};
const OnTouchStart = (res) => {
handleTouchEvent(res, wxOnTouchStartCallback);
};
function WX_OnTouchCancel() {
wx.onTouchCancel(OnTouchCancel);
}
function WX_OffTouchCancel() {
wx.offTouchCancel(OnTouchCancel);
}
function WX_OnTouchEnd() {
wx.onTouchEnd(OnTouchEnd);
}
function WX_OffTouchEnd() {
wx.offTouchEnd(OnTouchEnd);
}
function WX_OnTouchMove() {
wx.onTouchMove(OnTouchMove);
}
function WX_OffTouchMove() {
wx.offTouchMove(OnTouchMove);
}
function WX_OnTouchStart() {
wx.onTouchStart(OnTouchStart);
}
function WX_OffTouchStart() {
wx.offTouchStart(OnTouchStart);
}
function WX_RegisterOnTouchCancelCallback(callback) {
wxOnTouchCancelCallback = callback;
}
function WX_RegisterOnTouchEndCallback(callback) {
wxOnTouchEndCallback = callback;
}
function WX_RegisterOnTouchMoveCallback(callback) {
wxOnTouchMoveCallback = callback;
}
function WX_RegisterOnTouchStartCallback(callback) {
wxOnTouchStartCallback = callback;
}
export default {
WX_OnTouchCancel,
WX_OffTouchCancel,
WX_OnTouchEnd,
WX_OffTouchEnd,
WX_OnTouchMove,
WX_OffTouchMove,
WX_OnTouchStart,
WX_OffTouchStart,
WX_RegisterOnTouchCancelCallback,
WX_RegisterOnTouchEndCallback,
WX_RegisterOnTouchMoveCallback,
WX_RegisterOnTouchStartCallback,
};
import moduleHelper from './module-helper';
import { formatJsonStr, getListObject, offEventCallback, onEventCallback } from './utils';
const uploadTaskList = {};
const wxUpdateTaskOnProgressList = {};
const wxUpdateTaskOnHeadersList = {};
const getObject = getListObject(uploadTaskList, 'uploadTask');
export default {
WX_UploadFile(option, callbackId) {
const conf = formatJsonStr(option);
const obj = wx.uploadFile({
...conf,
success: (res) => {
moduleHelper.send('UploadFileCallback', JSON.stringify({
callbackId,
type: 'success',
res: JSON.stringify(res),
}));
},
fail: (res) => {
moduleHelper.send('UploadFileCallback', JSON.stringify({
callbackId,
type: 'fail',
res: JSON.stringify(res),
}));
},
complete: (res) => {
moduleHelper.send('UploadFileCallback', JSON.stringify({
callbackId,
type: 'complete',
res: JSON.stringify(res),
}));
setTimeout(() => {
if (uploadTaskList) {
delete uploadTaskList[callbackId];
}
}, 0);
},
});
uploadTaskList[callbackId] = obj;
},
WXUploadTaskAbort(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.abort();
},
WXUploadTaskOffHeadersReceived(id) {
const obj = getObject(id);
if (!obj) {
return;
}
offEventCallback(wxUpdateTaskOnHeadersList, (v) => {
obj.offHeadersReceived(v);
}, id);
},
WXUploadTaskOffProgressUpdate(id) {
const obj = getObject(id);
if (!obj) {
return;
}
offEventCallback(wxUpdateTaskOnProgressList, (v) => {
obj.offProgressUpdate(v);
}, id);
},
WXUploadTaskOnHeadersReceived(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxUpdateTaskOnHeadersList, '_OnHeadersReceivedCallback', id);
obj.onHeadersReceived(callback);
},
WXUploadTaskOnProgressUpdate(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = onEventCallback(wxUpdateTaskOnProgressList, '_OnProgressUpdateCallback', id);
obj.onProgressUpdate(callback);
},
};
import moduleHelper from './module-helper';
import { getListObject, uid } from './utils';
const userInfoButtonList = {};
const getObject = getListObject(userInfoButtonList, 'userInfoButton');
export default {
WXCreateUserInfoButton(x, y, width, height, lang, withCredentials) {
const id = uid();
const button = wx.createUserInfoButton({
type: 'text',
text: '',
withCredentials,
lang,
style: {
left: x / window.devicePixelRatio,
top: y / window.devicePixelRatio,
width: width / window.devicePixelRatio,
height: height / window.devicePixelRatio,
backgroundColor: 'rgba(0, 0, 0, 0)',
color: 'rgba(0, 0, 0, 0)',
textAlign: 'center',
fontSize: 0,
borderRadius: 0,
borderColor: '#FFFFFF',
borderWidth: 0,
lineHeight: height / window.devicePixelRatio,
},
});
userInfoButtonList[id] = button;
return id;
},
WXUserInfoButtonShow(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.show();
},
WXUserInfoButtonDestroy(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.destroy();
if (userInfoButtonList) {
delete userInfoButtonList[id];
}
},
WXUserInfoButtonHide(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.hide();
},
WXUserInfoButtonOffTap(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.offTap();
},
WXUserInfoButtonOnTap(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.onTap((res) => {
res.userInfo = res.userInfo || {};
moduleHelper.send('UserInfoButtonOnTapCallback', JSON.stringify({
callbackId: id,
errCode: res.err_code || (res.errMsg.indexOf('getUserInfo:fail') === 0 ? 1 : 0),
errMsg: res.errMsg || '',
signature: res.signature || '',
encryptedData: res.encryptedData || '',
iv: res.iv || '',
cloudID: res.cloudID || '',
userInfoRaw: JSON.stringify({
nickName: res.userInfo.nickName || '',
avatarUrl: res.userInfo.avatarUrl || '',
country: res.userInfo.country || '',
province: res.userInfo.province || '',
city: res.userInfo.city || '',
language: res.userInfo.language || '',
gender: res.userInfo.gender || 0,
}),
}));
});
},
};
import moduleHelper from './module-helper';
import { launchEventType } from '../plugin-config';
import { setArrayBuffer, uid } from './utils';
import '../events';
export default {
WXReportGameStart() {
GameGlobal.manager.reportCustomLaunchInfo();
},
WXReportGameSceneError(sceneId, errorType, errStr, extInfo) {
if (GameGlobal.manager && GameGlobal.manager.reportGameSceneError) {
GameGlobal.manager.reportGameSceneError(sceneId, errorType, errStr, extInfo);
}
},
WXWriteLog(str) {
if (GameGlobal.manager && GameGlobal.manager.writeLog) {
GameGlobal.manager.writeLog(str);
}
},
WXWriteWarn(str) {
if (GameGlobal.manager && GameGlobal.manager.writeWarn) {
GameGlobal.manager.writeWarn(str);
}
},
WXHideLoadingPage() {
if (GameGlobal.manager && GameGlobal.manager.hideLoadingPage) {
GameGlobal.manager.hideLoadingPage();
}
},
WXReportUserBehaviorBranchAnalytics(branchId, branchDim, eventType) {
wx.reportUserBehaviorBranchAnalytics({ branchId, branchDim, eventType });
},
WXPreloadConcurrent(count) {
if (GameGlobal.manager && GameGlobal.manager.setConcurrent) {
GameGlobal.manager.setConcurrent(count);
}
},
WXIsCloudTest() {
if (typeof GameGlobal.isTest !== 'undefined' && GameGlobal.isTest) {
return true;
}
return false;
},
WXUncaughtException(needAbort) {
function currentStackTrace() {
const err = new Error('WXUncaughtException');
return err;
}
const err = currentStackTrace();
let fullTrace = err.stack?.toString();
if (fullTrace) {
const posOfThisFunc = fullTrace.indexOf('WXUncaughtException');
if (posOfThisFunc !== -1) {
fullTrace = fullTrace.substr(posOfThisFunc);
}
const posOfRaf = fullTrace.lastIndexOf('browserIterationFunc');
if (posOfRaf !== -1) {
fullTrace = fullTrace.substr(0, posOfRaf);
}
}
const realTimelog = wx.getRealtimeLogManager();
realTimelog.error(fullTrace);
const logmanager = wx.getLogManager({ level: 0 });
logmanager.warn(fullTrace);
if (needAbort === true) {
GameGlobal.onCrash(err);
throw err;
}
else {
setTimeout(() => {
throw err;
}, 0);
}
},
WXCleanAllFileCache() {
if (GameGlobal.manager && GameGlobal.manager.cleanCache) {
const key = uid();
GameGlobal.manager.cleanAllCache().then((res) => {
moduleHelper.send('CleanAllFileCacheCallback', JSON.stringify({
callbackId: key,
result: res,
}));
});
return key;
}
return '';
},
WXCleanFileCache(fileSize) {
if (GameGlobal.manager && GameGlobal.manager.cleanCache) {
const key = uid();
GameGlobal.manager.cleanCache(fileSize).then((res) => {
moduleHelper.send('CleanFileCacheCallback', JSON.stringify({
callbackId: key,
result: res,
}));
});
return key;
}
return '';
},
WXRemoveFile(path) {
if (GameGlobal.manager && GameGlobal.manager.removeFile && path) {
const key = uid();
GameGlobal.manager.removeFile(path).then((res) => {
moduleHelper.send('RemoveFileCallback', JSON.stringify({
callbackId: key,
result: res,
}));
});
return key;
}
return '';
},
WXGetCachePath(url) {
if (GameGlobal.manager && GameGlobal.manager.getCachePath) {
return GameGlobal.manager.getCachePath(url);
}
},
WXGetPluginCachePath() {
if (GameGlobal.manager && GameGlobal.manager.PLUGIN_CACHE_PATH) {
return GameGlobal.manager.PLUGIN_CACHE_PATH;
}
},
WXOnLaunchProgress() {
if (GameGlobal.manager && GameGlobal.manager.onLaunchProgress) {
const key = uid();
// 异步执行,保证C#已经记录这个回调ID
setTimeout(() => {
GameGlobal.manager.onLaunchProgress((e) => {
moduleHelper.send('OnLaunchProgressCallback', JSON.stringify({
callbackId: key,
res: JSON.stringify(Object.assign({}, e.data, {
type: e.type,
})),
}));
if (e.type === launchEventType.prepareGame) {
moduleHelper.send('RemoveLaunchProgressCallback', JSON.stringify({
callbackId: key,
}));
}
});
}, 0);
return key;
}
return '';
},
WXSetDataCDN(path) {
if (GameGlobal.manager && GameGlobal.manager.setDataCDN) {
GameGlobal.manager.setDataCDN(path);
}
},
WXSetPreloadList(paths) {
if (GameGlobal.manager && GameGlobal.manager.setPreloadList) {
const list = (paths || '').split(',').filter(str => !!str && !!str.trim());
GameGlobal.manager.setPreloadList(list);
}
},
WXSetArrayBuffer(buffer, offset, callbackId) {
setArrayBuffer(buffer, offset, callbackId);
},
WXLaunchOperaBridge(args) {
const res = GameGlobal.events.emit('launchOperaMsgBridgeFromWasm', args);
if (Array.isArray(res) && res.length > 0) {
return res[0];
}
return null;
},
WXLaunchOperaBridgeToC(callback, args) {
moduleHelper.send('WXLaunchOperaBridgeToC', JSON.stringify({
callback,
args,
}));
},
WX_SetPreferredFramesPerSecond(fps) {
wx.setPreferredFramesPerSecond(fps);
},
};
/* eslint-disable no-param-reassign */
import moduleHelper from './module-helper';
import { ResType } from './resType';
import { ResTypeOther } from './resTypeOther';
Object.assign(ResType, ResTypeOther);
function realUid(length = 20, char = true) {
const soup = `${char ? '' : '!#%()*+,-./:;=?@[]^_`{|}~'}ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`;
const soupLength = soup.length;
const id = [];
for (let i = 0; i < length; i++) {
id[i] = soup.charAt(Math.random() * soupLength);
}
return id.join('');
}
// 用于调试js代码
const isDebug = false;
const identifierCache = [];
const clearIdTicker = {};
const tempCacheObj = {};
const typeMap = {
array: [],
arrayBuffer: [],
string: '',
number: 0,
bool: false,
object: {},
}; // 类型默认值映射
const interfaceTypeMap = {
array: 'object',
arrayBuffer: 'object',
string: 'string',
number: 'number',
bool: 'boolean',
object: 'object',
};
export const uid = () => realUid(20, true);
export function formatIdentifier(identifier, eventType, changed) {
if (changed && clearIdTicker[identifier]) {
clearTimeout(clearIdTicker[identifier]);
delete clearIdTicker[identifier];
}
let id = identifierCache.indexOf(identifier);
if (id <= -1) {
for (let key = 0; key < identifierCache.length; key++) {
if (identifierCache[key] === null) {
identifierCache[key] = identifier;
id = key;
break;
}
}
}
if (id <= -1) {
identifierCache.push(identifier);
id = identifierCache.length - 1;
}
if (changed && (eventType === 'touchend' || eventType === 'touchcancel')) {
clearIdTicker[identifier] = setTimeout(() => {
identifierCache[id] = null;
delete clearIdTicker[identifier];
}, 50);
}
return id;
}
export function formatTouchEvent(v, type, changed) {
return {
clientX: v.clientX * window.devicePixelRatio,
clientY: (window.innerHeight - v.clientY) * window.devicePixelRatio,
force: v.force,
identifier: formatIdentifier(v.identifier, type, changed),
pageX: v.pageX * window.devicePixelRatio,
pageY: (window.innerHeight - v.pageY) * window.devicePixelRatio,
};
}
export function formatResponse(type, data, id) {
if (!data) {
data = {};
}
if (typeof data !== 'object') {
return {};
}
const conf = ResType[type];
if (!conf) {
return data;
}
Object.keys(conf).forEach((key) => {
if (data[key] === null || typeof data[key] === 'undefined') {
if (typeof typeMap[conf[key]] === 'undefined') {
if (conf[key].indexOf('[]') > -1) {
data[key] = [];
}
else {
data[key] = {};
if (ResType[conf[key]]) {
formatResponse(conf[key], data[key]);
}
}
}
else {
data[key] = typeMap[conf[key]];
}
}
else if (conf[key] === 'long') {
data[key] = parseInt(data[key], 10);
}
else if (conf[key] === 'number' && typeof data[key] === 'string') {
data[key] = Number(data[key]);
}
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];
}
else if (conf[key] === 'arrayBuffer') {
if (id) {
cacheArrayBuffer(id, data[key]);
data.arrayBufferLength = data[key].byteLength;
data[key] = [];
}
else if (data[key] instanceof ArrayBuffer) {
data[key] = new Uint8Array(data[key]);
data[key] = Array.from(data[key]);
}
else {
data[key] = [];
}
}
else if (typeof data[key] === 'object' && conf[key] === 'object') {
Object.keys(data[key]).forEach((v) => {
if (typeof data[key][v] === 'object') {
data[key][v] = JSON.stringify(data[key][v]);
}
else {
data[key][v] += '';
}
});
}
else if (typeof data[key] === 'object' && conf[key]) {
const array = conf[key].match(/(.+)\[\]/);
if (array) {
for (const itemKey of Object.keys(data[key])) {
if (array[1] === 'string') {
data[key][itemKey] = `${data[key][itemKey]}`;
}
else if (array[1] === 'number') {
data[key][itemKey] = Number(data[key][itemKey]);
}
else {
formatResponse(array[1], data[key][itemKey]);
}
}
}
else {
formatResponse(conf[key], data[key]);
}
}
});
if (conf.anyKeyWord) {
return data;
}
Object.keys(data).forEach((key) => {
if (typeof conf[key] === 'undefined') {
delete data[key];
}
else {
const getType = interfaceTypeMap[conf[key]];
if (getType && getType !== typeof data[key]) {
data[key] = typeMap[conf[key]];
}
}
});
if ((type === 'SystemInfo' || type === 'WindowInfo') && data.pixelRatio) {
data.pixelRatio = window.devicePixelRatio;
}
return data;
}
export function formatJsonStr(str, type) {
if (!str) {
return {};
}
if (type === 'string|arrayBuffer') {
return convertBase64ToData(str);
}
try {
const data = JSON.parse(str);
Object.keys(data).forEach((v) => {
if (data[v] === null) {
delete data[v];
}
});
if (type) {
const conf = ResType[type];
if (!conf) {
return data;
}
Object.keys(conf).forEach((key) => {
if (data[key]) {
if (conf[key] === 'arrayBuffer') {
data[key] = new Uint8Array(data[key]).buffer;
}
else if (conf[key] === 'string|arrayBuffer') {
data[key] = convertBase64ToData(data[key]);
}
}
});
}
return data;
}
catch (e) {
return str;
}
}
function isBase64(str) {
const base64Pattern = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
return base64Pattern.test(str);
}
function base64ToArrayBuffer(base64) {
const binaryString = atob(base64);
const len = binaryString.length;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = binaryString.charCodeAt(i);
}
return bytes.buffer;
}
function convertBase64ToData(input) {
if (isBase64(input)) {
return base64ToArrayBuffer(input);
}
return input;
}
export function cacheArrayBuffer(callbackId, data) {
if (!callbackId || !data) {
return;
}
tempCacheObj[callbackId] = data;
}
export function setArrayBuffer(buffer, offset, callbackId) {
buffer.set(new Uint8Array(tempCacheObj[callbackId]), offset);
delete tempCacheObj[callbackId];
}
export function getListObject(list, name) {
return (id) => {
if (!list) {
list = {};
}
const obj = list[id];
if (!obj) {
console.error(`${name} 不存在:`, id);
}
return obj;
};
}
export function onEventCallback(list, eventName, id, callbackId) {
if (!list[id]) {
list[id] = [];
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: callbackId || id,
res: JSON.stringify(res),
});
moduleHelper.send(eventName, resStr);
};
list[id].push(callback);
return callback;
}
export function offEventCallback(list, callback, id) {
if (!list || !list[id]) {
return;
}
list[id].forEach(callback);
delete list[id];
}
function allocateAndSet(byteArray) {
const ptr = GameGlobal.Module._malloc(byteArray.length);
GameGlobal.Module.HEAPU8.set(byteArray, ptr);
return ptr;
}
function convertNumberToPointer(num, ArrayType = Float64Array) {
const byteArray = numberToUint8Array(num, ArrayType);
return allocateAndSet(byteArray);
}
function convertArrayBufferToPointer(arrayBuffer) {
const byteArray = new Uint8Array(arrayBuffer);
return allocateAndSet(byteArray);
}
function convertStringToPointer(str) {
const byteArray = GameGlobal.Module.lengthBytesUTF8(str) + 1;
const ptr = GameGlobal.Module._malloc(byteArray);
GameGlobal.Module.stringToUTF8(str, ptr, byteArray);
return ptr;
}
export function convertDataToPointer(data) {
if (typeof data === 'number') {
return convertNumberToPointer(data);
}
if (typeof data === 'string') {
return convertStringToPointer(data);
}
if (data instanceof ArrayBuffer || typeof data === 'object') {
return convertArrayBufferToPointer(data);
}
return 0;
}
function numberToUint8Array(num, ArrayType = Float64Array) {
return new Uint8Array(new ArrayType([num]).buffer);
}
function stringToUint8ArrayWithLength(str) {
const strPtr = convertStringToPointer(str);
const strBytesLength = GameGlobal.Module.lengthBytesUTF8(str);
const strBytes = new Uint8Array(GameGlobal.Module.HEAPU8.buffer, strPtr, strBytesLength);
const lengthBytes = new Uint8Array(4);
new DataView(lengthBytes.buffer).setUint32(0, strBytes.length, true);
const result = new Uint8Array(4 + strBytes.length);
result.set(lengthBytes);
result.set(strBytes, 4);
GameGlobal.Module._free(strPtr);
return result;
}
function createUint8ArrayFromByteArrays(byteArrays) {
const totalLength = byteArrays.reduce((sum, byteArray) => sum + byteArray.length, 0);
const result = new Uint8Array(totalLength);
let offset = 0;
byteArrays.forEach((byteArray) => {
result.set(byteArray, offset);
offset += byteArray.length;
});
return result;
}
function touchToUint8Array(touch) {
return createUint8ArrayFromByteArrays([
numberToUint8Array(touch.clientX, Float32Array),
numberToUint8Array(touch.clientY, Float32Array),
numberToUint8Array(touch.force),
numberToUint8Array(touch.identifier, Uint32Array),
numberToUint8Array(touch.pageX, Float32Array),
numberToUint8Array(touch.pageY, Float32Array),
]);
}
function touchesToUint8Array(touches) {
return createUint8ArrayFromByteArrays(touches.map(touchToUint8Array));
}
function onTouchStartListenerResultToUint8Array(result) {
return createUint8ArrayFromByteArrays([
touchesToUint8Array(result.touches),
touchesToUint8Array(result.changedTouches),
numberToUint8Array(result.timeStamp, Uint32Array),
]);
}
export function convertOnTouchStartListenerResultToPointer(result) {
return allocateAndSet(onTouchStartListenerResultToUint8Array(result));
}
function infoToUint8Array(info) {
return createUint8ArrayFromByteArrays([
stringToUint8ArrayWithLength(info.address),
stringToUint8ArrayWithLength(info.family),
numberToUint8Array(info.port, Uint32Array)
]);
}
export function convertInfoToPointer(info) {
return allocateAndSet(infoToUint8Array(info));
}
export function stringifyRes(obj) {
if (!obj) {
return '{}';
}
return JSON.stringify(obj);
}
export function getDefaultData(canvas, conf) {
const config = formatJsonStr(conf);
if (typeof config.x === 'undefined') {
config.x = 0;
}
if (typeof config.y === 'undefined') {
config.y = 0;
}
if (typeof config.width === 'undefined' || config.width === 0) {
config.width = canvas.width;
}
if (typeof config.height === 'undefined' || config.height === 0) {
config.height = canvas.height;
}
if (typeof config.destWidth === 'undefined' || config.destWidth === 0) {
config.destWidth = canvas.width;
}
if (typeof config.destHeight === 'undefined' || config.destHeight === 0) {
config.destHeight = canvas.height;
}
return config;
}
export function debugLog(...args) {
if (isDebug) {
console.log('[debug]', ...args);
}
}
import moduleHelper from './module-helper';
import { formatJsonStr, getListObject, uid } from './utils';
const videoList = {};
const getObject = getListObject(videoList, 'video');
export default {
WXCreateVideo(conf) {
const id = uid();
const params = formatJsonStr(conf);
if (params.underGameView) {
GameGlobal.enableTransparentCanvas = true;
}
videoList[id] = wx.createVideo(params);
return id;
},
WXVideoSetProperty(id, key, value) {
const obj = getObject(id);
if (!obj) {
return;
}
if (key === 'x' || key === 'y' || key === 'width' || key === 'height' || key === 'initialTime' || key === 'playbackRate') {
obj[key] = +value;
}
else if (key === 'src' || key === 'poster' || key === 'objectFit' || key === 'backgroundColor') {
obj[key] = value;
}
else if (key === 'live' || key === 'controls' || key === 'showProgress' || key === 'showProgressInControlMode'
|| key === 'autoplay' || key === 'loop' || key === 'muted' || key === 'obeyMuteSwitch'
|| key === 'enableProgressGesture' || key === 'enablePlayGesture' || key === 'showCenterPlayBtn') {
obj[key] = value === 'True';
}
},
WXVideoAddListener(id, key) {
getObject(id)?.[key]((e) => {
moduleHelper.send('OnVideoCallback', JSON.stringify({
callbackId: id,
type: key,
position: e?.position,
buffered: e?.buffered ? Number(e.buffered) : undefined,
duration: e?.duration,
errMsg: e?.errMsg,
}));
if (key === 'onError') {
GameGlobal.enableTransparentCanvas = false;
console.error(e);
}
});
},
WXVideoRemoveListener(id, key) {
getObject(id)?.[key]();
},
WXVideoDestroy(id, isLast) {
getObject(id)?.destroy();
if (isLast) {
GameGlobal.enableTransparentCanvas = false;
}
},
WXVideoPlay(id) {
getObject(id)?.play();
},
WXVideoPause(id) {
getObject(id)?.pause();
},
WXVideoStop(id) {
getObject(id)?.stop();
},
WXVideoSeek(id, time) {
getObject(id)?.seek(time);
},
WXVideoRequestFullScreen(id, direction) {
getObject(id)?.requestFullScreen(direction);
},
WXVideoExitFullScreen(id) {
getObject(id)?.exitFullScreen();
},
};
/* eslint-disable @typescript-eslint/prefer-for-of */
/* eslint-disable @typescript-eslint/naming-convention */
import { isH5Renderer, isSupportVideoPlayer, isPc, isDevtools } from '../../check-version';
import { debugLog } from '../utils';
let FrameworkData = null;
const isWebVideo = (isH5Renderer && !GameGlobal.isIOSHighPerformanceModePlus) || isPc || isDevtools;
const needCache = true;
const cacheVideoDecoder = [];
let supportVideoFrame = !!GameGlobal.isIOSHighPerformanceModePlus;
const videoInstances = {};
class VideoBufferManager {
videoBuffers = new Map();
getTempBuffer(videoId, byteLength) {
const Module = GameGlobal.manager.gameInstance.Module;
if (this.videoBuffers.has(videoId)) {
const bufferInfo = this.videoBuffers.get(videoId);
if (bufferInfo.byteLength >= byteLength) {
return bufferInfo.ptr;
}
if (bufferInfo.ptr !== null) {
Module._free(bufferInfo.ptr);
}
}
const newPtr = Module._malloc(byteLength);
if (newPtr === null) {
return null;
}
this.videoBuffers.set(videoId, { byteLength, ptr: newPtr });
return newPtr;
}
destroyTempBuffer(videoId) {
if (this.videoBuffers.has(videoId)) {
const Module = GameGlobal.manager.gameInstance.Module;
const bufferInfo = this.videoBuffers.get(videoId);
if (bufferInfo.ptr !== null) {
Module._free(bufferInfo.ptr);
}
this.videoBuffers.delete(videoId);
}
}
}
;
let videoBufferManager;
function _JS_Video_CanPlayFormat(format, data) {
FrameworkData = data;
return !!isSupportVideoPlayer;
}
let videoInstanceIdCounter = 0;
function dynCall_vi(...args) {
if (FrameworkData) {
FrameworkData.dynCall_vi(...args);
}
}
function dynCall_vii(...args) {
if (FrameworkData) {
FrameworkData.dynCall_vii(...args);
}
}
function jsVideoEnded() {
debugLog('jsVideoEnded');
// @ts-ignore
if (this.onendedCallback) {
// @ts-ignore
dynCall_vi(this.onendedCallback, this.onendedRef);
}
}
function _JS_Video_Create(url) {
let source = '';
if (FrameworkData) {
source = FrameworkData.UTF8ToString(url);
}
debugLog('_JS_Video_Create', source);
if (GameGlobal.mtl) {
supportVideoFrame = false;
if (!videoBufferManager) {
videoBufferManager = new VideoBufferManager();
}
}
if (isWebVideo) {
// @ts-ignore
const video = GameGlobal.manager.createWKVideo(source, FrameworkData.GLctx);
// eslint-disable-next-line no-plusplus
videoInstances[++videoInstanceIdCounter] = video;
}
else {
let videoDecoder;
if (cacheVideoDecoder.length > 0) {
videoDecoder = cacheVideoDecoder.pop();
}
else {
// @ts-ignore 8.0.38客户端+3.0.0基础库,才能正常使用type参数
videoDecoder = wx.createVideoDecoder({
type: 'wemedia',
});
}
// eslint-disable-next-line no-plusplus
const videoInstance = {
videoDecoder,
videoWidth: 0,
videoHeight: 0,
isReady: false,
stoped: true,
paused: false,
ended: false,
seeking: false,
duration: 1,
};
// eslint-disable-next-line no-plusplus
videoInstances[++videoInstanceIdCounter] = videoInstance;
videoDecoder.remove();
videoDecoder.on('start', (res) => {
debugLog('wxVideoDecoder start:', res);
if (!videoInstance.isReady) {
if (res.video && res.video.duration) {
videoInstance.duration = res.video.duration / 1000;
}
videoInstance.videoWidth = res.width ?? 0;
videoInstance.videoHeight = res.height ?? 0;
videoInstance.isReady = true;
videoDecoder.stop();
}
else {
videoInstance.paused = false;
videoInstance.stoped = false;
}
});
videoDecoder.on('stop', (res) => {
debugLog('wxVideoDecoder stop:', res);
videoInstance.stoped = true;
});
videoDecoder.on('bufferchange', (res) => {
debugLog('wxVideoDecoder bufferchange:', res);
});
videoDecoder.on('ended', (res) => {
debugLog('wxVideoDecoder ended:', res);
if (videoInstance.loop) {
videoInstance.seek(0);
}
else {
videoInstance.ended = true;
videoInstance.onended?.();
}
});
// @ts-ignore
videoDecoder.on('frame', (res) => {
// @ts-ignore
videoInstance.currentTime = res.pts / 1000;
if (supportVideoFrame || GameGlobal.mtl) {
videoInstance.frameData?.close?.();
}
videoInstance.frameData = res;
});
const startOption = {
source,
};
if (supportVideoFrame) {
startOption.videoDataType = 2;
}
videoInstance.play = () => {
if (videoInstance.seeking) {
videoInstance.seeking = false;
}
if (videoInstance.paused) {
videoInstance.paused = false;
videoDecoder.wait(false);
}
else {
videoDecoder.start(startOption);
}
};
videoInstance.pause = () => {
videoDecoder.wait(true);
videoInstance.paused = true;
};
videoInstance.seek = (time) => {
// @ts-ignore
videoDecoder.avSync.seek({ stamp: time });
videoInstance.seeking = true;
videoDecoder.emitter.emit('seek', {});
};
videoInstance.destroy = () => {
if (needCache) {
videoDecoder.stop();
cacheVideoDecoder.push(videoDecoder);
}
else {
videoDecoder.remove();
}
if (videoInstance.loopEndPollInterval) {
clearInterval(videoInstance.loopEndPollInterval);
}
delete videoInstance.videoDecoder;
delete videoInstance.onendedCallback;
delete videoInstance.frameData;
videoInstance.stoped = true;
videoInstance.paused = false;
videoInstance.ended = false;
videoInstance.seeking = false;
videoInstance.currentTime = 0;
videoInstance.onended = null;
};
videoInstance.play();
}
return videoInstanceIdCounter;
}
function _JS_Video_Destroy(video) {
debugLog('_JS_Video_Destroy', video);
videoInstances[video].destroy();
const Module = GameGlobal.manager.gameInstance.Module;
const { GL } = Module;
if (GameGlobal.mtl) {
if (!isWebVideo) {
videoBufferManager?.destroyTempBuffer(video);
}
}
else {
const gl = GL.currentContext.GLctx;
if (!isWebVideo && gl.emscriptenGLX && Module._glxVideoDestroy) {
Module._glxVideoDestroy(video);
}
}
delete videoInstances[video];
}
function _JS_Video_Duration(video) {
return videoInstances[video].duration;
}
function _JS_Video_EnableAudioTrack(video, trackIndex, enabled) {
const v = videoInstances[video];
if (!v.enabledTracks) {
v.enabledTracks = [];
}
while (v.enabledTracks.length <= trackIndex) {
v.enabledTracks.push(true);
}
v.enabledTracks[trackIndex] = enabled;
const tracks = v.audioTracks;
if (!tracks) {
return;
}
const track = tracks[trackIndex];
if (track) {
track.enabled = !!enabled;
}
}
function _JS_Video_GetAudioLanguageCode(video, trackIndex) {
const tracks = videoInstances[video].audioTracks;
if (!tracks) {
return '';
}
const track = tracks[trackIndex];
return track ? track.language : '';
}
function _JS_Video_GetNumAudioTracks(video) {
const tracks = videoInstances[video].audioTracks;
// console.log('_JS_Video_GetNumAudioTracks', tracks);
return tracks ? tracks.length : 1;
}
function _JS_Video_Height(video) {
return videoInstances[video].videoHeight;
}
function _JS_Video_IsPlaying(video) {
if (isWebVideo) {
const v = videoInstances[video];
return v.isPlaying;
}
const v = videoInstances[video];
return v.isReady && !v.stoped && !v.paused && !v.ended;
}
function _JS_Video_IsReady(video) {
const v = videoInstances[video];
return !!v.isReady;
}
function _JS_Video_IsSeeking(video) {
const v = videoInstances[video];
return !!v.seeking;
}
function _JS_Video_Pause(video) {
debugLog('_JS_Video_Pause');
const v = videoInstances[video];
if (v.loopEndPollInterval) {
clearInterval(v.loopEndPollInterval);
}
v.pause();
}
function _JS_Video_SetLoop(video, loop = false) {
debugLog('_JS_Video_SetLoop', video, loop);
const v = videoInstances[video];
if (v.loopEndPollInterval) {
clearInterval(v.loopEndPollInterval);
}
v.loop = loop;
if (loop) {
v.loopEndPollInterval = setInterval(() => {
if (typeof v.currentTime !== 'undefined' && typeof v.lastSeenPlaybackTime !== 'undefined') {
const cur = Math.floor(v.currentTime);
const last = Math.floor(v.lastSeenPlaybackTime);
if (cur < last) {
const dur = v.duration;
const margin = 0.2;
const closeToBegin = margin * dur;
const closeToEnd = dur - closeToBegin;
if (cur < closeToBegin && last > closeToEnd) {
jsVideoEnded.apply(v);
}
}
}
v.lastSeenPlaybackTime = v.currentTime;
}, 1e3 / 30);
v.lastSeenPlaybackTime = v.currentTime;
v.onended = null;
}
else {
v.onended = jsVideoEnded;
}
}
function jsVideoAllAudioTracksAreDisabled(v) {
debugLog('jsVideoAllAudioTracksAreDisabled');
if (!v.enabledTracks) {
return false;
}
for (let i = 0; i < v.enabledTracks.length; ++i) {
if (v.enabledTracks[i]) {
return false;
}
}
return true;
}
function _JS_Video_Play(video, muted) {
debugLog('_JS_Video_Play', video, muted);
const v = videoInstances[video];
v.muted = muted || jsVideoAllAudioTracksAreDisabled(v);
v.play();
_JS_Video_SetLoop(video, v.loop);
}
function _JS_Video_Seek(video, time) {
debugLog('_JS_Video_Seek', video, time);
const v = videoInstances[video];
v.seek(time);
}
function _JS_Video_SetEndedHandler(video, ref, onended) {
debugLog('_JS_Video_SetEndedHandler', video, ref, onended);
const v = videoInstances[video];
v.onendedCallback = onended;
v.onendedRef = ref;
}
function _JS_Video_SetErrorHandler(video, ref, onerror) {
debugLog('_JS_Video_SetErrorHandler', video, ref, onerror);
if (isWebVideo) {
videoInstances[video].on('error', (errMsg) => {
debugLog('video error:', errMsg);
dynCall_vii(onerror, ref, errMsg);
});
}
}
function _JS_Video_SetMute(video, muted) {
debugLog('_JS_Video_SetMute', video, muted);
const v = videoInstances[video];
v.muted = muted || jsVideoAllAudioTracksAreDisabled(v);
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function _JS_Video_SetPlaybackRate(video, rate) {
return;
}
function _JS_Video_SetReadyHandler(video, ref, onready) {
debugLog('_JS_Video_SetReadyHandler', video, ref, onready);
const v = videoInstances[video];
if (isWebVideo) {
v.on('canplay', () => {
dynCall_vi(onready, ref);
});
}
else {
const fn = () => {
console.log('_JS_Video_SetReadyHandler onCanPlay');
dynCall_vi(onready, ref);
v.videoDecoder?.off('bufferchange', fn);
};
v.videoDecoder?.on('bufferchange', fn);
}
}
function _JS_Video_SetSeekedOnceHandler(video, ref, onseeked) {
debugLog('_JS_Video_SetSeekedOnceHandler', video, ref, onseeked);
const v = videoInstances[video];
if (isWebVideo) {
v.on('seek', () => {
dynCall_vi(onseeked, ref);
});
}
else {
v.videoDecoder?.on('seek', () => {
dynCall_vi(onseeked, ref);
});
}
}
function _JS_Video_SetVolume(video, volume) {
debugLog('_JS_Video_SetVolume');
videoInstances[video].volume = volume;
}
function _JS_Video_Time(video) {
return videoInstances[video].currentTime;
}
function _JS_Video_UpdateToTexture(video, tex) {
const v = videoInstances[video];
if (!(v.videoWidth > 0 && v.videoHeight > 0)) {
return false;
}
if (v.lastUpdateTextureTime === v.currentTime) {
return false;
}
v.lastUpdateTextureTime = v.currentTime;
if (!FrameworkData) {
return false;
}
const Module = GameGlobal.manager.gameInstance.Module;
const { GL, GLctx } = FrameworkData;
if (!isWebVideo && GameGlobal.mtl) {
if (supportVideoFrame) {
return false;
}
const data = v.frameData?.data;
const source = supportVideoFrame ? data : new Uint8ClampedArray(data);
const byteLength = supportVideoFrame ? 0 : source.byteLength;
const sourceIdOrPtr = videoBufferManager?.getTempBuffer(video, byteLength);
if (sourceIdOrPtr) {
Module.HEAPU8.set(source, sourceIdOrPtr);
}
return Module._mtlVideoUpdateToTexture(video, supportVideoFrame, tex, v.videoWidth, v.videoHeight, sourceIdOrPtr);
}
const gl = GL.currentContext.GLctx;
if (!isWebVideo && Module._glxVideoUpdateToTexture && gl.emscriptenGLX) {
const data = v.frameData?.data;
const source = supportVideoFrame ? data : new Uint8ClampedArray(data);
const byteLength = supportVideoFrame ? 0 : source.byteLength;
let sourceIdOrPtr;
if (supportVideoFrame) {
sourceIdOrPtr = source.__uid;
}
else {
sourceIdOrPtr = Module._glxGetVideoTempBuffer(video, byteLength);
if (sourceIdOrPtr) {
Module.HEAPU8.set(source, sourceIdOrPtr);
}
}
Module._glxVideoUpdateToTexture(v, supportVideoFrame, tex, v.videoWidth, v.videoHeight, sourceIdOrPtr);
return true;
}
GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, true);
const internalFormat = GLctx.RGBA;
const format = GLctx.RGBA;
const width = v.videoWidth;
const height = v.videoHeight;
if (v.previousUploadedWidth !== width || v.previousUploadedHeight !== height) {
GLctx.deleteTexture(GL.textures[tex]);
const t = GLctx.createTexture();
t.name = tex;
GL.textures[tex] = t;
GLctx.bindTexture(GLctx.TEXTURE_2D, t);
GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_WRAP_S, GLctx.CLAMP_TO_EDGE);
GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_WRAP_T, GLctx.CLAMP_TO_EDGE);
GLctx.texParameteri(GLctx.TEXTURE_2D, GLctx.TEXTURE_MIN_FILTER, GLctx.LINEAR);
if (isWebVideo) {
v.render();
}
else {
const data = v.frameData?.data;
const source = supportVideoFrame ? data : new Uint8ClampedArray(data);
if (supportVideoFrame) {
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, internalFormat, format, GLctx.UNSIGNED_BYTE, source);
}
else {
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, internalFormat, v.videoWidth, v.videoHeight, 0, format, GLctx.UNSIGNED_BYTE, source);
}
}
v.previousUploadedWidth = width;
v.previousUploadedHeight = height;
}
else {
GLctx.bindTexture(GLctx.TEXTURE_2D, GL.textures[tex]);
if (isWebVideo) {
v.render();
}
else {
const data = v.frameData?.data;
const source = supportVideoFrame ? data : new Uint8ClampedArray(data);
if (supportVideoFrame) {
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, internalFormat, format, GLctx.UNSIGNED_BYTE, source);
}
else {
GLctx.texImage2D(GLctx.TEXTURE_2D, 0, internalFormat, v.videoWidth, v.videoHeight, 0, format, GLctx.UNSIGNED_BYTE, source);
}
}
}
GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, false);
return true;
}
function _JS_Video_Width(video) {
return videoInstances[video].videoWidth;
}
function _JS_Video_SetSeekedHandler(video, ref, onseeked) {
const v = videoInstances[video];
if (isWebVideo) {
v.on('seek', () => {
dynCall_vi(onseeked, ref);
});
}
else {
v.videoDecoder?.on('seek', () => {
dynCall_vi(onseeked, ref);
});
}
}
function _JS_Video_GetPlaybackRate(video) {
return videoInstances[video].playbackRate;
}
export default {
_JS_Video_CanPlayFormat,
_JS_Video_Create,
_JS_Video_Destroy,
_JS_Video_Duration,
_JS_Video_EnableAudioTrack,
_JS_Video_GetAudioLanguageCode,
_JS_Video_GetNumAudioTracks,
_JS_Video_Height,
_JS_Video_IsPlaying,
_JS_Video_IsReady,
_JS_Video_IsSeeking,
_JS_Video_Pause,
_JS_Video_SetLoop,
_JS_Video_Play,
_JS_Video_Seek,
_JS_Video_SetEndedHandler,
_JS_Video_SetErrorHandler,
_JS_Video_SetMute,
_JS_Video_SetPlaybackRate,
_JS_Video_SetReadyHandler,
_JS_Video_SetSeekedOnceHandler,
_JS_Video_SetVolume,
_JS_Video_Time,
_JS_Video_UpdateToTexture,
_JS_Video_Width,
_JS_Video_SetSeekedHandler,
_JS_Video_GetPlaybackRate,
};
// @ts-nocheck
import { formatIdentifier } from './unity-sdk/utils';
/* eslint-disable */
const isWK = false;
// try{
// isWK = wx.getSystemInfoSync().renderer == 'h5';
// }catch(e){
// isWK = typeof(window)!='undefined' && window.XMLHttpRequest;
// }
/** ****/ (function (modules) {
/** ****/ // The module cache
/** ****/ const installedModules = {};
/** ****/ // The require function
/** ****/ function __webpack_require__(moduleId) {
/** ****/ // Check if module is in cache
/** ****/ if (installedModules[moduleId])
/** ****/ return installedModules[moduleId].exports;
/** ****/ // Create a new module (and put it into the cache)
/** ****/ const module = installedModules[moduleId] = {
/** ****/ exports: {},
/** ****/ id: moduleId,
/** ****/ loaded: false,
/** ****/
};
/** ****/ // Execute the module function
/** ****/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/** ****/ // Flag the module as loaded
/** ****/ module.loaded = true;
/** ****/ // Return the exports of the module
/** ****/ return module.exports;
/** ****/
}
/** ****/ // expose the modules object (__webpack_modules__)
/** ****/ __webpack_require__.m = modules;
/** ****/ // expose the module cache
/** ****/ __webpack_require__.c = installedModules;
/** ****/ // __webpack_public_path__
/** ****/ __webpack_require__.p = '';
/** ****/ // Load entry module and return exports
/** ****/ return __webpack_require__(0);
/** ****/
}([
/* 0 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
const _window2 = __webpack_require__(1);
const _window = _interopRequireWildcard(_window2);
const _HTMLElement = __webpack_require__(5);
const _HTMLElement2 = _interopRequireDefault(_HTMLElement);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
const newObj = {};
if (obj != null) {
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key))
newObj[key] = obj[key];
}
}
newObj.default = obj;
return newObj;
}
const global = GameGlobal;
function inject() {
_window.addEventListener = function (type, listener) {
_window.document.addEventListener(type, listener);
};
_window.removeEventListener = function (type, listener) {
_window.document.removeEventListener(type, listener);
};
if (_window.canvas) {
_window.canvas.addEventListener = _window.addEventListener;
_window.canvas.removeEventListener = _window.removeEventListener;
}
const { platform } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
// 开发者工具无法重定义 window
if (platform === 'devtools') {
for (const key in _window) {
const descriptor = Object.getOwnPropertyDescriptor(global, key);
if (!descriptor || descriptor.configurable === true) {
Object.defineProperty(window, key, {
value: _window[key],
});
}
}
for (const _key in _window.document) {
const _descriptor = Object.getOwnPropertyDescriptor(global.document, _key);
if (!_descriptor || _descriptor.configurable === true) {
Object.defineProperty(global.document, _key, {
value: _window.document[_key],
});
}
}
window.parent = window;
}
else {
for (const _key2 in _window) {
global[_key2] = _window[_key2];
}
global.window = _window;
window = global;
window.top = window.parent = window;
}
}
if (!GameGlobal.__isAdapterInjected) {
GameGlobal.__isAdapterInjected = true;
inject();
}
/***/
}),
/* 1 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.clearInterval = exports.clearTimeout = exports.setInterval = exports.setTimeout = exports.canvas = exports.location = exports.localStorage = exports.HTMLElement = exports.FileReader = exports.Audio = exports.Image = exports.WebSocket = /* exports.XMLHttpRequest =*/ exports.navigator = exports.document = undefined;
if (!isWK) {
exports.XMLHttpRequest = undefined;
}
const _WindowProperties = __webpack_require__(2);
Object.keys(_WindowProperties).forEach((key) => {
if (key === 'default' || key === '__esModule')
return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _WindowProperties[key];
},
});
});
const _constructor = __webpack_require__(4);
Object.keys(_constructor).forEach((key) => {
if (key === 'default' || key === '__esModule')
return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _constructor[key];
},
});
});
const _Canvas = __webpack_require__(10);
const _Canvas2 = _interopRequireDefault(_Canvas);
const _document2 = __webpack_require__(11);
const _document3 = _interopRequireDefault(_document2);
const _navigator2 = __webpack_require__(18);
const _navigator3 = _interopRequireDefault(_navigator2);
const _XMLHttpRequest2 = __webpack_require__(19);
const _XMLHttpRequest3 = _interopRequireDefault(_XMLHttpRequest2);
const _WebSocket2 = __webpack_require__(20);
const _WebSocket3 = _interopRequireDefault(_WebSocket2);
const _Image2 = __webpack_require__(12);
const _Image3 = _interopRequireDefault(_Image2);
const _Audio2 = __webpack_require__(13);
const _Audio3 = _interopRequireDefault(_Audio2);
const _FileReader2 = __webpack_require__(21);
const _FileReader3 = _interopRequireDefault(_FileReader2);
const _HTMLElement2 = __webpack_require__(5);
const _HTMLElement3 = _interopRequireDefault(_HTMLElement2);
const _localStorage2 = __webpack_require__(22);
const _localStorage3 = _interopRequireDefault(_localStorage2);
const _location2 = __webpack_require__(23);
const _location3 = _interopRequireDefault(_location2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
exports.document = _document3.default;
exports.navigator = _navigator3.default;
if (!isWK) {
exports.XMLHttpRequest = _XMLHttpRequest3.default;
}
// exports.XMLHttpRequest = _XMLHttpRequest3.default;
exports.WebSocket = _WebSocket3.default;
exports.Image = _Image3.default;
exports.Audio = _Audio3.default;
exports.FileReader = _FileReader3.default;
exports.HTMLElement = _HTMLElement3.default;
exports.localStorage = _localStorage3.default;
exports.location = _location3.default;
// 模拟web中的CustomEvent接口
function CustomEvent(event, params) {
params = params || {
bubbles: false,
cancelable: false,
detail: undefined,
};
const evt = {
type: event,
bubbles: params.bubbles,
cancelable: params.cancelable,
detail: params.detail,
};
return evt;
}
;
exports.CustomEvent = CustomEvent;
// 暴露全局的 canvas
const canvas = new _Canvas2.default();
exports.canvas = canvas;
exports.setTimeout = setTimeout;
exports.setInterval = setInterval;
exports.clearTimeout = clearTimeout;
exports.clearInterval = clearInterval;
exports.requestAnimationFrame = requestAnimationFrame;
exports.cancelAnimationFrame = cancelAnimationFrame;
/***/
}),
/* 2 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.performance = exports.ontouchend = exports.ontouchmove = exports.ontouchstart = exports.screen = exports.devicePixelRatio = exports.innerHeight = exports.innerWidth = undefined;
const _performance2 = __webpack_require__(3);
const _performance3 = _interopRequireDefault(_performance2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const { screenWidth, screenHeight, pixelRatio } = wx.getWindowInfo ? wx.getWindowInfo() : wx.getSystemInfoSync();
const innerWidth = exports.innerWidth = screenWidth;
const innerHeight = exports.innerHeight = screenHeight;
exports.devicePixelRatio = pixelRatio;
const screen = exports.screen = {
availWidth: innerWidth,
availHeight: innerHeight,
};
const ontouchstart = exports.ontouchstart = null;
const ontouchmove = exports.ontouchmove = null;
const ontouchend = exports.ontouchend = null;
exports.performance = _performance3.default;
/***/
}),
/* 3 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
let performance = void 0;
let ori_performance = wx.getPerformance();
const initTime = Date.now();
const ori_initTime = ori_performance.now();
const clientPerfAdapter = Object.assign({}, {
now: function now() {
if (GameGlobal.unityNamespace.isDevelopmentBuild
&& GameGlobal.unityNamespace.isProfilingBuild
&& !GameGlobal.unityNamespace.isDevtools
&& !GameGlobal.isIOSHighPerformanceMode) {
// 由于wx.getPerformance()获取到的是微秒级,因此这里需要/1000.0,进行单位的统一
return (ori_performance.now() - ori_initTime) * 0.001;
}
return (Date.now() - initTime);
},
});
performance = clientPerfAdapter;
exports.default = performance;
/***/
}),
/* 4 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.HTMLCanvasElement = exports.HTMLImageElement = undefined;
const _HTMLElement3 = __webpack_require__(5);
const _HTMLElement4 = _interopRequireDefault(_HTMLElement3);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const HTMLImageElement = exports.HTMLImageElement = (function (_HTMLElement) {
_inherits(HTMLImageElement, _HTMLElement);
function HTMLImageElement() {
_classCallCheck(this, HTMLImageElement);
return _possibleConstructorReturn(this, (HTMLImageElement.__proto__ || Object.getPrototypeOf(HTMLImageElement)).call(this, 'img'));
}
return HTMLImageElement;
}(_HTMLElement4.default));
const HTMLCanvasElement = exports.HTMLCanvasElement = (function (_HTMLElement2) {
_inherits(HTMLCanvasElement, _HTMLElement2);
function HTMLCanvasElement() {
_classCallCheck(this, HTMLCanvasElement);
return _possibleConstructorReturn(this, (HTMLCanvasElement.__proto__ || Object.getPrototypeOf(HTMLCanvasElement)).call(this, 'canvas'));
}
return HTMLCanvasElement;
}(_HTMLElement4.default));
/***/
}),
/* 5 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
const _Element2 = __webpack_require__(6);
const _Element3 = _interopRequireDefault(_Element2);
const _util = __webpack_require__(9);
const _WindowProperties = __webpack_require__(2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const HTMLElement = (function (_Element) {
_inherits(HTMLElement, _Element);
function HTMLElement() {
const tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
_classCallCheck(this, HTMLElement);
const _this = _possibleConstructorReturn(this, (HTMLElement.__proto__ || Object.getPrototypeOf(HTMLElement)).call(this));
_this.className = '';
_this.childern = [];
_this.style = {
width: `${_WindowProperties.innerWidth}px`,
height: `${_WindowProperties.innerHeight}px`,
};
_this.insertBefore = _util.noop;
_this.innerHTML = '';
_this.tagName = tagName.toUpperCase();
return _this;
}
_createClass(HTMLElement, [{
key: 'setAttribute',
value: function setAttribute(name, value) {
this[name] = value;
},
}, {
key: 'getAttribute',
value: function getAttribute(name) {
return this[name];
},
}, {
key: 'getBoundingClientRect',
value: function getBoundingClientRect() {
return {
top: 0,
left: 0,
width: _WindowProperties.innerWidth,
height: _WindowProperties.innerHeight,
};
},
}, {
key: 'focus',
value: function focus() { },
}, {
key: 'clientWidth',
get: function get() {
const ret = parseInt(this.style.fontSize, 10) * this.innerHTML.length;
return Number.isNaN(ret) ? 0 : ret;
},
}, {
key: 'clientHeight',
get: function get() {
const ret = parseInt(this.style.fontSize, 10);
return Number.isNaN(ret) ? 0 : ret;
},
}]);
return HTMLElement;
}(_Element3.default));
exports.default = HTMLElement;
/***/
}),
/* 6 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _Node2 = __webpack_require__(7);
const _Node3 = _interopRequireDefault(_Node2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const ELement = (function (_Node) {
_inherits(ELement, _Node);
function ELement() {
_classCallCheck(this, ELement);
const _this = _possibleConstructorReturn(this, (ELement.__proto__ || Object.getPrototypeOf(ELement)).call(this));
_this.className = '';
_this.children = [];
return _this;
}
return ELement;
}(_Node3.default));
exports.default = ELement;
/***/
}),
/* 7 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
const _EventTarget2 = __webpack_require__(8);
const _EventTarget3 = _interopRequireDefault(_EventTarget2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const Node = (function (_EventTarget) {
_inherits(Node, _EventTarget);
function Node() {
_classCallCheck(this, Node);
const _this = _possibleConstructorReturn(this, (Node.__proto__ || Object.getPrototypeOf(Node)).call(this));
_this.childNodes = [];
return _this;
}
_createClass(Node, [{
key: 'appendChild',
value: function appendChild(node) {
if (node instanceof Node) {
this.childNodes.push(node);
}
else {
throw new TypeError('Failed to executed \'appendChild\' on \'Node\': parameter 1 is not of type \'Node\'.');
}
},
}, {
key: 'cloneNode',
value: function cloneNode() {
const copyNode = Object.create(this);
Object.assign(copyNode, this);
return copyNode;
},
}, {
key: 'removeChild',
value: function removeChild(node) {
const index = this.childNodes.findIndex(child => child === node);
if (index > -1) {
return this.childNodes.splice(index, 1);
}
return null;
},
}]);
return Node;
}(_EventTarget3.default));
exports.default = Node;
/***/
}),
/* 8 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
const _events = new WeakMap();
const EventTarget = (function () {
function EventTarget() {
_classCallCheck(this, EventTarget);
_events.set(this, {});
}
_createClass(EventTarget, [{
key: 'addEventListener',
value: function addEventListener(type, listener) {
const options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let events = _events.get(this);
if (!events) {
events = {};
_events.set(this, events);
}
if (!events[type]) {
events[type] = [];
}
events[type].push(listener);
if (options.capture) {
console.warn('EventTarget.addEventListener: options.capture is not implemented.');
}
if (options.once) {
console.warn('EventTarget.addEventListener: options.once is not implemented.');
}
if (options.passive) {
console.warn('EventTarget.addEventListener: options.passive is not implemented.');
}
},
}, {
key: 'removeEventListener',
value: function removeEventListener(type, listener) {
const listeners = _events.get(this)[type];
if (listeners && listeners.length > 0) {
for (let i = listeners.length; i--; i > 0) {
if (listeners[i] === listener) {
listeners.splice(i, 1);
break;
}
}
}
},
}, {
key: 'dispatchEvent',
value: function dispatchEvent() {
const event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const listeners = _events.get(this)[event.type];
if (listeners) {
for (let i = 0; i < listeners.length; i++) {
listeners[i](event);
}
}
},
}]);
return EventTarget;
}());
exports.default = EventTarget;
/***/
}),
/* 9 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.noop = noop;
function noop() { }
/***/
}),
/* 10 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.default = Canvas;
const _constructor = __webpack_require__(4);
const _HTMLElement = __webpack_require__(5);
const _HTMLElement2 = _interopRequireDefault(_HTMLElement);
const _document = __webpack_require__(11);
const _document2 = _interopRequireDefault(_document);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
const hasModifiedCanvasPrototype = false;
const hasInit2DContextConstructor = false;
const hasInitWebGLContextConstructor = false;
function Canvas() {
const canvas = wx.createCanvas();
canvas.type = 'canvas';
canvas.__proto__.__proto__ = new _HTMLElement2.default('canvas');
const _getContext = canvas.getContext;
canvas.getBoundingClientRect = function () {
const ret = {
top: 0,
left: 0,
width: window.innerWidth,
height: window.innerHeight,
};
return ret;
};
return canvas;
}
/***/
}),
/* 11 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _window = __webpack_require__(1);
const window = _interopRequireWildcard(_window);
const _HTMLElement = __webpack_require__(5);
const _HTMLElement2 = _interopRequireDefault(_HTMLElement);
const _Image = __webpack_require__(12);
const _Image2 = _interopRequireDefault(_Image);
const _Audio = __webpack_require__(13);
const _Audio2 = _interopRequireDefault(_Audio);
const _Canvas = __webpack_require__(10);
const _Canvas2 = _interopRequireDefault(_Canvas);
__webpack_require__(16);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
const newObj = {};
if (obj != null) {
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key))
newObj[key] = obj[key];
}
}
newObj.default = obj;
return newObj;
}
const events = {};
var document = {
readyState: 'complete',
visibilityState: 'visible',
documentElement: window,
hidden: false,
style: {},
location: window.location,
ontouchstart: null,
ontouchmove: null,
ontouchend: null,
head: new _HTMLElement2.default('head'),
body: new _HTMLElement2.default('body'),
createElement: function createElement(tagName) {
if (tagName === 'canvas') {
return new _Canvas2.default();
}
if (tagName === 'audio') {
return new _Audio2.default();
}
if (tagName === 'img') {
return new _Image2.default();
}
return new _HTMLElement2.default(tagName);
},
getElementById: function getElementById(id) {
if (id === window.canvas.id) {
return window.canvas;
}
return null;
},
getElementsByTagName: function getElementsByTagName(tagName) {
if (tagName === 'head') {
return [document.head];
}
if (tagName === 'body') {
return [document.body];
}
if (tagName === 'canvas') {
return [window.canvas];
}
return [];
},
getElementsByName: function getElementsByName(tagName) {
if (tagName === 'head') {
return [document.head];
}
if (tagName === 'body') {
return [document.body];
}
if (tagName === 'canvas') {
return [window.canvas];
}
return [];
},
querySelector: function querySelector(query) {
if (query === 'head') {
return document.head;
}
if (query === 'body') {
return document.body;
}
if (query === 'canvas') {
return window.canvas;
}
if (query === `#${window.canvas.id}`) {
return window.canvas;
}
return null;
},
querySelectorAll: function querySelectorAll(query) {
if (query === 'head') {
return [document.head];
}
if (query === 'body') {
return [document.body];
}
if (query === 'canvas') {
return [window.canvas];
}
return [];
},
addEventListener: function addEventListener(type, listener) {
if (!events[type]) {
events[type] = [];
}
events[type].push(listener);
},
removeEventListener: function removeEventListener(type, listener) {
const listeners = events[type];
if (listeners && listeners.length > 0) {
for (let i = listeners.length; i--; i > 0) {
if (listeners[i] === listener) {
listeners.splice(i, 1);
break;
}
}
}
},
dispatchEvent: function dispatchEvent(event) {
const listeners = events[event.type];
if (listeners) {
for (let i = 0; i < listeners.length; i++) {
listeners[i](event);
}
}
},
};
exports.default = document;
/***/
}),
/* 12 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
exports.default = Image;
function Image() {
const image = wx.createImage();
return image;
}
/***/
}),
/* 13 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
const _HTMLAudioElement2 = __webpack_require__(14);
const _HTMLAudioElement3 = _interopRequireDefault(_HTMLAudioElement2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const HAVE_NOTHING = 0;
const HAVE_METADATA = 1;
const HAVE_CURRENT_DATA = 2;
const HAVE_FUTURE_DATA = 3;
const HAVE_ENOUGH_DATA = 4;
const _innerAudioContext = new WeakMap();
const _src = new WeakMap();
const _loop = new WeakMap();
const _autoplay = new WeakMap();
const Audio = (function (_HTMLAudioElement) {
_inherits(Audio, _HTMLAudioElement);
function Audio(url) {
_classCallCheck(this, Audio);
const _this = _possibleConstructorReturn(this, (Audio.__proto__ || Object.getPrototypeOf(Audio)).call(this));
_this.HAVE_NOTHING = HAVE_NOTHING;
_this.HAVE_METADATA = HAVE_METADATA;
_this.HAVE_CURRENT_DATA = HAVE_CURRENT_DATA;
_this.HAVE_FUTURE_DATA = HAVE_FUTURE_DATA;
_this.HAVE_ENOUGH_DATA = HAVE_ENOUGH_DATA;
_this.readyState = HAVE_NOTHING;
_src.set(_this, '');
const innerAudioContext = wx.createInnerAudioContext();
_innerAudioContext.set(_this, innerAudioContext);
innerAudioContext.onCanplay(() => {
_this.dispatchEvent({ type: 'load' });
_this.dispatchEvent({ type: 'loadend' });
_this.dispatchEvent({ type: 'canplay' });
_this.dispatchEvent({ type: 'canplaythrough' });
_this.dispatchEvent({ type: 'loadedmetadata' });
_this.readyState = HAVE_CURRENT_DATA;
});
innerAudioContext.onPlay(() => {
_this.dispatchEvent({ type: 'play' });
});
innerAudioContext.onPause(() => {
_this.dispatchEvent({ type: 'pause' });
});
innerAudioContext.onEnded(() => {
_this.dispatchEvent({ type: 'ended' });
_this.readyState = HAVE_ENOUGH_DATA;
});
innerAudioContext.onError(() => {
_this.dispatchEvent({ type: 'error' });
});
if (url) {
_innerAudioContext.get(_this).src = url;
}
return _this;
}
_createClass(Audio, [{
key: 'load',
value: function load() {
console.warn('HTMLAudioElement.load() is not implemented.');
},
}, {
key: 'play',
value: function play() {
_innerAudioContext.get(this).play();
},
}, {
key: 'pause',
value: function pause() {
_innerAudioContext.get(this).pause();
},
}, {
key: 'canPlayType',
value: function canPlayType() {
const mediaType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
if (typeof mediaType !== 'string') {
return '';
}
if (mediaType.indexOf('audio/mpeg') > -1 || mediaType.indexOf('audio/mp4')) {
return 'probably';
}
return '';
},
}, {
key: 'cloneNode',
value: function cloneNode() {
const newAudio = new Audio();
newAudio.loop = _innerAudioContext.get(this).loop;
newAudio.autoplay = _innerAudioContext.get(this).autoplay;
newAudio.src = this.src;
return newAudio;
},
}, {
key: 'currentTime',
get: function get() {
return _innerAudioContext.get(this).currentTime;
},
set: function set(value) {
_innerAudioContext.get(this).seek(value);
},
}, {
key: 'src',
get: function get() {
return _src.get(this);
},
set: function set(value) {
_src.set(this, value);
_innerAudioContext.get(this).src = value;
},
}, {
key: 'loop',
get: function get() {
return _innerAudioContext.get(this).loop;
},
set: function set(value) {
_innerAudioContext.get(this).loop = value;
},
}, {
key: 'autoplay',
get: function get() {
return _innerAudioContext.get(this).autoplay;
},
set: function set(value) {
_innerAudioContext.get(this).autoplay = value;
},
}, {
key: 'paused',
get: function get() {
return _innerAudioContext.get(this).paused;
},
}]);
return Audio;
}(_HTMLAudioElement3.default));
exports.default = Audio;
/***/
}),
/* 14 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _HTMLMediaElement2 = __webpack_require__(15);
const _HTMLMediaElement3 = _interopRequireDefault(_HTMLMediaElement2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const HTMLAudioElement = (function (_HTMLMediaElement) {
_inherits(HTMLAudioElement, _HTMLMediaElement);
function HTMLAudioElement() {
_classCallCheck(this, HTMLAudioElement);
return _possibleConstructorReturn(this, (HTMLAudioElement.__proto__ || Object.getPrototypeOf(HTMLAudioElement)).call(this, 'audio'));
}
return HTMLAudioElement;
}(_HTMLMediaElement3.default));
exports.default = HTMLAudioElement;
/***/
}),
/* 15 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
const _HTMLElement2 = __webpack_require__(5);
const _HTMLElement3 = _interopRequireDefault(_HTMLElement2);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');
}
return call && (typeof call === 'object' || typeof call === 'function') ? call : self;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(`Super expression must either be null or a function, not ${typeof superClass}`);
}
subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } });
if (superClass)
Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
}
const HTMLMediaElement = (function (_HTMLElement) {
_inherits(HTMLMediaElement, _HTMLElement);
function HTMLMediaElement(type) {
_classCallCheck(this, HTMLMediaElement);
return _possibleConstructorReturn(this, (HTMLMediaElement.__proto__ || Object.getPrototypeOf(HTMLMediaElement)).call(this, type));
}
_createClass(HTMLMediaElement, [{
key: 'addTextTrack',
value: function addTextTrack() { },
}, {
key: 'captureStream',
value: function captureStream() { },
}, {
key: 'fastSeek',
value: function fastSeek() { },
}, {
key: 'load',
value: function load() { },
}, {
key: 'pause',
value: function pause() { },
}, {
key: 'play',
value: function play() { },
}]);
return HTMLMediaElement;
}(_HTMLElement3.default));
exports.default = HTMLMediaElement;
/***/
}),
/* 16 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
__webpack_require__(17);
/***/
}),
/* 17 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
const _window = __webpack_require__(1);
const window = _interopRequireWildcard(_window);
const _document = __webpack_require__(11);
const _document2 = _interopRequireDefault(_document);
const _util = __webpack_require__(9);
function _interopRequireDefault(obj) {
return obj && obj.__esModule ? obj : { default: obj };
}
function _interopRequireWildcard(obj) {
if (obj && obj.__esModule) {
return obj;
}
const newObj = {};
if (obj != null) {
for (const key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key))
newObj[key] = obj[key];
}
}
newObj.default = obj;
return newObj;
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
const TouchEvent = function TouchEvent(type) {
_classCallCheck(this, TouchEvent);
this.target = window.canvas;
this.currentTarget = window.canvas;
this.touches = [];
this.targetTouches = [];
this.changedTouches = [];
this.preventDefault = _util.noop;
this.stopPropagation = _util.noop;
this.type = type;
};
function formatTouchEvent(v, type, changed) {
return {
...v,
identifier: formatIdentifier(v.identifier, type, changed)
};
}
let activeTouchId = -1;
function touchEventHandlerFactory(type) {
return function (event) {
// 禁止多点触控
if (GameGlobal.disableMultiTouch) {
if (event.touches.length > 0 || event.changedTouches.length > 0) {
if (activeTouchId !== -1) {
const touch = event.touches.find(v => v.identifier === activeTouchId);
const changedTouch = event.changedTouches.find(v => v.identifier === activeTouchId);
event.touches = touch ? [touch] : [];
event.changedTouches = changedTouch ? [changedTouch] : [];
}
else {
event.touches = event.touches.slice(0, 1);
event.changedTouches = event.changedTouches.slice(0, 1);
}
let getFirstTouchId;
if (event.changedTouches.length > 0) {
getFirstTouchId = event.changedTouches[0].identifier;
}
if (type === 'touchstart') {
if (activeTouchId === -1) {
activeTouchId = getFirstTouchId;
}
else {
return;
}
}
else if (type === 'touchmove') {
if (getFirstTouchId !== activeTouchId) {
return;
}
}
else if (type === 'touchend') {
if (getFirstTouchId === activeTouchId) {
activeTouchId = -1;
}
else {
return;
}
}
else if (type === 'touchcancel') {
activeTouchId = -1;
}
}
}
const touchEvent = new TouchEvent(type);
touchEvent.touches = event.touches.map(v => formatTouchEvent(v, event.type));
touchEvent.targetTouches = Array.prototype.slice.call(event.touches).map(v => formatTouchEvent(v, event.type));
touchEvent.changedTouches = event.changedTouches.map(v => formatTouchEvent(v, event.type, 1));
touchEvent.timeStamp = event.timeStamp;
_document2.default.dispatchEvent(touchEvent);
};
}
wx.onTouchStart(touchEventHandlerFactory('touchstart'));
wx.onTouchMove(touchEventHandlerFactory('touchmove'));
wx.onTouchEnd(touchEventHandlerFactory('touchend'));
wx.onTouchCancel(touchEventHandlerFactory('touchcancel'));
/***/
}),
/* 18 */
/***/ (function (module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _util = __webpack_require__(9);
// TODO 需要 wx.getSystemInfo 获取更详细信息
const { platform } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
const navigator = {
platform,
language: 'zh-cn',
appVersion: '5.0 (iPhone; CPU iPhone OS 9_1 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1',
userAgent: 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/zh_CN',
onLine: true,
// TODO 用 wx.getLocation 来封装 geolocation
geolocation: {
getCurrentPosition: _util.noop,
watchPosition: _util.noop,
clearWatch: _util.noop,
},
};
exports.default = navigator;
/***/
}),
/* 19 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
const _url = new WeakMap();
const _method = new WeakMap();
const _requestHeader = new WeakMap();
const _responseHeader = new WeakMap();
const _requestTask = new WeakMap();
function _triggerEvent(type) {
if (typeof this[`on${type}`] === 'function') {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
this[`on${type}`].apply(this, args);
}
}
function _changeReadyState(readyState) {
this.readyState = readyState;
_triggerEvent.call(this, 'readystatechange');
}
const XMLHttpRequest = (function () {
// TODO 没法模拟 HEADERS_RECEIVED 和 LOADING 两个状态
function XMLHttpRequest() {
_classCallCheck(this, XMLHttpRequest);
this.onabort = null;
this.onerror = null;
this.onload = null;
this.onloadstart = null;
this.onprogress = null;
this.ontimeout = null;
this.onloadend = null;
this.onreadystatechange = null;
this.readyState = 0;
this.response = null;
this.responseText = null;
this.responseType = '';
this.responseXML = null;
this.status = 0;
this.statusText = '';
this.upload = {};
this.withCredentials = false;
this.timeout = 60000;
_requestHeader.set(this, {
'content-type': 'application/x-www-form-urlencoded',
});
_responseHeader.set(this, {});
}
/*
* TODO 这一批事件应该是在 XMLHttpRequestEventTarget.prototype 上面的
*/
_createClass(XMLHttpRequest, [{
key: 'abort',
value: function abort() {
const myRequestTask = _requestTask.get(this);
if (myRequestTask) {
myRequestTask.abort();
}
},
}, {
key: 'getAllResponseHeaders',
value: function getAllResponseHeaders() {
const responseHeader = _responseHeader.get(this);
return Object.keys(responseHeader).map(header => `${header}: ${responseHeader[header]}`)
.join('\n');
},
}, {
key: 'getResponseHeader',
value: function getResponseHeader(header) {
return _responseHeader.get(this)[header];
},
}, {
key: 'open',
value: function open(method, url /* async, user, password 这几个参数在小程序内不支持*/) {
_method.set(this, method);
_url.set(this, url);
_changeReadyState.call(this, XMLHttpRequest.OPENED);
},
}, {
key: 'overrideMimeType',
value: function overrideMimeType() { },
}, {
key: 'send',
value: function send() {
const _this = this;
let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
if (this.readyState !== XMLHttpRequest.OPENED) {
throw new Error('Failed to execute \'send\' on \'XMLHttpRequest\': The object\'s state must be OPENED.');
}
else {
if (data instanceof Uint8Array) {
// unity 过来的请求会出现Uint8Array的数组,而客户端这里处理有问题,先这样兼容
data = Uint8Array.from(data).buffer;
}
const { responseType } = this;
wx.request({
data,
url: _url.get(this),
method: _method.get(this),
header: _requestHeader.get(this),
responseType: this.responseType,
enableHttp2: true,
enableQuic: true,
timeout: this.timeout ? this.timeout : 60000,
success: function success(_ref) {
let { data } = _ref;
const { statusCode } = _ref;
const { header } = _ref;
if (typeof data !== 'string' && !(data instanceof ArrayBuffer)) {
try {
data = JSON.stringify(data);
}
catch (e) {
data = data;
}
}
_this.status = statusCode;
_responseHeader.set(_this, header);
_triggerEvent.call(_this, 'loadstart');
_changeReadyState.call(_this, XMLHttpRequest.HEADERS_RECEIVED);
_changeReadyState.call(_this, XMLHttpRequest.LOADING);
_this.response = data;
_this.profile = _ref.profile;
if (responseType === 'text') {
if (data instanceof ArrayBuffer) {
_this.responseText = '';
const bytes = new Uint8Array(data);
const len = bytes.byteLength;
for (let i = 0; i < len; i++) {
_this.responseText += String.fromCharCode(bytes[i]);
}
}
else {
_this.responseText = data;
}
}
_changeReadyState.call(_this, XMLHttpRequest.DONE);
_triggerEvent.call(_this, 'load');
_triggerEvent.call(_this, 'loadend');
},
fail: function fail(_ref2) {
const { errMsg } = _ref2;
// TODO 规范错误
if (errMsg.indexOf('abort') !== -1) {
_triggerEvent.call(_this, 'abort');
}
else {
_triggerEvent.call(_this, 'error', errMsg);
}
_triggerEvent.call(_this, 'loadend');
},
});
}
},
}, {
key: 'setRequestHeader',
value: function setRequestHeader(header, value) {
const myHeader = _requestHeader.get(this);
myHeader[header] = value;
_requestHeader.set(this, myHeader);
},
}]);
return XMLHttpRequest;
}());
XMLHttpRequest.UNSEND = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
if (!isWK) {
exports.default = XMLHttpRequest;
}
/***/
}),
/* 20 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
const _socketTask = new WeakMap();
const WebSocket = (function () {
// TODO 更新 binaryType
// The connection is in the process of closing.
// The connection is not yet open.
function WebSocket(url) {
const _this = this;
const protocols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
_classCallCheck(this, WebSocket);
this.binaryType = '';
this.bufferedAmount = 0;
this.extensions = '';
this.onclose = null;
this.onerror = null;
this.onmessage = null;
this.onopen = null;
this.protocol = '';
this.readyState = 3;
if (typeof url !== 'string' || !/(^ws:\/\/)|(^wss:\/\/)/.test(url)) {
throw new TypeError(`Failed to construct 'WebSocket': The URL '${url}' is invalid`);
}
this.url = url;
this.readyState = WebSocket.CONNECTING;
const socketTask = wx.connectSocket({
url,
protocols: Array.isArray(protocols) ? protocols : [protocols],
});
_socketTask.set(this, socketTask);
socketTask.onClose((res) => {
_this.readyState = WebSocket.CLOSED;
if (typeof _this.onclose === 'function') {
_this.onclose(res);
}
});
socketTask.onMessage((res) => {
if (typeof _this.onmessage === 'function') {
_this.onmessage(res);
}
});
socketTask.onOpen(() => {
_this.readyState = WebSocket.OPEN;
if (typeof _this.onopen === 'function') {
_this.onopen();
}
});
socketTask.onError((res) => {
if (typeof _this.onerror === 'function') {
_this.onerror(new Error(res.errMsg));
}
});
return this;
} // TODO 小程序内目前获取不到,实际上需要根据服务器选择的 sub-protocol 返回
// TODO 更新 bufferedAmount
// The connection is closed or couldn't be opened.
// The connection is open and ready to communicate.
_createClass(WebSocket, [{
key: 'close',
value: function close(code, reason) {
this.readyState = WebSocket.CLOSING;
const socketTask = _socketTask.get(this);
socketTask.close({
code,
reason,
});
},
}, {
key: 'send',
value: function send(data) {
if (typeof data !== 'string' && !(data instanceof ArrayBuffer) && !((typeof data) === 'object')) {
throw new TypeError(`Failed to send message: The data ${data} is invalid`);
}
const socketTask = _socketTask.get(this);
socketTask.send({
data,
});
},
}]);
return WebSocket;
}());
WebSocket.CONNECTING = 0;
WebSocket.OPEN = 1;
WebSocket.CLOSING = 2;
WebSocket.CLOSED = 3;
exports.default = WebSocket;
/***/
}),
/* 21 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const _createClass = (function () {
function defineProperties(target, props) {
for (let i = 0; i < props.length; i++) {
const descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ('value' in descriptor)
descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
return function (Constructor, protoProps, staticProps) {
if (protoProps)
defineProperties(Constructor.prototype, protoProps);
if (staticProps)
defineProperties(Constructor, staticProps);
return Constructor;
};
}());
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError('Cannot call a class as a function');
}
}
/*
* TODO 使用 wx.readFile 来封装 FileReader
*/
const FileReader = (function () {
function FileReader() {
_classCallCheck(this, FileReader);
}
_createClass(FileReader, [{
key: 'construct',
value: function construct() { },
}]);
return FileReader;
}());
exports.default = FileReader;
/***/
}),
/* 22 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const localStorage = {
get length() {
const _wx$getStorageInfoSyn = wx.getStorageInfoSync();
const { keys } = _wx$getStorageInfoSyn;
return keys.length;
},
key: function key(n) {
const _wx$getStorageInfoSyn2 = wx.getStorageInfoSync();
const { keys } = _wx$getStorageInfoSyn2;
return keys[n];
},
getItem: function getItem(key) {
return wx.getStorageSync(key);
},
setItem: function setItem(key, value) {
return wx.setStorageSync(key, value);
},
removeItem: function removeItem(key) {
wx.removeStorageSync(key);
},
clear: function clear() {
wx.clearStorageSync();
},
};
exports.default = localStorage;
/***/
}),
/* 23 */
/***/ (function (module, exports) {
'use strict';
Object.defineProperty(exports, '__esModule', {
value: true,
});
const location = {
href: 'game.js',
reload: function reload() { },
};
exports.default = location;
/***/
}),
/** ****/
]));
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
// 消息类型
const messageType = {
config: 0,
writeFile: 1, // 写文件
};
// @ts-ignore SDK实际有暴露这几个API,但是协议里没有
const { createSharedArrayBuffer, getFileSystemManager } = worker;
const fs = getFileSystemManager ? getFileSystemManager() : null;
function compareVersion(_v1, _v2) {
return (_v1
.split('.')
.map(v => v.padStart(2, '0'))
.join('')
>= _v2
.split('.')
.map(v => v.padStart(2, '0'))
.join(''));
}
worker.onMessage((res) => {
const { type, payload } = res;
if (type === messageType.writeFile) {
const { filePath, data, isSharedBuffer } = payload;
let content = data;
if (isSharedBuffer) {
content = data.buffer;
}
if (!fs) {
console.error('getFileSystemManager不存在');
return;
}
fs.writeFile({
filePath,
data: content,
success: () => {
worker.postMessage({
type: messageType.writeFile,
payload: {
isok: true,
filePath,
},
});
},
fail: (err) => {
worker.postMessage({
type: messageType.writeFile,
payload: {
isok: false,
filePath,
err,
},
});
},
});
}
if (type === messageType.config) {
const { systemInfo } = payload;
const { platform, version } = systemInfo;
// 安卓才需要使用worker写文件
const isAndroid = platform.toLocaleLowerCase() === 'android';
// 8.0.18以下版本出现写文件报错
const isClientValid = compareVersion(version, '8.0.18');
worker.postMessage({
type: messageType.config,
payload: {
supportWorkerFs: isAndroid && !!fs && isClientValid,
supportSharedBuffer: isAndroid && !!createSharedArrayBuffer,
},
});
}
});
import SDK from './sdk.js'
const sdkBridgeMap = {
sdk: null,
initSdk: function(params) {
this.sdk = new SDK(params)
const resObj = {
type: 'initSdk'
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
},
getGameConf: async function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.getGameConf().then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'getGameConf',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
login: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
const {
query
} = wx.getEnterOptionsSync()
this.sdk
.login({
state: query.state || '',
query: query,
...params
})
.then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'login',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
updateUserInfo: async function() {
if (!this.sdk) return console.error('请初始化sdk')
wx.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户当前已授权,则可调用 wx.getUserInfo 获取用户最新个人信息
wx.getUserInfo({
success: (userInfo) => {
this.sdk
.updateUserInfo({
raw_data: userInfo.rawData,
signature: userInfo.signature,
encrypted_data: userInfo.encryptedData,
iv: userInfo.iv,
user_info: userInfo.userInfo
})
.then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'updateUserInfo',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
}
})
}
}
})
},
createOrder: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.createOrder(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'createOrder',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkOrder: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.checkOrder(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'checkOrder',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
getShareInfo: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.getShareInfo(params)
},
shareAppMessage: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.shareAppMessage(params)
},
updateRole: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.updateRole(params).then((res) => {
const resObj = {
type: 'updateRole',
result: res
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkMsg: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.checkMsg(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'checkMsg',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkImg: async function() {
if (!this.sdk) return console.error('请初始化sdk')
wx.chooseImage({
count: 1,
success: (res) => {
this.sdk
.checkImg({
filePath: res.tempFilePaths[0]
})
.then((res) => {
const result = res.data
const resObj = {
type: 'checkImg',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
fail: (res) => console.error(res)
})
},
customMessage: function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.customMessage()
},
subscribeMessage: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.subscribeMessage(params).then((res) => {
const resObj = {
type: 'subscribeMessage',
result: res
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
gameClubSetStyle: function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.gameClubSetStyle(params)
},
gameClubShow: function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.gameClubShow()
},
gameClubHide: function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.gameClubHide()
},
gameClubDecryptedData: async function() {
if (!this.sdk) return console.error('请初始化sdk')
wx.getGameClubData({
dataTypeList: [{
type: 1
}],
success: (getGameClubData) => {
this.sdk
.gameClubDecryptedData({
encryptedData: getGameClubData.encryptedData,
iv: getGameClubData.iv,
signature: getGameClubData.signature
})
.then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'gameClubDecryptedData',
result
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
fail: (res) => console.error(res)
})
},
roleEventReport: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.roleEventReport(params).then((res) => {
const resObj = {
type: 'roleEventReport',
result: res
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
adReport: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.adReport(params).then((res) => {
const resObj = {
type: 'adReport',
result: res
}
Module.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
}
}
function sdkBridge(fn, params) {
sdkBridgeMap[fn](params)
}
GameGlobal['wxSdkBridge'] = sdkBridge
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
function createUnityInstance(r,n,l){function s(e,r){if(!s.aborted&&n.showBanner)return"error"==r&&(s.aborted=!0),n.showBanner(e,r);switch(r){case"error":console.error(e);break;case"warning":console.warn(e);break;default:console.log(e)}}function t(e){var r=e.reason||e.error,n=r?r.toString():e.message||e.reason||"",t=r&&r.stack?r.stack.toString():"";(n+="\n"+(t=t.startsWith(n)?t.substring(n.length):t).trim())&&c.stackTraceRegExp&&c.stackTraceRegExp.test(n)&&m(n,e.filename||r&&(r.fileName||r.sourceURL)||"",e.lineno||r&&(r.lineNumber||r.line)||0)}function e(e,r,n){var t=e[r];void 0!==t&&t||(console.warn('Config option "'+r+'" is missing or empty. Falling back to default value: "'+n+'". Consider updating your WebGL template to include the missing config option.'),e[r]=n)}l=l||function(){};var o,c={canvas:r,webglContextAttributes:{preserveDrawingBuffer:!1,powerPreference:2},streamingAssetsUrl:"StreamingAssets",downloadProgress:{},deinitializers:[],intervals:{},setInterval:function(e,r){e=window.setInterval(e,r);return this.intervals[e]=!0,e},clearInterval:function(e){delete this.intervals[e],window.clearInterval(e)},preRun:[],postRun:[],print:function(e){console.log(e)},printErr:function(e){console.error(e),"string"==typeof e&&-1!=e.indexOf("wasm streaming compile failed")&&(-1!=e.toLowerCase().indexOf("mime")?s('HTTP Response Header "Content-Type" configured incorrectly on the server for file '+c.codeUrl+' , should be "application/wasm". Startup time performance will suffer.',"warning"):s('WebAssembly streaming compilation failed! This can happen for example if "Content-Encoding" HTTP header is incorrectly enabled on the server for file '+c.codeUrl+", but the file is not pre-compressed on disk (or vice versa). Check the Network tab in browser Devtools to debug server header configuration.","warning"))},locateFile:function(e){return"build.wasm"==e?this.codeUrl:e},disabledCanvasEvents:["contextmenu","dragstart"]};for(o in e(n,"companyName","Unity"),e(n,"productName","WebGL Player"),e(n,"productVersion","1.0"),n)c[o]=n[o];c.streamingAssetsUrl=new URL(c.streamingAssetsUrl,document.URL).href;var a=c.disabledCanvasEvents.slice();function i(e){e.preventDefault()}a.forEach(function(e){r.addEventListener(e,i)}),window.addEventListener("error",t),window.addEventListener("unhandledrejection",t);var d="",u="";function f(e){document.webkitCurrentFullScreenElement===r?r.style.width&&(d=r.style.width,u=r.style.height,r.style.width="100%",r.style.height="100%"):d&&(r.style.width=d,r.style.height=u,u=d="")}document.addEventListener("webkitfullscreenchange",f),c.deinitializers.push(function(){for(var e in c.disableAccessToMediaDevices(),a.forEach(function(e){r.removeEventListener(e,i)}),window.removeEventListener("error",t),window.removeEventListener("unhandledrejection",t),document.removeEventListener("webkitfullscreenchange",f),c.intervals)window.clearInterval(e);c.intervals={}}),c.QuitCleanup=function(){for(var e=0;e<c.deinitializers.length;e++)c.deinitializers[e]();c.deinitializers=[],"function"==typeof c.onQuit&&c.onQuit()};var h={Module:c,SetFullscreen:function(){if(c.SetFullscreen)return c.SetFullscreen.apply(c,arguments);c.print("Failed to set Fullscreen mode: Player not loaded yet.")},SendMessage:function(){if(c.SendMessage)return c.SendMessage.apply(c,arguments);c.print("Failed to execute SendMessage: Player not loaded yet.")},Quit:function(){return new Promise(function(e,r){c.shouldQuit=!0,c.onQuit=e})},GetMemoryInfo:function(){var e=c._getMemInfo();return{totalWASMHeapSize:c.HEAPU32[e>>2],usedWASMHeapSize:c.HEAPU32[1+(e>>2)],totalJSHeapSize:c.HEAPF64[1+(e>>3)],usedJSHeapSize:c.HEAPF64[2+(e>>3)]}}};function g(e,r,n){-1==e.indexOf("fullscreen error")&&(c.startupErrorHandler?c.startupErrorHandler(e,r,n):c.errorHandler&&c.errorHandler(e,r,n)||(console.log("Invoking error handler due to\n"+e),"function"==typeof dump&&dump("Invoking error handler due to\n"+e),g.didShowErrorMessage||(-1!=(e="An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:\n"+e).indexOf("DISABLE_EXCEPTION_CATCHING")?e="An exception has occurred, but exception handling has been disabled in this build. If you are the developer of this content, enable exceptions in your project WebGL player settings to be able to catch the exception or see the stack trace.":-1!=e.indexOf("Cannot enlarge memory arrays")?e="Out of memory. If you are the developer of this content, try allocating more memory to your WebGL build in the WebGL player settings.":-1==e.indexOf("Invalid array buffer length")&&-1==e.indexOf("Invalid typed array length")&&-1==e.indexOf("out of memory")&&-1==e.indexOf("could not allocate memory")||(e="The browser could not allocate enough memory for the WebGL content. If you are the developer of this content, try allocating less memory to your WebGL build in the WebGL player settings."),alert(e),g.didShowErrorMessage=!0)))}function p(e,r){var n="(wasm-function\\[)(\\d+)(\\])",t=new RegExp(n);return e.replace(new RegExp(n,"g"),function(e){e=e.match(t);return e[1]+(r[e[2]]?r[e[2]]+"@":"")+e[2]+e[3]})}function m(t,o,a){c.symbols?g(p(t,c.symbols),o,a):c.symbolsUrl?v("symbolsUrl").then(function(e){for(var r="",n=0;n<e.length;n++)r+=String.fromCharCode(e[n]);c.symbols=JSON.parse(r),g(p(t,c.symbols),o,a)}).catch(function(e){g(t,o,a)}):g(t,o,a)}function b(e,r){if("symbolsUrl"!=e){var n=c.downloadProgress[e],t=(n=n||(c.downloadProgress[e]={started:!1,finished:!1,lengthComputable:!1,total:0,loaded:0}),"object"!=typeof r||"progress"!=r.type&&"load"!=r.type||(n.started||(n.started=!0,n.lengthComputable=r.lengthComputable),n.total=r.total,n.loaded=r.loaded,"load"==r.type&&(n.finished=!0)),0),o=0,a=0,i=0,s=0;for(e in c.downloadProgress){if(!(n=c.downloadProgress[e]).started)return;a++,n.lengthComputable?(t+=n.loaded,o+=n.total,i++):n.finished||s++}l(.9*(a?(a-s-(o?i*(o-t)/o:0))/a:0))}}function v(n){b(n);var e=c.fetchWithProgress,r=c[n],r=/file:\/\//.exec(r)?"same-origin":void 0;return e(c[n],{method:"GET",companyName:c.companyName,productName:c.productName,productVersion:c.productVersion,control:"no-store",mode:r,onProgress:function(e){b(n,e)}}).then(function(e){return e.parsedBody}).catch(function(e){var r="Failed to download file "+c[n];"file:"==location.protocol?s(r+". Loading web pages via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host Unity content, or use the Unity Build and Run option.","error"):console.error(r)})}function w(){new Promise(function(a,e){var i=document.createElement("script");i.src=c.frameworkUrl,i.onload=function(){if("undefined"==typeof unityFramework||!unityFramework){var e,r=[["br","br"],["gz","gzip"]];for(e in r){var n,t=r[e];if(c.frameworkUrl.endsWith("."+t[0]))return n="Unable to parse "+c.frameworkUrl+"!","file:"==location.protocol?void s(n+" Loading pre-compressed (brotli or gzip) content via a file:// URL without a web server is not supported by this browser. Please use a local development web server to host compressed Unity content, or use the Unity Build and Run option.","error"):(n+=' This can happen if build compression was enabled but web server hosting the content was misconfigured to not serve the file with HTTP Response Header "Content-Encoding: '+t[1]+'" present. Check browser Console and Devtools Network tab to debug.',"br"==t[0]&&"http:"==location.protocol&&(t=-1!=["localhost","127.0.0.1"].indexOf(location.hostname)?"":"Migrate your server to use HTTPS.",n=/Firefox/.test(navigator.userAgent)?"Unable to parse "+c.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported in Firefox over HTTP connections. '+t+' See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1670675">https://bugzilla.mozilla.org/show_bug.cgi?id=1670675</a> for more information.':"Unable to parse "+c.frameworkUrl+'!<br>If using custom web server, verify that web server is sending .br files with HTTP Response Header "Content-Encoding: br". Brotli compression may not be supported over HTTP connections. Migrate your server to use HTTPS.'),void s(n,"error"))}s("Unable to parse "+c.frameworkUrl+"! The file is corrupt, or compression was misconfigured? (check Content-Encoding HTTP Response Header on web server)","error")}var o=unityFramework;unityFramework=null,i.onload=null,a(o)},i.onerror=function(e){s("Unable to load file "+c.frameworkUrl+"! Check that the file exists on the remote server. (also check browser Console and Devtools Network tab to debug)","error")},document.body.appendChild(i),c.deinitializers.push(function(){document.body.removeChild(i)})}).then(function(e){e(c)});var e=v("dataUrl");c.preRun.push(function(){c.addRunDependency("dataUrl"),e.then(function(e){var r=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0,t="UnityWebData1.0\0";if(!String.fromCharCode.apply(null,e.subarray(n,n+t.length))==t)throw"unknown data format";var o=r.getUint32(n+=t.length,!0);for(n+=4;n<o;){var a=r.getUint32(n,!0),i=(n+=4,r.getUint32(n,!0)),s=(n+=4,r.getUint32(n,!0)),l=(n+=4,String.fromCharCode.apply(null,e.subarray(n,n+s)));n+=s;for(var d=0,u=l.indexOf("/",d)+1;0<u;d=u,u=l.indexOf("/",d)+1)c.FS_createPath(l.substring(0,d),l.substring(d,u-1),!0,!0);c.FS_createDataFile(l,null,e.subarray(a,a+i),!0,!0,!0)}c.removeRunDependency("dataUrl")})})}return c.SystemInfo=function(){var e,r,n,t,o=navigator.userAgent+" ",a=[["Firefox","Firefox"],["OPR","Opera"],["Edg","Edge"],["SamsungBrowser","Samsung Browser"],["Trident","Internet Explorer"],["MSIE","Internet Explorer"],["Chrome","Chrome"],["CriOS","Chrome on iOS Safari"],["FxiOS","Firefox on iOS Safari"],["Safari","Safari"]];function i(e,r,n){return(e=RegExp(e,"i").exec(r))&&e[n]}for(var s=0;s<a.length;++s)if(r=i(a[s][0]+"[/ ](.*?)[ \\)]",o,1)){e=a[s][1];break}"Safari"==e&&(r=i("Version/(.*?) ",o,1)),"Internet Explorer"==e&&(r=i("rv:(.*?)\\)? ",o,1)||r);for(var l=[["Windows (.*?)[;)]","Windows"],["Android ([0-9_.]+)","Android"],["iPhone OS ([0-9_.]+)","iPhoneOS"],["iPad.*? OS ([0-9_.]+)","iPadOS"],["FreeBSD( )","FreeBSD"],["OpenBSD( )","OpenBSD"],["Linux|X11()","Linux"],["Mac OS X ([0-9_\\.]+)","MacOS"],["bot|google|baidu|bing|msn|teoma|slurp|yandex","Search Bot"]],d=0;d<l.length;++d)if(c=i(l[d][0],o,1)){n=l[d][1],c=c.replace(/_/g,".");break}var u,c={"NT 5.0":"2000","NT 5.1":"XP","NT 5.2":"Server 2003","NT 6.0":"Vista","NT 6.1":"7","NT 6.2":"8","NT 6.3":"8.1","NT 10.0":"10"}[c]||c,f=((f=document.createElement("canvas"))&&(u=(h=f.getContext("webgl2"))?2:0,h||(h=f&&f.getContext("webgl"))&&(u=1),h&&(t=h.getExtension("WEBGL_debug_renderer_info")&&h.getParameter(37446)||h.getParameter(7937))),"undefined"!=typeof SharedArrayBuffer),h="object"==typeof WebAssembly&&"function"==typeof WebAssembly.compile;return{width:screen.width,height:screen.height,userAgent:o.trim(),browser:e||"Unknown browser",browserVersion:r||"Unknown version",mobile:/Mobile|Android|iP(ad|hone)/.test(navigator.appVersion),os:n||"Unknown OS",osVersion:c||"Unknown OS Version",gpu:t||"Unknown GPU",language:navigator.userLanguage||navigator.language,hasWebGL:u,hasCursorLock:!!document.body.requestPointerLock,hasFullscreen:!!document.body.requestFullscreen||!!document.body.webkitRequestFullscreen,hasThreads:f,hasWasm:h,hasWasmThreads:!1}}(),c.abortHandler=function(e){return m(e,"",0),!0},Error.stackTraceLimit=Math.max(Error.stackTraceLimit||0,50),c.readBodyWithProgress=function(a,i,s){var e=a.body?a.body.getReader():void 0,l=void 0!==a.headers.get("Content-Length"),d=function(e,r){if(!r)return 0;var r=e.headers.get("Content-Encoding"),n=parseInt(e.headers.get("Content-Length")),t=536870912;switch(r){case"br":return Math.min(Math.round(2*n),t);case"gzip":return Math.min(Math.round(1.6*n),t);default:return n}}(a,l),u=new Uint8Array(d),c=[],f=0,h=0;return l||console.warn("[UnityCache] Response is served without Content-Length header. Please reconfigure server to include valid Content-Length for better download performance."),function o(){return void 0===e?a.arrayBuffer().then(function(e){var r=new Uint8Array(e);return i({type:"progress",response:a,total:e.length,loaded:0,lengthComputable:l,chunk:s?r:null}),r}):e.read().then(function(e){if(e.done){if(f===d)return u;if(f<d)return u.slice(0,f);for(var r=new Uint8Array(f),n=(r.set(u,0),h),t=0;t<c.length;++t)r.set(c[t],n),n+=c[t].length;return r}return f+e.value.length<=u.length?(u.set(e.value,f),h=f+e.value.length):c.push(e.value),f+=e.value.length,i({type:"progress",response:a,total:Math.max(d,f),loaded:f,lengthComputable:l,chunk:s?e.value:null}),o()})}().then(function(e){return i({type:"load",response:a,total:e.length,loaded:e.length,lengthComputable:l,chunk:null}),a.parsedBody=e,a})},c.fetchWithProgress=function(e,r){var n=function(){};return r&&r.onProgress&&(n=r.onProgress),fetch(e,r).then(function(e){return c.readBodyWithProgress(e,n,r.enableStreamingDownload)})},new Promise(function(e,r){c.SystemInfo.hasWebGL?c.SystemInfo.hasWasm?(c.startupErrorHandler=r,l(0),c.postRun.push(function(){l(1),delete c.startupErrorHandler,e(h)}),w()):r("Your browser does not support WebAssembly."):r("Your browser does not support WebGL.")})}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
var _0xe8b=(322362^322365)+(493575^493583);var __assign=this&&this['\u005F\u005F\u0061\u0073\u0073\u0069\u0067\u006E']||function(){__assign=Object['\u0061\u0073\u0073\u0069\u0067\u006E']||function(t){for(var s,i=960511^960510,n=arguments['\u006C\u0065\u006E\u0067\u0074\u0068'];i<n;i++){s=arguments[i];for(var p in s)if(Object['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0068\u0061\u0073\u004F\u0077\u006E\u0050\u0072\u006F\u0070\u0065\u0072\u0074\u0079']['\u0063\u0061\u006C\u006C'](s,p))t[p]=s[p];}return t;};return __assign['\u0061\u0070\u0070\u006C\u0079'](this,arguments);};_0xe8b='\u0062\u0068\u0062\u0067\u0065\u0065';var __awaiter=this&&this['\u005F\u005F\u0061\u0077\u0061\u0069\u0074\u0065\u0072']||function(thisArg,_arguments,P,generator){function _0x25638c(value){return value instanceof P?value:new P(function(resolve){resolve(value);});}return new(P||(P=Promise))(function(resolve,reject){function _0x9f_0x179(value){try{_0x4cf71b(generator['\u006E\u0065\u0078\u0074'](value));}catch(e){reject(e);}}function _0x7e49be(value){try{_0x4cf71b(generator["\u0074\u0068\u0072\u006F\u0077"](value));}catch(e){reject(e);}}function _0x4cf71b(result){result['\u0064\u006F\u006E\u0065']?resolve(result['\u0076\u0061\u006C\u0075\u0065']):_0x25638c(result['\u0076\u0061\u006C\u0075\u0065'])['\u0074\u0068\u0065\u006E'](_0x9f_0x179,_0x7e49be);}_0x4cf71b((generator=generator['\u0061\u0070\u0070\u006C\u0079'](thisArg,_arguments||[]))['\u006E\u0065\u0078\u0074']());});};var __generator=this&&this['\u005F\u005F\u0067\u0065\u006E\u0065\u0072\u0061\u0074\u006F\u0072']||function(thisArg,body){var _={'\u006C\u0061\u0062\u0065\u006C':0,'\u0073\u0065\u006E\u0074':function(){if(t[815463^815463]&(187208^187209))throw t[409537^409536];return t[535037^535036];},'\u0074\u0072\u0079\u0073':[],'\u006F\u0070\u0073':[]},f,y,t,g;return g={'\u006E\u0065\u0078\u0074':_0xf2a6f(324481^324481),"\u0074\u0068\u0072\u006F\u0077":_0xf2a6f(215705^215704),"\u0072\u0065\u0074\u0075\u0072\u006E":_0xf2a6f(638838^638836)},typeof Symbol==="noitcnuf".split("").reverse().join("")&&(g[Symbol['\u0069\u0074\u0065\u0072\u0061\u0074\u006F\u0072']]=function(){return this;}),g;function _0xf2a6f(n){return function(v){return _0x50ea5a([n,v]);};}function _0x50ea5a(op){if(f)throw new TypeError("\u0047\u0065\u006E\u0065\u0072\u0061\u0074\u006F\u0072\u0020\u0069\u0073\u0020\u0061\u006C\u0072\u0065\u0061\u0064\u0079\u0020\u0065\u0078\u0065\u0063\u0075\u0074\u0069\u006E\u0067\u002E");while(g&&(g=956393^956393,op[929738^929738]&&(_=893103^893103)),_)try{if(f=650893^650892,y&&(t=op[446781^446781]&(809380^809382)?y["\u0072\u0065\u0074\u0075\u0072\u006E"]:op[229582^229582]?y["\u0074\u0068\u0072\u006F\u0077"]||((t=y["\u0072\u0065\u0074\u0075\u0072\u006E"])&&t['\u0063\u0061\u006C\u006C'](y),829026^829026):y['\u006E\u0065\u0078\u0074'])&&!(t=t['\u0063\u0061\u006C\u006C'](y,op[192145^192144]))['\u0064\u006F\u006E\u0065'])return t;if(y=488380^488380,t)op=[op[273792^273792]&(479948^479950),t['\u0076\u0061\u006C\u0075\u0065']];switch(op[924327^924327]){case 744729^744729:case 293633^293632:t=op;break;case 203206^203202:_['\u006C\u0061\u0062\u0065\u006C']++;return{"value":op[728708^728709],'\u0064\u006F\u006E\u0065':false};case 622690^622695:_['\u006C\u0061\u0062\u0065\u006C']++;y=op[538598^538599];op=[810508^810508];continue;case 126772^126771:op=_['\u006F\u0070\u0073']['\u0070\u006F\u0070']();_['\u0074\u0072\u0079\u0073']['\u0070\u006F\u0070']();continue;default:if(!(t=_['\u0074\u0072\u0079\u0073'],t=t['\u006C\u0065\u006E\u0067\u0074\u0068']>(897152^897152)&&t[t['\u006C\u0065\u006E\u0067\u0074\u0068']-(907015^907014)])&&(op[639371^639371]===(697366^697360)||op[981967^981967]===(737907^737905))){_=729941^729941;continue;}if(op[278809^278809]===(990954^990953)&&(!t||op[758838^758839]>t[850300^850300]&&op[387493^387492]<t[435739^435736])){_['\u006C\u0061\u0062\u0065\u006C']=op[386283^386282];break;}if(op[663572^663572]===(161621^161619)&&_['\u006C\u0061\u0062\u0065\u006C']<t[659607^659606]){_['\u006C\u0061\u0062\u0065\u006C']=t[359055^359054];t=op;break;}if(t&&_['\u006C\u0061\u0062\u0065\u006C']<t[846045^846047]){_['\u006C\u0061\u0062\u0065\u006C']=t[869709^869711];_['\u006F\u0070\u0073']['\u0070\u0075\u0073\u0068'](op);break;}if(t[776480^776482])_['\u006F\u0070\u0073']['\u0070\u006F\u0070']();_['\u0074\u0072\u0079\u0073']['\u0070\u006F\u0070']();continue;}op=body['\u0063\u0061\u006C\u006C'](thisArg,_);}catch(e){op=[851321^851327,e];y=737146^737146;}finally{f=t=303353^303353;}if(op[132303^132303]&(275124^275121))throw op[694323^694322];return{"value":op[578117^578117]?op[690277^690276]:void(650817^650817),'\u0064\u006F\u006E\u0065':!![]};}};var _0xb52ge;var zwsdk=function(){function _0x38a(){this['\u0056\u0045\u0052\u0053\u0049\u004F\u004E']=_0x38a['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];var _0x95256e;var _0x7de9b=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(865508^865508)&&void(632281^632281)!==arguments[713028^713028]?arguments[254374^254374]:null;_0x95256e=768578^768579;_0x38a['\u0056\u0045\u0052\u0053\u0049\u004F\u004E']=this['\u0056\u0045\u0052\u0053\u0049\u004F\u004E'];var _0x6ee48d=tt['\u0067\u0065\u0074\u004C\u0061\u0075\u006E\u0063\u0068\u004F\u0070\u0074\u0069\u006F\u006E\u0073\u0053\u0079\u006E\u0063']()['\u0071\u0075\u0065\u0072\u0079'];if(_0x7de9b){_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']=_0x7de9b['\u0061\u0070\u0070\u005F\u0069\u0064'];_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064']=_0x7de9b['\u0067\u0061\u006D\u0065\u005F\u0069\u0064'];_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073']=_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004F\u0053']();_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072']=_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004E\u0075\u006D\u0062\u0065\u0072']();_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064']=_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0042\u0072\u0061\u006E\u0064']();_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']=_0x7de9b['\u0064\u0065\u0076']?"pot.30jklwwz.ipasz//:sptth".split("").reverse().join(""):"moc.nawgnahzow.ipauoyz//:sptth".split("").reverse().join("");_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0071\u0075\u0065\u0072\u0079']=_0x6ee48d;_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0074\u0061\u0074\u0065']=_0x38a['\u0067\u0065\u0074\u0053\u0074\u0061\u0074\u0065'](_0x6ee48d);var _0xf0151f;var _0x971g=tt['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];_0xf0151f=(312682^312687)+(106655^106653);console['\u006C\u006F\u0067']("\u006C\u0069\u0062\u0020\u0076\u0065\u0072\u0073\u0069\u006F\u006E\u003A"+_0x971g);if(_0x38a['\u0073\u0065\u006C\u0066\u0043\u006F\u006D\u0070\u0061\u0072\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E'](_0x971g,"\u0031\u002E\u0030\u002E\u0030")>=(182982^182982)){tt['\u0073\u0065\u0074\u004B\u0065\u0065\u0070\u0053\u0063\u0072\u0065\u0065\u006E\u004F\u006E']({'\u006B\u0065\u0065\u0070\u0053\u0063\u0072\u0065\u0065\u006E\u004F\u006E':!![]});console['\u006C\u006F\u0067']("\u5C4F\u606F\u4E0D\u7F6E\u8BBE".split("").reverse().join(""));}else{}}}_0x38a['\u0073\u0065\u006C\u0066\u0043\u006F\u006D\u0070\u0061\u0072\u0065\u0056\u0065\u0072\u0073\u0069\u006F\u006E']=function(v1,v2){v1=v1['\u0073\u0070\u006C\u0069\u0074']("\u002E");v2=v2['\u0073\u0070\u006C\u0069\u0074']("\u002E");var _0xb6f55e=Math['\u006D\u0061\u0078'](v1['\u006C\u0065\u006E\u0067\u0074\u0068'],v2['\u006C\u0065\u006E\u0067\u0074\u0068']);while(v1['\u006C\u0065\u006E\u0067\u0074\u0068']<_0xb6f55e){v1['\u0070\u0075\u0073\u0068']("\u0030");}while(v2['\u006C\u0065\u006E\u0067\u0074\u0068']<_0xb6f55e){v2['\u0070\u0075\u0073\u0068']("\u0030");}for(var i=394039^394039;i<_0xb6f55e;i++){var _0x3de3ab=parseInt(v1[i]);var _0x84ff;var _0xd1baf=parseInt(v2[i]);_0x84ff=902395^902399;if(_0x3de3ab>_0xd1baf){return 156812^156813;}else if(_0x3de3ab<_0xd1baf){return-(523730^523731);}}return 600332^600332;};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u0047\u0061\u006D\u0065\u0043\u006F\u006E\u0066']=function(){return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0067\u0061\u006D\u0065\u002F\u0067\u0065\u0074\u0043\u006F\u006E\u0066",{'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0076\u0065\u0072\u0073\u0069\u006F\u006E':'1.1'})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(490009^490008)){_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0043\u006F\u006E\u0066\u0069\u0067']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061'];}resolve(res);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u006C\u006F\u0067\u0069\u006E']=function(){var _0x9226b=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(872956^872956)&&void(276995^276995)!==arguments[629486^629486]?arguments[367958^367958]:{};return new Promise(function(resolve,rej){tt['\u006C\u006F\u0067\u0069\u006E']({"force":!![],'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(_a){var _0x8cabfb=_a['\u0063\u006F\u0064\u0065'],_0x881fd=_a['\u0061\u006E\u006F\u006E\u0079\u006D\u006F\u0075\u0073\u0043\u006F\u0064\u0065'],_0xad971e=_a['\u0069\u0073\u004C\u006F\u0067\u0069\u006E'];var _0xgd53dg={"is_login":_0xad971e,'\u0073\u0074\u0061\u0074\u0065':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0073\u0074\u0061\u0074\u0065'],'\u0071\u0075\u0065\u0072\u0079':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0071\u0075\u0065\u0072\u0079'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"os":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064']};_0xgd53dg['\u0063\u006F\u0064\u0065']=_0x8cabfb;_0xgd53dg['\u0061\u006E\u006F\u006E\u0079\u006D\u006F\u0075\u0073\u005F\u0063\u006F\u0064\u0065']=_0x881fd;_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0061\u0075\u0074\u0068\u002F\u006C\u006F\u0067\u0069\u006E",_0xgd53dg)['\u0074\u0068\u0065\u006E'](function(res){var _0xbc189b=(192753^192755)+(489847^489844);var _0x0d7g=res;_0xbc189b=(332771^332775)+(855014^855009);if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(386894^386895)){_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0075\u0073\u0065\u0072\u005F\u0074\u006F\u006B\u0065\u006E'];_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064'];_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0069\u0073\u0056\u0069\u0070']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0069\u0073\u005F\u0076\u0069\u0070'];_0x38a['\u0069\u006E\u0069\u0074\u0053\u0068\u0061\u0072\u0065']();resolve(_0x0d7g);}else{tt['\u0073\u0068\u006F\u0077\u004D\u006F\u0064\u0061\u006C']({"title":"\u5F02\u5E38",'\u0063\u006F\u006E\u0074\u0065\u006E\u0074':res['\u006D\u0073\u0067'],"confirmText":"\u6211\u77E5\u9053\u4E86","showCancel":false});}});}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0075\u0070\u0064\u0061\u0074\u0065\u0055\u0073\u0065\u0072\u0049\u006E\u0066\u006F']=function(){var _0x36399b=(542564^542566)+(242232^242225);var _0x02efd=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(855960^855960)&&void(993814^993814)!==arguments[369412^369412]?arguments[254735^254735]:{};_0x36399b=388361^388361;return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u006D\u0065\u006D\u0062\u0065\u0072\u002F\u0075\u0070\u0064\u0061\u0074\u0065\u0049\u006E\u0066\u006F",{"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"raw_data":_0x02efd['\u0072\u0061\u0077\u005F\u0064\u0061\u0074\u0061']||'','\u0073\u0069\u0067\u006E\u0061\u0074\u0075\u0072\u0065':_0x02efd['\u0073\u0069\u0067\u006E\u0061\u0074\u0075\u0072\u0065']||'',"encrypted_data":_0x02efd['\u0065\u006E\u0063\u0072\u0079\u0070\u0074\u0065\u0064\u005F\u0064\u0061\u0074\u0061']||'',"iv":_0x02efd['\u0069\u0076']||'','\u0075\u0073\u0065\u0072\u005F\u0069\u006E\u0066\u006F':_0x02efd['\u0075\u0073\u0065\u0072\u005F\u0069\u006E\u0066\u006F']||''})['\u0074\u0068\u0065\u006E'](function(res){_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0072\u006F\u006C\u0065\u0049\u0064']=res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'';resolve(res);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0061\u0077\u0065\u006D\u0065\u0050\u0061\u0079']=function(){var _0xcgf=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(860938^860938)&&void(414046^414046)!==arguments[136381^136381]?arguments[951565^951565]:{};return new Promise(function(resolve,reject){tt['\u006F\u0070\u0065\u006E\u0041\u0077\u0065\u006D\u0065\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065']({"buyQuantity":_0xcgf['\u0062\u0075\u0079\u0051\u0075\u0061\u006E\u0074\u0069\u0074\u0079']||782770^782806,'\u0063\u0075\u0073\u0074\u006F\u006D\u0049\u0064':_0xcgf['\u0063\u0075\u0073\u0074\u006F\u006D\u0049\u0064']||'','\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0054\u0079\u0070\u0065':_0xcgf['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065']||"\u0044\u0049\u0041\u004D\u004F\u004E\u0044",'\u007A\u006F\u006E\u0065\u0049\u0064':_0xcgf['\u007A\u006F\u006E\u0065\u0049\u0064']||"\u0031","extraInfo":_0xcgf['\u0065\u0078\u0074\u0072\u0061\u0049\u006E\u0066\u006F']||'',"success":function(res){resolve({'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,"msg":"\u652F\u4ED8\u6210\u529F","data":res});console['\u006C\u006F\u0067']("\u8C03\u7528\u51FD\u6570\u6210\u529F",res);},'\u0066\u0061\u0069\u006C':function(res){reject({"status_code":-(913434^913435),'\u006D\u0073\u0067':"\u652F\u4ED8\u5931\u8D25",'\u0064\u0061\u0074\u0061':res});console['\u006C\u006F\u0067']("\u8D25\u5931\u6570\u51FD\u7528\u8C03".split("").reverse().join(""),res);},'\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065':function(res){console['\u006C\u006F\u0067']("\u8C03\u7528\u5B8C\u6210",res);}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0072\u0065\u0061\u0074\u0065\u004F\u0072\u0064\u0065\u0072']=function(){var _0x6g600d=this;var _0xc749gf;var _0x20866e=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(663940^663940)&&void(742071^742071)!==arguments[969351^969351]?arguments[543488^543488]:{};_0xc749gf="bkmmlm".split("").reverse().join("");if(_0x20866e['\u006F\u0072\u0064\u0065\u0072']&&_0x20866e['\u006F\u0072\u0064\u0065\u0072']['\u0070\u0061\u0079\u005F\u0074\u0079\u0070\u0065']==="yap_tcerid_kotkit".split("").reverse().join("")&&!tt['\u0063\u0061\u006E\u0049\u0055\u0073\u0065']("\u006F\u0070\u0065\u006E\u0041\u0077\u0065\u006D\u0065\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065\u002E\u006F\u0062\u006A\u0065\u0063\u0074\u002E\u0067\u006F\u006F\u0064\u0054\u0079\u0070\u0065")&&!tt['\u0063\u0061\u006E\u0049\u0055\u0073\u0065']("\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0047\u0061\u006D\u0065\u0050\u0061\u0079\u006D\u0065\u006E\u0074\u002E\u006F\u0062\u006A\u0065\u0063\u0074\u002E\u0067\u006F\u006F\u0064\u0054\u0079\u0070\u0065")){tt['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074']({'\u0074\u0069\u0074\u006C\u0065':'请升级App版本',"icon":"\u006E\u006F\u006E\u0065"});}return new Promise(function(resolve,rej){return __awaiter(_0x6g600d,void(563848^563848),void(166441^166441),function(){var _0x61583c,_0x4f8b,_0x58f,_0x2881d,_0x1b344d,_0xge6c,_0xb1cf,_0xce_0x1a4,_0x45128a,_0x2_0x208,mode,env,offer_id,currency_type,platform,buy_quantity,zone_id,extra_info,_0x9bf4f,mode,env,offer_id,currency_type,platform,buy_quantity,zone_id,extra_info,_0x3_0x542,_0x1b3bcd,_0x4g4bd;return __generator(this,function(_g){switch(_g['\u006C\u0061\u0062\u0065\u006C']){case 378170^378170:return[295118^295114,_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u006F\u0072\u0064\u0065\u0072\u002F\u0063\u0072\u0065\u0061\u0074\u0065",{"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"os":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072'],"device_brand":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],'\u006F\u0072\u0064\u0065\u0072':_0x20866e['\u006F\u0072\u0064\u0065\u0072']||{},"role":_0x20866e['\u0072\u006F\u006C\u0065']||{},"role_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0072\u006F\u006C\u0065\u0049\u0064']})];case 701204^701205:_0x61583c=_g['\u0073\u0065\u006E\u0074']();if(_0x61583c['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(839438^839439)){resolve({"status_code":_0x61583c['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065'],"msg":_0x61583c['\u006D\u0073\u0067'],'\u0064\u0061\u0074\u0061':{"data":{"dy_pay":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']||{},'\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']}}});_0x4f8b=_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061'],_0x58f=_0x4f8b['\u0070\u0061\u0079\u005F\u0074\u0079\u0070\u0065'],_0x2881d=_0x4f8b['\u0070\u0061\u0079\u005F\u0074\u0069\u0074\u006C\u0065'],_0x1b344d=_0x2881d===void(816750^816750)?'':_0x2881d,_0xge6c=_0x4f8b['\u0070\u0061\u0079\u005F\u0063\u006F\u006E\u0074\u0065\u006E\u0074'],_0xb1cf=_0xge6c===void(835580^835580)?'':_0xge6c,_0xce_0x1a4=_0x4f8b['\u0070\u0061\u0079\u005F\u0062\u0075\u0074\u0074\u006F\u006E\u005F\u0074\u0065\u0078\u0074'],_0x45128a=_0xce_0x1a4===void(338282^338282)?'':_0xce_0x1a4;if(_0x58f==="yapinimniyuod".split("").reverse().join("")){_0x2_0x208=_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079'],mode=_0x2_0x208['\u006D\u006F\u0064\u0065'],env=_0x2_0x208['\u0065\u006E\u0076'],offer_id=_0x2_0x208['\u006F\u0066\u0066\u0065\u0072\u005F\u0069\u0064'],currency_type=_0x2_0x208['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065'],platform=_0x2_0x208['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'],buy_quantity=_0x2_0x208['\u0062\u0075\u0079\u005F\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079'],zone_id=_0x2_0x208['\u007A\u006F\u006E\u0065\u005F\u0069\u0064'],extra_info=_0x2_0x208['\u0065\u0078\u0074\u0072\u0061\u005F\u0069\u006E\u0066\u006F'];tt['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0047\u0061\u006D\u0065\u0050\u0061\u0079\u006D\u0065\u006E\u0074']({'\u006D\u006F\u0064\u0065':mode,'\u0065\u006E\u0076':env,'\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0054\u0079\u0070\u0065':currency_type,"platform":platform,'\u0062\u0075\u0079\u0051\u0075\u0061\u006E\u0074\u0069\u0074\u0079':buy_quantity,'\u007A\u006F\u006E\u0065\u0049\u0064':zone_id,"customId":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],'\u0065\u0078\u0074\u0072\u0061\u0049\u006E\u0066\u006F':extra_info,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(payInfo){console['\u006C\u006F\u0067']("\u0073\u0075\u0063\u0063\u0065\u0073\u0073\u0020\u0070\u0061\u0079\u0049\u006E\u0066\u006F\u003A",payInfo);_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B",{'\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'','\u0073\u0074\u0061\u0074\u0075\u0073':!![],"code":payInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065'],'\u006D\u0073\u0067':payInfo['\u0065\u0072\u0072\u004D\u0073\u0067']})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](":kcabllaCyapyd/yap/kds_kotkit/".split("").reverse().join(""),res);});},'\u0066\u0061\u0069\u006C':function(payInfo){console['\u006C\u006F\u0067']("\u0066\u0061\u0069\u006C\u0020\u0070\u0061\u0079\u0049\u006E\u0066\u006F\u003A",payInfo);_0x38a['\u0061\u006A\u0061\u0078']("kcabllaCyapyd/yap/kds_kotkit/".split("").reverse().join(""),{"order_id":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'',"status":false,'\u0063\u006F\u0064\u0065':payInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065'],"msg":payInfo['\u0065\u0072\u0072\u004D\u0073\u0067']})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B\u003A",res);});}});}if(_0x58f==="\u0064\u006F\u0075\u0079\u0069\u006E\u0069\u006F\u0073\u0061\u0075\u0074\u006F\u0070\u0061\u0079"){tt['\u0073\u0065\u0074\u0043\u006C\u0069\u0070\u0062\u006F\u0061\u0072\u0064\u0044\u0061\u0074\u0061']({"data":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0063\u006F\u0064\u0065\u005F\u0075\u0072\u006C'],"success":function(){tt['\u0073\u0068\u006F\u0077\u004D\u006F\u0064\u0061\u006C']({"title":_0x1b344d,'\u0063\u006F\u006E\u0074\u0065\u006E\u0074':_0xb1cf,'\u0063\u006F\u006E\u0066\u0069\u0072\u006D\u0054\u0065\u0078\u0074':_0x45128a,'\u0073\u0068\u006F\u0077\u0043\u0061\u006E\u0063\u0065\u006C':false,"success":function(res){},'\u0066\u0061\u0069\u006C':function(res){}});console['\u006C\u006F\u0067'](":sseccus ataDdraobpilCtes".split("").reverse().join(""),_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0063\u006F\u0064\u0065\u005F\u0075\u0072\u006C']);},'\u0066\u0061\u0069\u006C':function(){console['\u006C\u006F\u0067'](":liaf ataDdraobpilCtes".split("").reverse().join(""),_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0063\u006F\u0064\u0065\u005F\u0075\u0072\u006C']);}});}if(_0x58f==="\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0064\u0069\u0061\u006D\u006F\u006E\u0064"){tt['\u006F\u0070\u0065\u006E\u0041\u0077\u0065\u006D\u0065\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065']({"buyQuantity":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0062\u0075\u0079\u005F\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079']||243461^243553,"customId":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'','\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0054\u0079\u0070\u0065':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065']||"DNOMAID".split("").reverse().join(""),'\u007A\u006F\u006E\u0065\u0049\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u007A\u006F\u006E\u0065\u005F\u0069\u0064']||"\u0031",'\u0065\u0078\u0074\u0072\u0061\u0049\u006E\u0066\u006F':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0065\u0078\u0074\u0072\u0061\u005F\u0069\u006E\u0066\u006F']||'','\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){console['\u006C\u006F\u0067']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0064\u0069\u0061\u006D\u006F\u006E\u0064\u005F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B\u003A",res);},'\u0066\u0061\u0069\u006C':function(res){console['\u006C\u006F\u0067']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0064\u0069\u0061\u006D\u006F\u006E\u0064\u005F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B\u003A",res);}});}if(_0x58f==="yap_tcerid_kotkit".split("").reverse().join("")){if(_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073']==="\u0061\u006E\u0064\u0072\u006F\u0069\u0064"){_0x9bf4f=_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079'],mode=_0x9bf4f['\u006D\u006F\u0064\u0065'],env=_0x9bf4f['\u0065\u006E\u0076'],offer_id=_0x9bf4f['\u006F\u0066\u0066\u0065\u0072\u005F\u0069\u0064'],currency_type=_0x9bf4f['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065'],platform=_0x9bf4f['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'],buy_quantity=_0x9bf4f['\u0062\u0075\u0079\u005F\u0071\u0075\u0061\u006E\u0074\u0069\u0074\u0079'],zone_id=_0x9bf4f['\u007A\u006F\u006E\u0065\u005F\u0069\u0064'],extra_info=_0x9bf4f['\u0065\u0078\u0074\u0072\u0061\u005F\u0069\u006E\u0066\u006F'],_0x3_0x542=_0x9bf4f['\u0067\u006F\u006F\u0064\u005F\u0074\u0079\u0070\u0065'],_0x1b3bcd=_0x9bf4f['\u006F\u0072\u0064\u0065\u0072\u005F\u0061\u006D\u006F\u0075\u006E\u0074'],_0x4g4bd=_0x9bf4f['\u0067\u006F\u006F\u0064\u005F\u006E\u0061\u006D\u0065'];tt['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0047\u0061\u006D\u0065\u0050\u0061\u0079\u006D\u0065\u006E\u0074']({"mode":mode,'\u0065\u006E\u0076':env,'\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0054\u0079\u0070\u0065':currency_type,'\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D':platform,'\u0062\u0075\u0079\u0051\u0075\u0061\u006E\u0074\u0069\u0074\u0079':buy_quantity,'\u007A\u006F\u006E\u0065\u0049\u0064':zone_id,"customId":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064'],"extraInfo":extra_info,"goodType":_0x3_0x542||560049^560051,'\u006F\u0072\u0064\u0065\u0072\u0041\u006D\u006F\u0075\u006E\u0074':_0x1b3bcd,"goodName":_0x4g4bd,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(payInfo){console['\u006C\u006F\u0067']("\u0073\u0075\u0063\u0063\u0065\u0073\u0073\u0020\u0070\u0061\u0079\u0049\u006E\u0066\u006F\u003A",payInfo);_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B",{'\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'',"status":!![],"code":payInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065'],'\u006D\u0073\u0067':payInfo['\u0065\u0072\u0072\u004D\u0073\u0067']})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](":kcabllaCyapyd/yap/kds_kotkit/".split("").reverse().join(""),res);});},"fail":function(payInfo){console['\u006C\u006F\u0067']("\u0066\u0061\u0069\u006C\u0020\u0070\u0061\u0079\u0049\u006E\u0066\u006F\u003A",payInfo);_0x38a['\u0061\u006A\u0061\u0078']("kcabllaCyapyd/yap/kds_kotkit/".split("").reverse().join(""),{"order_id":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'','\u0073\u0074\u0061\u0074\u0075\u0073':false,'\u0063\u006F\u0064\u0065':payInfo['\u0065\u0072\u0072\u0043\u006F\u0064\u0065'],"msg":payInfo['\u0065\u0072\u0072\u004D\u0073\u0067']})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B\u003A",res);});}});}else{tt['\u006F\u0070\u0065\u006E\u0041\u0077\u0065\u006D\u0065\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065']({'\u0063\u0075\u0073\u0074\u006F\u006D\u0049\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u006F\u0072\u0064\u0065\u0072\u005F\u0069\u0064']||'','\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u0054\u0079\u0070\u0065':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0063\u0075\u0072\u0072\u0065\u006E\u0063\u0079\u005F\u0074\u0079\u0070\u0065']||"DNOMAID".split("").reverse().join(""),'\u007A\u006F\u006E\u0065\u0049\u0064':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u007A\u006F\u006E\u0065\u005F\u0069\u0064']||"\u0031",'\u0065\u0078\u0074\u0072\u0061\u0049\u006E\u0066\u006F':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0065\u0078\u0074\u0072\u0061\u005F\u0069\u006E\u0066\u006F']||'',"goodType":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0067\u006F\u006F\u0064\u005F\u0074\u0079\u0070\u0065']||101679^101677,'\u006F\u0072\u0064\u0065\u0072\u0041\u006D\u006F\u0075\u006E\u0074':_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u006F\u0072\u0064\u0065\u0072\u005F\u0061\u006D\u006F\u0075\u006E\u0074'],"goodName":_0x61583c['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0064\u0079\u005F\u0070\u0061\u0079']['\u0067\u006F\u006F\u0064\u005F\u006E\u0061\u006D\u0065'],'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){console['\u006C\u006F\u0067'](":kcabllaCyapyd/yap_dnomaid/kds_kotkit/".split("").reverse().join(""),res);},"fail":function(res){console['\u006C\u006F\u0067']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0064\u0069\u0061\u006D\u006F\u006E\u0064\u005F\u0070\u0061\u0079\u002F\u0064\u0079\u0070\u0061\u0079\u0043\u0061\u006C\u006C\u0062\u0061\u0063\u006B\u003A",res);}});}}}else{resolve(_0x61583c);}return[916619^916617];}});});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u004F\u0072\u0064\u0065\u0072']=function(){var _0x36f7e=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(417867^417867)&&void(340990^340990)!==arguments[447892^447892]?arguments[239281^239281]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("sutatSyaPteg/redro/kds_kotkit/".split("").reverse().join(""),{'\u006F\u0072\u0064\u0065\u0072':_0x36f7e['\u006F\u0072\u0064\u0065\u0072']})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x38a['\u0069\u006E\u0069\u0074\u0053\u0068\u0061\u0072\u0065']=function(){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F",{"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(867255^867254)){tt['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x38a['\u006C\u006F\u0067']("\u7CFB\u7EDF\u8F6C\u53D1\u003A\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0070\u0061\u0072\u0061\u006D\u0073':{"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064']},'\u0072\u0065\u0073\u0075\u006C\u0074':res});_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({"share_id":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});return{'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],"imageUrl":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],"query":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']};});tt['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075\u003A\u0073\u0075\u0063\u0063\u0065\u0073\u0073");},'\u0066\u0061\u0069\u006C':function(){console['\u006C\u006F\u0067']("liaf:uneMerahSwohs".split("").reverse().join(""));}});}});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F']=function(){var _0x837d3d=(785653^785649)+(576341^576340);var _0xg9c=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(422429^422429)&&void(821608^821608)!==arguments[730291^730291]?arguments[493706^493706]:{};_0x837d3d='\u0069\u0064\u0066\u0070\u0066\u006B';_0x38a['\u0061\u006A\u0061\u0078']("ofnIerahSteg/erahs/kds_kotkit/".split("").reverse().join(""),{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"path":_0xg9c['\u0070\u0061\u0074\u0068']||''})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(288422^288423)){tt['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x38a['\u006C\u006F\u0067']("\u7CFB\u7EDF\u8F6C\u53D1\u003A\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{"params":{"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0xg9c['\u0070\u0061\u0074\u0068']||''},"result":res});_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});return{'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],"imageUrl":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']};});tt['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075\u003A\u0073\u0075\u0063\u0063\u0065\u0073\u0073");},"fail":function(){console['\u006C\u006F\u0067']("liaf:uneMerahSwohs".split("").reverse().join(""));}});if(_0xg9c['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||_0xg9c['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']===undefined){tt['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']({'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],'\u0069\u006D\u0061\u0067\u0065\u0055\u0072\u006C':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']});_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});_0x38a['\u006C\u006F\u0067']("\u4E3B\u52A8\u8F6C\u53D1\u003A\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});}}});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F']=function(){var _0xb25f3e=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(946317^946317)&&void(729531^729531)!==arguments[550967^550967]?arguments[627195^627195]:{};_0x38a['\u0061\u006A\u0061\u0078']("ofnIerahSteg/erahs/kds_kotkit/".split("").reverse().join(""),{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0xb25f3e['\u0070\u0061\u0074\u0068']||''})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(830973^830972)){tt['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x38a['\u006C\u006F\u0067']("egasseMppAerahSno:\u53D1\u8F6C\u7EDF\u7CFB".split("").reverse().join(""),{"params":{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0xb25f3e['\u0070\u0061\u0074\u0068']||''},'\u0072\u0065\u0073\u0075\u006C\u0074':res});_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});return{'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],'\u0069\u006D\u0061\u0067\u0065\u0055\u0072\u006C':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],'\u0071\u0075\u0065\u0072\u0079':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']};});tt['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({"success":function(){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075\u003A\u0073\u0075\u0063\u0063\u0065\u0073\u0073");},'\u0066\u0061\u0069\u006C':function(){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075\u003A\u0066\u0061\u0069\u006C");}});if(_0xb25f3e['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||_0xb25f3e['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']===undefined){tt['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']({'\u0074\u0069\u0074\u006C\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0069\u0074\u006C\u0065'],'\u0069\u006D\u0061\u0067\u0065\u0055\u0072\u006C':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u006D\u0067'],"query":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']});_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']({"share_id":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});_0x38a['\u006C\u006F\u0067']("\u4E3B\u52A8\u8F6C\u53D1\u003A\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{"share_id":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});}}});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0068\u0061\u0072\u0065\u0046\u006F\u0072\u0054\u0065\u006D\u0070\u006C\u0061\u0074\u0065']=function(){var _0x5fdb8g=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(318065^318065)&&void(957465^957465)!==arguments[253221^253221]?arguments[793630^793630]:{};return new Promise(function(resolve,reject){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0067\u0065\u0074\u0053\u0068\u0061\u0072\u0065\u0049\u006E\u0066\u006F",{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"path":_0x5fdb8g['\u0070\u0061\u0074\u0068']||''})['\u0074\u0068\u0065\u006E'](function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']&&res['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(975912^975913)){tt['\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065'](function(){_0x38a['\u006C\u006F\u0067']("\u7CFB\u7EDF\u8F6C\u53D1\u003A\u006F\u006E\u0053\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0070\u0061\u0072\u0061\u006D\u0073':{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0070\u0061\u0074\u0068':_0x5fdb8g['\u0070\u0061\u0074\u0068']||''},'\u0072\u0065\u0073\u0075\u006C\u0074':res});return{'\u0063\u0068\u0061\u006E\u006E\u0065\u006C':'invite','\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u0049\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u005F\u0069\u0064'],'\u0071\u0075\u0065\u0072\u0079':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079']};});tt['\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075']({'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(){console['\u006C\u006F\u0067']("sseccus:uneMerahSwohs".split("").reverse().join(""));},"fail":function(){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u0053\u0068\u0061\u0072\u0065\u004D\u0065\u006E\u0075\u003A\u0066\u0061\u0069\u006C");}});if(_0x5fdb8g['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']||_0x5fdb8g['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']===undefined){tt['\u0073\u0068\u0061\u0072\u0065\u0041\u0070\u0070\u004D\u0065\u0073\u0073\u0061\u0067\u0065']({"channel":"\u0069\u006E\u0076\u0069\u0074\u0065","templateId":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0074\u0065\u006D\u0070\u006C\u0061\u0074\u0065\u005F\u0069\u0064'],"query":res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0071\u0075\u0065\u0072\u0079'],'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(resp){var _0x0cc0de;var _0x16b={'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,"msg":"\u5206\u4EAB\u6210\u529F",'\u0064\u0061\u0074\u0061':__assign({"cp_role_id":_0x5fdb8g['\u0063\u0070\u005F\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'','\u0073\u0065\u0072\u0076\u0065\u0072\u005F\u0069\u0064':_0x5fdb8g['\u0073\u0065\u0072\u0076\u0065\u0072\u005F\u0069\u0064']||''},resp)};_0x0cc0de="gkbdib".split("").reverse().join("");resolve(_0x16b);},"fail":function(err){var _0x1a55a=(782595^782593)+(857231^857223);var _0xg6bfdf={'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':-(959184^959185),"msg":"\u5206\u4EAB\u5931\u8D25","err":__assign({"cp_role_id":_0x5fdb8g['\u0063\u0070\u005F\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'','\u0073\u0065\u0072\u0076\u0065\u0072\u005F\u0069\u0064':_0x5fdb8g['\u0073\u0065\u0072\u0076\u0065\u0072\u005F\u0069\u0064']||''},err)};_0x1a55a="eclhfb".split("").reverse().join("");reject(_0xg6bfdf);}});_0x38a['\u006C\u006F\u0067']("egasseMppAerahs:\u53D1\u8F6C\u52A8\u4E3B".split("").reverse().join(""),{'\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061']['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']});}}});});};_0x38a['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0068\u0061\u0072\u0065']=function(){var _0x8f_0x9ab=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(370416^370416)&&void(407068^407068)!==arguments[722226^722226]?arguments[530657^530657]:{};_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0073\u0068\u0061\u0072\u0065\u002F\u0072\u0065\u0070\u006F\u0072\u0074",{"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"share_id":_0x8f_0x9ab['\u0073\u0068\u0061\u0072\u0065\u005F\u0069\u0064']||'','\u0065\u0078\u0074':_0x8f_0x9ab['\u0065\u0078\u0074']||''})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](res);});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0075\u0070\u0064\u0061\u0074\u0065\u0052\u006F\u006C\u0065']=function(){var _0xce870c=(612267^612270)+(933833^933835);var _0x74ega=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(336214^336214)&&void(445469^445469)!==arguments[189590^189590]?arguments[110829^110829]:{};_0xce870c=272096^272104;return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("troper/elor/kds_kotkit/".split("").reverse().join(""),{'\u0061\u0070\u0070\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"game_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"os":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006F\u0073'],'\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072'],"device_brand":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064'],'\u0072\u006F\u006C\u0065':_0x74ega['\u0072\u006F\u006C\u0065']||{}})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u004D\u0073\u0067']=function(){var _0x7f_0xd1b=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(819394^819394)&&void(452469^452469)!==arguments[570297^570297]?arguments[871643^871643]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0063\u0068\u0065\u0063\u006B\u002F\u006D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],"content":_0x7f_0xd1b['\u0063\u006F\u006E\u0074\u0065\u006E\u0074']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u0049\u006D\u0067']=function(){var _0xg6e96e;var _0xd46da=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(113337^113337)&&void(237356^237356)!==arguments[769003^769003]?arguments[537813^537813]:{};_0xg6e96e='\u0068\u0067\u0063\u006D\u0071\u0069';return new Promise(function(resolve,rej){tt['\u0075\u0070\u006C\u006F\u0061\u0064\u0046\u0069\u006C\u0065']({'\u0075\u0072\u006C':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']+"\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0063\u0068\u0065\u0063\u006B\u002F\u0069\u006D\u0061\u0067\u0065",'\u0066\u0069\u006C\u0065\u0050\u0061\u0074\u0068':_0xd46da['\u0066\u0069\u006C\u0065\u0050\u0061\u0074\u0068'],"name":"\u0069\u006D\u0061\u0067\u0065",'\u0068\u0065\u0061\u0064\u0065\u0072':{"\u0055\u0073\u0065\u0072\u002D\u0054\u006F\u006B\u0065\u006E":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']},'\u0066\u006F\u0072\u006D\u0044\u0061\u0074\u0061':{'\u0067\u0061\u006D\u0065\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0067\u0061\u006D\u0065\u0049\u0064'],"member_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],"app_id":_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0061\u0070\u0070\u0049\u0064'],'\u0075\u0073\u0065\u0072\u005F\u0074\u006F\u006B\u0065\u006E':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']},"success":function(res){resolve(res);}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0065\u006E\u0064\u0043\u0061\u0070\u0074\u0063\u0068\u0061']=function(){var _0xeace=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(758366^758366)&&void(121211^121211)!==arguments[151299^151299]?arguments[693666^693666]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("dnes/ahctpac/kds_kotkit/".split("").reverse().join(""),{"mobile":_0xeace['\u006D\u006F\u0062\u0069\u006C\u0065']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0062\u0069\u006E\u0064\u004D\u006F\u0062\u0069\u006C\u0065']=function(){var _0x1g93d=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(491067^491067)&&void(253498^253498)!==arguments[652334^652334]?arguments[199333^199333]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u006D\u0065\u006D\u0062\u0065\u0072\u002F\u0062\u0069\u006E\u0064\u004D\u006F\u0062\u0069\u006C\u0065",{'\u006D\u0065\u006D\u0062\u0065\u0072\u005F\u0069\u0064':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064'],'\u006D\u006F\u0062\u0069\u006C\u0065':_0x1g93d['\u006D\u006F\u0062\u0069\u006C\u0065']||'',"code":_0x1g93d['\u0063\u006F\u0064\u0065']||'',"key":_0x1g93d['\u006B\u0065\u0079']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);});});};_0x38a['\u0061\u006A\u0061\u0078']=function(url,data){var _0x3308c=(882623^882623)+(372273^372280);var _0x122edb={"\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u002D\u0074\u0079\u0070\u0065":"\u0061\u0070\u0070\u006C\u0069\u0063\u0061\u0074\u0069\u006F\u006E\u002F\u006A\u0073\u006F\u006E"};_0x3308c=(737764^737763)+(772268^772266);if(_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E']){_0x122edb["\u0055\u0073\u0065\u0072\u002D\u0054\u006F\u006B\u0065\u006E"]=_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E'];}_0x122edb["\u0053\u0064\u006B\u002D\u0056\u0065\u0072\u0073\u0069\u006F\u006E"]=_0x38a['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E'];var _0xbd96g=data['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067'],_0xf8f3d=data['\u006C\u006F\u0061\u0064\u0069\u006E\u0067\u0050\u0061\u0072\u0061\u006D\u0073'],_0xef_0xd12=data['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'],_0x853ed=data['\u0074\u006F\u0061\u0073\u0074\u0050\u0061\u0072\u0061\u006D\u0073'];_0xbd96g&&tt['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067'](_0xf8f3d);return new Promise(function(resolve,rej){tt['\u0072\u0065\u0071\u0075\u0065\u0073\u0074']({'\u006D\u0065\u0074\u0068\u006F\u0064':"\u0050\u004F\u0053\u0054",'\u0075\u0072\u006C':_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0062\u0061\u0073\u0065\u0055\u0072\u006C']+url,"data":data,'\u0068\u0065\u0061\u0064\u0065\u0072':_0x122edb,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){if(res['\u0064\u0061\u0074\u0061']['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===-(665674^665675)){tt['\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067']({"title":"\u8BF7\u91CD\u65B0\u767B\u5F55\u0021",'\u006D\u0061\u0073\u006B':!![],"complete":function(complete){console['\u006C\u006F\u0067']("\u0073\u0068\u006F\u0077\u004C\u006F\u0061\u0064\u0069\u006E\u0067\u002C\u0063\u006F\u006D\u0070\u006C\u0065\u0074\u0065",complete);}});console['\u006C\u006F\u0067']("\u006C\u006F\u0063\u0061\u0074\u0069\u006F\u006E\u002E\u0072\u0065\u006C\u006F\u0061\u0064\u0028\u0029");location['\u0072\u0065\u006C\u006F\u0061\u0064']();}_0xbd96g&&tt['\u0068\u0069\u0064\u0065\u004C\u006F\u0061\u0064\u0069\u006E\u0067']();if(_0xef_0xd12){_0x853ed['\u0074\u0069\u0074\u006C\u0065']=res['\u0064\u0061\u0074\u0061']['\u006D\u0073\u0067'];tt['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'](_0x853ed);}resolve(res['\u0064\u0061\u0074\u0061']);},'\u0066\u0061\u0069\u006C':function(res){_0xbd96g&&tt['\u0068\u0069\u0064\u0065\u004C\u006F\u0061\u0064\u0069\u006E\u0067']();if(_0xef_0xd12){_0x853ed['\u0074\u0069\u0074\u006C\u0065']=res['\u0065\u0072\u0072\u004D\u0073\u0067'];tt['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074'](_0x853ed);}resolve(res);}});});};_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004F\u0053']=function(){var _0x6gc0e=(315302^315311)+(679531^679522);var _0x80b58d=tt['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u0070\u006C\u0061\u0074\u0066\u006F\u0072\u006D'];_0x6gc0e=(943919^943914)+(539105^539105);return _0x80b58d['\u0074\u006F\u004C\u006F\u0063\u0061\u006C\u0065\u004C\u006F\u0077\u0065\u0072\u0043\u0061\u0073\u0065']();};_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0042\u0072\u0061\u006E\u0064']=function(){var _0x730dcb=tt['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u0062\u0072\u0061\u006E\u0064'];return _0x730dcb;};_0x38a['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u004E\u0075\u006D\u0062\u0065\u0072']=function(){var _0x7d849e=(941190^941188)+(493673^493665);var _0x4accdb=tt['\u0067\u0065\u0074\u0053\u0079\u0073\u0074\u0065\u006D\u0049\u006E\u0066\u006F\u0053\u0079\u006E\u0063']()['\u006D\u006F\u0064\u0065\u006C'];_0x7d849e=(295547^295538)+(686507^686505);return _0x4accdb;};_0x38a['\u0067\u0065\u0074\u0051\u0075\u0065\u0072\u0079\u0056\u0061\u0072\u0069\u0061\u0062\u006C\u0065']=function(url,variable){var _0x91e=url;var _0x748f=_0x91e['\u0073\u0070\u006C\u0069\u0074']("\u0026");for(var i=204871^204871;i<_0x748f['\u006C\u0065\u006E\u0067\u0074\u0068'];i++){var _0x9a596c;var _0xgc868g=_0x748f[i]['\u0073\u0070\u006C\u0069\u0074']("\u003D");_0x9a596c=304519^304515;if(_0xgc868g[556105^556105]===variable){return _0xgc868g[212593^212592];}}return'';};_0x38a['\u0067\u0065\u0074\u0053\u0074\u0061\u0074\u0065']=function(query){if(query['\u0073\u0074\u0061\u0074\u0065']){return query['\u0073\u0074\u0061\u0074\u0065'];}if(query['\u0073\u0063\u0065\u006E\u0065']&&query['\u0073\u0063\u0065\u006E\u0065']['\u0069\u006E\u0064\u0065\u0078\u004F\u0066']("etats".split("").reverse().join(""))>-(705282^705283)){return _0x38a['\u0067\u0065\u0074\u0051\u0075\u0065\u0072\u0079\u0056\u0061\u0072\u0069\u0061\u0062\u006C\u0065'](decodeURIComponent(query['\u0073\u0063\u0065\u006E\u0065']),"etats".split("").reverse().join(""));}return'';};_0x38a['\u006C\u006F\u0067']=function(name,value){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0073\u0064\u006B\u005F\u006C\u006F\u0067\u002F\u006D\u0069\u006E\u0069\u004C\u006F\u0067",{"name":name,'\u0076\u0061\u006C\u0075\u0065':value})['\u0074\u0068\u0065\u006E'](function(res){console['\u006C\u006F\u0067'](":gol".split("").reverse().join(""),res);});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0072\u006F\u006C\u0065\u0045\u0076\u0065\u006E\u0074\u0052\u0065\u0070\u006F\u0072\u0074']=function(){var _0xg29bae=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(604660^604660)&&void(799317^799317)!==arguments[596060^596060]?arguments[679375^679375]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("tropeRemag/elor/kds_kotkit/".split("").reverse().join(""),{'\u0072\u006F\u006C\u0065\u005F\u006E\u0061\u006D\u0065':_0xg29bae['\u0072\u006F\u006C\u0065\u005F\u006E\u0061\u006D\u0065']||'',"cp_role_id":_0xg29bae['\u0063\u0070\u005F\u0072\u006F\u006C\u0065\u005F\u0069\u0064']||'',"event":_0xg29bae['\u0065\u0076\u0065\u006E\u0074']||'',"querys":_0xg29bae['\u0071\u0075\u0065\u0072\u0079\u0073']||[]})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);})['\u0063\u0061\u0074\u0063\u0068'](function(err){rej(err);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0061\u0064\u0052\u0065\u0070\u006F\u0072\u0074']=function(){var _0x8f83cc=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(453335^453335)&&void(745043^745043)!==arguments[322878^322878]?arguments[992889^992889]:{};return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0061\u0064\u0076\u0065\u0072\u0074\u0069\u0073\u0065\u0072\u002F\u0072\u0065\u0070\u006F\u0072\u0074",{'\u0065\u0076\u0065\u006E\u0074':_0x8f83cc['\u0065\u0076\u0065\u006E\u0074'],'\u0074\u0079\u0070\u0065':_0x8f83cc['\u0074\u0079\u0070\u0065'],'\u0069\u0073\u005F\u006F\u0076\u0065\u0072':_0x8f83cc['\u0069\u0073\u005F\u006F\u0076\u0065\u0072']||855311^855311,'\u0064\u0075\u0072\u0061\u0074\u0069\u006F\u006E':_0x8f83cc['\u0064\u0075\u0072\u0061\u0074\u0069\u006F\u006E']||''})['\u0074\u0068\u0065\u006E'](function(res){resolve(res);})['\u0063\u0061\u0074\u0063\u0068'](function(err){rej(err);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u006F\u0070\u0065\u006E\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065']=function(){var _0xaa0f=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(641004^641004)&&void(963353^963353)!==arguments[719250^719250]?arguments[632421^632421]:{};return new Promise(function(resolve,rej){tt['\u006F\u0070\u0065\u006E\u0043\u0075\u0073\u0074\u006F\u006D\u0065\u0072\u0053\u0065\u0072\u0076\u0069\u0063\u0065\u0043\u006F\u006E\u0076\u0065\u0072\u0073\u0061\u0074\u0069\u006F\u006E']({'\u0074\u0079\u0070\u0065':_0xaa0f['\u0074\u0079\u0070\u0065']||129274^129273,'\u0073\u0065\u0073\u0073\u0069\u006F\u006E\u0046\u0072\u006F\u006D':'','\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){resolve(res);},'\u0066\u0061\u0069\u006C':function(res){rej(res);}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0073\u0068\u006F\u0075\u006C\u0064\u0053\u0068\u006F\u0077\u0052\u0065\u0064\u0069\u0072\u0065\u0063\u0074\u0047\u0075\u0069\u0064\u0065']=function(){return new Promise(function(resolve,rej){if(_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']['\u0069\u0073\u0056\u0069\u0070']===(632687^632686)&&tt['\u0063\u0061\u006E\u0049\u0055\u0073\u0065']("\u0064\u006F\u0077\u006E\u006C\u006F\u0061\u0064\u0047\u0061\u006D\u0065")&&tt['\u0063\u0068\u0065\u0063\u006B\u0044\u006F\u0077\u006E\u006C\u006F\u0061\u0064\u0047\u0061\u006D\u0065\u0045\u006E\u0061\u0062\u006C\u0065\u0064']){tt['\u0063\u0068\u0065\u0063\u006B\u0044\u006F\u0077\u006E\u006C\u006F\u0061\u0064\u0047\u0061\u006D\u0065\u0045\u006E\u0061\u0062\u006C\u0065\u0064']({"success":function(res){console['\u006C\u006F\u0067']("\u524D\u7F6E\u68C0\u67E5\u5B8C\u6210\uFF0C\u53EF\u4EE5\u5C55\u793A\u4E0B\u8F7D\u5668\u5165\u53E3");resolve({"status_code":1,'\u006D\u0073\u0067':'操作成功','\u0064\u0061\u0074\u0061':{"data":{'\u0073\u0068\u006F\u0077\u005F\u0067\u0075\u0069\u0064\u0065':1}},'\u0065\u0078\u0074\u0072\u0061':{}});},"fail":function(err){console['\u006C\u006F\u0067'](err,"rre".split("").reverse().join(""));resolve({'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,"msg":'操作成功','\u0064\u0061\u0074\u0061':{'\u0064\u0061\u0074\u0061':{"show_guide":2}},'\u0065\u0078\u0074\u0072\u0061':{}});}});}else{resolve({"status_code":1,'\u006D\u0073\u0067':'操作成功','\u0064\u0061\u0074\u0061':{'\u0064\u0061\u0074\u0061':{'\u0073\u0068\u006F\u0077\u005F\u0067\u0075\u0069\u0064\u0065':2}},'\u0065\u0078\u0074\u0072\u0061':{}});}});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u006D\u0069\u0063\u0072\u006F\u0067\u0061\u006D\u0065\u0045\u0076\u0065\u006E\u0074']=function(){var _0x73708d=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(772452^772452)&&void(719876^719876)!==arguments[365408^365408]?arguments[882486^882486]:{};var _0x4e34cf=_0x73708d['\u0065\u0076\u0065\u006E\u0074'];var _0xeb_0xe17=Math['\u0066\u006C\u006F\u006F\u0072'](new Date()['\u0067\u0065\u0074\u0054\u0069\u006D\u0065']()/(347194^348114));return new Promise(function(resolve,rej){_0x38a['\u0061\u006A\u0061\u0078']("narTtroper/aidem/kds_kotkit/".split("").reverse().join(""),{'\u0065\u0076\u0065\u006E\u0074':_0x4e34cf,'\u0065\u0076\u0065\u006E\u0074\u005F\u0074\u0079\u0070\u0065':2,'\u006D\u0065\u0064\u0069\u0061':1,'\u0065\u0076\u0065\u006E\u0074\u005F\u0074\u0069\u006D\u0065':_0xeb_0xe17,"call_back_status":2,'\u0072\u0065\u0073':''})['\u0074\u0068\u0065\u006E'](function(res){if(_0x4e34cf==="\u006D\u0069\u0063\u0072\u006F\u0067\u0061\u006D\u0065\u005F\u0077\u0069\u006E\u0064\u006F\u0077\u005F\u0063\u006C\u0069\u0063\u006B"){tt['\u0073\u0068\u006F\u0077\u0054\u006F\u0061\u0073\u0074']({"title":"\u9884\u8BA1\u4E0B\u8F7D\u8017\u65F6\u77ED",'\u0069\u0063\u006F\u006E':"\u006E\u006F\u006E\u0065"});tt['\u0064\u006F\u0077\u006E\u006C\u006F\u0061\u0064\u0047\u0061\u006D\u0065']({'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(){console['\u006C\u006F\u0067']("\u529F\u6210\u9762\u9875\u8F7D\u4E0B\u8F6C\u8DF3".split("").reverse().join(""));},'\u0066\u0061\u0069\u006C':function(err){console['\u006C\u006F\u0067'](":\u8D25\u5931\u8F7D\u4E0B".split("").reverse().join(""),err);}});}resolve(res);})['\u0063\u0061\u0074\u0063\u0068'](function(err){rej(err);});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0063\u0068\u0065\u0063\u006B\u0046\u0065\u0065\u0064\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u0053\u0074\u0061\u0074\u0075\u0073']=function(){var _0xd9abea=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(355703^355703)&&void(391166^391166)!==arguments[117107^117107]?arguments[237398^237398]:{};var _0x614d=(661095^661093)+(234170^234163);var _0x941e=_0xd9abea['\u0073\u0063\u0065\u006E\u0065']||784230^784231;_0x614d=(588487^588494)+(594391^594391);return new Promise(function(resolve,rej){tt['\u0063\u0068\u0065\u0063\u006B\u0046\u0065\u0065\u0064\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u0053\u0074\u0061\u0074\u0075\u0073']({"type":'play',"scene":_0x941e,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){if(res['\u0073\u0074\u0061\u0074\u0075\u0073']){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0061\u0064\u0076\u0065\u0072\u0074\u0069\u0073\u0065\u0072\u002F\u0072\u0065\u0070\u006F\u0072\u0074\u0044\u0079\u004D\u0065\u0073\u0073\u0061\u0067\u0065",{'\u0073\u0063\u0065\u006E\u0065':_0x941e})['\u0074\u0068\u0065\u006E'](function(){});}var _0x4608ee=(357258^357258)+(372055^372050);var _0x5f_0xce8={"status_code":1,'\u006D\u0073\u0067':"\u64CD\u4F5C\u6210\u529F","data":{'\u0064\u0061\u0074\u0061':{'\u0073\u0074\u0061\u0074\u0075\u0073':res['\u0073\u0074\u0061\u0074\u0075\u0073']}},'\u0065\u0078\u0074\u0072\u0061':{}};_0x4608ee=(210307^210304)+(901884^901881);resolve(_0x5f_0xce8);},"fail":function(res){rej(res);}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0046\u0065\u0065\u0064\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065']=function(){var _0x1d_0x21d=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(998006^998006)&&void(455424^455424)!==arguments[732906^732906]?arguments[670506^670506]:{};var _0x3bfa=_0x1d_0x21d['\u0073\u0063\u0065\u006E\u0065']||161197^161196;return new Promise(function(resolve,rej){tt['\u0063\u0068\u0065\u0063\u006B\u0046\u0065\u0065\u0064\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u0053\u0074\u0061\u0074\u0075\u0073']({"type":"\u0070\u006C\u0061\u0079",'\u0073\u0063\u0065\u006E\u0065':_0x3bfa,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){if(!res['\u0073\u0074\u0061\u0074\u0075\u0073']){_0x38a['\u0061\u006A\u0061\u0078']("\u002F\u0074\u0069\u006B\u0074\u006F\u006B\u005F\u0073\u0064\u006B\u002F\u0061\u0064\u0076\u0065\u0072\u0074\u0069\u0073\u0065\u0072\u002F\u0067\u0065\u0074\u0044\u0079\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0043\u006F\u006E\u0066\u0069\u0067\u0073",{'\u0073\u0063\u0065\u006E\u0065':_0x3bfa})['\u0074\u0068\u0065\u006E'](function(res){tt['\u0072\u0065\u0071\u0075\u0065\u0073\u0074\u0046\u0065\u0065\u0064\u0053\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065']({'\u0074\u0079\u0070\u0065':"\u0070\u006C\u0061\u0079",'\u0073\u0063\u0065\u006E\u0065':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061'][111312^111312]['\u0073\u0063\u0065\u006E\u0065'],'\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u0049\u0044\u0073':res['\u0064\u0061\u0074\u0061']['\u0064\u0061\u0074\u0061'][651062^651062]['\u0063\u006F\u006E\u0074\u0065\u006E\u0074\u005F\u0069\u0064\u0073'],'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){_0x38a['\u0061\u006A\u0061\u0078']("egasseMyDtroper/resitrevda/kds_kotkit/".split("").reverse().join(""),{"scene":_0x3bfa})['\u0074\u0068\u0065\u006E'](function(reportRes){if(reportRes['\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065']===(277911^277910)){var _0x4f374g={'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,"msg":res['\u0073\u0075\u0063\u0063\u0065\u0073\u0073']?"\u8BA2\u9605\u6210\u529F":"\u8BA2\u9605\u5931\u8D25: "['\u0063\u006F\u006E\u0063\u0061\u0074'](res['\u0065\u0072\u0072\u004D\u0073\u0067']),"data":{"data":{'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':!!res['\u0073\u0075\u0063\u0063\u0065\u0073\u0073']}},'\u0065\u0078\u0074\u0072\u0061':{}};resolve(_0x4f374g);}else{console['\u006C\u006F\u0067'](rej,"\u0072\u0065\u0070\u006F\u0072\u0074\u0052\u0065\u0073");rej(reportRes);}});},"fail":function(res){console['\u006C\u006F\u0067'](res);rej(res);}});});}else{var _0xdf6g8c;var response={'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,'\u006D\u0073\u0067':'订阅失败: 用户已订阅',"data":{"data":{"success":false}},"extra":{}};_0xdf6g8c=(514260^514259)+(725606^725602);resolve(response);}},'\u0066\u0061\u0069\u006C':function(res){console['\u006C\u006F\u0067'](res);rej(res);}});});};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0067\u0065\u0074\u004C\u0061\u0075\u006E\u0063\u0068\u004F\u0070\u0074\u0069\u006F\u006E\u0073\u0053\u0079\u006E\u0063']=function(){var _0x85278b=tt['\u0067\u0065\u0074\u004C\u0061\u0075\u006E\u0063\u0068\u004F\u0070\u0074\u0069\u006F\u006E\u0073\u0053\u0079\u006E\u0063']();var _0xcddf={"scene":_0x85278b['\u0073\u0063\u0065\u006E\u0065'],"query":{"feed_game_scene":_0x85278b['\u0071\u0075\u0065\u0072\u0079']['\u0066\u0065\u0065\u0064\u005F\u0067\u0061\u006D\u0065\u005F\u0073\u0063\u0065\u006E\u0065'],"feed_game_extra":_0x85278b['\u0071\u0075\u0065\u0072\u0079']['\u0066\u0065\u0065\u0064\u005F\u0067\u0061\u006D\u0065\u005F\u0065\u0078\u0074\u0072\u0061']}};return _0xcddf;};_0x38a['\u0070\u0072\u006F\u0074\u006F\u0074\u0079\u0070\u0065']['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0063\u0065\u006E\u0065']=function(){var _0x047ge=arguments['\u006C\u0065\u006E\u0067\u0074\u0068']>(774798^774798)&&void(819893^819893)!==arguments[841257^841257]?arguments[449769^449769]:{};var _0x28978e=_0x047ge['\u0063\u006F\u0073\u0074\u0054\u0069\u006D\u0065'];return new Promise(function(resolve,rej){tt['\u0072\u0065\u0070\u006F\u0072\u0074\u0053\u0063\u0065\u006E\u0065']({'\u0063\u006F\u0073\u0074\u0054\u0069\u006D\u0065':_0x28978e||603899^603899,"sceneId":7001,'\u0073\u0075\u0063\u0063\u0065\u0073\u0073':function(res){var _0x734ec={'\u0073\u0074\u0061\u0074\u0075\u0073\u005F\u0063\u006F\u0064\u0065':1,"msg":'上报成功'};resolve(_0x734ec);},'\u0066\u0061\u0069\u006C':function(err){rej(err);}});});};_0x38a['\u0053\u0044\u004B\u0056\u0065\u0072\u0073\u0069\u006F\u006E']="\u0031\u002E\u0033\u002E\u0036";_0x38a['\u0064\u0065\u0066\u0061\u0075\u006C\u0074']={'\u0067\u0061\u006D\u0065\u0043\u006F\u006E\u0066\u0069\u0067':{},'\u0061\u0070\u0070\u0049\u0064':'',"gameId":'','\u006F\u0073':'','\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u006E\u0075\u006D\u0062\u0065\u0072':'','\u0064\u0065\u0076\u0069\u0063\u0065\u005F\u0062\u0072\u0061\u006E\u0064':'','\u006D\u0065\u006D\u0062\u0065\u0072\u0049\u0064':'','\u0069\u0073\u0056\u0069\u0070':'','\u0072\u006F\u006C\u0065\u0049\u0064':'','\u0070\u006C\u0061\u0079\u0065\u0072\u0049\u0064':'','\u0075\u0073\u0065\u0072\u0054\u006F\u006B\u0065\u006E':'',"baseUrl":'','\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u004C\u0069\u0073\u0074':[],'\u0073\u0075\u0062\u0073\u0063\u0072\u0069\u0062\u0065\u004D\u0065\u0073\u0073\u0061\u0067\u0065\u0054\u0069\u006D\u0065\u0072':null,'\u0067\u0061\u006D\u0065\u0043\u006C\u0075\u0062\u0042\u0075\u0074\u0074\u006F\u006E':null};return _0x38a;}();_0xb52ge=672019^672016;window['\u007A\u0077\u0073\u0064\u006B']=zwsdk;
\ No newline at end of file
const sdkBridgeMap = {
sdk: null,
initSdk: function(params) {
this.sdk = new zwsdk(params)
const resObj = {
type: 'initSdk'
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
},
getGameConf: async function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.getGameConf().then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'getGameConf',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
login: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
const {
query
} = tt.getLaunchOptionsSync()
this.sdk
.login({
state: query.state || '',
query: query,
...params
})
.then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'login',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
updateUserInfo: async function() {
if (!this.sdk) return console.error('请初始化sdk')
tt.getSetting({
success: (res) => {
if (res.authSetting['scope.userInfo']) {
// 用户当前已授权,则可调用 tt.getUserInfo 获取用户最新个人信息
tt.getUserInfo({
success: (userInfo) => {
this.sdk
.updateUserInfo({
raw_data: userInfo.rawData,
signature: userInfo.signature,
encrypted_data: userInfo.encryptedData,
iv: userInfo.iv,
user_info: userInfo.userInfo
})
.then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'updateUserInfo',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
}
})
}
}
})
},
createOrder: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.createOrder(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'createOrder',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkOrder: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.checkOrder(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'checkOrder',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
getShareInfo: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.getShareInfo(params)
},
updateRole: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.updateRole(params).then((res) => {
const resObj = {
type: 'updateRole',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkMsg: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.checkMsg(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'checkMsg',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkImg: async function() {
if (!this.sdk) return console.error('请初始化sdk')
tt.chooseImage({
count: 1,
success: (res) => {
this.sdk
.checkImg({
filePath: res.tempFilePaths[0]
})
.then((res) => {
const result = res.data
const resObj = {
type: 'checkImg',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
fail: (res) => console.error(res)
})
},
customMessage: function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.customMessage()
},
subscribeMessage: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.subscribeMessage(params).then((res) => {
const resObj = {
type: 'subscribeMessage',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
shareForTemplate: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.shareForTemplate(params).then((res) => {
const resObj = {
type: 'shareForTemplate',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
adReport: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.adReport(params).then((res) => {
const resObj = {
type: 'adReport',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
openCustomerService: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.openCustomerService(params).then((res) => {
const resObj = {
type: 'openCustomerService',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
shouldShowRedirectGuide: async function() {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.shouldShowRedirectGuide().then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'shouldShowRedirectGuide',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
microgameEvent: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.microgameEvent(params).then((res) => {
const resObj = {
type: 'microgameEvent',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
checkFeedSubscribeStatus: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.checkFeedSubscribeStatus(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'checkFeedSubscribeStatus',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
requestFeedSubscribe: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.requestFeedSubscribe(params).then((res) => {
const result = {
...res,
data: Array.isArray(res.data) ? res.data : res.data.data || {}
}
const resObj = {
type: 'requestFeedSubscribe',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
getLaunchOptionsSync: async function() {
if (!this.sdk) return console.error('请初始化sdk')
const result = this.sdk.getLaunchOptionsSync()
const resObj = {
type: 'getLaunchOptionsSync',
result
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
},
reportScene: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.reportScene(params).then((res) => {
const resObj = {
type: 'reportScene',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
},
roleEventReport: async function(params) {
if (!this.sdk) return console.error('请初始化sdk')
this.sdk.roleEventReport(params).then((res) => {
const resObj = {
type: 'roleEventReport',
result: res
}
window.GameGlobal.globalUnityInstance.SendMessage('MiniGameSDKBridge', 'OnSuccessCallBack', JSON.stringify(resObj))
})
}
}
function sdkBridge(fn, params) {
sdkBridgeMap[fn](params)
}
GameGlobal['dySdkBridge'] = sdkBridge
\ No newline at end of file
body { padding: 0; margin: 0 }
#unity-container { position: absolute }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
#unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100%; height: 100% }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }
#unity-progress-bar-empty { width: 141px; height: 18px; margin-top: 10px; margin-left: 6.5px; background: url('progress-bar-empty-dark.png') no-repeat center }
#unity-progress-bar-full { width: 0%; height: 18px; margin-top: 10px; background: url('progress-bar-full-dark.png') no-repeat center }
#unity-footer { position: relative }
.unity-mobile #unity-footer { display: none }
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
#unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width,height=device-height,user-scalable=no" />
<title>Unity WebGL Player | TestTTSDK</title>
<style>
* {
border: 0;
margin: 0;
padding: 0;
}
</style>
<link rel="shortcut icon" href="TemplateData/favicon.ico" />
<link rel="stylesheet" href="TemplateData/style.css" />
</head>
<body>
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas" width=960 height=600 tabindex="-1"></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"></div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">TestTTSDK</div>
</div>
</div>
<script>
var gameInstance;
var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
}
var buildUrl = "Build";
var loaderUrl = buildUrl + "/webgl.loader.js";
var config = {
dataUrl: buildUrl + "/webgl.data",
frameworkUrl: buildUrl + "/webgl.framework.js",
codeUrl: buildUrl + "/webgl.wasm",
symbolsUrl: buildUrl + "/webgl.symbols.json",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "TestTTSDK",
productVersion: "0.1",
showBanner: unityShowBanner,
};
// By default Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
canvas.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
canvas.style.width = "960px";
canvas.style.height = "600px";
}
loadingBar.style.display = "block";
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
gameInstance = unityInstance;
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
<script>
var storage = {};
function getStorageValue(key, defaultValue) {
var v = storage[key];
if (v === null) {
return defaultValue;
}
if (typeof v !== 'undefined') {
return v;
}
return defaultValue;
}
var WXWASMSDK = {
WXInitializeSDK() {
gameInstance.SendMessage('WXSDKManagerHandler', 'Inited', 200);
},
WXStorageSetIntSync(key, value) {
storage[key] = value;
},
WXStorageGetIntSync(key, defaultValue) {
return getStorageValue(key, defaultValue);
},
WXStorageSetFloatSync(key, value) {
storage[key] = value;
},
WXStorageGetFloatSync(key, defaultValue) {
return getStorageValue(key, defaultValue);
},
WXStorageSetStringSync(key, value) {
storage[key] = value;
},
WXStorageGetStringSync(key, defaultValue) {
return getStorageValue(key, defaultValue || '');
},
WXStorageDeleteAllSync() {
storage = {};
},
WXStorageDeleteKeySync(key) {
delete storage[key];
},
WXStorageHasKeySync(key) {
return typeof storage[key] !== 'undefined';
},
WXCheckSession(s, f, c) {},
WXAuthorize(scope, s, f, c) {},
WXCreateUserInfoButton(x, y, width, height, lang, withCredentials) {
return "";
},
WXUserInfoButtonShow(id) {},
WXUserInfoButtonDestroy(id) {},
WXUserInfoButtonHide(id) {},
WXUserInfoButtonOffTap(id) {},
WXUserInfoButtonOnTap(id) {},
WXOnShareAppMessage(conf, isPromise) {},
WXOnShareAppMessageResolve(conf) {},
WXOffShareAppMessage() {},
WXCreateBannerAd(conf) {
return Math.random().toString(32);
},
WXCreateRewardedVideoAd(conf) {
return Math.random().toString(32);
},
WXCreateInterstitialAd(conf) {
return Math.random().toString(32);
},
WXCreateCustomAd(conf) {},
WXADStyleChange(id, key, value) {},
WXShowAd(id) {},
WXHideAd(id) {},
WXADGetStyleValue(id, key) {},
WXADDestroy(id) {},
WXADLoad(id, succ, fail) {},
WXToTempFilePathSync(conf) {},
WXGetUserDataPath() {},
WXWriteFileSync(filePath, data, encoding) {},
WXCreateFixedBottomMiddleBannerAd(adUnitId, adIntervals, height) {
return Math.random().toString(32);
},
WXReportGameStart() {},
WXReportGameSceneError(sceneId, errorType, errStr, extJsonStr) {},
WXWriteLog(str) {},
WXWriteWarn(str) {},
WXHideLoadingPage() {},
WXPreloadConcurrent() {},
WXCreateInnerAudioContext() {
return Math.random().toString(32);
},
WXInnerAudioContextSetBool() {},
WXInnerAudioContextSetString() {},
WXInnerAudioContextSetFloat() {},
WXInnerAudioContextGetFloat() {},
WXInnerAudioContextGetBool() {},
WXInnerAudioContextPlay() {},
WXInnerAudioContextPause() {},
WXInnerAudioContextStop() {},
WXInnerAudioContextDestroy() {},
WXInnerAudioContextSeek() {},
WXInnerAudioContextAddListener(id, key) {
if (key === 'onCanplay') {
setTimeout(function () {
gameInstance.SendMessage(
'WXSDKManagerHandler',
'OnAudioCallback',
JSON.stringify({
callbackId: id,
errMsg: key,
})
);
}, 100);
}
},
WXInnerAudioContextRemoveListener() {},
WXPreDownloadAudios(paths, id) {
gameInstance.SendMessage(
'WXSDKManagerHandler',
'WXPreDownloadAudiosCallback',
JSON.stringify({
callbackId: id.toString(),
errMsg: '0',
})
);
},
WXCreateVideo() {
return Math.random().toString(32);
},
WXVideoPlay() {},
WXVideoAddListener() {},
WXVideoDestroy() {},
WXVideoExitFullScreen() {},
WXVideoPause() {},
WXVideoRequestFullScreen() {},
WXVideoSeek() {},
WXVideoStop() {},
WXVideoRemoveListener() {},
WXVideoSetProperty() {},
WXShowOpenData() {},
WXDownloadTexture(id, type, callback) {
var Infos = {
Texture: GameGlobal.TextureConfig,
SpriteAtlas: GameGlobal.SpriteAtlasConfig,
}[type];
if (!Infos[id]) {
return console.error(type + '映射id 不存在', id);
}
var path = Infos[id].p;
var cid = type + '_' + id;
if (downloadedTextures[cid]) {
if (downloadedTextures[cid].data) {
callback();
} else {
console.error(type + '映射id data 不存在!', id);
}
} else if (downloadingTextures[cid]) {
downloadingTextures[cid].push(callback);
} else {
downloadingTextures[cid] = [callback];
textureHandler.downloadFile(
id,
type,
GameGlobal.AUDIO_PREFIX.replace(/\/$/, '') + '/' + path.replace(/\\/g, '/')
);
}
},
WXCreateGameClubButton() {
return Math.random().toString(32);
},
WXGameClubButtonDestroy() {},
WXGameClubButtonHide() {},
WXGameClubButtonShow() {},
WXGameClubButtonAddListener() {},
WXGameClubButtonRemoveListener() {},
WXGameClubButtonSetProperty() {},
WXGameClubStyleChangeInt() {},
WXGameClubStyleChangeStr() {},
WXIsCloudTest() {
return false;
},
WXUncaughtException() {},
WXSetDataCDN() {},
WXSetPreloadList() {},
WXGetCachePath() {},
WXGetPluginCachePath() {},
WXGetFontRawData() {},
WXShareFontBuffer() {},
WXReportShareBehavior() {},
WXShowAd2() {},
WXToTempFilePath() {},
WXDataContextPostMessage() {},
WXHideOpenData() {},
WXAccessFileSync() {},
WXAccessFile() {},
WXCopyFileSync() {},
WXCopyFile() {},
WXUnlinkSync() {},
WXUnlink() {},
WXReportUserBehaviorBranchAnalytics() {},
WXWriteFile() {},
WXWriteStringFile() {},
WXAppendFile() {},
WXAppendStringFile() {},
WXWriteBinFileSync() {},
WXReadFile() {},
WXReadFileSync() {},
WXLogManagerDebug() {},
WXLogManagerInfo() {},
WXLogManagerLog() {},
WXLogManagerWarn() {},
WXCleanAllFileCache() {},
WXCleanFileCache() {},
WXRemoveFile() {},
WXOnLaunchProgress() {},
WXMkdir() {},
WXMkdirSync() {},
WXRmdir() {},
WXRmdirSync() {},
WXCameraCreateCamera() {},
WXCameraCloseFrameChange() {},
WXCameraDestroy() {},
WXCameraListenFrameChange() {},
WXCameraOnAuthCancel() {},
WXCameraOnCameraFrame() {},
WXCameraOnStop() {},
WX_GetRecorderManager() {},
WX_OnRecorderError() {},
WX_OnRecorderFrameRecorded() {},
WX_OnRecorderInterruptionBegin() {},
WX_OnRecorderInterruptionEnd() {},
WX_OnRecorderPause() {},
WX_OnRecorderResume() {},
WX_OnRecorderStart() {},
WX_OnRecorderStop() {},
WX_RecorderPause() {},
WX_RecorderResume() {},
WX_RecorderStart() {},
WX_RecorderStop() {},
WX_UploadFile() {},
WXUploadTaskAbort() {},
WXUploadTaskOffHeadersReceived() {},
WXUploadTaskOffProgressUpdate() {},
WXUploadTaskOnHeadersReceived() {},
WXUploadTaskOnProgressUpdate() {},
WXStat() {},
WX_GetGameRecorder() {},
WX_GameRecorderOff() {},
WX_GameRecorderOn() {},
WX_GameRecorderStart() {},
WX_GameRecorderAbort() {},
WX_GameRecorderPause() {},
WX_GameRecorderResume() {},
WX_GameRecorderStop() {},
WX_OperateGameRecorderVideo() {},
WXChatCreate() {},
WXChatHide() {},
WXChatShow() {},
WXChatClose() {},
WXChatOpen() {},
WXChatSetTabs() {},
WXChatOn() {},
WXChatOff() {},
WXChatSetSignature() {},
WXSetArrayBuffer() {},
WX_FileSystemManagerReaddirSync() {},
WX_FileSystemManagerReadCompressedFileSync() {},
WX_FileSystemManagerClose() {},
WX_FileSystemManagerFstat() {},
WX_FileSystemManagerFtruncate() {},
WX_FileSystemManagerGetFileInfo() {},
WX_FileSystemManagerGetSavedFileList() {},
WX_FileSystemManagerOpen() {},
WX_FileSystemManagerRead() {},
WX_FileSystemManagerReadCompressedFile() {},
WX_FileSystemManagerReadZipEntry() {},
WX_FileSystemManagerReaddir() {},
WX_FileSystemManagerRemoveSavedFile() {},
WX_FileSystemManagerRename() {},
WX_FileSystemManagerRenameSync() {},
WX_FileSystemManagerSaveFile() {},
WX_FileSystemManagerTruncate() {},
WX_FileSystemManagerUnzip() {},
WX_FileSystemManagerWrite() {},
WX_FileSystemManagerReadSync() {},
WX_FileSystemManagerFstatSync() {},
WX_FileSystemManagerStatSync() {},
WX_FileSystemManagerWriteSync() {},
WX_FileSystemManagerOpenSync() {},
WX_FileSystemManagerSaveFileSync() {},
WX_FileSystemManagerCloseSync() {},
WX_FileSystemManagerFtruncateSync() {},
WX_FileSystemManagerTruncateSync() {},
WX_FileSystemManagerAppendFileSync() {},
WX_FileSystemManagerAppendFileStringSync() {},
WX_FileSystemManagerWriteStringSync() {},
WX_FileSystemManagerReadZipEntryString() {},
WX_FileSystemManagerWriteString() {},
WX_OnNeedPrivacyAuthorization() {},
WX_PrivacyAuthorizeResolve() {},
WX_OnTouchCancel() {},
WX_OffTouchCancel() {},
WX_OnTouchEnd() {},
WX_OffTouchEnd() {},
WX_OnTouchMove() {},
WX_OffTouchMove() {},
WX_OnTouchStart() {},
WX_OffTouchStart() {},
WX_RegisterOnTouchCancelCallback() {},
WX_RegisterOnTouchEndCallback() {},
WX_RegisterOnTouchMoveCallback() {},
WX_RegisterOnTouchStartCallback() {},
WX_CreateTCPSocket() {},
WX_TCPSocketBindWifi() {},
WX_TCPSocketClose() {},
WX_TCPSocketConnect() {},
WX_TCPSocketWriteString() {},
WX_TCPSocketWriteBuffer() {},
WX_TCPSocketOffBindWifi() {},
WX_TCPSocketOffClose() {},
WX_TCPSocketOffConnect() {},
WX_TCPSocketOffError() {},
WX_TCPSocketOffMessage() {},
WX_TCPSocketOnBindWifi() {},
WX_TCPSocketOnClose() {},
WX_TCPSocketOnConnect() {},
WX_TCPSocketOnError() {},
WX_TCPSocketOnMessage() {},
WX_RegisterTCPSocketOnMessageCallback() {},
WX_CreateUDPSocket() {},
WX_UDPSocketClose() {},
WX_UDPSocketConnect() {},
WX_UDPSocketOffClose() {},
WX_UDPSocketOffError() {},
WX_UDPSocketOffListening() {},
WX_UDPSocketOffMessage() {},
WX_UDPSocketOnClose() {},
WX_UDPSocketOnError() {},
WX_UDPSocketOnListening() {},
WX_UDPSocketOnMessage() {},
WX_UDPSocketSendString() {},
WX_UDPSocketSendBuffer() {},
WX_UDPSocketSetTTL() {},
WX_UDPSocketWriteString() {},
WX_UDPSocketWriteBuffer() {},
WX_UDPSocketBind() {},
WX_RegisterUDPSocketOnMessageCallback() {},
WX_OnBLECharacteristicValueChange() {},
WX_OffBLECharacteristicValueChange() {},
WX_RegisterOnBLECharacteristicValueChangeCallback() {},
WX_StartGyroscope() {},
WX_StopGyroscope() {},
WX_OnGyroscopeChange() {},
WX_OffGyroscopeChange() {},
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_CloudCDN() {},
WXLaunchOperaBridge() {},
WX_SetPreferredFramesPerSecond() {},
WX_OneWayFunction(functionName, successType, failType, completeType, conf, callbackId){},
WX_OneWayNoFunction_v() {},
WX_OneWayNoFunction_vs() {},
WX_OneWayNoFunction_vt() {},
WX_OneWayNoFunction_vst() {},
WX_OneWayNoFunction_vsn() {},
WX_OneWayNoFunction_vnns() {},
WX_OnEventRegister() {},
WX_OffEventRegister() {},
WX_OnAddToFavorites() {},
WX_OnAddToFavorites_Resolve(conf){},
WX_OffAddToFavorites() {},
WX_OnCopyUrl() {},
WX_OnCopyUrl_Resolve(conf){},
WX_OffCopyUrl() {},
WX_OnHandoff() {},
WX_OnHandoff_Resolve(conf){},
WX_OffHandoff() {},
WX_OnShareTimeline() {},
WX_OnShareTimeline_Resolve(conf){},
WX_OffShareTimeline() {},
WX_OnGameLiveStateChange() {},
WX_OnGameLiveStateChange_Resolve(conf){},
WX_OffGameLiveStateChange() {},
WX_SyncFunction_t() {
return "";
},
WX_SyncFunction_tt() {
return "";
},
WX_SyncFunction_bt() {
return false;
},
WX_SyncFunction_nt() {
return 0;
},
WX_SyncFunction_bs() {
return false;
},
WX_SyncFunction_b() {
return false;
},
WX_SyncFunction_bsnn() {
return false;
},
WX_SyncFunction_ss() {
return "";
},
WX_SyncFunction_tnn() {
return "";
},
WX_ClassFunction() {return ""},
WX_ClassConstructor() {return ""},
WX_ClassSetProperty() {},
WX_ClassOneWayNoFunction_v() {},
WX_ClassOneWayNoFunction_vs() {},
WX_ClassOneWayNoFunction_t() {
return "";
},
WX_ClassOneWayNoFunction_vt() {},
WX_ClassOnEventFunction() {},
WX_ClassOffEventFunction() {}, };
var downloadedTextures = {};
var downloadingTextures = {};
var textureHandler = {
downloadFile(textureId, type, prefix) {
var url = prefix + '.png';
var cid = type + '_' + textureId;
var image = new Image();
image.src = url;
image.onload = function () {
downloadedTextures[cid] = {
data: image,
};
if (downloadingTextures[cid] instanceof Array) {
downloadingTextures[cid].forEach(v => v());
} else {
downloadingTextures[cid]();
}
delete downloadingTextures[cid];
};
image.onerror = function () {
console.error(url + ' 下载失败!');
};
},
};
var GameGlobal = {
TextureConfig: {},
SpriteAtlasConfig: {},
DownloadedTextures: downloadedTextures,
AUDIO_PREFIX: './Assets/Textures/',
};
window._ScaleRate = 1;
</script>
</body>
</html>
...@@ -822,7 +822,9 @@ PlayerSettings: ...@@ -822,7 +822,9 @@ PlayerSettings:
webGLShowDiagnostics: 0 webGLShowDiagnostics: 0
webGLDataCaching: 0 webGLDataCaching: 0
webGLDebugSymbols: 1 webGLDebugSymbols: 1
webGLEmscriptenArgs: ' -s TOTAL_MEMORY=128MB' webGLEmscriptenArgs: ' -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end
-s ERROR_ON_UNDEFINED_SYMBOLS=0 -s TOTAL_MEMORY=256MB -s EXPORTED_RUNTIME_METHODS=''["ccall","cwrap","stackTrace","addRunDependency","removeRunDependency","FS_createPath","FS_createDataFile","stackTrace","writeStackCookie","checkStackCookie","lengthBytesUTF8","stringToUTF8"]''
--profiling-funcs '
webGLModulesDirectory: webGLModulesDirectory:
webGLTemplate: PROJECT:WXTemplate2022 webGLTemplate: PROJECT:WXTemplate2022
webGLAnalyzeBuildSize: 0 webGLAnalyzeBuildSize: 0
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
"projectname": "TestTTSDK", "projectname": "TestTTSDK",
"unity": { "unity": {
"build": { "build": {
"webgl": "E:\\UnityProject\\UnityTrunckPro_SDK\\tt_miniGame\\webgl_package-20251125_113539.zip", "webgl": "E:\\UnitySDKTrunck_Comm\\UnityTrunckPro_SDK\\MiniGameExport\\Tiktok\\webgl_package-20251125_151148.zip",
"native": { "native": {
"il2cpp": "", "il2cpp": "",
"apk": "", "apk": "",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论