Auto-publish.

This commit is contained in:
nebulaliu 2025-07-22 19:30:38 +08:00
parent bd9443720f
commit b60e83307c
201 changed files with 1818 additions and 1498 deletions

View File

@ -6,13 +6,7 @@ Removed - 删除功能/接口
Fixed - 修复问题 Fixed - 修复问题
Others - 其他 Others - 其他
--> -->
## v0.1.27 【普通更新】 ## v0.1.26 【预发布】
### Feature
* 普通:新增 JS_Sound_GetPosition 方法用于获取音频播放位置
* 普通WebGL2变更为正式特性
* 普通:支持小游戏试玩导出
## v0.1.26 【普通更新】
### Feature ### Feature
* 普通:增加禁止多点触控的配置 * 普通:增加禁止多点触控的配置
### Fixed ### Fixed

8
Editor/BuildProfile.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: DytLvSj8UC9CKob0XUy9Y3usKDmX8US1YgxYmBxa1iAZ/I8JbM5wZwE=
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

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

View File

@ -0,0 +1,43 @@
mergeInto(LibraryManager.library, {
// 定义供 C/C++ 调用的 JS 函数
js_batchRender_malloc: function(data, size, isSync) {
// 直接从 WASM 内存创建视图(零拷贝)
const binaryData = new Uint8Array(Module.HEAPU8.buffer, data, size);
// 转换为标准 ArrayBuffer如果需要复制
const targetBuffer =
binaryData.buffer.slice(binaryData.byteOffset, binaryData.byteOffset + binaryData.byteLength);
//console.log("processBinaryData invoke");
const extBuffer = new ArrayBuffer(1);
const headerBuffer = new ArrayBuffer(8);
const headerBufferView = new DataView(headerBuffer);
headerBufferView.setUint32(0, 0xDEC0DE, true);
headerBufferView.setUint32(4, mtl.ctx.__uid(), true);
const merged = new Uint8Array(headerBuffer.byteLength + targetBuffer.byteLength);
merged.set(new Uint8Array(headerBuffer), 0);
merged.set(new Uint8Array(targetBuffer), headerBuffer.byteLength);
if(!isSync){
mtl.batchRenderAsync(merged.buffer, extBuffer);
return null;
}
const result = mtl.batchRender(merged.buffer, extBuffer).buffer;
if(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,358 +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;
private static string _dstCache;
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 + "/../");
_dstCache = "";
}
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();
_dstCache = config.ProjectConf.DST;
this.setData("projectName", config.ProjectConf.projectName);
this.setData("appid", config.ProjectConf.Appid);
this.setData("orientation", (int)config.ProjectConf.Orientation);
this.setData("dst", _dstCache);
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");
_dstCache = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(_dstCache);
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;
}
}
// public static void SetPlayableEnabled(bool enabled) // public static void SetPlayableEnabled(bool enabled)
// { // {
// isPlayableBuild = enabled; // isPlayableBuild = enabled;
@ -112,9 +120,12 @@ namespace WeChatWASM
CheckBuildTarget(); CheckBuildTarget();
Init(); Init();
// 可能有顺序要求?如果没要求,可挪到此函数外 // 可能有顺序要求?如果没要求,可挪到此函数外
if (!isPlayableBuild) { if (!isPlayableBuild)
{
ProcessWxPerfBinaries(); ProcessWxPerfBinaries();
} }
// iOS metal 的相关特性
ProcessWxiOSMetalBinaries();
MakeEnvForLuaAdaptor(); MakeEnvForLuaAdaptor();
// JSLib // JSLib
SettingWXTextureMinJSLib(); SettingWXTextureMinJSLib();
@ -140,7 +151,7 @@ namespace WeChatWASM
return WXExportError.BUILD_WEBGL_FAILED; return WXExportError.BUILD_WEBGL_FAILED;
} }
dynamic config = isPlayableBuild ? UnityUtil.GetPlayableEditorConf() : UnityUtil.GetEditorConf(); dynamic config = isPlayableBuild ? UnityUtil.GetPlayableEditorConf() : UnityUtil.GetEditorConf();
if (config.ProjectConf.DST == string.Empty) if (config.ProjectConf.relativeDST == string.Empty)
{ {
Debug.LogError("请先配置游戏导出路径"); Debug.LogError("请先配置游戏导出路径");
return WXExportError.BUILD_WEBGL_FAILED; return WXExportError.BUILD_WEBGL_FAILED;
@ -400,6 +411,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;
@ -523,13 +569,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);
@ -1194,7 +1255,8 @@ namespace WeChatWASM
public static void convertDataPackageJS() public static void convertDataPackageJS()
{ {
if (!isPlayableBuild) { if (!isPlayableBuild)
{
checkNeedRmovePackageParallelPreload(); checkNeedRmovePackageParallelPreload();
} }
@ -1649,7 +1711,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);
@ -1903,7 +1966,7 @@ namespace WeChatWASM
config.ProjectConf.bundleHashLength.ToString(), config.ProjectConf.bundleHashLength.ToString(),
bundlePathIdentifierStr, bundlePathIdentifierStr,
excludeFileExtensionsStr, excludeFileExtensionsStr,
config.CompileOptions.Webgl2 ? "2" : "1", config.CompileOptions.enableiOSMetal ? "5" : (config.CompileOptions.Webgl2 ? "2" : "1"),
Application.unityVersion, Application.unityVersion,
WXExtEnvDef.pluginVersion, WXExtEnvDef.pluginVersion,
config.ProjectConf.dataFileSubPrefix, config.ProjectConf.dataFileSubPrefix,
@ -1951,11 +2014,14 @@ 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"
}); });
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

