Auto-publish.

This commit is contained in:
rainhong 2025-07-24 20:22:18 +08:00
parent 45e7581c92
commit 089f992857
161 changed files with 1013 additions and 764 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();
} }
@ -1317,7 +1379,8 @@ namespace WeChatWASM
var buildTemplate = new BuildTemplate( var buildTemplate = new BuildTemplate(
Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir), Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir),
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"), Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"),
Path.Combine(config.ProjectConf.DST, miniGameDir) Path.Combine(config.ProjectConf.DST, miniGameDir),
true
); );
buildTemplate.start(); buildTemplate.start();
// FIX: 2021.2版本生成symbol有bug导出时生成symbol报错有symbol才copy // FIX: 2021.2版本生成symbol有bug导出时生成symbol报错有symbol才copy
@ -1456,7 +1519,7 @@ namespace WeChatWASM
var shortFilename = filename.Substring(filename.IndexOf('.') + 1); var shortFilename = filename.Substring(filename.IndexOf('.') + 1);
// 如果code没有发生过变化且压缩方式不变则不再进行br压缩 // 如果code没有发生过变化且压缩方式不变则不再进行br压缩
if (cachePath.Contains("wasm.code") && File.Exists(cachePath) && lastBrotliType == config.CompileOptions.brotliMT) if (File.Exists(cachePath) && lastBrotliType == config.CompileOptions.brotliMT)
{ {
File.Copy(cachePath, targetPath, true); File.Copy(cachePath, targetPath, true);
return 0; return 0;
@ -1649,7 +1712,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 +1967,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,
@ -1955,7 +2019,8 @@ namespace WeChatWASM
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 = "202507230322"; // 这一行不要改他,导出的时候会自动替换 public static string pluginVersion = "202507241221"; // 这一行不要改他,导出的时候会自动替换
} }
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: 4a90389cebd5db8b1ab58b0a3ca5cdc8 guid: d05761f316f7eab715c19190699cc137
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -416,7 +416,7 @@ mergeInto(LibraryManager.library, {
WXVideoPlay: function(id) { WXVideoPlay: function(id) {
window.WXWASMSDK.WXVideoPlay(_WXPointer_stringify_adaptor(id)); window.WXWASMSDK.WXVideoPlay(_WXPointer_stringify_adaptor(id));
}, },
WXVideoAddListener: function(id,key) { WXVideoAddListener: function(id, key) {
window.WXWASMSDK.WXVideoAddListener(_WXPointer_stringify_adaptor(id), _WXPointer_stringify_adaptor(key)); window.WXWASMSDK.WXVideoAddListener(_WXPointer_stringify_adaptor(id), _WXPointer_stringify_adaptor(key));
}, },
WXVideoDestroy: function(id) { WXVideoDestroy: function(id) {

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,98 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete"> <member name="F:WeChatWASM.VirtualPaymentError.errMsg">
错误信息
| 错误码 | 错误信息 | 说明 |
| - | - | - |
| 1001 | | 参数错误 |
| -1 | | 支付失败 |
| -2 | | 支付取消 |
| -4 | | 风控拦截 |
| -5 | | 开通签约结果未知 |
| -15001 | | 参数错误,具体原因见err_msg |
| -15002 | | outTradeNo重复使用,请换新单号重试 |
| -15003 | | 系统错误 |
| -15004 | | currencyType错误,目前只能填CNY |
| -15005 | | 用户态签名signature错误 |
| -15006 | | 支付签名paySig错误 |
| -15007 | | session_key过期 |
| -15008 | | 二级商户进件未完成 |
| -15009 | | 代币未发布 |
| -15010 | | 道具productId未发布 |
| -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
| -15012 | | 调用米大师失败导致关单,请换新单号重试 |
| -15013 | | goodsPrice道具价格错误 |
| -15014 | | 道具/代币发布未生效禁止下单大概10分钟后生效 |
| -15016 | | signData格式有问题 |
| -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15018 | | 代币或者道具productId审核不通过 |
| -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15020 | | 操作过快,请稍候再试 |
| -15021 | | 小程序被限频交易 |
</member>
<member name="F:WeChatWASM.VirtualPaymentError.errCode">
错误码
| 错误码 | 错误信息 | 说明 |
| - | - | - |
| 1001 | | 参数错误 |
| -1 | | 支付失败 |
| -2 | | 支付取消 |
| -4 | | 风控拦截 |
| -5 | | 开通签约结果未知 |
| -15001 | | 参数错误,具体原因见err_msg |
| -15002 | | outTradeNo重复使用,请换新单号重试 |
| -15003 | | 系统错误 |
| -15004 | | currencyType错误,目前只能填CNY |
| -15005 | | 用户态签名signature错误 |
| -15006 | | 支付签名paySig错误 |
| -15007 | | session_key过期 |
| -15008 | | 二级商户进件未完成 |
| -15009 | | 代币未发布 |
| -15010 | | 道具productId未发布 |
| -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
| -15012 | | 调用米大师失败导致关单,请换新单号重试 |
| -15013 | | goodsPrice道具价格错误 |
| -15014 | | 道具/代币发布未生效禁止下单大概10分钟后生效 |
| -15016 | | signData格式有问题 |
| -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15018 | | 代币或者道具productId审核不通过 |
| -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15020 | | 操作过快,请稍候再试 |
| -15021 | | 小程序被限频交易 |
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentFailCallbackErr.errCode">
错误码
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentFailCallbackErr.errMsg">
错误信息
</member>
<member name="F:WeChatWASM.RequestCommonPaymentSuccessCallbackResult.errMsg">
调用成功信息
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentOption.mode">
<summary> <summary>
接口调用结束的回调函数(调用成功、失败都会执行) 支付的类型, 不同的支付类型有各自额外要传的附加参数
可选值:
- 'short_series_goods': 道具直购;
- 'short_series_coin': 代币充值;
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail"> <member name="F:WeChatWASM.RequestVirtualPaymentOption.paySig">
<summary> <summary>
接口调用失败的回调函数 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html)
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success"> <member name="F:WeChatWASM.RequestVirtualPaymentOption.signData">
<summary> <summary>
接口调用成功的回调函数 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}'
</summary>
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentOption.signature">
<summary>
用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html)
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
@ -8610,12 +8669,12 @@
取消监听视频播放到末尾事件 取消监听视频播放到末尾事件
</summary> </summary>
</member> </member>
<member name="M:WeChatWASM.WXVideo.OnError(System.Action)"> <member name="M:WeChatWASM.WXVideo.OnError(System.Action{WeChatWASM.WXVideoError})">
<summary> <summary>
监听视频错误事件 监听视频错误事件
</summary> </summary>
</member> </member>
<member name="M:WeChatWASM.WXVideo.OffError(System.Action)"> <member name="M:WeChatWASM.WXVideo.OffError(System.Action{WeChatWASM.WXVideoError})">
<summary> <summary>
取消监听视频错误事件,action 为空表示移除全部事件监听 取消监听视频错误事件,action 为空表示移除全部事件监听
</summary> </summary>

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a18857814588f027fbba2af025670e61 guid: 7a86865669cf8962db73b80475f73340
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,98 @@
 是否结束  是否结束
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.complete"> <member name="F:WeChatWASM.VirtualPaymentError.errMsg">
错误信息
| 错误码 | 错误信息 | 说明 |
| - | - | - |
| 1001 | | 参数错误 |
| -1 | | 支付失败 |
| -2 | | 支付取消 |
| -4 | | 风控拦截 |
| -5 | | 开通签约结果未知 |
| -15001 | | 参数错误,具体原因见err_msg |
| -15002 | | outTradeNo重复使用,请换新单号重试 |
| -15003 | | 系统错误 |
| -15004 | | currencyType错误,目前只能填CNY |
| -15005 | | 用户态签名signature错误 |
| -15006 | | 支付签名paySig错误 |
| -15007 | | session_key过期 |
| -15008 | | 二级商户进件未完成 |
| -15009 | | 代币未发布 |
| -15010 | | 道具productId未发布 |
| -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
| -15012 | | 调用米大师失败导致关单,请换新单号重试 |
| -15013 | | goodsPrice道具价格错误 |
| -15014 | | 道具/代币发布未生效禁止下单大概10分钟后生效 |
| -15016 | | signData格式有问题 |
| -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15018 | | 代币或者道具productId审核不通过 |
| -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15020 | | 操作过快,请稍候再试 |
| -15021 | | 小程序被限频交易 |
</member>
<member name="F:WeChatWASM.VirtualPaymentError.errCode">
错误码
| 错误码 | 错误信息 | 说明 |
| - | - | - |
| 1001 | | 参数错误 |
| -1 | | 支付失败 |
| -2 | | 支付取消 |
| -4 | | 风控拦截 |
| -5 | | 开通签约结果未知 |
| -15001 | | 参数错误,具体原因见err_msg |
| -15002 | | outTradeNo重复使用,请换新单号重试 |
| -15003 | | 系统错误 |
| -15004 | | currencyType错误,目前只能填CNY |
| -15005 | | 用户态签名signature错误 |
| -15006 | | 支付签名paySig错误 |
| -15007 | | session_key过期 |
| -15008 | | 二级商户进件未完成 |
| -15009 | | 代币未发布 |
| -15010 | | 道具productId未发布 |
| -15011 | | 现网版本的env只能是0,不能填1(沙盒环境) |
| -15012 | | 调用米大师失败导致关单,请换新单号重试 |
| -15013 | | goodsPrice道具价格错误 |
| -15014 | | 道具/代币发布未生效禁止下单大概10分钟后生效 |
| -15016 | | signData格式有问题 |
| -15017 | | 此商家涉嫌违规,收款功能已被限制,暂无法支付。商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15018 | | 代币或者道具productId审核不通过 |
| -15019 | | 调微信报商户受限,商家可以登录微信商户平台/微信支付商家助手小程序查看原因和解决方案 |
| -15020 | | 操作过快,请稍候再试 |
| -15021 | | 小程序被限频交易 |
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentFailCallbackErr.errCode">
错误码
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentFailCallbackErr.errMsg">
错误信息
</member>
<member name="F:WeChatWASM.RequestCommonPaymentSuccessCallbackResult.errMsg">
调用成功信息
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentOption.mode">
<summary> <summary>
接口调用结束的回调函数(调用成功、失败都会执行) 支付的类型, 不同的支付类型有各自额外要传的附加参数
可选值:
- 'short_series_goods': 道具直购;
- 'short_series_coin': 代币充值;
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.fail"> <member name="F:WeChatWASM.RequestVirtualPaymentOption.paySig">
<summary> <summary>
接口调用失败的回调函数 支付签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html)
</summary> </summary>
</member> </member>
<member name="P:WeChatWASM.NotifyMiniProgramPlayableStatusOption.success"> <member name="F:WeChatWASM.RequestVirtualPaymentOption.signData">
<summary> <summary>
接口调用成功的回调函数 具体支付参数见signData, 该参数需以string形式传递, 例如signData: '{"offerId":"123","buyQuantity":1,"env":0,"currencyType":"CNY","productId":"testproductId","goodsPrice":10,"outTradeNo":"xxxxxx","attach":"testdata"}'
</summary>
</member>
<member name="F:WeChatWASM.RequestVirtualPaymentOption.signature">
<summary>
用户态签名, 详见[《签名详解》](https://developers.weixin.qq.com/miniprogram/dev/platform-capabilities/industry/virtual-payment.html)
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.Gamepad.axes"> <member name="F:WeChatWASM.Gamepad.axes">
@ -8616,12 +8675,12 @@
取消监听视频播放到末尾事件 取消监听视频播放到末尾事件
</summary> </summary>
</member> </member>
<member name="M:WeChatWASM.WXVideo.OnError(System.Action)"> <member name="M:WeChatWASM.WXVideo.OnError(System.Action{WeChatWASM.WXVideoError})">
<summary> <summary>
监听视频错误事件 监听视频错误事件
</summary> </summary>
</member> </member>
<member name="M:WeChatWASM.WXVideo.OffError(System.Action)"> <member name="M:WeChatWASM.WXVideo.OffError(System.Action{WeChatWASM.WXVideoError})">
<summary> <summary>
取消监听视频错误事件,action 为空表示移除全部事件监听 取消监听视频错误事件,action 为空表示移除全部事件监听
</summary> </summary>

View File

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

View File

@ -535,7 +535,7 @@ namespace WeChatWASM
/// </summary> /// </summary>
/// <param name="param"></param> /// <param name="param"></param>
/// <returns></returns> /// <returns></returns>
public static WXVideo CreateVideo(WXCreateVideoParam param) public static WXVideo CreateVideo(CreateVideoOption param)
{ {
return WXSDKManagerHandler.Instance.CreateVideo(param); return WXSDKManagerHandler.Instance.CreateVideo(param);
} }
@ -1126,6 +1126,15 @@ namespace WeChatWASM
{ {
WXSDKManagerHandler.Instance.NotifyMiniProgramPlayableStatus(option); WXSDKManagerHandler.Instance.NotifyMiniProgramPlayableStatus(option);
} }
#endregion
#region
/// <summary>
/// 请求虚拟支付
/// </summary>
public static void RequestVirtualPayment(RequestVirtualPaymentOption option)
{
WXSDKManagerHandler.Instance.RequestVirtualPayment(option);
}
#endregion #endregion
} }
} }

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 92af1c93c32d8868b037a614a7c51557 guid: 335dccdc9352340664c08fb95d28c866
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 82a6bdd86dff7182973b291cb71e97cf guid: 2683c9b827ce7b0734aea795fa68f955
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 531515f3324b0cf5a249ca868fbb957e guid: 4fee9d8508122379deee33dcd4d88d01
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3b395b6e591cc8b3668e0b64e63fc88b guid: 9c59aaaf1229deb01ab6516a155ffbbd
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d04f0a28a0ef5cdd7a1d23182b85b42f guid: 111ac01339bc594b2f2345ae74ddeea5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9bcc1936d8e45b5791c599fe8253919c guid: f2b8c372505253a4b68197a27f003157
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bbec39b14da95d130e2852e718bcee52 guid: 47d939d6e5cdaa557176525bcf753a73
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5811c5c2d62fc7802c64f1d2b23745f1 guid: b8e770b716866aab217f6d829b689aef
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6dae963d59fa4418d09722a93e87d793 guid: 1079bb099ec19050ca4bb236a6dbf065
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 854f4bd8ff1dd4750841937bcddeaf70 guid: 8707e00480756f8d122bfdd433c3d4eb
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2c062721204b988f19733cfdcfb64e34 guid: 400a35d8ffe1a4fec2f6fc8690f31197
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2a92708403fe30f324cbf69ccf64a5ca guid: ae52906cc7d414c84bd24f75d8953ce5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a5bfd354ed4424c67e796543113905e3 guid: 3d286002dacb55b89e2dee3d30029167
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3a4d82e9de0cb38b0c9224360f3ad139 guid: dd704932952b4b17d387e11ef2d37fa0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 23b767c936834d1b790a40ea00e26d64 guid: c476081fa12f9f7108b55678af3f095e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 968b47eba0189213d3a4cfabbadee54c guid: 553454077f46eceb73722395dcf8129e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 710313a81f77482d26012751c5d6592a guid: dacdd7a023513516c116ab2831c3aff2
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8342caa71b7edf46f906aa855aea4ef3 guid: 20626743e0b0558c0e3b1f4c0e5179b1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c92653458db092aae35564ef3edd6252 guid: f8b28d9106992150d6222ff1c1bba535
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6e3f60a883fb2f8249ce74acf2c14acd guid: 99ff299d0c04a6d1e9f26d255c735e91
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cdaa05d30f80a46dddcc25d674615153 guid: da275993950b77b3082446985d98640f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 95650874bc818949f578987590377532 guid: 35075b448fb387941cacf0fb12165d82
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9733080f2e9cef0f03c3d0ee1dad8983 guid: dc82acacffe816e980aac9d7779cf3f3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d1ab83ac4fb090597d227ff725dbb6f7 guid: 2eb3f7ce00d2c430d859a1f006582bf8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 745ed2f1262c74198123f00a889f2b22 guid: fde43986481bf508d64982b4fbc6a35f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 23879d36971922e903eddd9885892fb3 guid: d05f3483931ba5a3bfebe6c7343f2c4d
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 62febf55450b14dd5e6d76f19bbd702a guid: 74cd3d9b84dbd6b216191dbf37c5845c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1ce4ef1463f0ff2eb0b56e23d2871901 guid: 6823ed6086107ca4f495233e6708f828
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4804e01bf66b4037ae3257077b1fa612 guid: 4ba70f50c346129b8cf8f118433e0da6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b53fa697f1378a92419ab4cdf86f71f7 guid: 99fe0823461771ba8abb3c6e61dae90c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c0bdb6ec2e9b51a1de21189c1df0b82d guid: 454c18d6b54887e535354de71eb98fe1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 45586bcf2aec8da319b74e07858c2427 guid: 3d7d47405556a8929f76e79c7dace700
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 38fecf1cc6b371057e50349b5f3551cd guid: 8926a6ce8793322bced7c52845a47c63
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8a6e150eef26403510c814e0e93a2694 guid: c7797c6e47fccbcdc7d281c493424e81
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4c10ebb6213c7a7fa92a91ba5c9649ee guid: b9a4ec03145722e7ce6b47f2b91f49c3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e9a5598b8047e5073d8baa4c8df0c978 guid: ec3ebdd1336b661f347e4d8227ce059e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -18,12 +18,15 @@ export default {
if (!obj) { if (!obj) {
return; return;
} }
if (key === 'x' || key === 'y' || key === 'width' || key === 'height') { if (key === 'x' || key === 'y' || key === 'width' || key === 'height' || key === 'playbackRate' || key === 'initialTime') {
obj[key] = +value; obj[key] = +value;
} }
else if (key === 'src' || key === 'poster') { else if (key === 'src' || key === 'poster') {
obj[key] = value; obj[key] = value;
} }
else if (key === 'loop' || key === 'muted') {
obj[key] = value === 'true';
}
}, },
WXVideoPlay(id) { WXVideoPlay(id) {
const obj = getObject(id); const obj = getObject(id);
@ -40,10 +43,11 @@ export default {
obj[key]((e) => { obj[key]((e) => {
moduleHelper.send('OnVideoCallback', JSON.stringify({ moduleHelper.send('OnVideoCallback', JSON.stringify({
callbackId: id, callbackId: id,
errMsg: key, type: key,
position: e && e.position, position: e && e.position,
buffered: e && e.buffered, buffered: e && e.buffered,
duration: e && e.duration, duration: e && e.duration,
errMsg: e && e.errMsg,
})); }));
if (key === 'onError') { if (key === 'onError') {
GameGlobal.enableTransparentCanvas = false; GameGlobal.enableTransparentCanvas = false;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 828f84320fa56abfa00ee9a5c916cbb9 guid: d079293153de35f4d3cee022396e4a32
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d85c26bfbd9a3283f6bb30cceca5ea5e guid: a56ec47c10c5b69f977342f9bf4a7bb9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 498e07525985bb6ced0bd9306b09f6a4 guid: 4da22deafe5fe711aa4db5f8f8c4f398
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 73905f6b06e6cb50adcc24a126ed8b65 guid: 14027e864d0331cd655800adb403f0d3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 042f851fc2cd2b760f52c343668c5cc8 guid: cff895ddcc183d043ef98c3b7fd80bf6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b6e2f562aef79212d81c2ba7a7edd3ff guid: a1b3c22a28ccda09822880c424d6c1a8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c21e4f9445ab1354e004ee6806d36b1c guid: 784ebce45949e79cb081e0a6081ef917
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c4e3d01e4d70fba53c1b8add5d1d79d6 guid: 8146b23caa3d3a5baead991ac718ce14
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e336f4b63e6dfc217c3b2a4de7b8811b guid: 864abcde9adb0b8fdf8f81f425ef3688
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 961219c24017591be9f7387b32c99dda guid: 5a68450425884c6afc20226134a96ba6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1512252be1263bff0bad2706fd57721b guid: 7b5b1298aad92d5b31b135852feb8212
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5b2baee358014e8ac3e76cf8b8a2efda guid: b26b357a89cf7b8ac6638e6fee6b1abd
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 08c8874633248aebb094108db516d49f guid: c56db505b3356b998cd90f5550157e30
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

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,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0c3f625fe020655264dfb668d2f443af guid: f48a91a86ec0cc1b40cce5f05a9c5f04
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2dabfccb636244e46ed52391be317a18 guid: ac47a37796cd53dcbd42a6b8673c9955
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cee045e37475f34b21d4c1720ef6c0bc guid: ccaee81b17770f682b87fd94a7de4fc5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4487cdaffd527c46b8025027c25a7694 guid: 70071c6a452f3604546285549ca6c2c2
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 76041096891fdcca03223685726e2ae1 guid: 8844d6c45946ad02f69a27fb08d88114
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b2f5a26d8cab56bc37d9aa5a89adb5a0 guid: 61b06e896bcad40acf5f264d766589f3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2ad251d35a6ede2c53d28c11d65588c4 guid: 5b745519f78dd10dd0df6829ef031d7b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: cc705c8a016fee6d8985e8ba225ce371 guid: c6b42994dcb4c1c5fcfd13d48f7307ca
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5ba45b49351ab15aa5fc8e93e883fa8a guid: 61c9b28fbb0a7ae675f4c9572aa1a0c9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 063969bb60d3e53350ddc08fd88643cd guid: 852014ab82b46c1dcf740e4bd75445f6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2c6228df96c79548152450bfa2509794 guid: 1f64a6a1f4c1340eb9c20b2787da96e6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 22e790c7a5b3c7c256fb86627288ec0e guid: 7a469fd2551b92ab3b4f40f610d4551e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1464cee678f948a7423a81d6594634b5 guid: fd0a82975984a469b64acca04fa552d3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d9050cfc8dad50151ceb17d5fae97f24 guid: bea6e8ad86eab07944e00a1c234a9ba1
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

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