mirror of
https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git
synced 2026-04-22 01:35:56 +08:00
Auto-publish.
This commit is contained in:
parent
2cc9cdddf7
commit
2e14dd7359
@ -6,13 +6,7 @@ Removed - 删除功能/接口
|
||||
Fixed - 修复问题
|
||||
Others - 其他
|
||||
-->
|
||||
## v0.1.27 【普通更新】
|
||||
### Feature
|
||||
* 普通:新增 JS_Sound_GetPosition 方法用于获取音频播放位置
|
||||
* 普通:WebGL2变更为正式特性
|
||||
* 普通:支持小游戏试玩导出
|
||||
|
||||
## v0.1.26 【普通更新】
|
||||
## v0.1.26 【预发布】
|
||||
### Feature
|
||||
* 普通:增加禁止多点触控的配置
|
||||
### Fixed
|
||||
|
||||
8
Editor/BuildProfile.meta
Normal file
8
Editor/BuildProfile.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: DytLvSj8UC9CKob0XUy9Y3usKDmX8US1YgxYmBxa1iAZ/I8JbM5wZwE=
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Editor/BuildProfile/lib.meta
Normal file
8
Editor/BuildProfile/lib.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: XSwesi78AS28ymfR2HEhHpEBAC2DHupI1hIKP7HApjHRaZgGw+DTwWI=
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Editor/BuildProfile/lib/libwx-metal-cpp.bc
Normal file
BIN
Editor/BuildProfile/lib/libwx-metal-cpp.bc
Normal file
Binary file not shown.
7
Editor/BuildProfile/lib/libwx-metal-cpp.bc.meta
Normal file
7
Editor/BuildProfile/lib/libwx-metal-cpp.bc.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c113acfee35db6b5c61fd4a76596cfd3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
43
Editor/BuildProfile/lib/mtl_library.jslib
Normal file
43
Editor/BuildProfile/lib/mtl_library.jslib
Normal 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();
|
||||
}
|
||||
});
|
||||
7
Editor/BuildProfile/lib/mtl_library.jslib.meta
Normal file
7
Editor/BuildProfile/lib/mtl_library.jslib.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dda1926f3454e003333e8085a4f2c0fd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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" };
|
||||
}
|
||||
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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
|
||||
|
||||
@ -2,7 +2,7 @@ namespace WeChatWASM
|
||||
{
|
||||
public class WXPluginVersion
|
||||
{
|
||||
public static string pluginVersion = "202507110255"; // 这一行不要改他,导出的时候会自动替换
|
||||
public static string pluginVersion = "202507140816"; // 这一行不要改他,导出的时候会自动替换
|
||||
}
|
||||
|
||||
public class WXPluginConf
|
||||
|
||||
Binary file not shown.
@ -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>
|
||||
导出路径(绝对路径)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 175482d15b3210c9cf4596d45192bdc5
|
||||
guid: d05761f316f7eab715c19190699cc137
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -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.
Binary file not shown.
@ -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>
|
||||
是否有新版本
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aae7ade219d8625ffa4614041aed5481
|
||||
guid: 7a86865669cf8962db73b80475f73340
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
@ -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>
|
||||
是否有新版本
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b709df3edaee2bfff5b85590b02c6a35
|
||||
guid: 73f0f5fde7193ea9d6786ceb70926356
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -4017,6 +4017,12 @@ namespace WeChatWASM
|
||||
return WXSDKManagerHandler.Instance.CreateFeedbackButton(option);
|
||||
}
|
||||
|
||||
/// <returns></returns>
|
||||
public static WXMiniReportManager GetMiniReportManager(GetMiniReportManagerParam param)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetMiniReportManager(param);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [[LogManager](https://developers.weixin.qq.com/minigame/dev/api/base/debug/LogManager.html) wx.getLogManager(Object object)](https://developers.weixin.qq.com/minigame/dev/api/base/debug/wx.getLogManager.html)
|
||||
/// 需要基础库: `2.1.0`
|
||||
@ -4036,32 +4042,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`
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6020b3480b7fe68c95c5bb57ba4bd59f
|
||||
guid: cc4d1b8b74f6b789bf69837ad5038f26
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 292a94c992e4202768c4ad789b4cc0d5
|
||||
guid: b28d18fe3653a8e25ac449c4a0fdb829
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 135f382abe5b45dd75cd4760ce2af518
|
||||
guid: d71d0e419191d50c4f4246dc3f175c4a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 70ce09b789b4a4723e195f4b65d78444
|
||||
guid: 56038ece53f4e5154f42b605f8ad8265
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1fa97797aa272f69fad5ee1bdf22f38
|
||||
guid: 8fbb8cb050f1d51c6e1b8c8bbbfae92e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4f8ce3feb4ddc7cb222037cef7e4f49d
|
||||
guid: deb864223ae3b38f239ad96baa66741a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 02002844557a5ec0a6565937141b26ba
|
||||
guid: ba8bcbdf337ff1ae3c1f865cfc5af6fd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 680b45b182e28c36d39d521a89c394fc
|
||||
guid: 341ccee6bd5ea1368262130cfe2cdd7d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6826d9d562e04bb5821da619ce97df76
|
||||
guid: 3e6d080fb26f26e313055200b81987a1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2c6395b66bbffe6a3b8d2269b3a1c433
|
||||
guid: a451f26281aa58075dd3e2c5be40eb64
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aae3e99187291fb8685425b94ec3f835
|
||||
guid: 3881109c34f2288af3119c2361e95fce
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d40cbe438eb7e4c3e26becb6d9af2c43
|
||||
guid: 985a5b6d31328ec6286af88b0e08dde0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44434ae454477959c4119a5bb2c3d677
|
||||
guid: 517c5a4a636b59fb465ad3746f6d79fa
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b0022ab4dac852d0f3a82f64ee94cbee
|
||||
guid: f72887dc1c5502fe97f16437a7b22e68
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a298ba2ecb8760639da618de87521011
|
||||
guid: a8561a14922272193fceb73083b55089
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5507d5f3fbfd30e86b28251eccffa6dd
|
||||
guid: 78c27d261be00725aa316d249bab303c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec7e53fba783369583c006c9344f8e2e
|
||||
guid: c94ddbda62938c6bd7bb26fa0f5a3ac7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd7f4bf7911552e8b4bbbe5d0e4e3f8c
|
||||
guid: ed282a77c054cb2f7d74dccee31d5757
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7333c474af9a11edd8458b84deb92fd5
|
||||
guid: 2f0c759aeee67dc817b33efe17e4dbf8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7b235c5035011bff50d0ce207e799ce
|
||||
guid: 81b6a2237a8ed090a823e46aba5429a2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f5acc773911c032919ad2c43119eda8
|
||||
guid: 013efaac240c9c870caee20f0b91b204
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c199ada196b116bc7e6b68d80cd80247
|
||||
guid: 9a3e31086fc40694d9be4e613abd5ba4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8039d588e010ff5a14429ddcbd3bde09
|
||||
guid: 31b9f1cb6c3d81c38126ce6cc54c8c2f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5138da1e9c3f209559ba8a328cef3a0a
|
||||
guid: b6c74729cf6202d0144ea059f390605e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f3f8bfddef62c29eb286e39efb6696d8
|
||||
guid: 7336eb0001c727c3e3b9cd7e2086a0f2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24ed30bc07d602c075831eb11b45b8b9
|
||||
guid: 9897552876176d09797a5e8c00ddcaf1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8e370646f3168ba4e0872208f02e077b
|
||||
guid: 98824e5bed1dd43b80381ce5a9da65c6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c566d1cd478d50599b71122b079a32ca
|
||||
guid: 0de6bee0e26e9171a56b01db1f13be0b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97d8b7aa855a0c42454765c4834e68cf
|
||||
guid: becc5947cca074b8699d021822c9f6c3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a4266e7720ab0e7fe46ab7c737ba07a2
|
||||
guid: 295f541cdad40cb6a52a541a76856931
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6698d1f0dc92ed62fe4493aeede62ffb
|
||||
guid: ac225b18751a57f97a9870e43c6b0361
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8d122b7c2d620d9d9e654b0a2a14305
|
||||
guid: 7fed5fbe0ac7a1c55cdc3fa5fd4bb341
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 683d3fc35bcb70bf56ffca3c6099b1dc
|
||||
guid: f9e032304913041c4d857bd12c42ce05
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74df9313e7f74f76fb48ed7e0313877d
|
||||
guid: c5b7710cc2869b088680870540f6f142
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -23,7 +23,7 @@ function getClassObject(className, id) {
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function WX_OneWayNoFunction(functionName, ...params) {
|
||||
wx[functionName.replace(/^\w/, a => a.toLowerCase())](...params);
|
||||
wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ const onlyReadyResponse = [
|
||||
];
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
function WX_SyncFunction(functionName, ...params) {
|
||||
return wx[functionName.replace(/^\w/, a => a.toLowerCase())](...params);
|
||||
return wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
@ -42,13 +42,22 @@ function WX_ClassOneWayNoFunction(className, functionName, id, ...params) {
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
obj[functionName.replace(/^\w/, a => a.toLowerCase())](...params);
|
||||
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](...params);
|
||||
}
|
||||
function classFormatAndSend(id, callbackId, callbackName, callbackType, resType, res) {
|
||||
formatResponse(resType, res);
|
||||
moduleHelper.send(callbackName, classGetMsg(id, callbackId, callbackType, res));
|
||||
}
|
||||
function classGetMsg(id, callbackId, resType, res) {
|
||||
return JSON.stringify({
|
||||
id, callbackId, type: resType, res: JSON.stringify(res) || '',
|
||||
});
|
||||
}
|
||||
export default {
|
||||
WX_OneWayFunction(functionName, successType, failType, completeType, conf, callbackId) {
|
||||
const lowerFunctionName = functionName.replace(/^\w/, a => a.toLowerCase());
|
||||
const lowerFunctionName = functionName.replace(/^\w/, (a) => a.toLowerCase());
|
||||
const config = formatJsonStr(conf);
|
||||
|
||||
// specialJS
|
||||
if (lowerFunctionName === 'login') {
|
||||
if (!config.timeout) {
|
||||
delete config.timeout;
|
||||
@ -111,7 +120,7 @@ export default {
|
||||
moduleHelper.send(`_${functionName}Callback`, resStr);
|
||||
};
|
||||
onEventLists[functionName].push(callback);
|
||||
wx[functionName.replace(/^\w/, a => a.toLowerCase())](callback);
|
||||
wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
|
||||
},
|
||||
WX_OffEventRegister(functionName) {
|
||||
(onEventLists[functionName] || []).forEach((v) => {
|
||||
@ -225,7 +234,7 @@ export default {
|
||||
},
|
||||
WX_SyncFunction_t(functionName, returnType) {
|
||||
const res = WX_SyncFunction(functionName);
|
||||
if (onlyReadyResponse.includes(functionName.replace(/^\w/, a => a.toLowerCase()))) {
|
||||
if (onlyReadyResponse.includes(functionName.replace(/^\w/, (a) => a.toLowerCase()))) {
|
||||
formatResponse(returnType, JSON.parse(JSON.stringify(res)));
|
||||
return JSON.stringify(res);
|
||||
}
|
||||
@ -262,10 +271,10 @@ 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())]({
|
||||
const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())]({
|
||||
...config,
|
||||
success(res) {
|
||||
formatResponse(successType, res);
|
||||
@ -293,7 +302,7 @@ export default {
|
||||
return callbackId;
|
||||
},
|
||||
WX_ClassFunction(functionName, returnType, option) {
|
||||
const obj = wx[functionName.replace(/^\w/, a => a.toLowerCase())](formatJsonStr(option));
|
||||
const obj = wx[functionName.replace(/^\w/, (a) => a.toLowerCase())](formatJsonStr(option));
|
||||
const id = uid();
|
||||
if (!ClassLists[returnType]) {
|
||||
ClassLists[returnType] = {};
|
||||
@ -347,10 +356,10 @@ export default {
|
||||
ClassOnEventLists[className + functionName][id + eventName].push(callback);
|
||||
// WXVideoDecoder OnEvent 不规范 特殊处理
|
||||
if (className === 'WXVideoDecoder') {
|
||||
obj[functionName.replace(/^\w/, a => a.toLowerCase())](eventName, callback);
|
||||
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](eventName, callback);
|
||||
}
|
||||
else {
|
||||
obj[functionName.replace(/^\w/, a => a.toLowerCase())](callback);
|
||||
obj[functionName.replace(/^\w/, (a) => a.toLowerCase())](callback);
|
||||
}
|
||||
},
|
||||
WX_ClassOffEventFunction(className, functionName, id, eventName) {
|
||||
@ -389,7 +398,7 @@ export default {
|
||||
if (!obj) {
|
||||
return JSON.stringify(formatResponse(returnType));
|
||||
}
|
||||
const res = obj[functionName.replace(/^\w/, a => a.toLowerCase())]();
|
||||
const res = obj[functionName.replace(/^\w/, (a) => a.toLowerCase())]();
|
||||
return JSON.stringify(formatResponse(returnType, res, id));
|
||||
},
|
||||
WX_ClassOneWayNoFunction_vt(className, functionName, id, param1) {
|
||||
@ -399,4 +408,41 @@ 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) {
|
||||
|
||||
const obj = getClassObject(className, id);
|
||||
if (!obj) {
|
||||
return;
|
||||
}
|
||||
const lowerFunctionName = functionName.replace(/^\w/, (a) => a.toLowerCase());
|
||||
const config = formatJsonStr(conf);
|
||||
|
||||
if (usePromise) {
|
||||
obj[lowerFunctionName]({
|
||||
...config,
|
||||
}).then((res) => {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'success', successType, res);
|
||||
})
|
||||
.catch((res) => {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'fail', failType, res);
|
||||
})
|
||||
.finally((res) => {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'complete', completeType, res);
|
||||
});
|
||||
}
|
||||
else {
|
||||
obj[lowerFunctionName]({
|
||||
...config,
|
||||
success(res) {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'success', successType, res);
|
||||
},
|
||||
fail(res) {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'fail', failType, res);
|
||||
},
|
||||
complete(res) {
|
||||
classFormatAndSend(id, callbackId, `_${className}${functionName}Callback`, 'complete', completeType, res);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6eb9abab67c11c007604f7605df37b2
|
||||
guid: 77075f1f6be29390ad96049c600c9c76
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 97e07ab57a52032bea6ed2cda7479eff
|
||||
guid: 9d39dc297d8ced46cf02e068358ee9ab
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 852498371f768a0722b81067f60da81e
|
||||
guid: c0136cd6bc33d677eae10dc16d78a091
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d629203579f9b42fab4b0d19ba3c933e
|
||||
guid: 155406e200e7b33f530fa7b85d982b90
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 459e3ae21579eb09cfbd6a86f0ce6f78
|
||||
guid: cc03a8fd176bb2a8e47d9d18a1059042
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4954b4520535f569d680a0eb0c57178f
|
||||
guid: 704924d674e1cdac74afb50b8cb992f8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26a6159a4d86c35b601046f80669b646
|
||||
guid: d57072523a8b245227d3967783913f07
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fe9708c018b010cd00178cc14b3ea179
|
||||
guid: 8e442c449a8082f6caccc458f06b4400
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 151fe45cbdea66b42d6e73c88b84a83d
|
||||
guid: 9e73fb2fc0813e8df1bd5b57530a58da
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b8bafdc7c90f8e06c430d13397165f9
|
||||
guid: 34cb285304fcc2832590ba6ea2de5ddb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6765c0064f197190a3d702e5ab47ffae
|
||||
guid: 8facd3d36454591362c811486b15aab8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1d2968520cb04052c7a885e706cc2f2
|
||||
guid: 44ea1ecc34e3808c78369d468f09c431
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bd209852ddcf3ed921f4d2f27a01aa43
|
||||
guid: 035e4590956e35012f99265f9a32dacc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e5096a2c0aec5864cb5ad0e326f9b385
|
||||
guid: a5de2c471507f0035754c228e684e409
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
]
|
||||
},
|
||||
"Layout": {
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.15",
|
||||
"provider": "wx7a727ff7d940bb3f",
|
||||
"contexts": [
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e527966302091cb1852ecf4ad7fd9587
|
||||
guid: cb1016ec8ed093bea9655fa15dfec7bc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7746ae0f914d92afaa5212dcebbafc53
|
||||
guid: 937ba27e5e2a07db361ed436e9a9ead4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d3af37e5f04918112f9147a3a396f37
|
||||
guid: 08f8f3b4155cfa5c0dd68244f9f92b32
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7eaabf92ca3e4fed895610eb26de5bc3
|
||||
guid: 152b1a3734b457128462f2cc7f89146b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a62750a7ccf2d4960b68c566f6917904
|
||||
guid: 4fceb99f21e49a102511b9dfc3702361
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -56,7 +56,6 @@ function LayoutWithTplAndStyle(xml, style) {
|
||||
Layout.clear();
|
||||
Layout.init(xml, style);
|
||||
Layout.layout(sharedContext);
|
||||
console.log(Layout);
|
||||
}
|
||||
// 仅仅渲染一些提示,比如数据加载中、当前无授权等
|
||||
function renderTips(tips = '') {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bb70b34a677edad13c83fab53c9142c7
|
||||
guid: 2921db18d9abb6eb0f94d3326f7406d0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc326a3ec7a53d3008e0358c0b60b983
|
||||
guid: 9925b4ee02d16560f68848bb33e9a7ba
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d6cb0bcc93e2bb8a43b95b6d89ff056e
|
||||
guid: b3a7eaefd76308277dd55f1efeb2099d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3f7281cd074ea6870006783eb08c1d08
|
||||
guid: ec10ef960c693a71230ef03ca3567fd3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a45fc426d6a87902a65c31bbc0e7068
|
||||
guid: fd3fc633c2dd6fc13c8bee1c07472da2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd8d51ebb538aa496c2455bed1a0e415
|
||||
guid: e17ce548e681c6af87b3222aa7cc87bf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6b9fd146d31d56f6426638c6f04ffbb
|
||||
guid: 64cd2ef2fca5bc8c3e748d26eaca1f07
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6371a4d33bb066ec4059ba04f070522c
|
||||
guid: aef1a76c0b80672d46fb10990e582543
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4c0cae15f7ab86093b657750dd9996d0
|
||||
guid: 854f447148c0c86b70516c21a09328fd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4830d278bb80e46b47fe5cf680608180
|
||||
guid: d77b9a484caed9f61a098b7ae2ce5254
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 93aa33c6c217bb6def26e982e0940fa2
|
||||
guid: 1d7e5dece9cfe2dde9627cfd0781084d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb05506e506aa5c70824bc7e524048c0
|
||||
guid: ebbbcab2286fd13e110d52dc81a700df
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -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: {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3c3aec3ae9ddd659e157b6d189615800
|
||||
guid: ac5e56c38e5bc566e27dcefce9cd37e5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2037d006af38ce88da856dd0e9549d7b
|
||||
guid: 840185574436b898fa3cb7f9ea4edb6b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -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>';
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c410b9bded8995187e18ac3fd398aa20
|
||||
guid: 3ccb47d3ecc13ead28ccd488991ea9f5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user