@ -54,15 +54,11 @@ namespace WeChatWASM
foldInstantGame = WXConvertCore.IsInstantGameAutoStreaming(); foldInstantGame = WXConvertCore.IsInstantGameAutoStreaming();
projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../"); projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../");
_dstCache = "";
} }
private static WXEditorScriptObject config; private static WXEditorScriptObject config;
private static bool m_EnablePerfTool = false; private static bool m_EnablePerfTool = false;
private static string _dstCache;
public void OnFocus() public void OnFocus()
{ {
loadData(); loadData();
@ -187,8 +183,9 @@ namespace WeChatWASM
this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP); this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP);
this.formCheckbox("profilingFuncs", "Profiling Funcs"); this.formCheckbox("profilingFuncs", "Profiling Funcs");
this.formCheckbox("profilingMemory", "Profiling Memory"); this.formCheckbox("profilingMemory", "Profiling Memory");
this.formCheckbox("webgl2", "WebGL2.0"); this.formCheckbox("webgl2", "WebGL2.0(beta)");
this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存"); this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存");
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");
@ -394,7 +391,6 @@ namespace WeChatWASM
// SDKFilePath = Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "index.js"); // SDKFilePath = Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "index.js");
SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js"); SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js");
config = UnityUtil.GetEditorConf(); config = UnityUtil.GetEditorConf();
_dstCache = config.ProjectConf.DST;
// Instant Game // Instant Game
if (WXConvertCore.IsInstantGameAutoStreaming()) if (WXConvertCore.IsInstantGameAutoStreaming())
@ -436,7 +432,7 @@ namespace WeChatWASM
this.setData("compressDataPackage", config.ProjectConf.compressDataPackage); this.setData("compressDataPackage", config.ProjectConf.compressDataPackage);
this.setData("videoUrl", config.ProjectConf.VideoUrl); this.setData("videoUrl", config.ProjectConf.VideoUrl);
this.setData("orientation", (int)config.ProjectConf.Orientation); this.setData("orientation", (int)config.ProjectConf.Orientation);
this.setData("dst", _dstCache); this.setData("dst", config.ProjectConf.relativeDST);
this.setData("bundleHashLength", config.ProjectConf.bundleHashLength.ToString()); this.setData("bundleHashLength", config.ProjectConf.bundleHashLength.ToString());
this.setData("bundlePathIdentifier", config.ProjectConf.bundlePathIdentifier); this.setData("bundlePathIdentifier", config.ProjectConf.bundlePathIdentifier);
this.setData("bundleExcludeExtensions", config.ProjectConf.bundleExcludeExtensions); this.setData("bundleExcludeExtensions", config.ProjectConf.bundleExcludeExtensions);
@ -452,6 +448,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("fbslim", config.CompileOptions.fbslim); this.setData("fbslim", config.CompileOptions.fbslim);
this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation); this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation);
this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat); this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat);
@ -513,8 +510,8 @@ namespace WeChatWASM
config.ProjectConf.compressDataPackage = this.getDataCheckbox("compressDataPackage"); config.ProjectConf.compressDataPackage = this.getDataCheckbox("compressDataPackage");
config.ProjectConf.VideoUrl = this.getDataInput("videoUrl"); config.ProjectConf.VideoUrl = this.getDataInput("videoUrl");
config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation"); config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation");
_dstCache = this.getDataInput("dst"); config.ProjectConf.relativeDST = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(_dstCache); config.ProjectConf.DST = GetAbsolutePath(config.ProjectConf.relativeDST);
config.ProjectConf.bundleHashLength = int.Parse(this.getDataInput("bundleHashLength")); config.ProjectConf.bundleHashLength = int.Parse(this.getDataInput("bundleHashLength"));
config.ProjectConf.bundlePathIdentifier = this.getDataInput("bundlePathIdentifier"); config.ProjectConf.bundlePathIdentifier = this.getDataInput("bundlePathIdentifier");
config.ProjectConf.bundleExcludeExtensions = this.getDataInput("bundleExcludeExtensions"); config.ProjectConf.bundleExcludeExtensions = this.getDataInput("bundleExcludeExtensions");
@ -530,6 +527,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.fbslim = this.getDataCheckbox("fbslim"); config.CompileOptions.fbslim = this.getDataCheckbox("fbslim");
config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation"); config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation");
config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat"); config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat");

