Auto-publish.

This commit is contained in:
nebulaliu 2025-08-13 15:31:14 +08:00
parent d95020f6fc
commit 0653a91e1f
202 changed files with 1893 additions and 1497 deletions

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: c113acfee35db6b5c61fd4a76596cfd3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,38 @@
mergeInto(LibraryManager.library, {
// 定义供 C/C++ 调用的 JS 函数
js_batchRender_malloc: function(data, size, isSync) {
// 直接从 WASM 内存创建视图(零拷贝)
const targetBuffer = new Uint8Array(Module.HEAPU8.buffer, data, size);
//console.log("processBinaryData invoke");
const extBuffer = new ArrayBuffer(1);
if(!isSync){
mtl.batchRenderAsync(targetBuffer, extBuffer);
return null;
}
const response = mtl.batchRender(targetBuffer, extBuffer);
if (!response) {
return null;
}
const result = response.buffer;
if(!result || result.byteLength == 0){
return null;
}
// 申请内存空间,后续在cpp wasm部分使用记得释放
const ptr = Module._malloc(result.byteLength);
// 将数据拷贝到WASM内存
Module.HEAPU8.set(new Uint8Array(result), ptr);
// 返回结构化的数据信息(指针和长度)
const ret = new DataView(new ArrayBuffer(8));
ret.setUint32(0, ptr, true); // 指针地址4字节
ret.setUint32(4, result.byteLength, true); // 数据长度4字节
// 返回合并后的8字节缓冲区指针记得也要在cpp部分释放
const retPtr = Module._malloc(8);
Module.HEAPU8.set(new Uint8Array(ret.buffer), retPtr);
return retPtr;
},
js_swapWindow: function(){
mtl.swapWindow();
}
});

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dda1926f3454e003333e8085a4f2c0fd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,134 +5,134 @@ using UnityEngine;
namespace WeChatWASM namespace WeChatWASM
{ {
public class WXPlayableConvertCore public class WXPlayableConvertCore
{
static WXPlayableConvertCore() { }
public static WXPlayableEditorScriptObject config => UnityUtil.GetPlayableEditorConf();
public static WXConvertCore.WXExportError DoExport(bool buildWebGL = true)
{ {
WXConvertCore.isPlayableBuild = true; static WXPlayableConvertCore() { }
// var preCheckResult = WXConvertCore.PreCheck(); public static WXPlayableEditorScriptObject config => UnityUtil.GetPlayableEditorConf();
// if (preCheckResult != WXConvertCore.WXExportError.SUCCEED)
// {
// WXConvertCore.isPlayableBuild = false;
// return preCheckResult;
// }
// WXConvertCore.PreInit();
var exportResult = WXConvertCore.DoExport();
WXConvertCore.isPlayableBuild = false; public static WXConvertCore.WXExportError DoExport(bool buildWebGL = true)
return exportResult;
}
public static WXEditorScriptObject GetFakeScriptObject()
{
return SetDefaultProperties(ConvertPlayableConfigToCommon(config));
}
public static WXEditorScriptObject ConvertPlayableConfigToCommon(
WXPlayableEditorScriptObject source,
WXEditorScriptObject target = null)
{
// 创建或使用现有的目标实例
var newTarget = target ?? ScriptableObject.CreateInstance<WXEditorScriptObject>();
// 使用序列化方式深度拷贝公共字段
var so = new SerializedObject(newTarget);
// 遍历源对象的所有字段
var sourceType = source.GetType();
foreach (var sourceField in sourceType.GetFields(
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic))
{
// 跳过readonly字段
if (sourceField.IsInitOnly) continue;
// 查找目标对象中的对应字段
var targetField = typeof(WXEditorScriptObject).GetField(
sourceField.Name,
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
// if (targetField != null && !targetField.FieldType.IsValueType && !targetField.FieldType.IsEnum)
// {
// // // 复制字段值
// // var value = sourceField.GetValue(source);
// // targetField.SetValue(newTarget, value);
// // 递归复制子对象属性
// var subObj = targetField.GetValue(newTarget) ?? Activator.CreateInstance(targetField.FieldType);
// CopySubObjectProperties(value, subObj);
// targetField.SetValue(newTarget, subObj);
// }
// if (targetField != null &&
// (targetField.FieldType.IsAssignableFrom(sourceField.FieldType) ||
// (targetField.FieldType.IsValueType && sourceField.FieldType.IsValueType &&
// targetField.FieldType == sourceField.FieldType)))
// {
// 复制字段值
var value = sourceField.GetValue(source);
// 特殊处理嵌套对象类型的字段
if (value != null && !targetField.FieldType.IsValueType && !targetField.FieldType.IsEnum)
{
// 递归复制子对象属性
var subObj = targetField.GetValue(newTarget) ?? Activator.CreateInstance(targetField.FieldType);
CopySubObjectProperties(value, subObj);
targetField.SetValue(newTarget, subObj);
}
else
{
targetField.SetValue(newTarget, value);
}
// }
}
// 应用修改到序列化对象
so.ApplyModifiedProperties();
return newTarget;
}
private static void CopySubObjectProperties(object source, object target)
{
var sourceType = source.GetType();
var targetType = target.GetType();
foreach (var sourceField in sourceType.GetFields(
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic))
{ {
if (sourceField.IsInitOnly) continue; WXConvertCore.isPlayableBuild = true;
// var preCheckResult = WXConvertCore.PreCheck();
// if (preCheckResult != WXConvertCore.WXExportError.SUCCEED)
// {
// WXConvertCore.isPlayableBuild = false;
// return preCheckResult;
// }
// WXConvertCore.PreInit();
var exportResult = WXConvertCore.DoExport();
var targetField = targetType.GetField( WXConvertCore.isPlayableBuild = false;
sourceField.Name, return exportResult;
}
public static WXEditorScriptObject GetFakeScriptObject()
{
return SetDefaultProperties(ConvertPlayableConfigToCommon(config));
}
public static WXEditorScriptObject ConvertPlayableConfigToCommon(
WXPlayableEditorScriptObject source,
WXEditorScriptObject target = null)
{
// 创建或使用现有的目标实例
var newTarget = target ?? ScriptableObject.CreateInstance<WXEditorScriptObject>();
// 使用序列化方式深度拷贝公共字段
var so = new SerializedObject(newTarget);
// 遍历源对象的所有字段
var sourceType = source.GetType();
foreach (var sourceField in sourceType.GetFields(
System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic); System.Reflection.BindingFlags.NonPublic))
if (targetField != null &&
(targetField.FieldType.IsAssignableFrom(sourceField.FieldType) ||
(targetField.FieldType.IsValueType && sourceField.FieldType.IsValueType &&
targetField.FieldType == sourceField.FieldType)))
{ {
// 跳过readonly字段
if (sourceField.IsInitOnly) continue;
// 查找目标对象中的对应字段
var targetField = typeof(WXEditorScriptObject).GetField(
sourceField.Name,
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
// if (targetField != null && !targetField.FieldType.IsValueType && !targetField.FieldType.IsEnum)
// {
// // // 复制字段值
// // var value = sourceField.GetValue(source);
// // targetField.SetValue(newTarget, value);
// // 递归复制子对象属性
// var subObj = targetField.GetValue(newTarget) ?? Activator.CreateInstance(targetField.FieldType);
// CopySubObjectProperties(value, subObj);
// targetField.SetValue(newTarget, subObj);
// }
// if (targetField != null &&
// (targetField.FieldType.IsAssignableFrom(sourceField.FieldType) ||
// (targetField.FieldType.IsValueType && sourceField.FieldType.IsValueType &&
// targetField.FieldType == sourceField.FieldType)))
// {
// 复制字段值
var value = sourceField.GetValue(source); var value = sourceField.GetValue(source);
targetField.SetValue(target, value); // 特殊处理嵌套对象类型的字段
if (value != null && !targetField.FieldType.IsValueType && !targetField.FieldType.IsEnum)
{
// 递归复制子对象属性
var subObj = targetField.GetValue(newTarget) ?? Activator.CreateInstance(targetField.FieldType);
CopySubObjectProperties(value, subObj);
targetField.SetValue(newTarget, subObj);
}
else
{
targetField.SetValue(newTarget, value);
}
// }
}
// 应用修改到序列化对象
so.ApplyModifiedProperties();
return newTarget;
}
private static void CopySubObjectProperties(object source, object target)
{
var sourceType = source.GetType();
var targetType = target.GetType();
foreach (var sourceField in sourceType.GetFields(
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic))
{
if (sourceField.IsInitOnly) continue;
var targetField = targetType.GetField(
sourceField.Name,
System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags.Instance |
System.Reflection.BindingFlags.NonPublic);
if (targetField != null &&
(targetField.FieldType.IsAssignableFrom(sourceField.FieldType) ||
(targetField.FieldType.IsValueType && sourceField.FieldType.IsValueType &&
targetField.FieldType == sourceField.FieldType)))
{
var value = sourceField.GetValue(source);
targetField.SetValue(target, value);
}
} }
} }
}
public static WXEditorScriptObject SetDefaultProperties(WXEditorScriptObject target) public static WXEditorScriptObject SetDefaultProperties(WXEditorScriptObject target)
{ {
target.ProjectConf.CDN = ""; target.ProjectConf.CDN = "";
target.ProjectConf.assetLoadType = 1; target.ProjectConf.assetLoadType = 1;
target.ProjectConf.compressDataPackage = true; target.ProjectConf.compressDataPackage = true;
target.CompileOptions.showMonitorSuggestModal = false; target.CompileOptions.showMonitorSuggestModal = false;
return target; return target;
}
} }
}
} }

View File

@ -6,354 +6,354 @@ using UnityEngine;
namespace WeChatWASM namespace WeChatWASM
{ {
[InitializeOnLoad] [InitializeOnLoad]
public class WXPlayableSettingsHelperInterface public class WXPlayableSettingsHelperInterface
{
public static WXPlayableSettingsHelper helper = new WXPlayableSettingsHelper();
}
public class WXPlayableSettingsHelper
{
public static string projectRootPath;
private static WXPlayableEditorScriptObject config;
private static bool m_EnablePerfTool = false;
public static bool UseIL2CPP
{ {
get public static WXPlayableSettingsHelper helper = new WXPlayableSettingsHelper();
{ }
public class WXPlayableSettingsHelper
{
public static string projectRootPath;
private static WXPlayableEditorScriptObject config;
private static bool m_EnablePerfTool = false;
public static bool UseIL2CPP
{
get
{
#if TUANJIE_2022_3_OR_NEWER #if TUANJIE_2022_3_OR_NEWER
return PlayerSettings.GetScriptingBackend(BuildTargetGroup.WeixinMiniGame) == ScriptingImplementation.IL2CPP; return PlayerSettings.GetScriptingBackend(BuildTargetGroup.WeixinMiniGame) == ScriptingImplementation.IL2CPP;
#else #else
return true; return true;
#endif #endif
} }
}
public WXPlayableSettingsHelper()
{
projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../");
}
public void OnFocus()
{
loadData();
}
public void OnLostFocus()
{
saveData();
}
public void OnDisable()
{
EditorUtility.SetDirty(config);
}
private Vector2 scrollRoot;
private bool foldBaseInfo = true;
private bool foldDebugOptions = true;
public void OnSettingsGUI(EditorWindow window)
{
scrollRoot = EditorGUILayout.BeginScrollView(scrollRoot);
GUIStyle linkStyle = new GUIStyle(GUI.skin.label);
linkStyle.normal.textColor = Color.yellow;
linkStyle.hover.textColor = Color.yellow;
linkStyle.stretchWidth = false;
linkStyle.alignment = TextAnchor.UpperLeft;
linkStyle.wordWrap = true;
foldBaseInfo = EditorGUILayout.Foldout(foldBaseInfo, "基本信息");
if (foldBaseInfo)
{
EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true));
this.formInput("appid", "小游戏试玩AppID");
this.formInput("projectName", "小游戏试玩项目名");
this.formIntPopup("orientation", "游戏方向", new[] { "Portrait", "Landscape" }, new[] { 0, 1, 2, 3 });
this.formInput("memorySize", "UnityHeap预留内存(?)", "单位MB预分配内存值超休闲游戏256/中轻度496/重度游戏768需预估游戏最大UnityHeap值以防止内存自动扩容带来的峰值尖刺。预估方法请查看GIT文档《优化Unity WebGL的内存》");
GUILayout.BeginHorizontal();
string targetDst = "dst";
if (!formInputData.ContainsKey(targetDst))
{
formInputData[targetDst] = "";
} }
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
GUILayout.Label(new GUIContent("导出路径(?)", "支持输入相对于项目根目录的相对路径wxbuild"), GUILayout.Width(140)); public WXPlayableSettingsHelper()
formInputData[targetDst] = GUILayout.TextField(formInputData[targetDst], GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 270));
if (GUILayout.Button(new GUIContent("打开"), GUILayout.Width(40)))
{ {
if (!formInputData[targetDst].Trim().Equals(string.Empty)) projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../");
{
EditorUtility.RevealInFinder(GetAbsolutePath(formInputData[targetDst]));
}
GUIUtility.ExitGUI();
} }
if (GUILayout.Button(new GUIContent("选择"), GUILayout.Width(40)))
public void OnFocus()
{ {
var dstPath = EditorUtility.SaveFolderPanel("选择你的游戏导出目录", string.Empty, string.Empty); loadData();
if (dstPath != string.Empty)
{
formInputData[targetDst] = dstPath;
this.saveData();
}
GUIUtility.ExitGUI();
} }
GUILayout.EndHorizontal();
public void OnLostFocus()
EditorGUILayout.EndVertical();
}
foldDebugOptions = EditorGUILayout.Foldout(foldDebugOptions, "调试编译选项");
if (foldDebugOptions)
{
EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true));
this.formCheckbox("developBuild", "Development Build", "", false, null, OnDevelopmentBuildToggleChanged);
this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP);
this.formCheckbox("profilingFuncs", "Profiling Funcs");
this.formCheckbox("webgl2", "WebGL2.0(beta)");
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndScrollView();
}
public void OnBuildButtonGUI(EditorWindow window)
{
GUIStyle linkStyle = new GUIStyle(GUI.skin.label);
linkStyle.normal.textColor = Color.yellow;
linkStyle.hover.textColor = Color.yellow;
linkStyle.stretchWidth = false;
linkStyle.alignment = TextAnchor.UpperLeft;
linkStyle.wordWrap = true;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.MinWidth(10));
if (GUILayout.Button(new GUIContent("生成并转换"), GUILayout.Width(100), GUILayout.Height(25)))
{
this.saveData();
if (WXPlayableConvertCore.DoExport() == WXConvertCore.WXExportError.SUCCEED)
{ {
window.ShowNotification(new GUIContent("转换完成")); saveData();
} }
GUIUtility.ExitGUI();
}
EditorGUILayout.EndHorizontal();
}
private void OnDevelopmentBuildToggleChanged(bool InNewValue)
{
// 针对non-dev build取消性能分析工具的集成
if (!InNewValue)
{
this.setData("enablePerfAnalysis", false);
}
}
private string SDKFilePath; public void OnDisable()
private void loadData()
{
SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-playable-default", "unity-sdk", "index.js");
config = UnityUtil.GetPlayableEditorConf();
this.setData("projectName", config.ProjectConf.projectName);
this.setData("appid", config.ProjectConf.Appid);
this.setData("orientation", (int)config.ProjectConf.Orientation);
this.setData("dst", config.ProjectConf.relativeDST);
this.setData("developBuild", config.CompileOptions.DevelopBuild);
this.setData("il2CppOptimizeSize", config.CompileOptions.Il2CppOptimizeSize);
this.setData("profilingFuncs", config.CompileOptions.profilingFuncs);
this.setData("webgl2", config.CompileOptions.Webgl2);
this.setData("customNodePath", config.CompileOptions.CustomNodePath);
this.setData("memorySize", config.ProjectConf.MemorySize.ToString());
}
private void saveData()
{
config.ProjectConf.projectName = this.getDataInput("projectName");
config.ProjectConf.Appid = this.getDataInput("appid");
config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation");
config.ProjectConf.relativeDST = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(config.ProjectConf.relativeDST);
config.CompileOptions.DevelopBuild = this.getDataCheckbox("developBuild");
config.CompileOptions.Il2CppOptimizeSize = this.getDataCheckbox("il2CppOptimizeSize");
config.CompileOptions.profilingFuncs = this.getDataCheckbox("profilingFuncs");
config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath");
config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2");
config.ProjectConf.MemorySize = int.Parse(this.getDataInput("memorySize"));
}
private Dictionary<string, string> formInputData = new Dictionary<string, string>();
private Dictionary<string, int> formIntPopupData = new Dictionary<string, int>();
private Dictionary<string, bool> formCheckboxData = new Dictionary<string, bool>();
private string getDataInput(string target)
{
if (this.formInputData.ContainsKey(target))
return this.formInputData[target];
return "";
}
private int getDataPop(string target)
{
if (this.formIntPopupData.ContainsKey(target))
return this.formIntPopupData[target];
return 0;
}
private bool getDataCheckbox(string target)
{
if (this.formCheckboxData.ContainsKey(target))
return this.formCheckboxData[target];
return false;
}
private void formCheckbox(string target, string label, string help = null, bool disable = false, Action<bool> setting = null, Action<bool> onValueChanged = null)
{
if (!formCheckboxData.ContainsKey(target))
{
formCheckboxData[target] = false;
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
if (help == null)
{
GUILayout.Label(label, GUILayout.Width(140));
}
else
{
GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140));
}
EditorGUI.BeginDisabledGroup(disable);
// Toggle the checkbox value based on the disable condition
bool newValue = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]);
// Update the checkbox data if the value has changed and invoke the onValueChanged action
if (newValue != formCheckboxData[target])
{
formCheckboxData[target] = newValue;
onValueChanged?.Invoke(newValue);
}
if (setting != null)
{
EditorGUILayout.LabelField("", GUILayout.Width(10));
// 配置按钮
if (GUILayout.Button(new GUIContent("设置"), GUILayout.Width(40), GUILayout.Height(18)))
{ {
setting?.Invoke(true); EditorUtility.SetDirty(config);
} }
EditorGUILayout.LabelField("", GUILayout.MinWidth(10));
}
EditorGUI.EndDisabledGroup(); private Vector2 scrollRoot;
private bool foldBaseInfo = true;
private bool foldDebugOptions = true;
public void OnSettingsGUI(EditorWindow window)
{
scrollRoot = EditorGUILayout.BeginScrollView(scrollRoot);
GUIStyle linkStyle = new GUIStyle(GUI.skin.label);
linkStyle.normal.textColor = Color.yellow;
linkStyle.hover.textColor = Color.yellow;
linkStyle.stretchWidth = false;
linkStyle.alignment = TextAnchor.UpperLeft;
linkStyle.wordWrap = true;
if (setting == null) foldBaseInfo = EditorGUILayout.Foldout(foldBaseInfo, "基本信息");
EditorGUILayout.LabelField(string.Empty); if (foldBaseInfo)
GUILayout.EndHorizontal(); {
EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true));
this.formInput("appid", "小游戏试玩AppID");
this.formInput("projectName", "小游戏试玩项目名");
this.formIntPopup("orientation", "游戏方向", new[] { "Portrait", "Landscape" }, new[] { 0, 1, 2, 3 });
this.formInput("memorySize", "UnityHeap预留内存(?)", "单位MB预分配内存值超休闲游戏256/中轻度496/重度游戏768需预估游戏最大UnityHeap值以防止内存自动扩容带来的峰值尖刺。预估方法请查看GIT文档《优化Unity WebGL的内存》");
GUILayout.BeginHorizontal();
string targetDst = "dst";
if (!formInputData.ContainsKey(targetDst))
{
formInputData[targetDst] = "";
}
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
GUILayout.Label(new GUIContent("导出路径(?)", "支持输入相对于项目根目录的相对路径wxbuild"), GUILayout.Width(140));
formInputData[targetDst] = GUILayout.TextField(formInputData[targetDst], GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 270));
if (GUILayout.Button(new GUIContent("打开"), GUILayout.Width(40)))
{
if (!formInputData[targetDst].Trim().Equals(string.Empty))
{
EditorUtility.RevealInFinder(GetAbsolutePath(formInputData[targetDst]));
}
GUIUtility.ExitGUI();
}
if (GUILayout.Button(new GUIContent("选择"), GUILayout.Width(40)))
{
var dstPath = EditorUtility.SaveFolderPanel("选择你的游戏导出目录", string.Empty, string.Empty);
if (dstPath != string.Empty)
{
formInputData[targetDst] = dstPath;
this.saveData();
}
GUIUtility.ExitGUI();
}
GUILayout.EndHorizontal();
EditorGUILayout.EndVertical();
}
foldDebugOptions = EditorGUILayout.Foldout(foldDebugOptions, "调试编译选项");
if (foldDebugOptions)
{
EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true));
this.formCheckbox("developBuild", "Development Build", "", false, null, OnDevelopmentBuildToggleChanged);
this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP);
this.formCheckbox("profilingFuncs", "Profiling Funcs");
this.formCheckbox("webgl2", "WebGL2.0(beta)");
EditorGUILayout.EndVertical();
}
EditorGUILayout.EndScrollView();
}
public void OnBuildButtonGUI(EditorWindow window)
{
GUIStyle linkStyle = new GUIStyle(GUI.skin.label);
linkStyle.normal.textColor = Color.yellow;
linkStyle.hover.textColor = Color.yellow;
linkStyle.stretchWidth = false;
linkStyle.alignment = TextAnchor.UpperLeft;
linkStyle.wordWrap = true;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.MinWidth(10));
if (GUILayout.Button(new GUIContent("生成并转换"), GUILayout.Width(100), GUILayout.Height(25)))
{
this.saveData();
if (WXPlayableConvertCore.DoExport() == WXConvertCore.WXExportError.SUCCEED)
{
window.ShowNotification(new GUIContent("转换完成"));
}
GUIUtility.ExitGUI();
}
EditorGUILayout.EndHorizontal();
}
private void OnDevelopmentBuildToggleChanged(bool InNewValue)
{
// 针对non-dev build取消性能分析工具的集成
if (!InNewValue)
{
this.setData("enablePerfAnalysis", false);
}
}
private string SDKFilePath;
private void loadData()
{
SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-playable-default", "unity-sdk", "index.js");
config = UnityUtil.GetPlayableEditorConf();
this.setData("projectName", config.ProjectConf.projectName);
this.setData("appid", config.ProjectConf.Appid);
this.setData("orientation", (int)config.ProjectConf.Orientation);
this.setData("dst", config.ProjectConf.relativeDST);
this.setData("developBuild", config.CompileOptions.DevelopBuild);
this.setData("il2CppOptimizeSize", config.CompileOptions.Il2CppOptimizeSize);
this.setData("profilingFuncs", config.CompileOptions.profilingFuncs);
this.setData("webgl2", config.CompileOptions.Webgl2);
this.setData("customNodePath", config.CompileOptions.CustomNodePath);
this.setData("memorySize", config.ProjectConf.MemorySize.ToString());
}
private void saveData()
{
config.ProjectConf.projectName = this.getDataInput("projectName");
config.ProjectConf.Appid = this.getDataInput("appid");
config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation");
config.ProjectConf.relativeDST = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(config.ProjectConf.relativeDST);
config.CompileOptions.DevelopBuild = this.getDataCheckbox("developBuild");
config.CompileOptions.Il2CppOptimizeSize = this.getDataCheckbox("il2CppOptimizeSize");
config.CompileOptions.profilingFuncs = this.getDataCheckbox("profilingFuncs");
config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath");
config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2");
config.ProjectConf.MemorySize = int.Parse(this.getDataInput("memorySize"));
}
private Dictionary<string, string> formInputData = new Dictionary<string, string>();
private Dictionary<string, int> formIntPopupData = new Dictionary<string, int>();
private Dictionary<string, bool> formCheckboxData = new Dictionary<string, bool>();
private string getDataInput(string target)
{
if (this.formInputData.ContainsKey(target))
return this.formInputData[target];
return "";
}
private int getDataPop(string target)
{
if (this.formIntPopupData.ContainsKey(target))
return this.formIntPopupData[target];
return 0;
}
private bool getDataCheckbox(string target)
{
if (this.formCheckboxData.ContainsKey(target))
return this.formCheckboxData[target];
return false;
}
private void formCheckbox(string target, string label, string help = null, bool disable = false, Action<bool> setting = null, Action<bool> onValueChanged = null)
{
if (!formCheckboxData.ContainsKey(target))
{
formCheckboxData[target] = false;
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
if (help == null)
{
GUILayout.Label(label, GUILayout.Width(140));
}
else
{
GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140));
}
EditorGUI.BeginDisabledGroup(disable);
// Toggle the checkbox value based on the disable condition
bool newValue = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]);
// Update the checkbox data if the value has changed and invoke the onValueChanged action
if (newValue != formCheckboxData[target])
{
formCheckboxData[target] = newValue;
onValueChanged?.Invoke(newValue);
}
if (setting != null)
{
EditorGUILayout.LabelField("", GUILayout.Width(10));
// 配置按钮
if (GUILayout.Button(new GUIContent("设置"), GUILayout.Width(40), GUILayout.Height(18)))
{
setting?.Invoke(true);
}
EditorGUILayout.LabelField("", GUILayout.MinWidth(10));
}
EditorGUI.EndDisabledGroup();
if (setting == null)
EditorGUILayout.LabelField(string.Empty);
GUILayout.EndHorizontal();
}
private void setData(string target, string value)
{
if (formInputData.ContainsKey(target))
{
formInputData[target] = value;
}
else
{
formInputData.Add(target, value);
}
}
private void setData(string target, bool value)
{
if (formCheckboxData.ContainsKey(target))
{
formCheckboxData[target] = value;
}
else
{
formCheckboxData.Add(target, value);
}
}
private void setData(string target, int value)
{
if (formIntPopupData.ContainsKey(target))
{
formIntPopupData[target] = value;
}
else
{
formIntPopupData.Add(target, value);
}
}
private void formInput(string target, string label, string help = null)
{
if (!formInputData.ContainsKey(target))
{
formInputData[target] = "";
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
if (help == null)
{
GUILayout.Label(label, GUILayout.Width(140));
}
else
{
GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140));
}
formInputData[target] = GUILayout.TextField(formInputData[target], GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 195));
GUILayout.EndHorizontal();
}
private void formIntPopup(string target, string label, string[] options, int[] values)
{
if (!formIntPopupData.ContainsKey(target))
{
formIntPopupData[target] = 0;
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
GUILayout.Label(label, GUILayout.Width(140));
formIntPopupData[target] = EditorGUILayout.IntPopup(formIntPopupData[target], options, values, GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 195));
GUILayout.EndHorizontal();
}
public static bool IsAbsolutePath(string path)
{
// 检查是否为空或空白
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
// 在 Windows 上,检查驱动器字母或网络路径
if (Application.platform == RuntimePlatform.WindowsEditor && Path.IsPathRooted(path))
{
return true;
}
// 在 Unix/Linux 和 macOS 上,检查是否以 '/' 开头
if (Application.platform == RuntimePlatform.OSXEditor && path.StartsWith("/"))
{
return true;
}
return false; // 否则为相对路径
}
public static string GetAbsolutePath(string path)
{
if (IsAbsolutePath(path))
{
return path;
}
return Path.Combine(projectRootPath, path);
}
} }
private void setData(string target, string value)
{
if (formInputData.ContainsKey(target))
{
formInputData[target] = value;
}
else
{
formInputData.Add(target, value);
}
}
private void setData(string target, bool value)
{
if (formCheckboxData.ContainsKey(target))
{
formCheckboxData[target] = value;
}
else
{
formCheckboxData.Add(target, value);
}
}
private void setData(string target, int value)
{
if (formIntPopupData.ContainsKey(target))
{
formIntPopupData[target] = value;
}
else
{
formIntPopupData.Add(target, value);
}
}
private void formInput(string target, string label, string help = null)
{
if (!formInputData.ContainsKey(target))
{
formInputData[target] = "";
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
if (help == null)
{
GUILayout.Label(label, GUILayout.Width(140));
}
else
{
GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140));
}
formInputData[target] = GUILayout.TextField(formInputData[target], GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 195));
GUILayout.EndHorizontal();
}
private void formIntPopup(string target, string label, string[] options, int[] values)
{
if (!formIntPopupData.ContainsKey(target))
{
formIntPopupData[target] = 0;
}
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField(string.Empty, GUILayout.Width(10));
GUILayout.Label(label, GUILayout.Width(140));
formIntPopupData[target] = EditorGUILayout.IntPopup(formIntPopupData[target], options, values, GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 195));
GUILayout.EndHorizontal();
}
public static bool IsAbsolutePath(string path)
{
// 检查是否为空或空白
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
// 在 Windows 上,检查驱动器字母或网络路径
if (Application.platform == RuntimePlatform.WindowsEditor && Path.IsPathRooted(path))
{
return true;
}
// 在 Unix/Linux 和 macOS 上,检查是否以 '/' 开头
if (Application.platform == RuntimePlatform.OSXEditor && path.StartsWith("/"))
{
return true;
}
return false; // 否则为相对路径
}
public static string GetAbsolutePath(string path)
{
if (IsAbsolutePath(path))
{
return path;
}
return Path.Combine(projectRootPath, path);
}
}
} }

