Auto-publish.

This commit is contained in:
yacent 2025-08-26 12:30:41 +08:00
parent 39e40b33bf
commit 7a7fdee7ef
168 changed files with 5626 additions and 1214 deletions

7
.DS_Store.meta Normal file
View File

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

View File

@ -6,22 +6,7 @@ Removed - 删除功能/接口
Fixed - 修复问题 Fixed - 修复问题
Others - 其他 Others - 其他
--> -->
## 2025-8-12 v0.1.28 【重要更新】 ## v0.1.26 【普通更新】
### Feature
* 普通PageManager.Show支持Promise
* 普通:性能工具实时数据流支持
* 普通适配插件版本升至1.2.79
### Fixed
* 重要修复Touch时进行IOS音频resume造成的卡顿问题
* 重要UnityWebRequest、AssetBundle、Addressables等加载已缓存资源时读文件报错导致游戏异常
## 2025-7-10 v0.1.27 【普通更新】
### Feature
* 普通:新增 JS_Sound_GetPosition 方法用于获取音频播放位置
* 普通WebGL2变更为正式特性
* 普通:支持小游戏试玩导出
## 2025-5-8 v0.1.26 【普通更新】
### Feature ### Feature
* 普通:增加禁止多点触控的配置 * 普通:增加禁止多点触控的配置
### Fixed ### Fixed