View File

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

View File

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

Binary file not shown.

View File

@ -381,6 +381,11 @@
视频url 视频url
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.WXProjectConf.relativeDST">
<summary>
导出路径(相对路径)
</summary>
</member>
<member name="F:WeChatWASM.WXProjectConf.DST"> <member name="F:WeChatWASM.WXProjectConf.DST">
<summary> <summary>
导出路径(绝对路径) 导出路径(绝对路径)
@ -643,6 +648,11 @@
是否使用iOS高性能Plus 是否使用iOS高性能Plus
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.CompileOptions.enableiOSMetal">
<summary>
是否使用iOS metal指令流
</summary>
</member>
<member name="F:WeChatWASM.CompileOptions.brotliMT"> <member name="F:WeChatWASM.CompileOptions.brotliMT">
<summary> <summary>
是否使用brotli多线程压缩 是否使用brotli多线程压缩
@ -773,6 +783,11 @@
试玩 appid 试玩 appid
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.WXPlayableProjectConf.relativeDST">
<summary>
导出路径(相对路径)
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.DST"> <member name="F:WeChatWASM.WXPlayableProjectConf.DST">
<summary> <summary>
导出路径(绝对路径) 导出路径(绝对路径)

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ec74264ef51ecc54c29cd5c5a9a20ccb guid: b993b0b8a806c75ed7a13b77fa17ce03
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.

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,19 +3109,24 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete"> <member name="F:WeChatWASM.LoadOption.openlink">
<summary> <summary>
接口调用结束的回调函数(调用成功、失败都会执行) 从不同渠道获得的OPENLINK字符串
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail"> <member name="F:WeChatWASM.LoadOption.query">
<summary> <summary>
接口调用失败的回调函数 选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success"> <member name="F:WeChatWASM.ShowOption.openlink">
<summary> <summary>
接口调用成功的回调函数 从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
@ -4138,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: b2507c6f3dd6177d8e07d4cd92dd4747 guid: 81cc65a11f5c9b5aebaa40f2f711e6d0
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,19 +3115,24 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete"> <member name="F:WeChatWASM.LoadOption.openlink">
<summary> <summary>
接口调用结束的回调函数(调用成功、失败都会执行) 从不同渠道获得的OPENLINK字符串
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail"> <member name="F:WeChatWASM.LoadOption.query">
<summary> <summary>
接口调用失败的回调函数 选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success"> <member name="F:WeChatWASM.ShowOption.openlink">
<summary> <summary>
接口调用成功的回调函数 从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
@ -4144,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: 9c7fe131f963b6a22e4c7df170d5ad6a guid: 37680c56d473229445bdc13eddec0f78
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: 78b92c0a34806c616314a2b38110e2fe guid: b9fc513d2c8a9d37e605779a4102879e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0273befd5791516c05640b866a4057ac guid: 89db8c4df7a9c1d302d44460e0cfc192
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1e86b03a75094af93af8381e63631d68 guid: 880356841391a3fd2b68ad1b271e0afa
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 82b94f8d78674655f5fd96d309e2e231 guid: e3c73fd0a49dd24600171dd8db20ce7b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7021bb155055f5439e15bad624e754ea guid: e6407fe9e5346de987dfdd5ab574d1d4
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d52a1b6e1c06472f3a3a461209736492 guid: 2482b32fcb00dad4d51bc27b7674e4ae
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 22d6d4c3187efed778d0776abc44ce6d guid: 8ffd3e0dc2e69cb29fb78951d509b261
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9c539111fe10b89f215e1572f657dd2a guid: 9bd589818e70d0a95c2924f75eb5d8b1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 488d189c07fbf53e6941f8664391a66e guid: 5f5d4541b01a0c13d8c56358b8cef4fc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 287b5811fc8fd36b46a2b8545c1f3f16 guid: 402a27a6da4bccdd64d64f684bb2334b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1b2b0b9cb250b1b36bf30c888f7e6050 guid: 319dda78c1069e11bd566e53f37aa623
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 31f9cc6cd458af9ae649ac0f4cc8772e guid: d88754d5df57ab93770a9812558ef16b
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d0a26195cb9a986d48760de79dc69c05 guid: 0f0900afc85027cafb51349df9be8c18
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ceec02b40e3331d02d75fa809a9760a7 guid: 8482e0efaf9d8031b24b98bf520b5cc7
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: fbd0765c6cc217558e67f1de4ed42e8e guid: 37af72b2f5937fcaacfc3db72cb55cef
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 552fb477e5508b21160a2e7eb74135f6 guid: ca3fdf6fceabf683aef8757d5a9c89e9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 11460eb62a332e567ffd18337835c5a3 guid: 3c5e978759899c2492575044b1d24dfe
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 793126ee05e3cb6427ed7e685091bd5c guid: 031c488973c7de3893b0d94f02b1e9cb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 65740368c44afc71d5753b9562f86cc2 guid: 96902bc6efb524914b3add8439fd810b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c44827b68db2e97debfcbbf33f96aed8 guid: 24045b87d488b060ebfb28d338efeecd
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 617ca8ad329aeb2cdb1b3a86ecd7ccdf guid: e1e287b443772c3df9720bd5df6f3d25
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: fe580a429e851c5b538fb30fe720b6c8 guid: 2421d345c9a462590ee675bfe6ea456b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 722b94b392ddd919fbf09bb0a7ada913 guid: 9bc2aebaaa5ecdbc6b944ca7413e92ba
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 481df7275cffcd473c8a1114f7d73979 guid: bf72b795285285516906c9eac57764b5
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 872f94a461970f6e90b75b6dff984f50 guid: 71c88c961adb4e500a35efbe3e8e3335
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 64fa60d73efc6ecd9e23ebf9fcde9742 guid: e7d59c3ae47f1d8a527168fa8621b8e2
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 210e11bb52287d97cf27b94e015ee407 guid: c892e2221a23935c8bf2f7a437f13a8d
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: d0dd28604e5d572747167a70c1c4de6e guid: 7dc2561f1aa8fc20816b482b961cea2f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6af54681fef4e331b3b7efb699c35869 guid: fd1c2e255d6145b7cdc737a0464cf439
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: 7bcae50b313522e756e4d41d4c0ccd27 guid: aeb8aec354fce0402147cb97cae0d2af
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 383be04e4d0cf10b85da8c23c8afe5a4 guid: b35626dea431f62021d6aa4289462054
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4b807ee5567f2a193edfca4bdffbd798 guid: 4e32cf68c4c19f69b2f419d5f73003f4
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: be9c345ac8e3d41ca3f3a564591ae6c6 guid: 1539910084f7055477191cdbe21919ff
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 820b6791bd928c3e235e0f59192a3bf8 guid: 3020e6a8dc03e43242d231120065a735
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4b8a6a9e53972c103f0eb844fed1ea99 guid: ad32710e768164287db082b6864ef60f
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b0db95ab8a436016cb140e286a1b4d51 guid: 950186c2b4e79e0dca3e5e91c6b95abc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 88c2c4f8b42d569b8094feb74e6da2a1 guid: b12e574529b1f946331f11bd0dc342a2
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e70c92b55cd153ee4b42e95ce8a9dd2e guid: 963bf9cccdb2d9c6ee533edd00407fe2
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6dbf1743442a404168465ac92a94b187 guid: 6589f0c8a05f1ddb1e43db44b4208333
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 67ff1f029018f30663345cd163b89865 guid: af28f8d0e2034edcdb57a49cb13651cd
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 218f06f91957f2a8da1b71a723e3d9d0 guid: db2bb3cadee900283ebecb7ae72db141
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: eb24ec50c2a1d858b55fc5703296c0e4 guid: 0014446e9877281a6062c83cac128cdb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

