Auto-publish.

This commit is contained in:
rainhong 2025-07-10 19:05:11 +08:00
parent debe320956
commit af5cf63d03
165 changed files with 1617 additions and 1415 deletions

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
{
public class WXPlayableConvertCore
{
static WXPlayableConvertCore() { }
public static WXPlayableEditorScriptObject config => UnityUtil.GetPlayableEditorConf();
public static WXConvertCore.WXExportError DoExport(bool buildWebGL = true)
public class WXPlayableConvertCore
{
WXConvertCore.isPlayableBuild = true;
// var preCheckResult = WXConvertCore.PreCheck();
// if (preCheckResult != WXConvertCore.WXExportError.SUCCEED)
// {
// WXConvertCore.isPlayableBuild = false;
// return preCheckResult;
// }
// WXConvertCore.PreInit();
var exportResult = WXConvertCore.DoExport();
static WXPlayableConvertCore() { }
public static WXPlayableEditorScriptObject config => UnityUtil.GetPlayableEditorConf();
WXConvertCore.isPlayableBuild = false;
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))
public static WXConvertCore.WXExportError DoExport(bool buildWebGL = true)
{
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(
sourceField.Name,
WXConvertCore.isPlayableBuild = false;
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);
if (targetField != null &&
(targetField.FieldType.IsAssignableFrom(sourceField.FieldType) ||
(targetField.FieldType.IsValueType && sourceField.FieldType.IsValueType &&
targetField.FieldType == sourceField.FieldType)))
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);
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)
{
target.ProjectConf.CDN = "";
target.ProjectConf.assetLoadType = 1;
target.ProjectConf.compressDataPackage = true;
public static WXEditorScriptObject SetDefaultProperties(WXEditorScriptObject target)
{
target.ProjectConf.CDN = "";
target.ProjectConf.assetLoadType = 1;
target.ProjectConf.compressDataPackage = true;
target.CompileOptions.showMonitorSuggestModal = false;
return target;
target.CompileOptions.showMonitorSuggestModal = false;
return target;
}
}
}
}

View File