7
Editor/.DS_Store.meta Normal file
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: DytLvSj8UC9CKob0XUy9Y3usKDmX8US1YgxYmBxa1iAZ/I8JbM5wZwE= guid: cccbd1d680cfe34fa1fef9e4875e5a12
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: XSwesi78AS28ymfR2HEhHpEBAC2DHupI1hIKP7HApjHRaZgGw+DTwWI= guid: cccbd1d680cfe34fa1fef9e3375e5a12
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c113acfee35db6b5c61fd4a76596cfd3 guid: 0b285665e0e99f23996af7366992c74a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -2,26 +2,21 @@ mergeInto(LibraryManager.library, {
// 定义供 C/C++ 调用的 JS 函数 // 定义供 C/C++ 调用的 JS 函数
js_batchRender_malloc: function(data, size, isSync) { js_batchRender_malloc: function(data, size, isSync) {
// 直接从 WASM 内存创建视图(零拷贝) // 直接从 WASM 内存创建视图(零拷贝)
const binaryData = new Uint8Array(Module.HEAPU8.buffer, data, size); const targetBuffer = new Uint8Array(Module.HEAPU8.buffer, data, size);
// 转换为标准 ArrayBuffer如果需要复制
const targetBuffer =
binaryData.buffer.slice(binaryData.byteOffset, binaryData.byteOffset + binaryData.byteLength);
//console.log("processBinaryData invoke"); //console.log("processBinaryData invoke");
const extBuffer = new ArrayBuffer(1); 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){ if(!isSync){
mtl.batchRenderAsync(merged.buffer, extBuffer); mtl.batchRenderAsync(targetBuffer, extBuffer);
return null; return null;
} }
const result = mtl.batchRender(merged.buffer, extBuffer).buffer; const response = mtl.batchRender(targetBuffer, extBuffer);
if(result.byteLength == 0){ if (!response) {
return null;; return null;
}
const result = response.buffer;
if(!result || result.byteLength == 0){
return null;
} }
// 申请内存空间,后续在cpp wasm部分使用记得释放 // 申请内存空间,后续在cpp wasm部分使用记得释放
const ptr = Module._malloc(result.byteLength); const ptr = Module._malloc(result.byteLength);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dda1926f3454e003333e8085a4f2c0fd guid: 2571a9ee13a2e6a560927f0346f1849e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

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

View File

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

View File

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

7
Editor/Node/node_modules/.DS_Store.meta generated vendored Normal file
View File

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

View File

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

7
Editor/Node/node_modules/binaryen/.DS_Store.meta generated vendored Normal file
View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 688f385fb02274584bc0da25fc717541 guid: 72db98ce23892438085944429a2f0f1e
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 7f21f78b4cc234191b76cd464483218a guid: 0786375919a5f4b39a2842d398bab691
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

7
Editor/Node/node_modules/binaryen/bin/.DS_Store.meta generated vendored Normal file
View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 87afef55b8ecb4102a02702ac98a8c08 guid: a687be9fecc0c4635a0198f4c84c5a7a
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 15b1d1d2687c240e79f3326305a8e34d guid: 59195b600f5474a34ab0de959545786a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f2f9e284d496f4f0da239b534fc0962e guid: 945d329c042b5422590297f9a668573b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c36b18db4fca44e7999111a49563794c guid: 5c728f27cb29c4a7ab957bec87aee79b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 18049f8d0a7b340e089d8f6a56329852 guid: e116238b593ee4f118e080fc2e1be1d0
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 717be45d5d44c471e96a22dbcd2aaddd guid: 95f171f78f3854726ba37852e7da8ace
TextScriptImporter: TextScriptImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

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

View File

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

View File

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

View File

@ -71,9 +71,7 @@ namespace WeChatWASM
BUILD_WEBGL_FAILED = 2, BUILD_WEBGL_FAILED = 2,
} }
public static WXEditorScriptObject config => isPlayableBuild ? WXPlayableConvertCore.GetFakeScriptObject() : UnityUtil.GetEditorConf(); public static WXEditorScriptObject config => UnityUtil.GetEditorConf();
public static string defaultTemplateDir => isPlayableBuild ? "playable-default" : "wechat-default";
public static string webglDir = "webgl"; // 导出的webgl目录 public static string webglDir = "webgl"; // 导出的webgl目录
public static string miniGameDir = "minigame"; // 生成小游戏的目录 public static string miniGameDir = "minigame"; // 生成小游戏的目录
public static string audioDir = "Assets"; // 音频资源目录 public static string audioDir = "Assets"; // 音频资源目录
@ -82,10 +80,6 @@ namespace WeChatWASM
public static string codeMd5 = string.Empty; public static string codeMd5 = string.Empty;
public static string dataMd5 = string.Empty; public static string dataMd5 = string.Empty;
public static string defaultImgSrc = "Assets/WX-WASM-SDK-V2/Runtime/wechat-default/images/background.jpg"; public static string defaultImgSrc = "Assets/WX-WASM-SDK-V2/Runtime/wechat-default/images/background.jpg";
/// <summary>
/// 是否在构建试玩,构建开始前修改值,构建结束后恢复值
/// </summary>
public static bool isPlayableBuild = false;
private static bool lastBrotliType = false; private static bool lastBrotliType = false;
public static bool UseIL2CPP public static bool UseIL2CPP
@ -99,6 +93,14 @@ namespace WeChatWASM
#endif #endif
} }
} }
// 用于replaceRules判断是否需要注入相关的修改
public static bool UseEmscriptenGLX
{
get
{
return config.CompileOptions.enableEmscriptenGLX;
}
}
// 是否使用 iOS Metal 渲染 // 是否使用 iOS Metal 渲染
public static bool UseiOSMetal public static bool UseiOSMetal
{ {
@ -107,69 +109,39 @@ namespace WeChatWASM
return config.CompileOptions.enableiOSMetal; return config.CompileOptions.enableiOSMetal;
} }
} }
// public static void SetPlayableEnabled(bool enabled) // 可以调用这个来集成
// { public static WXExportError DoExport(bool buildWebGL = true)
// isPlayableBuild = enabled;
// }
/// <summary>
/// 导出前的初始配置
/// 小游戏模式和试玩模式都会使用这个函数,如果要在这个函数加新方法,建议都以不兼容试玩模式看待
/// </summary>
public static void PreInit()
{ {
LifeCycleEvent.Init();
Emit(LifeCycle.beforeExport);
if (!CheckSDK())
{
Debug.LogError("若游戏曾使用旧版本微信SDK需删除 Assets/WX-WASM-SDK 文件夹后再导入最新工具包。");
return WXExportError.BUILD_WEBGL_FAILED;
}
if (!CheckBuildTemplate())
{
Debug.LogError("因构建模板检查失败终止导出。");
return WXExportError.BUILD_WEBGL_FAILED;
}
if (CheckInvalidPerfIntegration())
{
Debug.LogError("性能分析工具只能用于Development Build, 终止导出! ");
return WXExportError.BUILD_WEBGL_FAILED;
}
CheckBuildTarget(); CheckBuildTarget();
Init(); Init();
// 可能有顺序要求?如果没要求,可挪到此函数外
if (!isPlayableBuild)
{
ProcessWxPerfBinaries(); ProcessWxPerfBinaries();
} // emscriptenglx的相关特性
// iOS metal 的相关特性 ProcessWxEmscriptenGLXBinaries();
ProcessWxiOSMetalBinaries();
MakeEnvForLuaAdaptor(); MakeEnvForLuaAdaptor();
// JSLib // JSLib
SettingWXTextureMinJSLib(); SettingWXTextureMinJSLib();
UpdateGraphicAPI(); UpdateGraphicAPI();
EditorUtility.SetDirty(config); EditorUtility.SetDirty(config);
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
}
public static WXExportError PreCheck()
{
if (!CheckSDK())
{
Debug.LogError("若游戏曾使用旧版本微信SDK需删除 Assets/WX-WASM-SDK 文件夹后再导入最新工具包。");
return WXExportError.BUILD_WEBGL_FAILED;
}
if (!isPlayableBuild && !CheckBuildTemplate())
{
Debug.LogError("因构建模板检查失败终止导出。");
return WXExportError.BUILD_WEBGL_FAILED;
}
if (!isPlayableBuild && CheckInvalidPerfIntegration())
{
Debug.LogError("性能分析工具只能用于Development Build, 终止导出!");
return WXExportError.BUILD_WEBGL_FAILED;
}
dynamic config = isPlayableBuild ? UnityUtil.GetPlayableEditorConf() : UnityUtil.GetEditorConf();
if (config.ProjectConf.relativeDST == string.Empty)
{
Debug.LogError("请先配置游戏导出路径");
return WXExportError.BUILD_WEBGL_FAILED;
}
return WXExportError.SUCCEED;
}
// 可以调用这个来集成
public static WXExportError DoExport(bool buildWebGL = true)
{
LifeCycleEvent.Init();
Emit(LifeCycle.beforeExport);
var preCheckResult = PreCheck();
if (preCheckResult != WXExportError.SUCCEED)
{
return preCheckResult;
}
PreInit();
// 记录上次导出的brotliType // 记录上次导出的brotliType
{ {
@ -187,6 +159,12 @@ namespace WeChatWASM
} }
} }
if (config.ProjectConf.DST == string.Empty)
{
Debug.LogError("请先配置游戏导出路径");
return WXExportError.BUILD_WEBGL_FAILED;
}
else
{ {
// 仅删除StreamingAssets目录 // 仅删除StreamingAssets目录
if (config.CompileOptions.DeleteStreamingAssets) if (config.CompileOptions.DeleteStreamingAssets)
@ -371,6 +349,59 @@ namespace WeChatWASM
AssetDatabase.Refresh(); AssetDatabase.Refresh();
} }
private static void ProcessWxEmscriptenGLXBinaries()
{
string[] glLibs;
string DS = WXAssetsTextTools.DS;
if (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package)
{
glLibs = new string[]
{
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}libemscriptenglx.a",
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}libemscriptenglx_2021.a",
};
}
else
{
string glLibRootDir = $"Assets{DS}WX-WASM-SDK-V2{DS}Runtime{DS}Plugins{DS}";
// 下方顺序不要变动
glLibs = new string[]
{
$"{glLibRootDir}libemscriptenglx.a",
$"{glLibRootDir}libemscriptenglx_2021.a",
};
}
{
// unity2022, tuanjie lib引入
bool showEnableGLX2022Plugin = config.CompileOptions.enableEmscriptenGLX && IsCompatibleWithUnity202203OrNewer();
var glx2022Importer = AssetImporter.GetAtPath(glLibs[0]) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
glx2022Importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, showEnableGLX2022Plugin);
#else
glx2022Importer.SetCompatibleWithPlatform(BuildTarget.WebGL, showEnableGLX2022Plugin);
#endif
SetPluginCompatibilityByModifyingMetadataFile(glLibs[0], showEnableGLX2022Plugin);
}
{
// unity2021 lib引入
bool showEnableGLX2021Plugin = config.CompileOptions.enableEmscriptenGLX && IsCompatibleWithUnity202102To202203();
var glx2021Importer = AssetImporter.GetAtPath(glLibs[1]) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
glx2021Importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, showEnableGLX2021Plugin);
#else
glx2021Importer.SetCompatibleWithPlatform(BuildTarget.WebGL, showEnableGLX2021Plugin);
#endif
SetPluginCompatibilityByModifyingMetadataFile(glLibs[1], showEnableGLX2021Plugin);
}
AssetDatabase.Refresh();
}
/** /**
* Lua Adaptor Settings. * Lua Adaptor Settings.
*/ */
@ -411,41 +442,6 @@ 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;
@ -569,20 +565,6 @@ 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);
// 启用 iOS Metal 渲染
if (UseiOSMetal)
{
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
{
if (config.CompileOptions.Webgl2) if (config.CompileOptions.Webgl2)
{ {
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3 }); PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES3 });
@ -591,7 +573,6 @@ namespace WeChatWASM
{ {
PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES2 }); PlayerSettings.SetGraphicsAPIs(BuildTarget.WeixinMiniGame, new GraphicsDeviceType[] { GraphicsDeviceType.OpenGLES2 });
} }
}
#else #else
PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false); PlayerSettings.SetUseDefaultGraphicsAPIs(BuildTarget.WebGL, false);
if (config.CompileOptions.Webgl2) if (config.CompileOptions.Webgl2)
@ -656,7 +637,7 @@ namespace WeChatWASM
private static bool CheckBuildTemplate() private static bool CheckBuildTemplate()
{ {
string[] res = BuildTemplate.CheckCustomCoverBaseConflict( string[] res = BuildTemplate.CheckCustomCoverBaseConflict(
Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir), Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default"),
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"), Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template"),
new string[] { @"\.(js|ts|json)$" } new string[] { @"\.(js|ts|json)$" }
); );
@ -880,22 +861,6 @@ namespace WeChatWASM
} }
} }
{
Rule[] rules =
{
new Rule()
{
old = "if (GameGlobal.unityNamespace.enableProfileStats)",
newStr = "if (GameGlobal.unityNamespace.enableProfileStats || (typeof GameGlobal.manager.getWXAppCheatMonitor === 'function' && GameGlobal.manager.getWXAppCheatMonitor().shouldForceShowPerfMonitor()))"
}
};
foreach (var rule in rules)
{
text = text.Replace(rule.old, rule.newStr);
}
}
File.WriteAllText(targetPath, text, new UTF8Encoding(false)); File.WriteAllText(targetPath, text, new UTF8Encoding(false));
UnityEngine.Debug.LogFormat("[Converter] adapt framework done! "); UnityEngine.Debug.LogFormat("[Converter] adapt framework done! ");
@ -907,12 +872,7 @@ namespace WeChatWASM
PlayerSettings.WeixinMiniGame.emscriptenArgs = string.Empty; PlayerSettings.WeixinMiniGame.emscriptenArgs = string.Empty;
if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER")) if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER"))
{ {
PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_main,_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end"; PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_main,_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end -s ERROR_ON_UNDEFINED_SYMBOLS=0";
if (config.CompileOptions.enablePerfAnalysis)
{
PlayerSettings.WeixinMiniGame.emscriptenArgs += ",_WxPerfFrameIntervalCallback";
}
PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s ERROR_ON_UNDEFINED_SYMBOLS=0";
} }
#else #else
@ -920,10 +880,6 @@ namespace WeChatWASM
if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER")) if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER"))
{ {
PlayerSettings.WebGL.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end"; PlayerSettings.WebGL.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end";
if (config.CompileOptions.enablePerfAnalysis)
{
PlayerSettings.WebGL.emscriptenArgs += ",_WxPerfFrameIntervalCallback";
}
#if UNITY_2021_2_5 #if UNITY_2021_2_5
PlayerSettings.WebGL.emscriptenArgs += ",_main"; PlayerSettings.WebGL.emscriptenArgs += ",_main";
#endif #endif
@ -1270,11 +1226,8 @@ namespace WeChatWASM
} }
public static void convertDataPackageJS() public static void convertDataPackageJS()
{
if (!isPlayableBuild)
{ {
checkNeedRmovePackageParallelPreload(); checkNeedRmovePackageParallelPreload();
}
var loadDataFromCdn = config.ProjectConf.assetLoadType == 0; var loadDataFromCdn = config.ProjectConf.assetLoadType == 0;
Rule[] rules = Rule[] rules =
@ -1393,10 +1346,9 @@ namespace WeChatWASM
RemoveOldAssetPackage(Path.Combine(config.ProjectConf.DST, webglDir)); RemoveOldAssetPackage(Path.Combine(config.ProjectConf.DST, webglDir));
RemoveOldAssetPackage(Path.Combine(config.ProjectConf.DST, webglDir + "-min")); RemoveOldAssetPackage(Path.Combine(config.ProjectConf.DST, webglDir + "-min"));
var buildTemplate = new BuildTemplate( var buildTemplate = new BuildTemplate(
Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir), Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default"),
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
@ -1404,15 +1356,12 @@ namespace WeChatWASM
if (File.Exists(symbolPath)) if (File.Exists(symbolPath))
{ {
File.Copy(symbolPath, Path.Combine(config.ProjectConf.DST, miniGameDir, "webgl.wasm.symbols.unityweb"), true); File.Copy(symbolPath, Path.Combine(config.ProjectConf.DST, miniGameDir, "webgl.wasm.symbols.unityweb"), true);
// gen symbols.br
Brotlib("webgl.wasm.symbols.unityweb.br", symbolPath, Path.Combine(config.ProjectConf.DST, miniGameDir, "webgl.wasm.symbols.unityweb.br"));
} }
var info = new FileInfo(dataPath); var info = new FileInfo(dataPath);
dataFileSize = info.Length.ToString(); dataFileSize = info.Length.ToString();
UnityEngine.Debug.LogFormat("[Converter] that to genarate md5 and copy files ended"); UnityEngine.Debug.LogFormat("[Converter] that to genarate md5 and copy files ended");
// 若APPID为快适配小游戏示例则插入预览盒子 if (config.ProjectConf.Appid == "wx7c792ca878775717") // 快适配小游戏示例
if (config.ProjectConf.Appid == "wx7c792ca878775717")
{ {
InsertPreviewCode(); InsertPreviewCode();
} }
@ -1521,9 +1470,14 @@ namespace WeChatWASM
" } else {\n" + " } else {\n" +
" this._send = GameGlobal.Module.SendMessage;\n" + " this._send = GameGlobal.Module.SendMessage;\n" +
" }", " }",
},
new Rule()
{
old = "3.5.1", // project.config.json 转换插件 hardcode
newStr = "latest",
} }
}; };
string[] files = { "game.js", "game.json", "unity-sdk/module-helper.js" }; string[] files = { "game.js", "game.json", "unity-sdk/module-helper.js", "project.config.json" };
ReplaceFileContent(files, rules); ReplaceFileContent(files, rules);
Debug.LogWarning("[WeChat Preview] InsertPreviewCode End"); Debug.LogWarning("[WeChat Preview] InsertPreviewCode End");
} }
@ -1535,7 +1489,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;
@ -1625,8 +1579,7 @@ namespace WeChatWASM
writer.PrettyPrint = true; writer.PrettyPrint = true;
// 将 game.json 里面关系链相关的配置删除 // 将 game.json 里面关系链相关的配置删除
// 试玩 game.json 中不含其他配置 if (!config.SDKOptions.UseFriendRelation)
if (!config.SDKOptions.UseFriendRelation && gameJson.ContainsKey("openDataContext") && gameJson.ContainsKey("plugins"))
{ {
gameJson.Remove("openDataContext"); gameJson.Remove("openDataContext");
gameJson["plugins"].Remove("Layout"); gameJson["plugins"].Remove("Layout");
@ -1637,7 +1590,7 @@ namespace WeChatWASM
Directory.Delete(openDataDir, true); Directory.Delete(openDataDir, true);
} }
if (!config.SDKOptions.UseMiniGameChat && gameJson.ContainsKey("plugins")) if (!config.SDKOptions.UseMiniGameChat)
{ {
gameJson["plugins"].Remove("MiniGameChat"); gameJson["plugins"].Remove("MiniGameChat");
UnityEngine.Debug.Log(gameJson["plugins"]); UnityEngine.Debug.Log(gameJson["plugins"]);
@ -1724,20 +1677,17 @@ namespace WeChatWASM
{ {
dst = Path.Combine(config.ProjectConf.DST, miniGameDir); dst = Path.Combine(config.ProjectConf.DST, miniGameDir);
} }
string content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir, "unity-sdk", "index.js"), Encoding.UTF8); string content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js"), Encoding.UTF8);
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) content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "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);
File.WriteAllText(Path.Combine(dst, "unity-sdk", "storage.js"), content, Encoding.UTF8); File.WriteAllText(Path.Combine(dst, "unity-sdk", "storage.js"), content, Encoding.UTF8);
}
// 修改纹理dxt // 修改纹理dxt
// content = File.ReadAllText(Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "texture.js"), Encoding.UTF8); // content = File.ReadAllText(Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Runtime", "wechat-default", "unity-sdk", "texture.js"), Encoding.UTF8);
content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", defaultTemplateDir, "unity-sdk", "texture.js"), Encoding.UTF8); content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "texture.js"), Encoding.UTF8);
File.WriteAllText(Path.Combine(dst, "unity-sdk", "texture.js"), content, Encoding.UTF8); File.WriteAllText(Path.Combine(dst, "unity-sdk", "texture.js"), content, Encoding.UTF8);
} }
@ -1954,15 +1904,14 @@ namespace WeChatWASM
UnityEngine.Debug.LogFormat("[Converter] Starting to modify configs"); UnityEngine.Debug.LogFormat("[Converter] Starting to modify configs");
var PRELOAD_LIST = GetPreloadList(config.ProjectConf.preloadFiles); var PRELOAD_LIST = GetPreloadList(config.ProjectConf.preloadFiles);
// 试玩不存在封面图 var imgSrc = HandleLoadingImage();
var imgSrc = isPlayableBuild ? "" : HandleLoadingImage();
var bundlePathIdentifierStr = GetArrayString(config.ProjectConf.bundlePathIdentifier); var bundlePathIdentifierStr = GetArrayString(config.ProjectConf.bundlePathIdentifier);
var excludeFileExtensionsStr = GetArrayString(config.ProjectConf.bundleExcludeExtensions); var excludeFileExtensionsStr = GetArrayString(config.ProjectConf.bundleExcludeExtensions);
var screenOrientation = new List<string>() { "portrait", "landscape", "landscapeLeft", "landscapeRight" }[(int)config.ProjectConf.Orientation]; var screenOrientation = new List<string>() { "portrait", "landscape", "landscapeLeft", "landscapeRight" }[(int)config.ProjectConf.Orientation];
// 试玩不支持系统字体
var customUnicodeRange = isPlayableBuild ? "[]" : GetCustomUnicodeRange(config.FontOptions.CustomUnicode); var customUnicodeRange = GetCustomUnicodeRange(config.FontOptions.CustomUnicode);
Debug.Log("[Converter] customUnicodeRange: " + customUnicodeRange); Debug.Log("[Converter] customUnicodeRange: " + customUnicodeRange);
var boolConfigInfo = GenerateBootInfo(); var boolConfigInfo = GenerateBootInfo();
@ -1983,7 +1932,7 @@ namespace WeChatWASM
config.ProjectConf.bundleHashLength.ToString(), config.ProjectConf.bundleHashLength.ToString(),
bundlePathIdentifierStr, bundlePathIdentifierStr,
excludeFileExtensionsStr, excludeFileExtensionsStr,
config.CompileOptions.enableiOSMetal ? "5" : (config.CompileOptions.Webgl2 ? "2" : "1"), config.CompileOptions.Webgl2 ? "2" : "1",
Application.unityVersion, Application.unityVersion,
WXExtEnvDef.pluginVersion, WXExtEnvDef.pluginVersion,
config.ProjectConf.dataFileSubPrefix, config.ProjectConf.dataFileSubPrefix,
@ -2032,15 +1981,13 @@ namespace WeChatWASM
config.ProjectConf.MemorySize.ToString(), config.ProjectConf.MemorySize.ToString(),
config.SDKOptions.disableMultiTouch ? "true" : "false", config.SDKOptions.disableMultiTouch ? "true" : "false",
// Perfstream暂时设为false // Perfstream暂时设为false
"false" "false",
config.CompileOptions.enableEmscriptenGLX ? "true" : "false",
config.CompileOptions.enableiOSMetal ? "true" : "false"
}); });
List<Rule> replaceList = new List<Rule>(replaceArrayList); List<Rule> replaceList = new List<Rule>(replaceArrayList);
List<string> files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js", "unity-sdk/font/index.js" }; List<string> files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js", "unity-sdk/font/index.js" };
if (isPlayableBuild)
{
files = new List<string> { "game.js", "game.json", "project.config.json", "unity-namespace.js", "check-version.js" };
}
if (WXRuntimeExtEnvDef.IsPreviewing) if (WXRuntimeExtEnvDef.IsPreviewing)
{ {

View File

@ -54,11 +54,15 @@ 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();
@ -183,8 +187,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("EmscriptenGLX", "EmscriptenGLX(?)", "是否使用EmscriptenGLX渲染方案");
// this.formCheckbox("iOSMetal", "iOSMetal(?)", "是否使用iOSMetal渲染方案需要开启iOS高性能+模式有助于提升运行性能降低iOS功耗"); // 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");
@ -391,6 +396,7 @@ 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())
@ -432,7 +438,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", config.ProjectConf.relativeDST); this.setData("dst", _dstCache);
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);
@ -449,6 +455,7 @@ namespace WeChatWASM
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("iOSMetal", config.CompileOptions.enableiOSMetal);
this.setData("EmscriptenGLX", config.CompileOptions.enableEmscriptenGLX);
this.setData("fbslim", config.CompileOptions.fbslim); this.setData("fbslim", config.CompileOptions.fbslim);
this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation); this.setData("useFriendRelation", config.SDKOptions.UseFriendRelation);
this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat); this.setData("useMiniGameChat", config.SDKOptions.UseMiniGameChat);
@ -510,8 +517,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");
config.ProjectConf.relativeDST = this.getDataInput("dst"); _dstCache = this.getDataInput("dst");
config.ProjectConf.DST = GetAbsolutePath(config.ProjectConf.relativeDST); config.ProjectConf.DST = GetAbsolutePath(_dstCache);
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");
@ -528,6 +535,7 @@ namespace WeChatWASM
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.enableiOSMetal = this.getDataCheckbox("iOSMetal");
config.CompileOptions.enableEmscriptenGLX = this.getDataCheckbox("EmscriptenGLX");
config.CompileOptions.fbslim = this.getDataCheckbox("fbslim"); config.CompileOptions.fbslim = this.getDataCheckbox("fbslim");
config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation"); config.SDKOptions.UseFriendRelation = this.getDataCheckbox("useFriendRelation");
config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat"); config.SDKOptions.UseMiniGameChat = this.getDataCheckbox("useMiniGameChat");