View File

@ -99,6 +99,14 @@ namespace WeChatWASM
#endif #endif
} }
} }
// 是否使用 iOS Metal 渲染
public static bool UseiOSMetal
{
get
{
return config.CompileOptions.enableiOSMetal;
}
}
// 用于replaceRules判断是否需要注入相关的修改 // 用于replaceRules判断是否需要注入相关的修改
public static bool UseEmscriptenGLX public static bool UseEmscriptenGLX
{ {
@ -120,9 +128,12 @@ namespace WeChatWASM
CheckBuildTarget(); CheckBuildTarget();
Init(); Init();
// 可能有顺序要求?如果没要求,可挪到此函数外 // 可能有顺序要求?如果没要求,可挪到此函数外
if (!isPlayableBuild) { if (!isPlayableBuild)
{
ProcessWxPerfBinaries(); ProcessWxPerfBinaries();
} }
// iOS metal 的相关特性
ProcessWxiOSMetalBinaries();
// emscriptenglx的相关特性 // emscriptenglx的相关特性
ProcessWxEmscriptenGLXBinaries(); ProcessWxEmscriptenGLXBinaries();
MakeEnvForLuaAdaptor(); MakeEnvForLuaAdaptor();
@ -397,10 +408,10 @@ namespace WeChatWASM
#else #else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, config.CompileOptions.enableEmscriptenGLX); importer.SetCompatibleWithPlatform(BuildTarget.WebGL, config.CompileOptions.enableEmscriptenGLX);
#endif #endif
importer.SaveAndReimport(); // importer.SaveAndReimport();
// SetPluginCompatibilityByModifyingMetadataFile(glLibs[i], config.CompileOptions.enableEmscriptenGLX); SetPluginCompatibilityByModifyingMetadataFile(glLibs[i], config.CompileOptions.enableEmscriptenGLX);
} }
// AssetDatabase.Refresh(); AssetDatabase.Refresh();
} }
/** /**
@ -443,6 +454,41 @@ namespace WeChatWASM
return true; return true;
} }
private static void ProcessWxiOSMetalBinaries()
{
string[] glLibs;
string DS = WXAssetsTextTools.DS;
if (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package)
{
glLibs = new string[]
{
$"Packages{DS}com.qq.weixin.minigame{DS}Editor{DS}BuildProfile{DS}lib{DS}libwx-metal-cpp.bc",
$"Packages{DS}com.qq.weixin.minigame{DS}Editor{DS}BuildProfile{DS}lib{DS}mtl_library.jslib",
};
}
else
{
string glLibRootDir = $"Assets{DS}WX-WASM-SDK-V2{DS}Editor{DS}BuildProfile{DS}lib{DS}";
glLibs = new string[]
{
$"{glLibRootDir}libwx-metal-cpp.bc",
$"{glLibRootDir}mtl_library.jslib",
};
}
for (int i = 0; i < glLibs.Length; i++)
{
var importer = AssetImporter.GetAtPath(glLibs[i]) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, config.CompileOptions.enableiOSMetal);
#else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, config.CompileOptions.enableiOSMetal);
#endif
// importer.SaveAndReimport();
SetPluginCompatibilityByModifyingMetadataFile(glLibs[i], config.CompileOptions.enableiOSMetal);
}
AssetDatabase.Refresh();
}
private static string GetLuaAdaptorPath(string filename) private static string GetLuaAdaptorPath(string filename)
{ {
string DS = WXAssetsTextTools.DS; string DS = WXAssetsTextTools.DS;
@ -566,13 +612,28 @@ namespace WeChatWASM
GraphicsDeviceType[] targets = new GraphicsDeviceType[] { }; GraphicsDeviceType[] targets = new GraphicsDeviceType[] { };
#if PLATFORM_WEIXINMINIGAME #if PLATFORM_WEIXINMINIGAME
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WeixinMiniGame, false); PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WeixinMiniGame, false);
if (config.CompileOptions.Webgl2) // 启用 iOS Metal 渲染
if (UseiOSMetal)
{ {
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3 }); if (config.CompileOptions.Webgl2)
{
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.Metal, GraphicsDeviceType.OpenGLES3 });
}
else
{
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.Metal, GraphicsDeviceType.OpenGLES2 });
}
} }
else else
{ {
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES2 }); if (config.CompileOptions.Webgl2)
{
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3 });
}
else
{
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES2 });
}
} }
#else #else
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false); PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false);
@ -1237,7 +1298,8 @@ namespace WeChatWASM
public static void convertDataPackageJS() public static void convertDataPackageJS()
{ {
if (!isPlayableBuild) { if (!isPlayableBuild)
{
checkNeedRmovePackageParallelPreload(); checkNeedRmovePackageParallelPreload();
} }
@ -1360,8 +1422,7 @@ namespace WeChatWASM
var buildTemplate = new BuildTemplate( var buildTemplate = new BuildTemplate(
Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir), Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir),
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"), Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"),
Path.Combine(config.ProjectConf.DST, miniGameDir), Path.Combine(config.ProjectConf.DST, miniGameDir)
true
); );
buildTemplate.start(); buildTemplate.start();
// FIX: 2021.2版本生成symbol有bug导出时生成symbol报错有symbol才copy // FIX: 2021.2版本生成symbol有bug导出时生成symbol报错有symbol才copy
@ -1500,7 +1561,7 @@ namespace WeChatWASM
var shortFilename = filename.Substring(filename.IndexOf('.') + 1); var shortFilename = filename.Substring(filename.IndexOf('.') + 1);
// 如果code没有发生过变化且压缩方式不变则不再进行br压缩 // 如果code没有发生过变化且压缩方式不变则不再进行br压缩
if (File.Exists(cachePath) && lastBrotliType == config.CompileOptions.brotliMT) if (cachePath.Contains("wasm.code") && File.Exists(cachePath) && lastBrotliType == config.CompileOptions.brotliMT)
{ {
File.Copy(cachePath, targetPath, true); File.Copy(cachePath, targetPath, true);
return 0; return 0;
@ -1693,7 +1754,8 @@ namespace WeChatWASM
content = content.Replace("$unityVersion$", Application.unityVersion); content = content.Replace("$unityVersion$", Application.unityVersion);
File.WriteAllText(Path.Combine(dst, "unity-sdk", "index.js"), content, Encoding.UTF8); File.WriteAllText(Path.Combine(dst, "unity-sdk", "index.js"), content, Encoding.UTF8);
// content = File.ReadAllText(Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "storage.js"), Encoding.UTF8); // content = File.ReadAllText(Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "storage.js"), Encoding.UTF8);
if (!isPlayableBuild) { if (!isPlayableBuild)
{
content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir, "unity-sdk", "storage.js"), Encoding.UTF8); content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir, "unity-sdk", "storage.js"), Encoding.UTF8);
var PreLoadKeys = config.PlayerPrefsKeys.Count > 0 ? JsonMapper.ToJson(config.PlayerPrefsKeys) : "[]"; var PreLoadKeys = config.PlayerPrefsKeys.Count > 0 ? JsonMapper.ToJson(config.PlayerPrefsKeys) : "[]";
content = content.Replace("'$PreLoadKeys'", PreLoadKeys); content = content.Replace("'$PreLoadKeys'", PreLoadKeys);
@ -1947,7 +2009,7 @@ namespace WeChatWASM
config.ProjectConf.bundleHashLength.ToString(), config.ProjectConf.bundleHashLength.ToString(),
bundlePathIdentifierStr, bundlePathIdentifierStr,
excludeFileExtensionsStr, excludeFileExtensionsStr,
config.CompileOptions.enableEmscriptenGLX ? config.CompileOptions.Webgl2 ? "4" : "3" : config.CompileOptions.Webgl2 ? "2" : "1", config.CompileOptions.Webgl2 ? "2" : "1",
Application.unityVersion, Application.unityVersion,
WXExtEnvDef.pluginVersion, WXExtEnvDef.pluginVersion,
config.ProjectConf.dataFileSubPrefix, config.ProjectConf.dataFileSubPrefix,
@ -1995,11 +2057,16 @@ namespace WeChatWASM
config.CompileOptions.enablePerfAnalysis ? "true" : "false", config.CompileOptions.enablePerfAnalysis ? "true" : "false",
config.ProjectConf.MemorySize.ToString(), config.ProjectConf.MemorySize.ToString(),
config.SDKOptions.disableMultiTouch ? "true" : "false", config.SDKOptions.disableMultiTouch ? "true" : "false",
// Perfstream暂时设为false
"false",
config.CompileOptions.enableEmscriptenGLX ? "true" : "false",
config.CompileOptions.enableiOSMetal ? "true" : "false"
}); });
List<Rule> replaceList = new List<Rule>(replaceArrayList); List<Rule> replaceList = new List<Rule>(replaceArrayList);
List<string> files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js", "unity-sdk/font/index.js" }; List<string> files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js", "unity-sdk/font/index.js" };
if (isPlayableBuild) { if (isPlayableBuild)
{
files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js" }; files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js" };
} }

View File

@ -186,6 +186,7 @@ namespace WeChatWASM
this.formCheckbox("webgl2", "WebGL2.0(beta)"); this.formCheckbox("webgl2", "WebGL2.0(beta)");
this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存"); this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存");
this.formCheckbox("EmscriptenGLX", "EmscriptenGLX(?)", "是否使用EmscriptenGLX渲染方案"); this.formCheckbox("EmscriptenGLX", "EmscriptenGLX(?)", "是否使用EmscriptenGLX渲染方案");
// this.formCheckbox("iOSMetal", "iOSMetal(?)", "是否使用iOSMetal渲染方案需要开启iOS高性能+模式有助于提升运行性能降低iOS功耗");
this.formCheckbox("deleteStreamingAssets", "Clear Streaming Assets"); this.formCheckbox("deleteStreamingAssets", "Clear Streaming Assets");
this.formCheckbox("cleanBuild", "Clean WebGL Build"); this.formCheckbox("cleanBuild", "Clean WebGL Build");
// this.formCheckbox("cleanCloudDev", "Clean Cloud Dev"); // this.formCheckbox("cleanCloudDev", "Clean Cloud Dev");
@ -448,6 +449,7 @@ namespace WeChatWASM
this.setData("customNodePath", config.CompileOptions.CustomNodePath); this.setData("customNodePath", config.CompileOptions.CustomNodePath);
this.setData("webgl2", config.CompileOptions.Webgl2); this.setData("webgl2", config.CompileOptions.Webgl2);
this.setData("iOSPerformancePlus", config.CompileOptions.enableIOSPerformancePlus); this.setData("iOSPerformancePlus", config.CompileOptions.enableIOSPerformancePlus);
this.setData("iOSMetal", config.CompileOptions.enableiOSMetal);
this.setData("EmscriptenGLX", config.CompileOptions.enableEmscriptenGLX); this.setData("EmscriptenGLX", config.CompileOptions.enableEmscriptenGLX);
this.setData("fbslim", config.CompileOptions.fbslim); this.setData("fbslim", config.CompileOptions.fbslim);
this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation); this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation);
@ -527,6 +529,7 @@ namespace WeChatWASM
config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath"); config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath");
config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2"); config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2");
config.CompileOptions.enableIOSPerformancePlus = this.getDataCheckbox("iOSPerformancePlus"); config.CompileOptions.enableIOSPerformancePlus = this.getDataCheckbox("iOSPerformancePlus");
config.CompileOptions.enableiOSMetal = this.getDataCheckbox("iOSMetal");
config.CompileOptions.enableEmscriptenGLX = this.getDataCheckbox("EmscriptenGLX"); config.CompileOptions.enableEmscriptenGLX = this.getDataCheckbox("EmscriptenGLX");
config.CompileOptions.fbslim = this.getDataCheckbox("fbslim"); config.CompileOptions.fbslim = this.getDataCheckbox("fbslim");
config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation"); config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation");

View File

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

View File

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

Binary file not shown.

View File

@ -648,11 +648,12 @@
是否使用iOS高性能Plus 是否使用iOS高性能Plus
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.CompileOptions.enableEmscriptenGLX"> <member name="F:WeChatWASM.CompileOptions.enableiOSMetal">
<summary> <summary>
是否使用EmscriptenGLX 是否使用iOS metal指令流
</summary> </summary>
</member> </member>
<!-- Badly formed XML comment ignored for member "F:WeChatWASM.CompileOptions.enableEmscriptenGLX" -->
<member name="F:WeChatWASM.CompileOptions.brotliMT"> <member name="F:WeChatWASM.CompileOptions.brotliMT">
<summary> <summary>
是否使用brotli多线程压缩 是否使用brotli多线程压缩

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 74e660ca973d2a890864a7dbe6d81507 guid: 3477ea39b1ba2a3c93fd36d055b21e3d
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -115,8 +115,8 @@ WX_SyncFunction_tnn: function(functionName, returnType, param1, param2){
stringToUTF8((res || ''), buffer, bufferSize); stringToUTF8((res || ''), buffer, bufferSize);
return buffer; return buffer;
}, },
WX_ClassOneWayFunction:function(functionName, returnType, successType, failType, completeType, conf) { WX_ClassConstructor:function(functionName, returnType, successType, failType, completeType, conf) {
var res = window.WXWASMSDK.WX_ClassOneWayFunction(_WXPointer_stringify_adaptor(functionName), _WXPointer_stringify_adaptor(returnType), _WXPointer_stringify_adaptor(successType), _WXPointer_stringify_adaptor(failType), _WXPointer_stringify_adaptor(completeType), _WXPointer_stringify_adaptor(conf)); var res = window.WXWASMSDK.WX_ClassConstructor(_WXPointer_stringify_adaptor(functionName), _WXPointer_stringify_adaptor(returnType), _WXPointer_stringify_adaptor(successType), _WXPointer_stringify_adaptor(failType), _WXPointer_stringify_adaptor(completeType), _WXPointer_stringify_adaptor(conf));
var bufferSize = lengthBytesUTF8(res || '') + 1; var bufferSize = lengthBytesUTF8(res || '') + 1;
var buffer = _malloc(bufferSize); var buffer = _malloc(bufferSize);
stringToUTF8((res || ''), buffer, bufferSize); stringToUTF8((res || ''), buffer, bufferSize);
@ -156,5 +156,7 @@ WX_ClassOneWayNoFunction_vt: function(className, functionName, id, param1) {
}, },
WX_ClassOneWayNoFunction_vn: function(className, functionName, id, param1) { WX_ClassOneWayNoFunction_vn: function(className, functionName, id, param1) {
window.WXWASMSDK.WX_ClassOneWayNoFunction_vs(_WXPointer_stringify_adaptor(className), _WXPointer_stringify_adaptor(functionName), _WXPointer_stringify_adaptor(id), param1); window.WXWASMSDK.WX_ClassOneWayNoFunction_vs(_WXPointer_stringify_adaptor(className), _WXPointer_stringify_adaptor(functionName), _WXPointer_stringify_adaptor(id), param1);
},WX_ClassOneWayFunction: function(className, id, functionName, successType, failType, completeType, conf, callbackId, usePromise) {
window.WXWASMSDK.WX_ClassOneWayFunction(_WXPointer_stringify_adaptor(className), _WXPointer_stringify_adaptor(id), _WXPointer_stringify_adaptor(functionName), _WXPointer_stringify_adaptor(successType), _WXPointer_stringify_adaptor(failType), _WXPointer_stringify_adaptor(completeType), _WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(callbackId), usePromise);
}, },
}) })

View File

@ -0,0 +1,55 @@
mergeInto(LibraryManager.library, {
JSStartGameDataMonitor: function() {
console.log("call JSStartGameDataMonitor \n");
if (typeof GameGlobal.manager.getGameDataMonitor === 'function')
{
GameGlobal.manager.getGameDataMonitor().start();
}
else
{
console.log("GameGlobal.manager.getGameDataMonitor is not a function \n");
}
},
JSReportUnityProfileData: function(
targetFrameRate, // fps.
monoHeapReserved, monoHeapUsed, nativeReserved, nativeUnused, nativeAllocated, // profiler.
setPassCalls, drawCalls, vertices, trianglesCount // render.
) {
console.log("call JSReportUnityProfileData \n");
let report_data = {
timestamp: new Date().getTime(),
fps: {
targetFrameRate: targetFrameRate,
avgEXFrameTime: _WXGetEXFrameTime(),
},
profiler: {
monoHeapReserved: monoHeapReserved,
monoHeapUsed: monoHeapUsed,
nativeReserved: nativeReserved,
nativeUnused: nativeUnused,
nativeAllocated: nativeAllocated,
},
render: {
setPassCalls: setPassCalls,
drawCalls: drawCalls,
vertices: vertices,
trianglesCount: trianglesCount,
},
webassembly: {
totalHeapMemory: _WXGetTotalMemorySize(),
dynamicMemory: _WXGetDynamicMemorySize(),
usedHeapMemory: _WXGetUsedMemorySize(),
unAllocatedMemory: _WXGetUnAllocatedMemorySize(),
},
assetbundle: {
numberInMemory: _WXGetBundleNumberInMemory(),
numberOnDisk: _WXGetBundleNumberOnDisk(),
sizeInMemory: _WXGetBundleSizeInMemory(),
sizeOnDisk: _WXGetBundleSizeOnDisk(),
}
}
GameGlobal.manager.getGameDataMonitor().reportUnityProfileData(report_data)
},
});

View File

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

Binary file not shown.

Binary file not shown.

View File

@ -1699,26 +1699,6 @@
如果返回的是字符串,则数据在这个字段 如果返回的是字符串,则数据在这个字段
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.WXStatInfo.mode">
<summary>
文件的类型和存取的权限,对应 POSIX stat.st_mode
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.size">
<summary>
文件大小单位B对应 POSIX stat.st_size
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.lastAccessedTime">
<summary>
文件最近一次被存取或被执行的时间UNIX 时间戳,对应 POSIX stat.st_atime
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.lastModifiedTime">
<summary>
文件最后一次被修改的时间UNIX 时间戳,对应 POSIX stat.st_mtime
</summary>
</member>
<member name="F:WeChatWASM.WXStat.path"> <member name="F:WeChatWASM.WXStat.path">
<summary> <summary>
文件的路径 文件的路径
@ -3129,6 +3109,26 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.LoadOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
<summary> <summary>
一个表示控制器设备上存在的坐标轴的数组 (比如控制器摇杆)。 一个表示控制器设备上存在的坐标轴的数组 (比如控制器摇杆)。
@ -4123,26 +4123,6 @@
取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0 取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.LoadOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.OnCheckForUpdateListenerResult.hasUpdate"> <member name="F:WeChatWASM.OnCheckForUpdateListenerResult.hasUpdate">
<summary> <summary>
是否有新版本 是否有新版本

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f16b00080d6530ba94a60e10ef0653ce guid: 07a34bd03b33fd6b26c8c70b919189a6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

Binary file not shown.

View File

@ -1705,26 +1705,6 @@
如果返回的是字符串,则数据在这个字段 如果返回的是字符串,则数据在这个字段
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.WXStatInfo.mode">
<summary>
文件的类型和存取的权限,对应 POSIX stat.st_mode
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.size">
<summary>
文件大小单位B对应 POSIX stat.st_size
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.lastAccessedTime">
<summary>
文件最近一次被存取或被执行的时间UNIX 时间戳,对应 POSIX stat.st_atime
</summary>
</member>
<member name="F:WeChatWASM.WXStatInfo.lastModifiedTime">
<summary>
文件最后一次被修改的时间UNIX 时间戳,对应 POSIX stat.st_mtime
</summary>
</member>
<member name="F:WeChatWASM.WXStat.path"> <member name="F:WeChatWASM.WXStat.path">
<summary> <summary>
文件的路径 文件的路径
@ -3135,6 +3115,26 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.LoadOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
<summary> <summary>
一个表示控制器设备上存在的坐标轴的数组 (比如控制器摇杆)。 一个表示控制器设备上存在的坐标轴的数组 (比如控制器摇杆)。
@ -4129,26 +4129,6 @@
取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0 取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.LoadOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.OnCheckForUpdateListenerResult.hasUpdate"> <member name="F:WeChatWASM.OnCheckForUpdateListenerResult.hasUpdate">
<summary> <summary>
是否有新版本 是否有新版本

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 915c569ad9083f479aeb5d000297162c guid: 0a2143cd89625ef82b4f55965caf4743
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -4036,32 +4036,6 @@ namespace WeChatWASM
return WXSDKManagerHandler.Instance.GetLogManager(option); return WXSDKManagerHandler.Instance.GetLogManager(option);
} }
/// <summary>
/// [[PageManager](https://developers.weixin.qq.com/minigame/dev/api/open-api/openlink/PageManager.html) wx.createPageManager()](https://developers.weixin.qq.com/minigame/dev/api/open-api/openlink/wx.createPageManager.html)
/// 需要基础库: `3.6.7`
/// 小游戏开放页面管理器用于启动微信内置的各种小游戏活动、功能页面。具体OPENLINK值由不同的能力渠道获得。
/// **示例代码**
/// ```js
/// const pageManager = wx.createPageManager();
/// pageManager.load({
/// openlink: 'xxxxxxx-xxxxxx', // 由不同渠道获得的OPENLINK值
/// }).then((res) => {
/// // 加载成功res 可能携带不同活动、功能返回的特殊回包信息(具体请参阅渠道说明)
/// console.log(res);
/// // 加载成功后按需显示
/// pageManager.show();
/// }).catch((err) => {
/// // 加载失败,请查阅 err 给出的错误信息
/// console.error(err);
/// })
/// ```
/// </summary>
/// <returns></returns>
public static WXPageManager CreatePageManager()
{
return WXSDKManagerHandler.Instance.CreatePageManager();
}
/// <summary> /// <summary>
/// [[RealtimeLogManager](https://developers.weixin.qq.com/minigame/dev/api/base/debug/RealtimeLogManager.html) wx.getRealtimeLogManager()](https://developers.weixin.qq.com/minigame/dev/api/base/debug/wx.getRealtimeLogManager.html) /// [[RealtimeLogManager](https://developers.weixin.qq.com/minigame/dev/api/base/debug/RealtimeLogManager.html) wx.getRealtimeLogManager()](https://developers.weixin.qq.com/minigame/dev/api/base/debug/wx.getRealtimeLogManager.html)
/// 需要基础库: `2.14.4` /// 需要基础库: `2.14.4`

View File

@ -1127,6 +1127,32 @@ namespace WeChatWASM
WXSDKManagerHandler.Instance.NotifyMiniProgramPlayableStatus(option); WXSDKManagerHandler.Instance.NotifyMiniProgramPlayableStatus(option);
} }
#endregion #endregion
/// <summary>
/// [[PageManager](https://developers.weixin.qq.com/minigame/dev/api/open-api/openlink/PageManager.html) wx.createPageManager()](https://developers.weixin.qq.com/minigame/dev/api/open-api/openlink/wx.createPageManager.html)
/// 需要基础库: `3.6.7`
/// 小游戏开放页面管理器用于启动微信内置的各种小游戏活动、功能页面。具体OPENLINK值由不同的能力渠道获得。
/// **示例代码**
/// ```js
/// const pageManager = wx.createPageManager();
/// pageManager.load({
/// openlink: 'xxxxxxx-xxxxxx', // 由不同渠道获得的OPENLINK值
/// }).then((res) => {
/// // 加载成功res 可能携带不同活动、功能返回的特殊回包信息(具体请参阅渠道说明)
/// console.log(res);
/// // 加载成功后按需显示
/// pageManager.show();
/// }).catch((err) => {
/// // 加载失败,请查阅 err 给出的错误信息
/// console.error(err);
/// })
/// ```
/// </summary>
/// <returns></returns>
public static WXPageManager CreatePageManager()
{
return WXSDKManagerHandler.Instance.CreatePageManager();
}
} }
} }
#endif #endif

View File

@ -8,6 +8,10 @@ using UnityEngine;
using UnityEngine.Scripting; using UnityEngine.Scripting;
using System.IO; using System.IO;
using Unity.Profiling;
using UnityEngine.Profiling;
using Debug = UnityEngine.Debug;
#if PLATFORM_WEIXINMINIGAME || PLATFORM_WEBGL || UNITY_EDITOR #if PLATFORM_WEIXINMINIGAME || PLATFORM_WEBGL || UNITY_EDITOR
@ -20,17 +24,17 @@ namespace WXSDKPerf
public class WXPerfEngine public class WXPerfEngine
{ {
#if !UNITY_EDITOR #if !UNITY_EDITOR
static WXPerfEngine_Implementation m_PerfEngineImplementation = null; static WXPerfEngine_Implementation m_PerfEngineImplementation = null;
#endif #endif
[RuntimeInitializeOnLoadMethod] [RuntimeInitializeOnLoadMethod]
public static void StartWXPerfEngine() public static void StartWXPerfEngine()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
m_PerfEngineImplementation = new WXPerfEngine_Implementation(); m_PerfEngineImplementation = new WXPerfEngine_Implementation();
m_PerfEngineImplementation.StartPerfEngine(); m_PerfEngineImplementation.StartPerfEngine();
#endif #endif
} }
@ -45,7 +49,7 @@ namespace WXSDKPerf
public static void Annotation(string InAnnotationString) public static void Annotation(string InAnnotationString)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
// Don't record annotation if we are not recording. // Don't record annotation if we are not recording.
if (!IsRecording()) if (!IsRecording())
@ -68,7 +72,7 @@ namespace WXSDKPerf
#endif #endif
} }
/// <summary> /// <summary>
/// 检查是否正在录制性能数据 /// 检查是否正在录制性能数据
/// </summary> /// </summary>
@ -89,14 +93,14 @@ namespace WXSDKPerf
#else #else
DateTime timestamp = DateTime.Now; DateTime timestamp = DateTime.Now;
var dateString = timestamp.ToLocalTime().ToString("yyyy-MM-dd_HH-mm-ss", System.Globalization.CultureInfo.InvariantCulture); var dateString = timestamp.ToLocalTime().ToString("yyyy-MM-dd_HH-mm-ss", System.Globalization.CultureInfo.InvariantCulture);
var snapshotFileName = $"{dateString}.snap"; var snapshotFileName = $"{dateString}.snap";
#if UNITY_2018_3_OR_NEWER && !UNITY_2022_2_OR_NEWER #if UNITY_2018_3_OR_NEWER && !UNITY_2022_2_OR_NEWER
UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot(Path.Combine(Application.persistentDataPath, snapshotFileName), UnityEngine.Profiling.Memory.Experimental.MemoryProfiler.TakeSnapshot(Path.Combine(Application.persistentDataPath, snapshotFileName),
WXPerfEngine_Implementation.CaptureSnapshotCallback, (UnityEngine.Profiling.Memory.Experimental.CaptureFlags)31); WXPerfEngine_Implementation.CaptureSnapshotCallback, (UnityEngine.Profiling.Memory.Experimental.CaptureFlags)31);
#elif UNITY_2022_2_OR_NEWER #elif UNITY_2022_2_OR_NEWER
Unity.Profiling.Memory.MemoryProfiler.TakeSnapshot(Path.Combine(Application.persistentDataPath, snapshotFileName), Unity.Profiling.Memory.MemoryProfiler.TakeSnapshot(Path.Combine(Application.persistentDataPath, snapshotFileName),
WXPerfEngine_Implementation.CaptureSnapshotCallback, (Unity.Profiling.Memory.CaptureFlags)31); WXPerfEngine_Implementation.CaptureSnapshotCallback, (Unity.Profiling.Memory.CaptureFlags)31);
#endif #endif
#endif #endif
@ -109,7 +113,7 @@ namespace WXSDKPerf
public static void SetLuaState(IntPtr L) public static void SetLuaState(IntPtr L)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {
@ -120,7 +124,7 @@ namespace WXSDKPerf
m_PerfEngineImplementation.SetLuaState(L); m_PerfEngineImplementation.SetLuaState(L);
#endif #endif
} }
/// <summary> /// <summary>
/// 声明自定义性能指标 /// 声明自定义性能指标
/// </summary> /// </summary>
@ -130,7 +134,7 @@ namespace WXSDKPerf
public static void DeclareCustomStatInfo(string inStatName, string inStatCategory, int inStatInterpType = 1) public static void DeclareCustomStatInfo(string inStatName, string inStatCategory, int inStatInterpType = 1)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {
@ -151,7 +155,7 @@ namespace WXSDKPerf
public static void SetCustomStatValue(string inStatName, float inValue) public static void SetCustomStatValue(string inStatName, float inValue)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {
@ -171,7 +175,7 @@ namespace WXSDKPerf
public static void AddCustomStatInfoBy(string inStatName, float inValue) public static void AddCustomStatInfoBy(string inStatName, float inValue)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {
@ -179,9 +183,9 @@ namespace WXSDKPerf
return; return;
} }
m_PerfEngineImplementation.AddCustomStatInfoBy(inStatName, inValue); m_PerfEngineImplementation.AddCustomStatInfoBy(inStatName, inValue);
#endif #endif
} }
@ -195,11 +199,11 @@ namespace WXSDKPerf
/// <param name="inEnableCaptureResource">是否启用资源捕获</param> /// <param name="inEnableCaptureResource">是否启用资源捕获</param>
/// <param name="inEnableLuaMemoryMonitor">是否启用Lua内存监控</param> /// <param name="inEnableLuaMemoryMonitor">是否启用Lua内存监控</param>
/// <param name="inEnableLuaFunctionMemoryTracking">是否启用Lua函数内存跟踪</param> /// <param name="inEnableLuaFunctionMemoryTracking">是否启用Lua函数内存跟踪</param>
public static void StartRecordManually(bool inEnableStackTrace, bool inEnableStatInfo, bool inFrequentScreenShot, bool inEnablebRenderInst, public static void StartRecordManually(bool inEnableStackTrace, bool inEnableStatInfo, bool inFrequentScreenShot, bool inEnablebRenderInst,
bool inEnableCaptureResource, bool inEnableLuaMemoryMonitor, bool inEnableLuaFunctionMemoryTracking) bool inEnableCaptureResource, bool inEnableLuaMemoryMonitor, bool inEnableLuaFunctionMemoryTracking)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {
@ -207,7 +211,7 @@ namespace WXSDKPerf
return; return;
} }
m_PerfEngineImplementation.StartRecordManually(inEnableStackTrace, inEnableStatInfo, inFrequentScreenShot, inEnablebRenderInst, m_PerfEngineImplementation.StartRecordManually(inEnableStackTrace, inEnableStatInfo, inFrequentScreenShot, inEnablebRenderInst,
inEnableCaptureResource, inEnableLuaMemoryMonitor, inEnableLuaFunctionMemoryTracking); inEnableCaptureResource, inEnableLuaMemoryMonitor, inEnableLuaFunctionMemoryTracking);
#endif #endif
} }
@ -218,7 +222,7 @@ namespace WXSDKPerf
public static void StopRecordManually() public static void StopRecordManually()
{ {
#if UNITY_EDITOR #if UNITY_EDITOR
return; return;
#else #else
if (m_PerfEngineImplementation == null) if (m_PerfEngineImplementation == null)
{ {

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f559d29680b149f9a9320d0570be7521 guid: 69bfeaf5da028b3d384aab5f1a2be8b1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 985ee420ff632203aefda8db32df1041 guid: 9572832f2c91116fa7a9866561020764
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3557a962fd3402d3284431a2e883932e guid: 1299035d26ee3050be047dc72bb1e23f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 833c8deeebb60f96103e28a58f92c582 guid: 5e045c15bcbc3152a68fbfd3f940c54f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ade973da253a4c5a3318a3d9de677f3a guid: 6e25c8348181d0f6005250553ad3ceeb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4a63a6b948ea9ef67a6a2f9999186812 guid: 3a0448c1c6debc78593cc4a0e10fe2c6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d810ff1aaebd1b0c2f797db7a530063d guid: 7d1630ae136316b9a401bc7fb39debd3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5997f77dc880f2742d79d88881f434b5 guid: 064cef8885d7ba6f62bc83bcd5b4bf90
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 324084e65d26ac8fcf67beb9acd0908c guid: a37f761de5963966a78f52803af702e9
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7837c676f68369fd838619d0ebdb3c05 guid: a51b19941c896fcdf4cb2f1b34a3fca7
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 92817bb5805556689fc583654f2514df guid: ea06347491ece7e302668b729f22060c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -47,6 +47,10 @@
{ {
"type": "suffix", "type": "suffix",
"value": ".symbols.unityweb" "value": ".symbols.unityweb"
},
{
"type": "suffix",
"value": ".symbols.unityweb.br"
} }
] ]
}, },

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2abc766f3b98dbe918666c58591dd265 guid: 954cae7dd667e1ee920584e25e0f6d10
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 11799ab06b9be7256df16d4abae5ee27 guid: 7a32263b8529890ceac0a1c9a9cadac6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 37a7aad9e59774046bc3608cf3e1f68c guid: 51c2b48054433376a0e00d14f13c5f1f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 921448045df92cca51124bda7b501e4e guid: 16a01ac0a74e3888c7cd27ad42692835
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6e205f735c4d6f4894725d90dbdace5d guid: 09cdedb82d92c7e8edfddaa43bdb956b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ec3aeca85f8ab04c1d515c514404351d guid: 212c80201a527f9daa5fd8ded6fdf766
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1e295165c6519f30b65235504633e973 guid: 10542729e5d685cfc8e10e1e386e9bac
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: fa0da8271fae1945d761d4e7afa379d3 guid: 4b93fe09d856317783791dc6039e8968
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ab5ca6526511f02e1019c55260ac0f92 guid: ab96eb7f2118c5db58271bb17a771aa3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bf1d918f44888ca5f28e22c227b6a4bc guid: 2a5961845c01494e0b70ce34d50b6cc0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 410a86604aba02eb0c9025174d91aef4 guid: b80defa51c71c57c2d8732aac0ae1a16
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a36ea91786670d1cfffb78f90d53e2ee guid: 4c221614d8600db6626d60a3586a84ac
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7330316c96b2ce8db3870d650b88d0ac guid: 5d1ec32ef06eecf0640abe5092583946
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6a967aac7d0c5f9ab1451e3ab3628825 guid: db325512583c32c097ed61125f0deceb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8f436b74adad0e71b61baffacc5abe06 guid: 825020547b3535309834c54bb3aef592
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f64e2b18f8c1cde7e8059ae994f22fbe guid: f9e51fab460e8464844b19ccac8448d6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6c70f051b73c490f55c6bc1bc85e8106 guid: 8b37a594208d5c50e16719e379fe4bf7
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3bb24a920c3b38d438464e158deca714 guid: 220a340900638d2f76abdd7f121387c4
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2c684789414dd26a7f0b0248115d19c6 guid: 4710c93128a0a1da4ea4e4f5c56a14a8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 69ae57171b25512259a2e4b92d554f15 guid: e0768c7d86d9b9234b529fa9faf6adf8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0c03acbb0ee59661f89c4a07f2c00677 guid: 7c06c703a510aeac873db9d81cc14e60
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 091a83c6d554c6b4c3321cd1f4df08ea guid: 8dbd20ce4b45cedf4a3d23a9acfca7e9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a422c07da6e5964c436fe22f690b36ce guid: 12ad07dd7e0deb7fc60b8273612367dc
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dd57e6157edaf5f06b5544f3dce4b2e0 guid: 0fd6757532ceb9073c7264e2a265a415
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 39db3abf36c715583a3118b41bdaed66 guid: 9be5eb96b1f121bcef0a7f9fa42dc752
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6a00c4a0bcf5e89b1072c6334ac91419 guid: 39da48edb2004f65dac98ea91cdb9d96
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,4 +1,11 @@
export const ResType = { export const ResType = {
Gamepad: {
axes: 'IAnyObject[]',
buttons: 'IAnyObject[]',
connected: 'bool',
id: 'string',
index: 'string',
},
AccountInfo: { AccountInfo: {
miniProgram: 'MiniProgram', miniProgram: 'MiniProgram',
plugin: 'Plugin', plugin: 'Plugin',
@ -496,7 +503,7 @@ export const ResType = {
headUrl: 'string', headUrl: 'string',
nickname: 'string', nickname: 'string',
nonceId: 'string', nonceId: 'string',
otherInfos: 'AnyKeyword[]', otherInfos: 'any[]',
replayStatus: 'number', replayStatus: 'number',
status: 'number', status: 'number',
errMsg: 'string', errMsg: 'string',
@ -505,7 +512,7 @@ export const ResType = {
headUrl: 'string', headUrl: 'string',
nickname: 'string', nickname: 'string',
noticeId: 'string', noticeId: 'string',
otherInfos: 'AnyKeyword[]', otherInfos: 'any[]',
reservable: 'bool', reservable: 'bool',
startTime: 'string', startTime: 'string',
status: 'number', status: 'number',
@ -574,6 +581,11 @@ export const ResType = {
weakNet: 'bool', weakNet: 'bool',
errMsg: 'string', errMsg: 'string',
}, },
GetPhoneNumberSuccessCallbackResult: {
code: 'string',
errMsg: 'string',
errno: 'number',
},
GetPrivacySettingSuccessCallbackResult: { GetPrivacySettingSuccessCallbackResult: {
needAuthorization: 'bool', needAuthorization: 'bool',
privacyContractName: 'string', privacyContractName: 'string',
@ -598,6 +610,10 @@ export const ResType = {
mainSwitch: 'bool', mainSwitch: 'bool',
itemSettings: 'object', itemSettings: 'object',
}, },
GetShowSplashAdStatusSuccessCallbackResult: {
status: 'string',
errMsg: 'string',
},
GetStorageInfoSuccessCallbackOption: { GetStorageInfoSuccessCallbackOption: {
currentSize: 'number', currentSize: 'number',
keys: 'string[]', keys: 'string[]',
@ -724,6 +740,12 @@ export const ResType = {
message: 'string', message: 'string',
stack: 'string', stack: 'string',
}, },
OnGamepadConnectedListenerResult: {
gamepad: 'string',
},
OnGamepadDisconnectedListenerResult: {
gamepad: 'string',
},
OnHandoffListenerResult: { OnHandoffListenerResult: {
query: 'string', query: 'string',
}, },
@ -741,14 +763,6 @@ export const ResType = {
OnMemoryWarningListenerResult: { OnMemoryWarningListenerResult: {
level: 'number', level: 'number',
}, },
OnMenuButtonBoundingClientRectWeightChangeListenerResult: {
bottom: 'number',
height: 'number',
left: 'number',
right: 'number',
top: 'number',
width: 'number',
},
OnMouseDownListenerResult: { OnMouseDownListenerResult: {
button: 'number', button: 'number',
timeStamp: 'long', timeStamp: 'long',
@ -849,17 +863,6 @@ export const ResType = {
subscriptionsSetting: 'SubscriptionsSetting', subscriptionsSetting: 'SubscriptionsSetting',
errMsg: 'string', errMsg: 'string',
}, },
OperateGameRecorderVideoOption: {
atempo: 'number',
audioMix: 'bool',
bgm: 'string',
desc: 'string',
path: 'string',
query: 'string',
timeRange: 'number[]',
title: 'string',
volume: 'number',
},
MediaSource: { MediaSource: {
url: 'string', url: 'string',
poster: 'string', poster: 'string',

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0fc60fb512c188f3172b6f47fefde5fa guid: 2d4bde445c6c8d9d7aed0b1ec3e4ed0a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: be0ca22017e04399a53e051671165f55 guid: 9168c1c9dbabf466784907010fbb9c11
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ffeb0af90cd7a659e1afdd8284c8916a guid: 72a6f26aeb2630043abdb31b95f18327
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -23,7 +23,7 @@ function getClassObject(className, id) {
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
function WX_OneWayNoFunction(functionName, ...params) { function WX_OneWayNoFunction(functionName, ...params) {
wx[functionName.replace(/^\w/, a => a.toLowerCase())](...params); wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
} }
@ -33,7 +33,7 @@ const onlyReadyResponse = [
]; ];
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
function WX_SyncFunction(functionName, ...params) { function WX_SyncFunction(functionName, ...params) {
return wx[functionName.replace(/^\w/, a => a.toLowerCase())](...params); return wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
} }
// eslint-disable-next-line @typescript-eslint/naming-convention // eslint-disable-next-line @typescript-eslint/naming-convention
@ -42,13 +42,22 @@ function WX_ClassOneWayNoFunction(className, functionName, id, ...params) {
if (!obj) { if (!obj) {
return; return;
} }
obj[functionName.replace(/^\w/, a => a.toLowerCase())](...params); 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 { export default {
WX_OneWayFunction(functionName, successType, failType, completeType, conf, callbackId) { WX_OneWayFunction(functionName, successType, failType, completeType, conf, callbackId) {
const lowerFunctionName = functionName.replace(/^\w/, a => a.toLowerCase()); const lowerFunctionName = functionName.replace(/^\w/, (a) => a.toLowerCase());
const config = formatJsonStr(conf); const config = formatJsonStr(conf);
// specialJS
if (lowerFunctionName === 'login') { if (lowerFunctionName === 'login') {
if (!config.timeout) { if (!config.timeout) {
delete config.timeout; delete config.timeout;
@ -111,7 +120,7 @@ export default {
moduleHelper.send(`_${functionName}Callback`, resStr); moduleHelper.send(`_${functionName}Callback`, resStr);
}; };
onEventLists[functionName].push(callback); onEventLists[functionName].push(callback);
wx[functionName.replace(/^\w/, a => a.toLowerCase())](callback); wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
}, },
WX_OffEventRegister(functionName) { WX_OffEventRegister(functionName) {
(onEventLists[functionName] || []).forEach((v) => { (onEventLists[functionName] || []).forEach((v) => {
@ -225,7 +234,7 @@ export default {
}, },
WX_SyncFunction_t(functionName, returnType) { WX_SyncFunction_t(functionName, returnType) {
const res = WX_SyncFunction(functionName); const res = WX_SyncFunction(functionName);
if (onlyReadyResponse.includes(functionName.replace(/^\w/, a => a.toLowerCase()))) { if (onlyReadyResponse.includes(functionName.replace(/^\w/, (a) => a.toLowerCase()))) {
formatResponse(returnType, JSON.parse(JSON.stringify(res))); formatResponse(returnType, JSON.parse(JSON.stringify(res)));
return JSON.stringify(res); return JSON.stringify(res);
} }
@ -262,10 +271,10 @@ export default {
formatResponse(returnType, res); formatResponse(returnType, res);
return JSON.stringify(res); return JSON.stringify(res);
}, },
WX_ClassOneWayFunction(functionName, returnType, successType, failType, completeType, conf) { WX_ClassConstructor(functionName, returnType, successType, failType, completeType, conf) {
const config = formatJsonStr(conf); const config = formatJsonStr(conf);
const callbackId = uid(); const callbackId = uid();
const obj = wx[functionName.replace(/^\w/, a => a.toLowerCase())]({ const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())]({
...config, ...config,
success(res) { success(res) {
formatResponse(successType, res); formatResponse(successType, res);
@ -293,7 +302,7 @@ export default {
return callbackId; return callbackId;
}, },
WX_ClassFunction(functionName, returnType, option) { WX_ClassFunction(functionName, returnType, option) {
const obj = wx[functionName.replace(/^\w/, a => a.toLowerCase())](formatJsonStr(option)); const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](formatJsonStr(option));
const id = uid(); const id = uid();
if (!ClassLists[returnType]) { if (!ClassLists[returnType]) {
ClassLists[returnType] = {}; ClassLists[returnType] = {};
@ -347,10 +356,10 @@ export default {
ClassOnEventLists[className + functionName][id + eventName].push(callback); ClassOnEventLists[className + functionName][id + eventName].push(callback);
// WXVideoDecoder OnEvent 不规范 特殊处理 // WXVideoDecoder OnEvent 不规范 特殊处理
if (className === 'WXVideoDecoder') { if (className === 'WXVideoDecoder') {
obj[functionName.replace(/^\w/, a => a.toLowerCase())](eventName, callback); obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](eventName, callback);
} }
else { else {
obj[functionName.replace(/^\w/, a => a.toLowerCase())](callback); obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
} }
}, },
WX_ClassOffEventFunction(className, functionName, id, eventName) { WX_ClassOffEventFunction(className, functionName, id, eventName) {
@ -389,7 +398,7 @@ export default {
if (!obj) { if (!obj) {
return JSON.stringify(formatResponse(returnType)); return JSON.stringify(formatResponse(returnType));
} }
const res = obj[functionName.replace(/^\w/, a => a.toLowerCase())](); const res = obj[functionName.replace(/^\w/, (a) => a.toLowerCase())]();
return JSON.stringify(formatResponse(returnType, res, id)); return JSON.stringify(formatResponse(returnType, res, id));
}, },
WX_ClassOneWayNoFunction_vt(className, functionName, id, param1) { WX_ClassOneWayNoFunction_vt(className, functionName, id, param1) {
@ -399,4 +408,41 @@ export default {
WX_ClassOneWayNoFunction_vn(className, functionName, id, param1) { WX_ClassOneWayNoFunction_vn(className, functionName, id, param1) {
WX_ClassOneWayNoFunction(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);
},
});
}
},
}; };

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3226abd0306e36c7bb7f9f7a3eec3095 guid: 9feeb2df85764ae670a1216f2ea864a7
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f5e9bc3387f9598afc5f7f68f56d3911 guid: 0c95be6ce3e52e35dbe11493d1923a70
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 325f384eaa0c3eaa109775c92c41ab62 guid: 12dee947dffbcdff4734003a9ef217bc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6e3d3d18f1d5208946231f05f7ec6393 guid: 5434790436097fcc24bb970f40bf835b
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e3873a61887e2cd5cf7fab8ccb09f234 guid: d3beab7c1b0a7259419d67b28c00a49f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 216ac06f0ae6e95e1a52902d87d27ade guid: 2b9fe87d9bae7dbc128fd001b34576b0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0935239197d3eaf480d351b6008a6e3f guid: e188b2e4a0040e686003c2870f54f6f9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4bec208191b9c2b028887bc516145d85 guid: 1f9ba665e9bfe6529a283184e4b4582f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 626da5aac8a91c22f3283496474046c6 guid: ada964bd4c3ea8d7c81dbf0399a83f2a
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -171,6 +171,12 @@ function _JS_Video_Create(url) {
function _JS_Video_Destroy(video) { function _JS_Video_Destroy(video) {
debugLog('_JS_Video_Destroy', video); debugLog('_JS_Video_Destroy', video);
videoInstances[video].destroy(); videoInstances[video].destroy();
const Module = GameGlobal.manager.gameInstance.Module;
const { GL } = Module;
const gl = GL.currentContext.GLctx;
if (!isWebVideo && gl.emscriptenGLX && Module._glxVideoDestroy) {
Module._glxVideoDestroy(video);
}
delete videoInstances[video]; delete videoInstances[video];
} }
function _JS_Video_Duration(video) { function _JS_Video_Duration(video) {
@ -375,7 +381,29 @@ function _JS_Video_UpdateToTexture(video, tex) {
if (!FrameworkData) { if (!FrameworkData) {
return false; return false;
} }
const Module = GameGlobal.manager.gameInstance.Module;
const { GL, GLctx } = FrameworkData; const { GL, GLctx } = FrameworkData;
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); GLctx.pixelStorei(GLctx.UNPACK_FLIP_Y_WEBGL, true);

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 47b6fb8e40dad5650a03b6b90a9e3854 guid: 35971cbff7beef8bdd988f57968ed875
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8b486e81c171279389438f4a53171eb8 guid: 981b9edfe995f2b533ad3e518a4647a0
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bd8dab62c1c483a64f44e4cf2a573c75 guid: 0db935536a598c1b9ed6e61c7305aebb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2412911088bca0378b37e03d7c9edaad guid: 9c41c4b94ac0b73eef273cc06e0fa35b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -65,8 +65,8 @@ const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1');
const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid); const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid);
// iOS系统版本>=17.5时,小游戏退后台会导致异常 // iOS系统版本>=17.5时,小游戏退后台会导致异常
export const isIOS175 = compareVersion(systemVersion, '17.5') && isH5Renderer; export const isIOS175 = compareVersion(systemVersion, '17.5') && isH5Renderer;
// 是否支持开放数据域渲染模式使用ScreenCanvas模式可以优化ToTempFilePath的使用 // 是否支持开放数据域渲染模式使用ScreenCanvas模式可以优化ToTempFilePath的使用PC 上 ScreenCanvas 模式事件处理有问题PC 先禁止这个模式
export const isSupportSharedCanvasMode = compareVersion(SDKVersion, '3.6.6'); export const isSupportSharedCanvasMode = compareVersion(SDKVersion, '3.6.6') && !isPc;
// 是否能以iOS高性能模式运行 // 是否能以iOS高性能模式运行
// 请勿修改GameGlobal.canUseH5Renderer赋值 // 请勿修改GameGlobal.canUseH5Renderer赋值
GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid; GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid;

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e9fb9b3caad6dec8d975d4e0244dda4e guid: 76d18f5f8a87f4b5dbfe3b1d3eafe456
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7876f291585b84c91bfb2ecd4fda96de guid: be4054c42e31d2538fb77180130626f6
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8d220c6108fa139540028c8d8b730c91 guid: 772c3b7b7539d7de0043be5bd2a6068b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4c2817c12941f5b21ba22eb45dbe363f guid: a0d9ecb11b75628ffac93b5f770b4d21
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 38691e6bf69a6e0794f206de35f0b810 guid: 3339261f938cc9ad644a72dd0c5a1a7f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -23,7 +23,7 @@
], ],
"plugins": { "plugins": {
"UnityPlugin": { "UnityPlugin": {
"version": "1.2.77", "version": "1.2.79",
"provider": "wxe5a48f1ed5f544b7", "provider": "wxe5a48f1ed5f544b7",
"contexts": [ "contexts": [
{ {
@ -32,7 +32,7 @@
] ]
}, },
"Layout": { "Layout": {
"version": "1.0.15", "version": "1.0.16",
"provider": "wx7a727ff7d940bb3f", "provider": "wx7a727ff7d940bb3f",
"contexts": [ "contexts": [
{ {

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4fe695ad98d7e147f10b7f02b9e23885 guid: a2c1796c30d974217dafe1fbbbb68f8d
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a8b368565349c464585be31f1de8cbb4 guid: 22eeeb5bac28cd9bd27de9d4e3d3cf29
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4271761c3faa23339d4b34005eaac7c1 guid: 9f76dd150e421c44e6d7a3dd766a01ab
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6644d6c5e264b1d552937fe30ab5828a guid: 77fe2b496ab203656de223fff20c4a75
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a4dc6cb18702e483f8c0e33040ec7a8c guid: 0e9d1e2d19336c4d08335e4ea96e9437
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,8 +1,8 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c8e8941eec0094aafae952831b56f585 guid: 4dbe42a5733d802e0e234dda54e2a1e9
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8a19bd329261faafe1a4967d891859a6 guid: 87c38ac95bdd0e1b2ec2000cd823a550
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: eb0b3b6ab722091f2521f0a31d50a515 guid: 5afee5c4ebe9451388e0237741ec9fc1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

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