Skip to content

Commit 16bf0ca

Browse files
author
uhu
committed
feat: update sdk
1 parent c321c9c commit 16bf0ca

File tree

137 files changed

+2579
-733
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+2579
-733
lines changed

Demo/API/Assets/Scenes/Video.unity

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Transform:
214214
m_PrefabAsset: {fileID: 0}
215215
m_GameObject: {fileID: 705144908}
216216
m_LocalRotation: {x: -0.082156666, y: -0.9390545, z: 0.33253664, w: -0.029093198}
217-
m_LocalPosition: {x: 0, y: -2, z: 10}
217+
m_LocalPosition: {x: 0, y: 0, z: 5}
218218
m_LocalScale: {x: 1, y: 1, z: 1}
219219
m_ConstrainProportionsScale: 0
220220
m_Children: []
@@ -632,9 +632,9 @@ VideoPlayer:
632632
m_TargetCamera: {fileID: 0}
633633
m_TargetTexture: {fileID: 8400000, guid: 7b832c8ec20444466b25ff90d77c6745, type: 2}
634634
m_TimeReference: 0
635-
m_TargetMaterialRenderer: {fileID: 0}
635+
m_TargetMaterialRenderer: {fileID: 705144910}
636636
m_TargetMaterialProperty: <noninit>
637-
m_RenderMode: 2
637+
m_RenderMode: 3
638638
m_AspectRatio: 2
639639
m_DataSource: 1
640640
m_PlaybackSpeed: 1
@@ -890,14 +890,14 @@ VideoPlayer:
890890
m_GameObject: {fileID: 2114722371}
891891
m_Enabled: 1
892892
m_VideoClip: {fileID: 0}
893-
m_TargetCameraAlpha: 1
893+
m_TargetCameraAlpha: 0.8
894894
m_TargetCamera3DLayout: 0
895895
m_TargetCamera: {fileID: 1159140101}
896896
m_TargetTexture: {fileID: 0}
897897
m_TimeReference: 0
898898
m_TargetMaterialRenderer: {fileID: 0}
899899
m_TargetMaterialProperty: <noninit>
900-
m_RenderMode: 0
900+
m_RenderMode: 1
901901
m_AspectRatio: 2
902902
m_DataSource: 1
903903
m_PlaybackSpeed: 1

Demo/API/Assets/WX-WASM-SDK-V2/CHANGELOG.md

Lines changed: 61 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,78 @@ Removed - 删除功能/接口
66
Fixed - 修复问题
77
Others - 其他
88
-->
9+
## 2023-12-18
10+
【重要更新】包含重要bugfix、特性支持
11+
### Feature
12+
* 普通:TouchStart/TouchEnd去json性能优化
13+
### Fixed
14+
* 重要:修复TCP接口处理buffer
15+
16+
## 2023-12-12
17+
【重要更新】包含重要bugfix、特性支持
18+
### Feature
19+
* 重要:优化TCP接口能力,使用请查阅[网络通信适配](https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/UsingNetworking.md)
20+
* 重要:优化UDP接口能力
21+
* 普通:优化启动剧情能力(Beta)
22+
* 普通:增加接口WX.CanIUse
23+
24+
## 2023-12-08
25+
【重要更新】包含重要bugfix、特性支持
26+
### Feature
27+
* 重要:新增启动剧情能力(Beta)
28+
* 重要:新增TCP接口能力
29+
* 普通:更新适配插件版本到1.2.34
30+
### Fixed
31+
* 严重:修复TouchMove在<iOS 15.0系统BigUnit64Array兼容性问题
32+
* 严重:修复适配插件处理代码分包时序导致的一定概率启动失败
33+
34+
## 2023-11-29
35+
【普通更新】
36+
### Fixed
37+
* 普通:修复TouchMove优化在2020之前版本产生的导出错误
38+
39+
## 2023-11-28
40+
【重要更新】包含重要bugfix、特性支持
41+
### Feature
42+
* 普通:FileSystem Stat支持isDirectory和isFile
43+
* 普通:优化胶水层代码,删减多余代码
44+
* 重要:TouchMove触摸性能优化
45+
* 重要:优化微信字体所占用的MonoHeap临时内存
46+
### Fixed
47+
* 普通:修复IOS音频被打断无法重新播放
48+
* 普通:修复2022导出Video的BUG
49+
50+
## 2023-11-10
51+
【普通更新】
52+
### Feature
53+
* 普通:支持2022 Input Field组件适配微信输入法
54+
* 普通:PC端和开发者工具支持Unity VideoPlayer组件
55+
56+
## 2023-11-02
57+
【普通更新】
58+
### Fixed
59+
* 修复部分首资源包压缩异常问题
60+
961
## 2023-10-20
62+
【普通更新】
1063
### Feature
11-
* Unity2022 development build的导出支持
12-
* 更新小游戏云测试profile获取的性能数据
64+
* 重要:Unity2022 development build的导出支持
65+
* 普通:更新小游戏云测试profile获取的性能数据
1366
### Fixed
14-
* 修复微信压缩纹理工具对音频ab包的处理bug问题
15-
* 修复微信压缩纹理工具在 MacOS M1系列芯片执行异常问题
67+
* 普通:修复微信压缩纹理工具对音频ab包的处理bug问题
68+
* 普通:修复微信压缩纹理工具在 MacOS M1系列芯片执行异常问题
1669