View File

@ -129,6 +129,10 @@ namespace WeChatWASM
{ {
return WXConvertCore.UseiOSMetal; return WXConvertCore.UseiOSMetal;
}); });
WXExtEnvDef.RegisterAction("WXConvertCore.UseEmscriptenGLX", (args) =>
{
return WXConvertCore.UseEmscriptenGLX;
});
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 = "202508190736"; // 这一行不要改他,导出的时候会自动替换 public static string pluginVersion = "202508260429"; // 这一行不要改他,导出的时候会自动替换
} }
public class WXPluginConf public class WXPluginConf

Binary file not shown.

View File

@ -9,17 +9,12 @@
构建模板工具类 构建模板工具类
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.BuildTemplate.ignoreUserTemplate">
<summary>
是否忽略用户自定义模板
</summary>
</member>
<member name="F:WeChatWASM.BuildTemplate.IgnoreRules"> <member name="F:WeChatWASM.BuildTemplate.IgnoreRules">
<summary> <summary>
复制覆盖时不参与覆盖的正则表达式,可在 beforeCoverTemplate前动态修改 复制覆盖时不参与覆盖的正则表达式,可在 beforeCoverTemplate前动态修改
</summary> </summary>
</member> </member>
<member name="M:WeChatWASM.BuildTemplate.CheckCustomCoverBaseConflict(System.String,System.String,System.String[],System.Boolean)"> <member name="M:WeChatWASM.BuildTemplate.CheckCustomCoverBaseConflict(System.String,System.String,System.String[])">
<summary> <summary>
防止自定义模板对覆盖基础模板有覆盖在新版本更新后有代码冲突需要做此检查 防止自定义模板对覆盖基础模板有覆盖在新版本更新后有代码冲突需要做此检查
</summary> </summary>
@ -294,7 +289,7 @@
<member name="T:WeChatWASM.UnityUtil"> <member name="T:WeChatWASM.UnityUtil">
工具函数 工具函数
</member> </member>
<member name="M:WeChatWASM.UnityUtil.WxSDKEnvInit(System.Boolean)"> <member name="M:WeChatWASM.UnityUtil.WxSDKEnvInit">
<summary> <summary>
微信SDK环境初始化 微信SDK环境初始化
</summary> </summary>
@ -381,11 +376,6 @@
视频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>
导出路径(绝对路径) 导出路径(绝对路径)
@ -653,6 +643,7 @@
是否使用iOS metal指令流 是否使用iOS metal指令流
</summary> </summary>
</member> </member>
<!-- Badly formed XML comment ignored for member "F:WeChatWASM.CompileOptions.enableEmscriptenGLX" -->
<member name="F:WeChatWASM.CompileOptions.brotliMT"> <member name="F:WeChatWASM.CompileOptions.brotliMT">
<summary> <summary>
是否使用brotli多线程压缩 是否使用brotli多线程压缩
@ -773,66 +764,5 @@
字体配置 字体配置
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.WXPlayableProjectConf.projectName">
<summary>
试玩项目名
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.Appid">
<summary>
试玩 appid
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.relativeDST">
<summary>
导出路径(相对路径)
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.DST">
<summary>
导出路径(绝对路径)
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.MemorySize">
<summary>
游戏内存大小(MB)
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.Orientation">
<summary>
游戏方向
</summary>
</member>
<member name="F:WeChatWASM.WXPlayableProjectConf.IOSDevicePixelRatio">
<summary>
IOS限制固定的分辨率以减少内存但是会降低游戏画面品质
注意不要随意修改默认值为00表示不限制
</summary>
</member>
<member name="F:WeChatWASM.PlayableCompileOptions.DevelopBuild">
<summary>
Development Build
</summary>
</member>
<member name="F:WeChatWASM.PlayableCompileOptions.Il2CppOptimizeSize">
<summary>
Il2CppCodeGeneration.OptimizeSize
</summary>
</member>
<member name="F:WeChatWASM.PlayableCompileOptions.profilingFuncs">
<summary>
Profiling Funcs
</summary>
</member>
<member name="F:WeChatWASM.PlayableCompileOptions.Webgl2">
<summary>
WebGL2.0
</summary>
</member>
<member name="F:WeChatWASM.PlayableCompileOptions.CustomNodePath">
<summary>
CustomNodePath
</summary>
</member>
</members> </members>
</doc> </doc>

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 4e2a80fab2cbe76fc8f8a9443ecab609 guid: 030532471fcadbdfbf292be558833e91
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