@ -6,358 +6,354 @@ using UnityEngine;
namespace WeChatWASM
{
[InitializeOnLoad]
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
[InitializeOnLoad]
public class WXPlayableSettingsHelperInterface
{
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
return PlayerSettings.GetScriptingBackend(BuildTargetGroup.WeixinMiniGame) == ScriptingImplementation.IL2CPP;
#else
return true;
return true;
#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));
formInputData[targetDst] = GUILayout.TextField(formInputData[targetDst], GUILayout.MaxWidth(EditorGUIUtility.currentViewWidth - 270));
if (GUILayout.Button(new GUIContent("打开"), GUILayout.Width(40)))
public WXPlayableSettingsHelper()
{
if (!formInputData[targetDst].Trim().Equals(string.Empty))
{
EditorUtility.RevealInFinder(GetAbsolutePath(formInputData[targetDst]));
}
GUIUtility.ExitGUI();
projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../");
}
if (GUILayout.Button(new GUIContent("选择"), GUILayout.Width(40)))
public void OnFocus()
{
var dstPath = EditorUtility.SaveFolderPanel("选择你的游戏导出目录", string.Empty, string.Empty);
if (dstPath != string.Empty)
{
formInputData[targetDst] = dstPath;
this.saveData();
}
GUIUtility.ExitGUI();
loadData();
}
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)
public void OnLostFocus()
{
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;
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)))
public void OnDisable()
{
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)
EditorGUILayout.LabelField(string.Empty);
GUILayout.EndHorizontal();
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));
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
}
}
// 是否使用 iOS Metal 渲染
public static bool UseiOSMetal
{
get
{
return config.CompileOptions.enableiOSMetal;
}
}
// public static void SetPlayableEnabled(bool enabled)
// {
// isPlayableBuild = enabled;
@ -112,9 +120,12 @@ namespace WeChatWASM
CheckBuildTarget();
Init();
// 可能有顺序要求?如果没要求,可挪到此函数外
if (!isPlayableBuild) {
if (!isPlayableBuild)
{
ProcessWxPerfBinaries();
}
// iOS metal 的相关特性
ProcessWxiOSMetalBinaries();
MakeEnvForLuaAdaptor();
// JSLib
SettingWXTextureMinJSLib();
@ -140,7 +151,7 @@ namespace WeChatWASM
return WXExportError.BUILD_WEBGL_FAILED;
}
dynamic config = isPlayableBuild ? UnityUtil.GetPlayableEditorConf() : UnityUtil.GetEditorConf();
if (config.ProjectConf.DST == string.Empty)
if (config.ProjectConf.relativeDST == string.Empty)
{
Debug.LogError("请先配置游戏导出路径");
return WXExportError.BUILD_WEBGL_FAILED;
@ -400,6 +411,41 @@ namespace WeChatWASM
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)
{
string DS = WXAssetsTextTools.DS;
@ -523,13 +569,28 @@ namespace WeChatWASM
GraphicsDeviceType[] targets = new GraphicsDeviceType[] { };
#if PLATFORM_WEIXINMINIGAME
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
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false);
@ -1194,7 +1255,8 @@ namespace WeChatWASM
public static void convertDataPackageJS()
{
if (!isPlayableBuild) {
if (!isPlayableBuild)
{
checkNeedRmovePackageParallelPreload();
}
@ -1650,7 +1712,8 @@ namespace WeChatWASM
content = content.Replace("$unityVersion$", Application.unityVersion);
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);
if (!isPlayableBuild) {
if (!isPlayableBuild)
{
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) : "[]";
content = content.Replace("'$PreLoadKeys'", PreLoadKeys);
@ -1904,7 +1967,7 @@ namespace WeChatWASM
config.ProjectConf.bundleHashLength.ToString(),
bundlePathIdentifierStr,
excludeFileExtensionsStr,
config.CompileOptions.Webgl2 ? "2" : "1",
config.CompileOptions.enableiOSMetal ? "5" : (config.CompileOptions.Webgl2 ? "2" : "1"),
Application.unityVersion,
WXExtEnvDef.pluginVersion,
config.ProjectConf.dataFileSubPrefix,
@ -1956,7 +2019,8 @@ namespace WeChatWASM
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" };
if (isPlayableBuild) {
if (isPlayableBuild)
{
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();
projectRootPath = System.IO.Path.GetFullPath(Application.dataPath + "/../");
_dstCache = "";
}
private static WXEditorScriptObject config;
private static bool m_EnablePerfTool = false;
private static string _dstCache;
public void OnFocus()
{
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("profilingFuncs", "Profiling Funcs");
this.formCheckbox("profilingMemory", "Profiling Memory");
this.formCheckbox("webgl2", "WebGL2.0");
this.formCheckbox("webgl2", "WebGL2.0(beta)");
this.formCheckbox("iOSPerformancePlus", "iOSPerformancePlus(?)", "是否使用iOS高性能+渲染方案有助于提升渲染兼容性、降低WebContent进程内存");
// this.formCheckbox("iOSMetal", "iOSMetal(?)", "是否使用iOSMetal渲染方案需要开启iOS高性能+模式有助于提升运行性能降低iOS功耗");
this.formCheckbox("deleteStreamingAssets", "Clear Streaming Assets");
this.formCheckbox("cleanBuild", "Clean WebGL Build");
// 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(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js");
config = UnityUtil.GetEditorConf();
_dstCache = config.ProjectConf.DST;
// Instant Game
if (WXConvertCore.IsInstantGameAutoStreaming())
@ -436,7 +432,7 @@ namespace WeChatWASM
this.setData("compressDataPackage", config.ProjectConf.compressDataPackage);
this.setData("videoUrl", config.ProjectConf.VideoUrl);
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("bundlePathIdentifier", config.ProjectConf.bundlePathIdentifier);
this.setData("bundleExcludeExtensions", config.ProjectConf.bundleExcludeExtensions);
@ -452,6 +448,7 @@ namespace WeChatWASM
this.setData("customNodePath", config.CompileOptions.CustomNodePath);
this.setData("webgl2", config.CompileOptions.Webgl2);
this.setData("iOSPerformancePlus", config.CompileOptions.enableIOSPerformancePlus);
this.setData("iOSMetal", config.CompileOptions.enableiOSMetal);
this.setData("fbslim", config.CompileOptions.fbslim);
this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation);
this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat);
@ -513,8 +510,8 @@ namespace WeChatWASM
config.ProjectConf.compressDataPackage = this.getDataCheckbox("compressDataPackage");
config.ProjectConf.VideoUrl = this.getDataInput("videoUrl");
config.ProjectConf.Orientation = (WXScreenOritation)this.getDataPop("orientation");
_dstCache = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(_dstCache);
config.ProjectConf.relativeDST = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(config.ProjectConf.relativeDST);
config.ProjectConf.bundleHashLength = int.Parse(this.getDataInput("bundleHashLength"));
config.ProjectConf.bundlePathIdentifier = this.getDataInput("bundlePathIdentifier");
config.ProjectConf.bundleExcludeExtensions = this.getDataInput("bundleExcludeExtensions");
@ -530,6 +527,7 @@ namespace WeChatWASM
config.CompileOptions.CustomNodePath = this.getDataInput("customNodePath");
config.CompileOptions.Webgl2 = this.getDataCheckbox("webgl2");
config.CompileOptions.enableIOSPerformancePlus = this.getDataCheckbox("iOSPerformancePlus");
config.CompileOptions.enableiOSMetal = this.getDataCheckbox("iOSMetal");
config.CompileOptions.fbslim = this.getDataCheckbox("fbslim");
config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation");
config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat");

View File

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

View File

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

Binary file not shown.

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 6beb6d8e857e38f8b6bebe7de23ff41d
guid: d05761f316f7eab715c19190699cc137
DefaultImporter:
externalObjects: {}
userData:

View File

@ -115,8 +115,8 @@ WX_SyncFunction_tnn: function(functionName, returnType, param1, param2){
stringToUTF8((res || ''), buffer, bufferSize);
return buffer;
},
WX_ClassOneWayFunction: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));
WX_ClassConstructor:function(functionName, returnType, successType, failType, completeType, 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 buffer = _malloc(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) {
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);
},
})