17-
## 2023-10-11
70+
## 2023-10-11【普通更新】
1871
### Feature
1972
* 适配Video Player, 安卓3.0.0基础库/IOS 3.1.1基础库且只支持播放一个视频
2073

2174
## 2023-9-26
75+
【重要更新】包含重要bugfix、特性支持
2276
### Feature
2377
* 适配Application.targetFramerate,无需再调用小游戏的帧率设置API
2478
### Fixed
25-
* 修复wasm分包patch未生效的问题
26-
* 修复WXAssetBundle在异常时上报错误
79+
* 重要:修复wasm分包patch未生效的问题
80+
* 重要:修复WXAssetBundle在异常时上报错误
2781
* 更新适配插件版本到1.2.31
2882

2983
## 2023-09-20

Demo/API/Assets/WX-WASM-SDK-V2/Editor/MiniGameConfig.asset

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ MonoBehaviour:
1313
m_Name: MiniGameConfig
1414
m_EditorClassIdentifier:
1515
ProjectConf:
16-
projectName: ccccccccc
17-
Appid: wx7a727ff7d940bb3f
18-
CDN: ccccccccc
16+
projectName:
17+
Appid:
18+
CDN:
1919
assetLoadType: 1
2020
compressDataPackage: 0
2121
VideoUrl:
22-
DST: /Users/uhu/Projects/WeChat/minigame-unity-webgl-transform/Demo/API/Dist
22+
DST:
2323
StreamCDN:
2424
bundleHashLength: 32
2525
bundlePathIdentifier: StreamingAssets;
@@ -45,7 +45,7 @@ MonoBehaviour:
4545
UseMiniGameChat: 0
4646
PreloadWXFont: 0
4747
CompileOptions:
48-
DevelopBuild: 1
48+
DevelopBuild: 0
4949
AutoProfile: 0
5050
ScriptOnly: 0
5151
Il2CppOptimizeSize: 1
Binary file not shown.

Demo/API/Assets/WX-WASM-SDK-V2/Editor/WXConvertCore.cs

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using UnityEngine.Rendering;
1010
using LitJson;
1111
using UnityEditor.Build;
12+
using System.Linq;
1213

1314
namespace WeChatWASM
1415
{
@@ -155,6 +156,54 @@ public static void UpdateGraphicAPI()
155156
}
156157
}
157158