7
Runtime/.DS_Store.meta Normal file
View File

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

View File

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

View File

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

View File

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

View File

@ -28,22 +28,6 @@ mergeInto(LibraryManager.library, {
GameGlobal.unityNamespace.ProfileWebgl.stopRecord(); GameGlobal.unityNamespace.ProfileWebgl.stopRecord();
} }
}, },
JSProfilerUploadBinary: function(dataPtr, bufSize, namePtr, dirPtr, id, inStartFrameIdx, inEndFrameIdx) {
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) {
const name = UTF8ToString(namePtr);
const dir = UTF8ToString(dirPtr);
const content = HEAPU8.slice(dataPtr, dataPtr+bufSize);
GameGlobal.manager.profiler.uploadBinary({
'data': content,
'len': bufSize,
'fileName': name,
'uploadDir': dir,
'id': id,
'startFrameIndex': inStartFrameIdx,
'endFrameIndex': inEndFrameIdx
});
//}
},
JSProfilerUploadString: function(dataPtr, bufSize, namePtr, dirPtr, id, inStartFrameIdx, inEndFrameIdx) { JSProfilerUploadString: function(dataPtr, bufSize, namePtr, dirPtr, id, inStartFrameIdx, inEndFrameIdx) {
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) { //if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) {
const name = UTF8ToString(namePtr); const name = UTF8ToString(namePtr);
@ -122,12 +106,5 @@ mergeInto(LibraryManager.library, {
stringToUTF8(GameGlobal.unityNamespace.convertPluginVersion, stringOnWasmHeap, lengthBytes); stringToUTF8(GameGlobal.unityNamespace.convertPluginVersion, stringOnWasmHeap, lengthBytes);
return stringOnWasmHeap; return stringOnWasmHeap;
},
JSProfilerCanvasToFilepathSync: function(savePath) {
if (GameGlobal && GameGlobal.unityNamespace && GameGlobal.unityNamespace.ProfileWebgl && GameGlobal.unityNamespace.ProfileWebgl.stopRecord) {
const savePathJSStr = UTF8ToString(savePath);
GameGlobal.manager.profiler.canvasToFilepathSync(savePathJSStr);
}
} }
}); });