Binary file not shown.

View File

@ -1699,26 +1699,6 @@
如果返回的是字符串,则数据在这个字段
</summary>
</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">
<summary>
文件的路径
@ -3129,19 +3109,24 @@
 是否结束
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete">
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
接口调用结束的回调函数(调用成功、失败都会执行)
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail">
<member name="F:WeChatWASM.LoadOption.query">
<summary>
接口调用失败的回调函数
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success">
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
接口调用成功的回调函数
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.Gamepad.axes">
@ -4138,26 +4123,6 @@
取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0
</summary>
</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">
<summary>
是否有新版本

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e59aba6a2f1488c6f45969265dada192
guid: 7a86865669cf8962db73b80475f73340
DefaultImporter:
externalObjects: {}
userData:

Binary file not shown.

View File

@ -1705,26 +1705,6 @@
如果返回的是字符串,则数据在这个字段
</summary>
</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">
<summary>
文件的路径
@ -3135,19 +3115,24 @@
 是否结束
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete">
<member name="F:WeChatWASM.LoadOption.openlink">
<summary>
接口调用结束的回调函数(调用成功、失败都会执行)
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail">
<member name="F:WeChatWASM.LoadOption.query">
<summary>
接口调用失败的回调函数
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success">
<member name="F:WeChatWASM.ShowOption.openlink">
<summary>
接口调用成功的回调函数
从不同渠道获得的OPENLINK字符串
</summary>
</member>
<member name="F:WeChatWASM.ShowOption.query">
<summary>
选填部分活动、功能允许接收自定义query参数请参阅渠道说明默认可不填
</summary>
</member>
<member name="F:WeChatWASM.Gamepad.axes">
@ -4144,26 +4129,6 @@
取值为0/1取值为0表示会把 `App`、`Page` 的生命周期函数和 `wx` 命名空间下的函数调用写入日志取值为1则不会。默认值是 0
</summary>
</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">
<summary>
是否有新版本

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a4f84d1484728bdc7f8b22c245c12954
guid: 73f0f5fde7193ea9d6786ceb70926356
DefaultImporter:
externalObjects: {}
userData:

View File

@ -4036,32 +4036,6 @@ namespace WeChatWASM
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>
/// [[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`

View File

@ -1127,6 +1127,32 @@ namespace WeChatWASM
WXSDKManagerHandler.Instance.NotifyMiniProgramPlayableStatus(option);
}
#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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: efd466b65c54b332a045eb2a2b7bcd45
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 98c226d2c0b95cd9c41e66f659b77518
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 1a26deb368681059a6efbc7198b97271
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8f900df282483fe0b44d51216d7632a1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 1cd422863090f735317f0b026acb8650
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 9481450cbf5e182fd85f759f54cf092a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: b9620d2e870f2070152ba599cc3b98b1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 39daf193cb0994c3f598430449748c8e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: d1c06bdafb5551891701f5ccfa01bb2f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 491ea96b1da764b7f4f75fd37964de13
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: a5e6271e94af38d72cfd86514ed9c094
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 9083c27e58e5c1e932c596eb1c4e1246
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 1335edb1334e7d2ca51aa361ab4e5e28
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 39fbdc73d5bdd681f77ce72ae3881eb0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8ef13099c4e88b3b8bdf4d4625834310
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 7d4748243437a6f2dbc5d029c21f746f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 87a15cda2827c13ab79be33896188e15
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 4dedf0af8e492b4e8b0f18c15d73777b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 3c9889acfb476e516ecc71fc86d015a6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 58361aeed030e41725f681a68be8c48a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: ee76ea2541df6d253d8001fc932cb33e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 3f4b7b4b50b37543843a4aeedf8441d6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: d1c8ad657fb8ab40dc9f680f3c58fd18
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 99551a7ac72af0149200d011366faba6
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8676811d588186c0506f7c8ab09f889b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8c9de2934dbdcf55bc4d8b6e519f6ac4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 3d7877cde8035e267188fab320abc765
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: d000803b9ce06f9fe2365551e38a077b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 72599062956481857fb69ff094c92bb4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 3a071e263d20711fc94aa701d8884eb3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 2749e4754bd07d3c3d9313bb861fc4c7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 33deebb5a2c004b54f1b2ca241c9e97d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: ab12d6c8d1fef80dfd3c4c06bbbd5c16
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 3a53eabab88c0b28bc749166a0ed3688
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: e4cd6a130970b32124d85a344f7424f3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 9547564f629a70fa59d6f401e33f03e1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 46c4f829083322d564dd6598007fb648
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8cb67e670fe2d6dcc4829f87d8f5a380
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 750d54649f1074c9697fe084442269ef
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: ca23ed08b838e56dc206dc2d33464e3a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 379609f17fe23436b2ef41a98fe54ba3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 67b9cbab08d03a63dc64fbc6fd60bf18
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 03f109f37535b82a53464b38b5821e9d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: ba347c330afbf0056959a4fe0df57db2
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 30ab62c6ccbb05532fce2a282cdf1808
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8982d318073de632e9f7e893418763ff
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: b79461c69f6bf9f0d7b42c557137bc38
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8336cd82f89ed780ff02ce1045a8eea3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -262,7 +262,7 @@ export default {
formatResponse(returnType, 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 callbackId = uid();
const obj = wx[functionName.replace(/^\w/, a => a.toLowerCase())]({
@ -399,4 +399,59 @@ export default {
WX_ClassOneWayNoFunction_vn(className, functionName, id, param1) {
WX_ClassOneWayNoFunction(className, functionName, id, param1);
},
WX_ClassOneWayFunction(className, functionName, id, successType, failType, completeType, conf, callbackId, usePromise = false) {
console.log('!!! WX_ClassOneWayFunction', className, functionName, id, successType, failType, completeType, conf, callbackId);
const obj = getClassObject(className, id);
if (!obj) {
return;
}
const lowerFunctionName = functionName.replace(/^\w/, a => a.toLowerCase());
const config = formatJsonStr(conf);
console.log('!!! WX_ClassOneWayFunction 1', `${className}${functionName}Callback`);
if (usePromise) {
obj[lowerFunctionName]({
...config,
}).then((res) => {
formatResponse(successType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'success', res: JSON.stringify(res),
}));
})
.catch((res) => {
formatResponse(failType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'fail', res: JSON.stringify(res),
}));
})
.finally((res) => {
formatResponse(completeType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'complete', res: JSON.stringify(res),
}));
});
}
else {
obj[lowerFunctionName]({
...config,
success(res) {
formatResponse(successType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'success', res: JSON.stringify(res),
}));
},
fail(res) {
formatResponse(failType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'fail', res: JSON.stringify(res),
}));
},
complete(res) {
formatResponse(completeType, res);
moduleHelper.send(`${className}${functionName}Callback`, JSON.stringify({
callbackId, type: 'complete', res: JSON.stringify(res),
}));
},
});
}
},
};

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: f0488ad515f244cbe10d149307718965
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 67b0189c9d2382837eb7c718f50ef6fd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 687636a1968b801dc01a16adc71a6abd
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 209fe3d7a79f5fa90c60cc96d4cfc386
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: ad669a0514de61d1af7a1361accc7988
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 456218360c685822e52a927d23fd4287
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: cb2f745d1f61a96ff7e72cfaca95bf71
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 44f4a9f52b1d03ad2469b50c48841ffc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8e416ca24ac782bfd0019c50f69483eb
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 9b301f1ae9e8ad1b2fdee1831be4b367
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 158006b8c80f282c5931f1ec1bd256b0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 5446f8a9992da648361eb64e7e8be5d0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8607b6c6083947c3c6af3134854014e1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8f700b285b264ebc83a8a91eff78c8a7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8247d2ba453b82521c60371561249528
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 8f6e4baa621ad88688c36550a27a9dba
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 326d880942254b95db8f85fb5298083d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 62980c95411f10851b6f534a2ae26a6c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -32,7 +32,7 @@
]
},
"Layout": {
"version": "1.0.7",
"version": "1.0.15",
"provider": "wx7a727ff7d940bb3f",
"contexts": [
{

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 07b6da9d7f35b611a5b329316306545f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: c369ab37751bbee3ccf95da6d6b73614
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 583cdb84a872347ee3010ec555edf6ff
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: f2270cd6fe51d29ed3f958c6067974e3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 2adc58beafc6b77b4dbc45b1419f868a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 123a8c49e641d39bfbdd5d33eeaa96d1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 5918b79306c520e843d9d74d1e6ff13e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: cad808f90b9929073f1867cc491394fe
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: e114b8d6b286d8e0e1678c7656604afc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 89659bf7c478bd26a8fc9c457e194c0e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: e3d5db5f7b35488952b5161b3129b270
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 16413aeb7372dce483936dbb1c1e44b7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 8199af91b610986a50d11b430e3be5d0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 49866ca22b5165ebd631e8448414aae9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 52c6e07f19f11ec4e46f825560727e5f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: a961bbe98618ebc1c33991997cce3685
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: ad35ebc20b99e6941eabb6da4c0673c8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 31c9c923c760217a2853f0ef678042d4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: d7385c758bb2f68a97f79920c40f1c29
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 4921d2044404603ea067491df65c2666
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 9f553ca21dc3bc3c8d79d1c7a1aef1bc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 320319d78b25d4b3c7d532442491f0ee
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 3aeef152ac8a3da58d47098ff371d729
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: ebfb9e8ed7e26b64e4d4c221f0ec94e3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -63,9 +63,10 @@ export default function getStyle(data) {
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
textAlign: 'center',
lineHeight: (data.height / 2 / 3) * 0.4,
verticalAlign: 'center',
fontSize: data.width * 0.043,
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
color: '#fff',
},
rankScoreTip: {

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 62381ca2561d520bf69466acdf65bee8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: fc9aee3c0ead90f7c24d1adc8367654e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 6bdb84e6a60e0638bb092f8248c84d80
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 52e2ffd9a70c72c661b8ab21e573df3e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,11 +1,10 @@
/**
* 下面的内容分成两部分第一部分是一个模板模板的好处是能够有一定的语法
* 坏处是模板引擎一般都依赖 new Function 或者 eval 能力小游戏下面是没有的
* 所以模板的编译需要在外部完成可以将注释内的模板贴到下面的页面内点击 "run"就能够得到编译后的模板函数
* https://wechat-miniprogram.github.io/minigame-canvas-engine/playground.html
* 如果觉得模板引擎使用过于麻烦也可以手动拼接字符串本文件对应函数的目标仅仅是为了创建出 xml 节点数
*/
/*
* 模板引擎使用教程可见https://wechat-miniprogram.github.io/minigame-canvas-engine/tutorial/templateengine.html
* xml经过doT.js编译出的模板函数
* 因为小游戏不支持new Function模板函数只能外部编译
* 可直接拷贝本函数到小游戏中使用
* 原始的模板如下
*
<view class="container" id="main">
<view class="rankList">
<scrollview class="list" scrollY="true">
@ -29,22 +28,17 @@
</scrollview>
</view>
</view>
*/
/**
* xml经过doT.js编译出的模板函数
* 因为小游戏不支持new Function模板函数只能外部编译
* 可直接拷贝本函数到小游戏中使用
*
*/
export default function anonymous(it) {
let out = '<view class="container" id="main"> <view class="rankList"> <scrollview class="list" scrollY="true"> ';
const arr1 = it.data;
export default function tplFunc(it) {
var out = '<view class="container" id="main"> <view class="rankList"> <scrollview class="list" scrollY="true"> ';
var arr1 = it.data;
if (arr1) {
let item;
let index = -1;
const l1 = arr1.length - 1;
var item, index = -1, l1 = arr1.length - 1;
while (index < l1) {
item = arr1[(index += 1)];
out += ` <view class="listItem"> <image src="open-data/render/image/rankBg.png" class="rankBg"></image> <image class="rankAvatarBg" src="open-data/render/image/rankAvatar.png"></image> <image class="rankAvatar" src="${item.avatarUrl}"></image> <view class="rankNameView"> <image class="rankNameBg" src="open-data/render/image/nameBg.png"></image> <text class="rankName" value="${item.nickname}"></text> <text class="rankScoreTip" value="战力值:"></text> <text class="rankScoreVal" value="${item.score || 0}"></text> </view> <view class="shareToBtn" data-isSelf="${!!item.isSelf}" data-id="${item.openid || ''}"> <image src="open-data/render/image/${item.isSelf ? 'button3' : 'button2'}.png" class="shareBtnBg"></image> <text class="shareText" value="${item.isSelf ? '你自己' : '分享'}"></text> </view> </view> `;
item = arr1[index += 1];
out += ' <view class="listItem"> <image src="open-data/render/image/rankBg.png" class="rankBg"></image> <image class="rankAvatarBg" src="open-data/render/image/rankAvatar.png"></image> <image class="rankAvatar" src="' + (item.avatarUrl) + '"></image> <view class="rankNameView"> <image class="rankNameBg" src="open-data/render/image/nameBg.png"></image> <text class="rankName" value="' + (item.nickname) + '"></text> <text class="rankScoreTip" value="战力值:"></text> <text class="rankScoreVal" value="' + (item.score || 0) + '"></text> </view> <view class="shareToBtn" data-isSelf="' + (item.isSelf ? true : false) + '" data-id="' + (item.openid || '') + '"> <image src="open-data/render/image/' + (item.isSelf ? 'button3' : 'button2') + '.png" class="shareBtnBg"></image> <text class="shareText" value="' + (item.isSelf ? '你自己' : '分享') + '"></text> </view> </view> ';
}
}
out += ' </scrollview> </view></view>';

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: 246c809615f7912b828c4dad194c84f5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 10bc3c1f6a0fc7b2fcaa6a75be743477
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
fileFormatVersion: 2
guid: fda717625d729aef6e560a8b171f96f3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
guid: 86c7c4a5979ad3e588896133bff2d5dc
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

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