@ -23,7 +23,7 @@
], ],
"plugins": { "plugins": {
"UnityPlugin": { "UnityPlugin": {
"version": "1.2.74", "version": "1.2.78",
"provider": "wxe5a48f1ed5f544b7", "provider": "wxe5a48f1ed5f544b7",
"contexts": [ "contexts": [
{ {
@ -32,7 +32,7 @@
] ]
}, },
"Layout": { "Layout": {
"version": "1.0.7", "version": "1.0.16",
"provider": "wx7a727ff7d940bb3f", "provider": "wx7a727ff7d940bb3f",
"contexts": [ "contexts": [
{ {

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ebace106ae81525b2d597de54b319641 guid: 1f2f8df870e0259f139e1d700f14901d
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 25ed7fd4b38e62dd76dad82ad8180f32 guid: 8907d4bc0539950da8b57b8b54ad31cb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:
assetBundleVariant: assetBundleVariant:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9b7a4b7182bc265e1f19186313e10f47 guid: 4b4cea4575e099ab4114cfb4644bd1a2
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0b8738d6b9bb9fd55482c734e21beb13 guid: f9315ef5811eb8f357f4bb29d06df373
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

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

View File

@ -56,7 +56,6 @@ function LayoutWithTplAndStyle(xml, style) {
Layout.clear(); Layout.clear();
Layout.init(xml, style); Layout.init(xml, style);
Layout.layout(sharedContext); Layout.layout(sharedContext);
console.log(Layout);
} }
// 仅仅渲染一些提示,比如数据加载中、当前无授权等 // 仅仅渲染一些提示,比如数据加载中、当前无授权等
function renderTips(tips = '') { function renderTips(tips = '') {

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 718eb08c349015c23350d41ce262e595 guid: 983e56fc2669588d85d0591b2c16c923
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