Binary file not shown.

View File

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

Binary file not shown.

View File

@ -0,0 +1,93 @@
fileFormatVersion: 2
guid: 89ccba97a8e2991dc502c741bc8cd6c6
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Android: 1
Exclude Editor: 1
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 1
Exclude Win: 1
Exclude Win64: 1
Exclude WindowsStoreApps: 1
- first:
Android: Android
second:
enabled: 0
settings:
AndroidSharedLibraryType: Executable
CPU: ARMv7
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
WebGL: WebGL
second:
enabled: 0
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 0
settings: {}
- first:
Windows Store Apps: WindowsStoreApps
second:
enabled: 0
settings:
CPU: AnyCPU
DontProcess: false
PlaceholderPath:
SDK: AnySDK
ScriptingBackend: AnyScriptingBackend
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ffcf22f69c45d4919a04626e60e86c20 guid: f0cbdcf50f6d52cea758f1ea825443c0
PluginImporter: PluginImporter:
externalObjects: {} externalObjects: {}
serializedVersion: 2 serializedVersion: 2
@ -7,21 +7,68 @@ PluginImporter:
executionOrder: {} executionOrder: {}
defineConstraints: [] defineConstraints: []
isPreloaded: 0 isPreloaded: 0
isOverridable: 0 isOverridable: 1
isExplicitlyReferenced: 0 isExplicitlyReferenced: 0
validateReferences: 1 validateReferences: 1
platformData: platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 0
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude WebGL: 0
Exclude Win: 1
Exclude Win64: 1
- first: - first:
Any: Any:
second: second:
enabled: 1 enabled: 0
settings: {} settings: {}
- first: - first:
Editor: Editor Editor: Editor
second:
enabled: 1
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second: second:
enabled: 0 enabled: 0
settings: settings:
DefaultValueInitialized: true CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
WebGL: WebGL
second:
enabled: 1
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 1
settings: {}
- first: - first:
Windows Store Apps: WindowsStoreApps Windows Store Apps: WindowsStoreApps
second: second:

View File

@ -1,6 +1,6 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 94249136b4b39434dbb3ae3f5b41f47b guid: 8ea3a597042b1e09596b698c5fcfd06b
TextScriptImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:
assetBundleName: assetBundleName:

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 744bf12ecf3dfaa699dd812a15f33b22 guid: 8e492e76cce10a02f6995c95f8ac154c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 00bce541fac34af9181e2dc507ef6680 guid: 06afea380d802ca52d01def6f20bad4d
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

Binary file not shown.

Binary file not shown.

View File

@ -648,7 +648,6 @@ namespace WeChatWASM
/// ## 注意事项 /// ## 注意事项
/// - 基础库 v2.10.4 开始支持获取群工具小程序启动信息 /// - 基础库 v2.10.4 开始支持获取群工具小程序启动信息
/// - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息 /// - 基础库 v2.17.3 开始支持获取群聊小程序消息卡片、群待办小程序启动信息
/// - 基础库 v3.7.8 支持获取单聊群启动信息,获取的群(含单聊)唯一标识,可用于[聊天工具模式](https://developers.weixin.qq.com/minigame/dev/api/chattool/wx.openChatTool.html)。
/// **示例代码** /// **示例代码**
/// ```js /// ```js
/// wx.getGroupEnterInfo({ /// wx.getGroupEnterInfo({
@ -668,10 +667,7 @@ namespace WeChatWASM
/// 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识): /// 获取得到的开放数据为以下 json 结构(其中 opengid 为当前群的唯一标识):
/// ```json /// ```json
/// { /// {
/// "opengid": "OPENGID", // 多聊群下返回的群唯一标识 /// "opengid": "OPENGID"
/// "open_single_roomid": "", // 单聊群下返回的群唯一标识
/// "group_openid": "", // 用户在当前群的唯一标识
/// "chat_type": 3, // 聊天室类型
/// } /// }
/// ``` /// ```
/// **Tips** /// **Tips**
@ -1404,7 +1400,7 @@ namespace WeChatWASM
/// <summary> /// <summary>
/// [wx.openCustomerServiceConversation(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.html) /// [wx.openCustomerServiceConversation(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.html)
/// 需要基础库: `2.0.3` /// 需要基础库: `2.0.3`
/// 进入客服会话。要求在用户发生过至少一次 touch 事件后才能调用。后台接入方式与小程序一致,详见 [客服消息接入](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/customer-message/customer-message.html) /// 进入客服会话。要求在用户发生过至少一次 touch 事件后才能调用。后台接入方式与小程序一致,详见 [客服消息接入](#)
/// **注意事项** /// **注意事项**
/// - 在客服会话内点击小程序消息卡片进入小程序时,不能通过 wx.onShow 或 wx.getEnterOptionsSync 等接口获取启动路径和参数,而是应该通过 wx.openCustomerServiceConversation 接口的 success 回调获取启动路径和参数 /// - 在客服会话内点击小程序消息卡片进入小程序时,不能通过 wx.onShow 或 wx.getEnterOptionsSync 等接口获取启动路径和参数,而是应该通过 wx.openCustomerServiceConversation 接口的 success 回调获取启动路径和参数
/// </summary> /// </summary>
@ -2154,6 +2150,9 @@ namespace WeChatWASM
/// [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.showShareImageMenu.html) /// [wx.showShareImageMenu(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.showShareImageMenu.html)
/// 需要基础库: `2.14.3` /// 需要基础库: `2.14.3`
/// 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载 /// 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载
/// **Bug & Tip**
/// 1. `tip`: `needShowEntrance`分享的图片消息是否要带小程序入口,支持申明类目:商家自营、电商平台、餐饮服务(餐饮服务场所/餐饮服务管理企业、点餐平台、外卖平台)、旅游服务(住宿服务、景区服务、OTA、旅游管理单位)、生活服务(家政服务、丽人服务、宠物(非医院类)、婚庆服务、洗浴保健、休闲娱乐、百货/超市/便利店、开锁服务、营业性演出票务、其他宠物健康服务、洗浴保健平台、共享服务、跑腿、寄存、求职/招聘)
/// 2. `tip`: `needShowEntrance`小游戏所有类目都支持
/// </summary> /// </summary>
public static void ShowShareImageMenu(ShowShareImageMenuOption callback) public static void ShowShareImageMenu(ShowShareImageMenuOption callback)
{ {

View File

@ -1117,42 +1117,6 @@ namespace WeChatWASM
{ {
WXSDKManagerHandler.Instance.ReserveChannelsLive(option); WXSDKManagerHandler.Instance.ReserveChannelsLive(option);
} }
#region
/// <summary>
/// 通知试玩结束
/// </summary>
/// <param name="option"></param>
public static void NotifyMiniProgramPlayableStatus(NotifyMiniProgramPlayableStatusOption option)
{
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 #endif

View File

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

View File

@ -8,10 +8,6 @@ using UnityEngine;
using UnityEngine.Scripting; using UnityEngine.Scripting;
using System.IO; using System.IO;
using Unity.Profiling;
using UnityEngine.Profiling;
using Debug = UnityEngine.Debug;
#if PLATFORM_WEIXINMINIGAME || PLATFORM_WEBGL || UNITY_EDITOR #if PLATFORM_WEIXINMINIGAME || PLATFORM_WEBGL || UNITY_EDITOR

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ac4244e6a18805d144af9149f834e0a1 guid: 85fc06506867e10192a18187f399a026
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b359eabcdef1919195de839fb78762b2 guid: a08797d6096241e488ad4b88a34e39ab
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d1cea326b818f8026ffe01ca8bbd6c7a guid: fd82b33ac8d4c0e7b9985b3f142656f9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 82e623a803146806f2646ef54be62f88 guid: b06eb165a6812792b9684b22554894c8
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -27,7 +27,11 @@ const managerConfig = {
'$PRELOAD_LIST', '$PRELOAD_LIST',
], ],
contextConfig: { contextConfig: {
contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2 contextType: $WEBGL_VERSION,
contextExt: {
enableGLX: $ENABLE_GLX,
enableMetal: $ENABLE_METAL,
}
}, },
PROFILER_UPLOAD_URL: '', PROFILER_UPLOAD_URL: '',
}; };

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dfb3621b99c16fe5918bd0f61cabef6d guid: e1b113b16802035c55968b50f6c148a5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 43a58900cd1f2cceeebe71cd0da6e9ea guid: 409a31dbd92db503623f9b227889d8d9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 62d3610273924692d8a468a7612ca4ba guid: f93d271982c7462215f1d119235c7aff
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 83a12c74827ac659f16b70e632b0a36b guid: 03e3a319f0d5c48d4cb8216af22be61a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d16ea1b19da3cbb0776441ccf58afbf5 guid: 8144e84264dbf191c32b234e31dc14ca
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -56,6 +56,7 @@ 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: da79e742fd6f9ced13d2208f2588ed39 guid: 3cf8477b3c854e1a953e60af6a169aad
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 949a3f0616e67d1ce1337ed2c59fa822 guid: ca07ac15ee7ea8d9a20512bbe62ea6fc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: ee533953826d9d9c4cb0291691e1b608 guid: 91a8c69182fc9bf4b2faba4a483fe5fc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 46a723a67bd4b6ee5333584557212874 guid: 9c259dd50d3291eb862412bb820caa29
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e5beb47a7a3e97157d24f21aae34b1a0 guid: 3424d186192f69a2e9f29a5508b3d809
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d166c6892cd742fe6ee449e519168f51 guid: 88da0cdde0bb82e100461400ac9e031b
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e3d922faf659fb2f5321801daafb7d28 guid: 559bdd8a07a91b8a55df2d50db4ed050
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 398acef606ef104ab0715b23023520f0 guid: bcacd9a212cc2894f580589ad7347625
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: da8ea56c5c1dedd89d1c7d12ee8cd911 guid: f1891d35f30e4aa380b1222d9a81293a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f10a1f4d932cbdb0fe9bf1a0476bdc4e guid: f842a11e2e2ac626b199fec97f57eac5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9beab2d6233f4d41c7d1f698611ad5c9 guid: 10856ea7ea8c227727a527ae3ea47311
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: dc2e337596896fcf8ba39fad1dbb01f4 guid: 3121417645d2f33812d600a8caa1c2b4
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -63,10 +63,9 @@ 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',
verticalAlign: 'center', lineHeight: (data.height / 2 / 3) * 0.4,
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: 6b3dac806ae44ddca7e3a5cac6283268 guid: b75eb97f4eb669a3fa0b669ba1e115b2
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 16d87f2bbc7e0cab87750e250d8fb706 guid: d2e00805dd3211a51a686400311de0bd
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0240fe214f6ddc3de61e9f07f3811586 guid: b65bc8d8dfd5377886495a13ce663504
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1e2e88509f4f353bcfa082724749eb11 guid: 72cc0585542eb273e2e7b1c0b2583ab0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

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