159+
/// <summary>
160+
/// 移除输入js代码字符串中所有以prefix为前缀的函数的函数体,function与函数名之间仅允许有一个空格
161+
/// </summary>
162+
/// <param name="input">输入字符串</param>
163+
/// <param name="prefix">函数前缀</param>
164+
/// <returns>处理后的字符串</returns>
165+
public static string RemoveFunctionsWithPrefix(string input, string prefix)
166+
{
167+
StringBuilder output = new StringBuilder();
168+
169+
int braceCount = 0;
170+
int lastIndex = 0;
171+
int index = input.IndexOf("function " + prefix);
172+
173+
while (index != -1)
174+
{
175+
output.Append(input, lastIndex, index - lastIndex);
176+
lastIndex = index;
177+
178+
while (input[lastIndex] != '{')
179+
{
180+
lastIndex++;
181+
}
182+
183+
braceCount = 1;
184+
++lastIndex;
185+
186+
while (braceCount > 0)
187+
{
188+
if (input[lastIndex] == '{')
189+
{
190+
++braceCount;
191+
}
192+
else if (input[lastIndex] == '}')
193+
{
194+
--braceCount;
195+
}
196+
++lastIndex;
197+
}
198+
199+
index = input.IndexOf("function " + prefix, lastIndex);
200+
}
201+
202+
output.Append(input, lastIndex, input.Length - lastIndex);
203+
204+
return output.ToString();
205+
}
206+
158207
private static void ConvertCode()
159208
{
160209
UnityEngine.Debug.LogFormat("[Converter] Starting to adapt framewor. Dst: " + config.ProjectConf.DST);
@@ -175,7 +224,19 @@ private static void ConvertCode()
175224
var rule = ReplaceRules.rules[i];
176225
text = Regex.Replace(text, rule.old, rule.newStr);
177226
}
178-
227+
string[] prefixs =
228+
{
229+
"_JS_Video_",
230+
//"jsVideo",
231+
"_JS_Sound_",
232+
"jsAudio",
233+
"_JS_MobileKeyboard_",
234+
"_JS_MobileKeybard_"
235+
};
236+
foreach (var prefix in prefixs)
237+
{
238+
text = RemoveFunctionsWithPrefix(text, prefix);
239+
}
179240
if (PlayerSettings.WebGL.exceptionSupport == WebGLExceptionSupport.None)
180241
{
181242
Rule[] rules =
@@ -184,7 +245,8 @@ private static void ConvertCode()
184245
{
185246
old = "console.log\\(\"Exception at",
186247
newStr = "if(Module.IsWxGame);console.log(\"Exception at",
187-
}, new Rule()
248+
},
249+
new Rule()
188250
{
189251
old = "throw ptr",
190252
newStr = "if(Module.IsWxGame)window.WXWASMSDK.WXUncaughtException(true);else throw ptr",
@@ -274,6 +336,11 @@ private static int Build()
274336
PlayerSettings.WebGL.emscriptenArgs += " --profiling-funcs ";
275337
}
276338

339+
string original_EXPORTED_RUNTIME_METHODS = "\"ccall\",\"cwrap\",\"stackTrace\",\"addRunDependency\",\"removeRunDependency\",\"FS_createPath\",\"FS_createDataFile\",\"stackTrace\",\"writeStackCookie\",\"checkStackCookie\"";
340+
// 添加额外的EXPORTED_RUNTIME_METHODS
341+
string additional_EXPORTED_RUNTIME_METHODS = ",\"lengthBytesUTF8\",\"stringToUTF8\"";
342+
PlayerSettings.WebGL.emscriptenArgs += " -s EXPORTED_RUNTIME_METHODS='[" + original_EXPORTED_RUNTIME_METHODS + additional_EXPORTED_RUNTIME_METHODS + "]'";
343+
277344
#if UNITY_2021_2_OR_NEWER
278345
#if UNITY_2022_1_OR_NEWER
279346
// 默认更改为OptimizeSize,减少代码包体积

Demo/API/Assets/WX-WASM-SDK-V2/Editor/WXPluginVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
public class WXPluginVersion
44
{
5-
public static string pluginVersion = "202310201901"; // 这一行不要改他,导出的时候会自动替换
5+
public static string pluginVersion = "202312181916"; // 这一行不要改他,导出的时候会自动替换
66
}
77

88
public class WXPluginConf
Binary file not shown.

Demo/API/Assets/WX-WASM-SDK-V2/Runtime/Plugins/SDK-Call-JS-Old.jslib

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,5 +963,27 @@ mergeInto(LibraryManager.library, {
963963
},
964964
WX_PrivacyAuthorizeResolve: function(option) {
965965
window.WXWASMSDK.WX_PrivacyAuthorizeResolve(_WXPointer_stringify_adaptor(option));
966+
},
967+
WXLaunchOperaBridge: function(req) {
968+
var res = window.WXWASMSDK.WXLaunchOperaBridge(_WXPointer_stringify_adaptor(req));
969+
if (res) {
970+
var bufferSize = lengthBytesUTF8(res) + 1;
971+
var buffer = _malloc(bufferSize);
972+
stringToUTF8(res, buffer, bufferSize);
973+
return buffer;
974+
}
975+
},
976+
WX_OnTouchMove:function() {
977+
window.WXWASMSDK.WX_OnTouchMove();
978+
},
979+
WX_OffTouchMove:function() {
980+
window.WXWASMSDK.WX_OffTouchMove();
981+
},
982+
WXCanIUse: function(key) {
983+
if (!key || !_WXPointer_stringify_adaptor(key)) {
984+
return false;
985+
}
986+
const keyString = _WXPointer_stringify_adaptor(key);
987+
return typeof wx[keyString[0].toLowerCase() + keyString.slice(1)] !== 'undefined';
966988
}
967989
});

0 commit comments

Comments
 (0)