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
263973209d
commit
e4b3cd325c
31
CHANGELOG.md
31
CHANGELOG.md
@ -6,6 +6,37 @@ Removed - 删除功能/接口
|
||||
Fixed - 修复问题
|
||||
Others - 其他
|
||||
-->
|
||||
## 2024-1-7 【重要更新】
|
||||
### Feature
|
||||
* 重要:支持Unity6,预览版本不建议上线使用
|
||||
* 普通:OffShareMessageToFriend支持
|
||||
* 普通:性能深度分析工具版本更新
|
||||
### Fixed
|
||||
* 普通: reserveChannelsLive补充回调参数
|
||||
* 普通: 低基础库版本报错修复
|
||||
* 普通: BannerAd.OnResize回调报错修复
|
||||
* 普通: requestMidasPaymentGameItem修复
|
||||
* 普通: WriteSync接口无法正常返回已写入的字节数
|
||||
* 普通: ReadSync接口无法正常调用
|
||||
|
||||
## 2024-12-18 【重要更新】
|
||||
### Feature
|
||||
* 普通: 开放数据域支持screenCanvas
|
||||
* 普通: 完善screenCanvas.toTempFilePath
|
||||
* 普通: 低版本WindowInfo适配
|
||||
* 普通: 调整autoAdaptScreen默认false
|
||||
* 普通: 首资源包放小游戏分包时,总大小调整为30MB
|
||||
### Fixed
|
||||
* 重要: 更改WebGLInput.mobileKeyboardSupport默认属性为 false,该属性导致Unity2022 以上版本 Touch 会多调用一次 MainLoop产生较大性能损耗。请使用微信键盘API或 WXTouchInputOverride支持文本输入框
|
||||
|
||||
## 2024-11-14 【普通更新】
|
||||
### Feature
|
||||
* 普通: WXSDK代码简化
|
||||
* 普通: 增强JsonMapper报错信息
|
||||
* 普通: 适配插件版本升级到1.2.62
|
||||
### Fixed
|
||||
* 普通: WX.Cloud.Init 自定义环境报错
|
||||
|
||||
## 2024-10-8 【重要更新】
|
||||
### Feature
|
||||
* 普通: UDPSocket.write适配
|
||||
|
||||
@ -25,7 +25,6 @@ namespace WeChatWASM
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
SDKFilePath = Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js");
|
||||
string templateHeader = "PROJECT:";
|
||||
#if TUANJIE_2022_3_OR_NEWER
|
||||
PlayerSettings.WeixinMiniGame.threadsSupport = false;
|
||||
@ -79,7 +78,6 @@ namespace WeChatWASM
|
||||
public static string dataFileSize = string.Empty;
|
||||
public static string codeMd5 = string.Empty;
|
||||
public static string dataMd5 = string.Empty;
|
||||
private static string SDKFilePath = string.Empty;
|
||||
public static string defaultImgSrc = "Assets/WX-WASM-SDK-V2/Runtime/wechat-default/images/background.jpg";
|
||||
|
||||
private static bool lastBrotliType = false;
|
||||
@ -243,7 +241,7 @@ namespace WeChatWASM
|
||||
try
|
||||
{
|
||||
string metaPath = AssetDatabase.GetTextMetaFilePathFromAssetPath(inAssetPath); // 获取.meta文件的路径
|
||||
string enableFlagStr = inEnabled? "1" : "0";
|
||||
string enableFlagStr = inEnabled ? "1" : "0";
|
||||
|
||||
// 读取.meta文件
|
||||
// 处理WebGL
|
||||
@ -314,12 +312,12 @@ namespace WeChatWASM
|
||||
#else
|
||||
wxPerf2022Importer.SetCompatibleWithPlatform(BuildTarget.WebGL, bShouldEnablePerf2022Plugin);
|
||||
#endif
|
||||
SetPluginCompatibilityByModifyingMetadataFile(wxPerfPlugins[1], bShouldEnablePerf2022Plugin);
|
||||
SetPluginCompatibilityByModifyingMetadataFile(wxPerfPlugins[1], bShouldEnablePerf2022Plugin);
|
||||
}
|
||||
|
||||
{
|
||||
// wx_perf_2021.a
|
||||
bool bShouldEnablePerf2021Plugin = config.CompileOptions.enablePerfAnalysis && IsCompatibleWithUnity202103To202203();
|
||||
bool bShouldEnablePerf2021Plugin = config.CompileOptions.enablePerfAnalysis && IsCompatibleWithUnity202102To202203();
|
||||
|
||||
var wxPerf2021Importer = AssetImporter.GetAtPath(wxPerfPlugins[2]) as PluginImporter;
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
@ -335,7 +333,7 @@ namespace WeChatWASM
|
||||
/**
|
||||
* Lua Adaptor Settings.
|
||||
*/
|
||||
|
||||
|
||||
private static bool GetRequiredLuaHeaderFiles(out Dictionary<string, string> luaPaths)
|
||||
{
|
||||
luaPaths = new Dictionary<string, string>()
|
||||
@ -349,8 +347,8 @@ namespace WeChatWASM
|
||||
{"ltable.h", null},
|
||||
{"lauxlib.h", null},
|
||||
};
|
||||
|
||||
string rootPath = Directory.GetParent(Application.dataPath).ToString();
|
||||
|
||||
string rootPath = Directory.GetParent(Application.dataPath).ToString();
|
||||
string[] paths = Directory.GetFiles(rootPath, "*.h", SearchOption.AllDirectories);
|
||||
foreach (var path in paths)
|
||||
{
|
||||
@ -379,7 +377,7 @@ namespace WeChatWASM
|
||||
{
|
||||
return $"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}LuaAdaptor{DS}{filename}";
|
||||
}
|
||||
|
||||
|
||||
return $"Assets{DS}WX-WASM-SDK-V2{DS}Runtime{DS}Plugins{DS}LuaAdaptor{DS}{filename}";
|
||||
}
|
||||
|
||||
@ -408,8 +406,9 @@ namespace WeChatWASM
|
||||
|
||||
File.WriteAllText(luaAdaptorImportHeaderPath, importHeaderContent);
|
||||
}
|
||||
|
||||
private static void ManageLuaAdaptorBuildOptions(bool shouldBuild) {
|
||||
|
||||
private static void ManageLuaAdaptorBuildOptions(bool shouldBuild)
|
||||
{
|
||||
string[] maybeBuildFiles = new string[]
|
||||
{
|
||||
"lua_adaptor_501.c",
|
||||
@ -441,7 +440,7 @@ namespace WeChatWASM
|
||||
SetPluginCompatibilityByModifyingMetadataFile(path, shouldBuild);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void MakeEnvForLuaAdaptor()
|
||||
{
|
||||
bool hasLuaEnv = GetRequiredLuaHeaderFiles(out var luaPaths);
|
||||
@ -449,10 +448,10 @@ namespace WeChatWASM
|
||||
{
|
||||
MakeLuaImport(luaPaths);
|
||||
}
|
||||
|
||||
|
||||
ManageLuaAdaptorBuildOptions(hasLuaEnv && config.CompileOptions.enablePerfAnalysis);
|
||||
}
|
||||
|
||||
|
||||
private static bool IsCompatibleWithUnity202203OrNewer()
|
||||
{
|
||||
#if UNITY_2022_3_OR_NEWER
|
||||
@ -462,11 +461,11 @@ namespace WeChatWASM
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool IsCompatibleWithUnity202103To202203()
|
||||
static bool IsCompatibleWithUnity202102To202203()
|
||||
{
|
||||
#if UNITY_2022_3_OR_NEWER
|
||||
return false;
|
||||
#elif !UNITY_2021_3_OR_NEWER
|
||||
#elif !UNITY_2021_2_OR_NEWER
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
@ -809,10 +808,11 @@ namespace WeChatWASM
|
||||
PlayerSettings.WebGL.emscriptenArgs = string.Empty;
|
||||
if (WXExtEnvDef.GETDEF("UNITY_2021_2_OR_NEWER"))
|
||||
{
|
||||
PlayerSettings.WebGL.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end -s ERROR_ON_UNDEFINED_SYMBOLS=0";
|
||||
PlayerSettings.WebGL.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end";
|
||||
#if UNITY_2021_2_5
|
||||
PlayerSettings.WebGL.emscriptenArgs += ",_main";
|
||||
PlayerSettings.WebGL.emscriptenArgs += ",_main";
|
||||
#endif
|
||||
PlayerSettings.WebGL.emscriptenArgs += " -s ERROR_ON_UNDEFINED_SYMBOLS=0";
|
||||
}
|
||||
#endif
|
||||
PlayerSettings.runInBackground = false;
|
||||
@ -874,6 +874,11 @@ namespace WeChatWASM
|
||||
PlayerSettings.WebGL.emscriptenArgs += " --profiling-funcs ";
|
||||
}
|
||||
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
// 从小游戏转换工具里无法直接开启wasm2023特性 会导致转出的webgl异常,所以强制关闭
|
||||
PlayerSettings.WebGL.wasm2023 = false;
|
||||
#endif
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
// 默认更改为OptimizeSize,减少代码包体积
|
||||
@ -1090,11 +1095,16 @@ namespace WeChatWASM
|
||||
File.Copy(tempDataPath, config.ProjectConf.compressDataPackage ? brMinigameDataPath : originMinigameDataPath, true);
|
||||
}
|
||||
}
|
||||
checkNeedRmovePackageParallelPreload();
|
||||
|
||||
// 设置InstantGame的首资源包路径,上传用
|
||||
FirstBundlePath = tempDataPath;
|
||||
|
||||
convertDataPackageJS();
|
||||
}
|
||||
|
||||
public static void convertDataPackageJS()
|
||||
{
|
||||
checkNeedRmovePackageParallelPreload();
|
||||
|
||||
var loadDataFromCdn = config.ProjectConf.assetLoadType == 0;
|
||||
Rule[] rules =
|
||||
{
|
||||
@ -1115,15 +1125,31 @@ namespace WeChatWASM
|
||||
}
|
||||
};
|
||||
string[] files = { "game.js", "game.json", "project.config.json", "check-version.js" };
|
||||
ReplaceFileContent(files, rules);
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
ReplaceFileContent(files, rules, WXRuntimeExtEnvDef.PreviewDst);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReplaceFileContent(files, rules);
|
||||
}
|
||||
}
|
||||
|
||||
private static void checkNeedRmovePackageParallelPreload()
|
||||
{
|
||||
string dst;
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
dst = WXRuntimeExtEnvDef.PreviewDst;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst = Path.Combine(config.ProjectConf.DST, miniGameDir);
|
||||
}
|
||||
// cdn下载时不需要填写并行下载配置
|
||||
if (config.ProjectConf.assetLoadType == 0)
|
||||
{
|
||||
var filePath = Path.Combine(config.ProjectConf.DST, miniGameDir, "game.json");
|
||||
var filePath = Path.Combine(dst, "game.json");
|
||||
|
||||
string content = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
JsonData gameJson = JsonMapper.ToObject(content);
|
||||
@ -1143,13 +1169,14 @@ namespace WeChatWASM
|
||||
/// </summary>
|
||||
/// <param name="files"></param>
|
||||
/// <param name="replaceList"></param>
|
||||
public static void ReplaceFileContent(string[] files, Rule[] replaceList)
|
||||
public static void ReplaceFileContent(string[] files, Rule[] replaceList, string fileDir = null)
|
||||
{
|
||||
if (files.Length != 0 && replaceList.Length != 0)
|
||||
{
|
||||
var dstPath = fileDir != null ? fileDir : Path.Combine(config.ProjectConf.DST, miniGameDir);
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
var filePath = Path.Combine(config.ProjectConf.DST, miniGameDir, files[i]);
|
||||
var filePath = Path.Combine(dstPath, files[i]);
|
||||
string text = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
for (int j = 0; j < replaceList.Length; j++)
|
||||
{
|
||||
@ -1210,6 +1237,10 @@ namespace WeChatWASM
|
||||
var info = new FileInfo(dataPath);
|
||||
dataFileSize = info.Length.ToString();
|
||||
UnityEngine.Debug.LogFormat("[Converter] that to genarate md5 and copy files ended");
|
||||
if (config.ProjectConf.Appid == "wx7c792ca878775717") // 快适配小游戏示例
|
||||
{
|
||||
InsertPreviewCode();
|
||||
}
|
||||
ModifyWeChatConfigs(isFromConvert);
|
||||
ModifySDKFile();
|
||||
ClearFriendRelationCode();
|
||||
@ -1223,6 +1254,110 @@ namespace WeChatWASM
|
||||
return Brotlib(codeMd5 + ".webgl.wasm.code.unityweb.wasm.br", codePath, Path.Combine(config.ProjectConf.DST, miniGameDir, "wasmcode", codeMd5 + ".webgl.wasm.code.unityweb.wasm.br"));
|
||||
}
|
||||
|
||||
private static void InsertPreviewCode()
|
||||
{
|
||||
Debug.LogWarning("[WeChat Preview] InsertPreviewCode Start");
|
||||
Rule[] rules =
|
||||
{
|
||||
// game.json 引入预览插件
|
||||
new Rule()
|
||||
{
|
||||
old = "\"plugins\": {",
|
||||
newStr = "\"plugins\": {\n" +
|
||||
" \"MiniGamePreviewPlugin\": {\n" +
|
||||
" \"version\": \"latest\",\n" + // 这里更改版本号
|
||||
" \"provider\": \"wx7c792ca878775717\",\n" +
|
||||
" \"contexts\": [\n" +
|
||||
" {\n" +
|
||||
" \"type\": \"isolatedContext\"\n" +
|
||||
" }\n" +
|
||||
" ]\n" +
|
||||
" },"
|
||||
},
|
||||
// game.js 嵌入:有url启动参数进入预览盒子
|
||||
new Rule()
|
||||
{
|
||||
old = "const managerConfig = {",
|
||||
newStr =
|
||||
"export let minigamePreview;\n" +
|
||||
"let isStarted = false;\n" +
|
||||
"wx.onShow((res) => {\n" +
|
||||
" console.warn('onShow: ' + JSON.stringify(res));\n" +
|
||||
" // res.query.url = 'localhost:8044';\n" +
|
||||
" if (!isStarted) {\n" +
|
||||
" isStarted = true;\n" +
|
||||
" if (res.query.url) {\n" +
|
||||
" startPreview(res.query.url);\n" +
|
||||
" } else {\n" +
|
||||
" startGame();\n" +
|
||||
" }\n" +
|
||||
" } else if (res.query.url) { // 扫预览码进入\n" +
|
||||
" wx.restartMiniProgram({\n" +
|
||||
" path: `/?url=${res.query.url}`\n" +
|
||||
" });\n" +
|
||||
" }\n" +
|
||||
"})\n" +
|
||||
"function startPreview(url) {\n" +
|
||||
" wx.setEnableDebug({ enableDebug: true });\n" +
|
||||
" const [ip, port] = url.split(':');\n" +
|
||||
" let MiniGamePreview;\n" +
|
||||
" if (requirePlugin) {\n" +
|
||||
" try {\n" +
|
||||
" MiniGamePreview = requirePlugin('MiniGamePreviewPlugin', {\n" +
|
||||
" enableRequireHostModule: true,\n" +
|
||||
" customEnv: {\n" +
|
||||
" wx,\n" +
|
||||
" canvas,\n" +
|
||||
" gameGlobal: {...GameGlobal},\n" +
|
||||
" },\n" +
|
||||
" }).default;\n" +
|
||||
" } catch (e) {\n" +
|
||||
" console.error(e);\n" +
|
||||
" }\n" +
|
||||
" minigamePreview = new MiniGamePreview({\n" +
|
||||
" ip: ip,\n" +
|
||||
" port: port\n" +
|
||||
" })\n" +
|
||||
" minigamePreview.initStartPage();\n" +
|
||||
" }\n" +
|
||||
"}\n" +
|
||||
"function startGame() {\n" +
|
||||
"const managerConfig = {",
|
||||
},
|
||||
// game.js 括号补齐
|
||||
new Rule()
|
||||
{
|
||||
old = " }\n});",
|
||||
newStr = " }\n});}",
|
||||
},
|
||||
// unity-sdk/module-helper.js 引入预览插件
|
||||
new Rule()
|
||||
{
|
||||
old = "import { MODULE_NAME } from './conf';",
|
||||
newStr = "import { MODULE_NAME } from './conf';\n" +
|
||||
"import { minigamePreview } from '../game';",
|
||||
},
|
||||
// unity-sdk/module-helper.js 预览环境下hookAPI
|
||||
new Rule()
|
||||
{
|
||||
old = "this._send = GameGlobal.Module.SendMessage;",
|
||||
newStr = "if (minigamePreview) {\n" +
|
||||
" this._send = minigamePreview.getPreviewSend();\n" +
|
||||
" } else {\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", "project.config.json" };
|
||||
ReplaceFileContent(files, rules);
|
||||
Debug.LogWarning("[WeChat Preview] InsertPreviewCode End");
|
||||
}
|
||||
|
||||
private static int Brotlib(string filename, string sourcePath, string targetPath)
|
||||
{
|
||||
UnityEngine.Debug.LogFormat("[Converter] Starting to generate Brotlib file");
|
||||
@ -1297,9 +1432,18 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// 更新game.json
|
||||
/// </summary>
|
||||
private static void ClearFriendRelationCode()
|
||||
public static void ClearFriendRelationCode()
|
||||
{
|
||||
var filePath = Path.Combine(config.ProjectConf.DST, miniGameDir, "game.json");
|
||||
string dst;
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
dst = WXRuntimeExtEnvDef.PreviewDst;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst = Path.Combine(config.ProjectConf.DST, miniGameDir);
|
||||
}
|
||||
var filePath = Path.Combine(dst, "game.json");
|
||||
|
||||
string content = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
JsonData gameJson = JsonMapper.ToObject(content);
|
||||
@ -1317,7 +1461,7 @@ namespace WeChatWASM
|
||||
gameJson["plugins"].Remove("Layout");
|
||||
|
||||
// 删除 open-data 相应的文件夹
|
||||
string openDataDir = Path.Combine(config.ProjectConf.DST, miniGameDir, "open-data");
|
||||
string openDataDir = Path.Combine(dst, "open-data");
|
||||
UnityUtil.DelectDir(openDataDir);
|
||||
Directory.Delete(openDataDir, true);
|
||||
}
|
||||
@ -1342,9 +1486,18 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// 更新game.js
|
||||
/// </summary>
|
||||
private static void GameJsPlugins()
|
||||
public static void GameJsPlugins()
|
||||
{
|
||||
var filePath = Path.Combine(config.ProjectConf.DST, miniGameDir, "game.js");
|
||||
string dst;
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
dst = WXRuntimeExtEnvDef.PreviewDst;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst = Path.Combine(config.ProjectConf.DST, miniGameDir);
|
||||
}
|
||||
var filePath = Path.Combine(dst, "game.js");
|
||||
|
||||
string content = File.ReadAllText(filePath, Encoding.UTF8);
|
||||
|
||||
@ -1366,7 +1519,7 @@ namespace WeChatWASM
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(Path.Combine(config.ProjectConf.DST, miniGameDir, "plugins", "check-update.js"));
|
||||
File.Delete(Path.Combine(dst, "plugins", "check-update.js"));
|
||||
}
|
||||
if (config.CompileOptions.autoAdaptScreen)
|
||||
{
|
||||
@ -1375,7 +1528,7 @@ namespace WeChatWASM
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Delete(Path.Combine(config.ProjectConf.DST, miniGameDir, "plugins", "screen-adapter.js"));
|
||||
File.Delete(Path.Combine(dst, "plugins", "screen-adapter.js"));
|
||||
}
|
||||
|
||||
if (changed)
|
||||
@ -1384,26 +1537,34 @@ namespace WeChatWASM
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.Delete(Path.Combine(config.ProjectConf.DST, miniGameDir, "plugins"), true);
|
||||
Directory.Delete(Path.Combine(dst, "plugins"), true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void ModifySDKFile()
|
||||
public static void ModifySDKFile()
|
||||
{
|
||||
var config = UnityUtil.GetEditorConf();
|
||||
string content = File.ReadAllText(SDKFilePath, Encoding.UTF8);
|
||||
string dst;
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
dst = WXRuntimeExtEnvDef.PreviewDst;
|
||||
}
|
||||
else
|
||||
{
|
||||
dst = Path.Combine(config.ProjectConf.DST, miniGameDir);
|
||||
}
|
||||
string content = File.ReadAllText(Path.Combine(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "index.js"), Encoding.UTF8);
|
||||
content = content.Replace("$unityVersion$", Application.unityVersion);
|
||||
File.WriteAllText(Path.Combine(config.ProjectConf.DST, miniGameDir, "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(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "storage.js"), Encoding.UTF8);
|
||||
var PreLoadKeys = config.PlayerPrefsKeys.Count > 0 ? JsonMapper.ToJson(config.PlayerPrefsKeys) : "[]";
|
||||
content = content.Replace("'$PreLoadKeys'", PreLoadKeys);
|
||||
File.WriteAllText(Path.Combine(config.ProjectConf.DST, miniGameDir, "unity-sdk", "storage.js"), content, Encoding.UTF8);
|
||||
File.WriteAllText(Path.Combine(dst, "unity-sdk", "storage.js"), content, Encoding.UTF8);
|
||||
// 修改纹理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(UnityUtil.GetWxSDKRootPath(), "Runtime", "wechat-default", "unity-sdk", "texture.js"), Encoding.UTF8);
|
||||
File.WriteAllText(Path.Combine(config.ProjectConf.DST, miniGameDir, "unity-sdk", "texture.js"), content, Encoding.UTF8);
|
||||
File.WriteAllText(Path.Combine(dst, "unity-sdk", "texture.js"), content, Encoding.UTF8);
|
||||
}
|
||||
|
||||
public static string HandleLoadingImage()
|
||||
@ -1610,8 +1771,6 @@ namespace WeChatWASM
|
||||
{
|
||||
UnityEngine.Debug.LogFormat("[Converter] Starting to modify configs");
|
||||
|
||||
var config = UnityUtil.GetEditorConf();
|
||||
|
||||
var PRELOAD_LIST = GetPreloadList(config.ProjectConf.preloadFiles);
|
||||
var imgSrc = HandleLoadingImage();
|
||||
|
||||
@ -1621,7 +1780,7 @@ namespace WeChatWASM
|
||||
var screenOrientation = new List<string>() { "portrait", "landscape", "landscapeLeft", "landscapeRight" }[(int)config.ProjectConf.Orientation];
|
||||
|
||||
var customUnicodeRange = GetCustomUnicodeRange(config.FontOptions.CustomUnicode);
|
||||
Debug.Log("customUnicodeRange: " + customUnicodeRange);
|
||||
Debug.Log("[Converter] customUnicodeRange: " + customUnicodeRange);
|
||||
|
||||
var boolConfigInfo = GenerateBootInfo();
|
||||
|
||||
@ -1693,12 +1852,24 @@ 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" };
|
||||
|
||||
ReplaceFileContent(files.ToArray(), replaceList.ToArray());
|
||||
BuildTemplate.mergeJSON(
|
||||
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template", "minigame"),
|
||||
Path.Combine(config.ProjectConf.DST, miniGameDir)
|
||||
);
|
||||
if (WXRuntimeExtEnvDef.IsPreviewing)
|
||||
{
|
||||
ReplaceFileContent(files.ToArray(), replaceList.ToArray(), WXRuntimeExtEnvDef.PreviewDst);
|
||||
BuildTemplate.mergeJSON(
|
||||
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template", "minigame"),
|
||||
WXRuntimeExtEnvDef.PreviewDst
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
ReplaceFileContent(files.ToArray(), replaceList.ToArray());
|
||||
BuildTemplate.mergeJSON(
|
||||
Path.Combine(Application.dataPath, "WX-WASM-SDK-V2", "Editor", "template", "minigame"),
|
||||
Path.Combine(config.ProjectConf.DST, miniGameDir)
|
||||
);
|
||||
}
|
||||
Emit(LifeCycle.afterBuildTemplate);
|
||||
|
||||
UnityEngine.Debug.LogFormat("[Converter] that to modify configs ended");
|
||||
}
|
||||
|
||||
|
||||
@ -721,15 +721,15 @@ namespace WeChatWASM
|
||||
const string MACRO_ENABLE_WX_PERF_FEATURE = "ENABLE_WX_PERF_FEATURE";
|
||||
string defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
|
||||
|
||||
bool shouldAddSymbol = this.getDataCheckbox("enablePerfAnalysis") && this.getDataCheckbox("developBuild");
|
||||
bool shouldAddSymbol = this.getDataCheckbox("enablePerfAnalysis") && this.getDataCheckbox("developBuild");
|
||||
|
||||
#if !UNITY_2021_2_OR_NEWER || UNITY_2023_2_OR_NEWER
|
||||
if(shouldAddSymbol)
|
||||
if (shouldAddSymbol)
|
||||
{
|
||||
shouldAddSymbol = false;
|
||||
EditorUtility.DisplayDialog("警告", $"当前Unity版本({Application.unityVersion})不在性能分析工具适配范围内(2021.2-2023.1), 性能分析工具将被禁用。", "确定");
|
||||
config.CompileOptions.enablePerfAnalysis = false;
|
||||
this.setData("enablePerfAnalysis", false);
|
||||
config.CompileOptions.enablePerfAnalysis = false;
|
||||
this.setData("enablePerfAnalysis", false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -72,6 +72,11 @@ namespace WeChatWASM
|
||||
#else
|
||||
WXExtEnvDef.SETDEF("UNITY_2022", false);
|
||||
#endif
|
||||
#if UNITY_6000
|
||||
WXExtEnvDef.SETDEF("UNITY_6000", true);
|
||||
#else
|
||||
WXExtEnvDef.SETDEF("UNITY_6000", false);
|
||||
#endif
|
||||
#if UNITY_2022_2_OR_NEWER
|
||||
WXExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", true);
|
||||
#else
|
||||
@ -92,6 +97,11 @@ namespace WeChatWASM
|
||||
#else
|
||||
WXExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
WXExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", true);
|
||||
#else
|
||||
WXExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", false);
|
||||
#endif
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WXExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", true);
|
||||
#else
|
||||
|
||||
@ -2,7 +2,7 @@ namespace WeChatWASM
|
||||
{
|
||||
public class WXPluginVersion
|
||||
{
|
||||
public static string pluginVersion = "202411211302"; // 这一行不要改他,导出的时候会自动替换
|
||||
public static string pluginVersion = "202502110725"; // 这一行不要改他,导出的时候会自动替换
|
||||
}
|
||||
|
||||
public class WXPluginConf
|
||||
|
||||
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3a203a0f026fa02c0462024b16c2e30
|
||||
guid: d05761f316f7eab715c19190699cc137
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
23
Runtime/DisableKeyboardInput.cs
Normal file
23
Runtime/DisableKeyboardInput.cs
Normal file
@ -0,0 +1,23 @@
|
||||
#if UNITY_WEBGL || WEIXINMINIGAME || UNITY_EDITOR
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using WeChatWASM;
|
||||
|
||||
|
||||
internal class DisableKeyboardInput : MonoBehaviour
|
||||
{
|
||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||
private static void OnGameLaunch()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = false;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = false;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
7
Runtime/DisableKeyboardInput.cs.meta
Normal file
7
Runtime/DisableKeyboardInput.cs.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b4b797696785c4e6c93ba24eb8129b15
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,8 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3b689e5d408dbed9ed74e621b4a87bd
|
||||
guid: 78d089244d74c3042a4f280b5652f74d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
assetBundleVariant:
|
||||
|
||||
@ -62,12 +62,12 @@ PluginImporter:
|
||||
- first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
WeixinMiniGame: WeixinMiniGame
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
@ -62,12 +62,12 @@ PluginImporter:
|
||||
- first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
WeixinMiniGame: WeixinMiniGame
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
@ -62,12 +62,12 @@ PluginImporter:
|
||||
- first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
WeixinMiniGame: WeixinMiniGame
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
@ -62,12 +62,12 @@ PluginImporter:
|
||||
- first:
|
||||
WebGL: WebGL
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
WeixinMiniGame: WeixinMiniGame
|
||||
second:
|
||||
enabled: 1
|
||||
enabled: 0
|
||||
settings: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
@ -232,6 +232,16 @@ mergeInto(LibraryManager.library, {
|
||||
stringToUTF8(returnStr, buffer, bufferSize);
|
||||
return buffer;
|
||||
},
|
||||
WXOpenDataToTempFilePath: function (conf, s, f, c) {
|
||||
window.WXWASMSDK.WXOpenDataToTempFilePath(_WXPointer_stringify_adaptor(conf), _WXPointer_stringify_adaptor(s), _WXPointer_stringify_adaptor(f), _WXPointer_stringify_adaptor(c))
|
||||
},
|
||||
WXOpenDataToTempFilePathSync: function (conf) {
|
||||
var returnStr = window.WXWASMSDK.WXOpenDataToTempFilePathSync(_WXPointer_stringify_adaptor(conf));
|
||||
var bufferSize = lengthBytesUTF8(returnStr || '') + 1;
|
||||
var buffer = _malloc(bufferSize);
|
||||
stringToUTF8(returnStr, buffer, bufferSize);
|
||||
return buffer;
|
||||
},
|
||||
WXGetUserDataPath: function () {
|
||||
var returnStr = window.WXWASMSDK.WXGetUserDataPath();
|
||||
var bufferSize = lengthBytesUTF8(returnStr || '') + 1;
|
||||
@ -253,6 +263,9 @@ mergeInto(LibraryManager.library, {
|
||||
stringToUTF8(returnStr, buffer, bufferSize);
|
||||
return buffer;
|
||||
},
|
||||
WXGetOpenDataContext: function (mode) {
|
||||
window.WXWASMSDK.WXGetOpenDataContext(_WXPointer_stringify_adaptor(mode));
|
||||
},
|
||||
WXDataContextPostMessage: function (msg) {
|
||||
window.WXWASMSDK.WXDataContextPostMessage(_WXPointer_stringify_adaptor(msg));
|
||||
},
|
||||
|
||||
@ -198,7 +198,7 @@ var WXAssetBundleLibrary = {
|
||||
}();
|
||||
|
||||
WXFS.cache = new WXFileCache(ttl, capacity);
|
||||
if(!unityNamespace.isAndroid) {
|
||||
if(unityNamespace.isIOS && unityNamespace.isH5Renderer) {
|
||||
WXFS.cache.RegularCleaning(1);
|
||||
}
|
||||
|
||||
|
||||
@ -94,5 +94,17 @@ mergeInto(LibraryManager.library, {
|
||||
'idbfsPathStr': idbfsPathStr,
|
||||
'targetPathStr': targetPathStr
|
||||
})
|
||||
},
|
||||
|
||||
JSGetDPR: function() {
|
||||
return window.devicePixelRatio;
|
||||
},
|
||||
|
||||
JSGetConvertPluginVersion: function() {
|
||||
var lengthBytes = lengthBytesUTF8(GameGlobal.unityNamespace.convertPluginVersion) + 1;
|
||||
var stringOnWasmHeap = _malloc(lengthBytes);
|
||||
stringToUTF8(GameGlobal.unityNamespace.convertPluginVersion, stringOnWasmHeap, lengthBytes);
|
||||
|
||||
return stringOnWasmHeap;
|
||||
}
|
||||
});
|
||||
|
||||
Binary file not shown.
@ -64,6 +64,11 @@ PluginImporter:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
WeixinMiniGame: WeixinMiniGame
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
</summary>
|
||||
<param name="inStatName">性能指标名称</param>
|
||||
<param name="inStatCategory">性能指标类别</param>
|
||||
<param name="inStatInterpType">性能指标展示方式,1. 线性插值;2. Step插值;0. 只显示单一值</param>
|
||||
<param name="inStatInterpType">性能指标展示方式,0. 不插值. 1. 线性插值;2. Step插值;</param>
|
||||
</member>
|
||||
<member name="M:WXSDKPerf.WXPerfEngine_Implementation.SetCustomStatInfo(System.String,System.Single)">
|
||||
<summary>
|
||||
|
||||
Binary file not shown.
@ -193,14 +193,31 @@
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXCanvas.ToTempFilePathSync(WeChatWASM.WXToTempFilePathSyncParam)">
|
||||
<summary>
|
||||
同步的将当前 Canvas 保存为一个临时文件
|
||||
同步的将当前 SharedCanvas(开放数据域) 截屏保存为一个临时文件
|
||||
华为机型分享有已知bug,推荐使用异步版本
|
||||
</summary>
|
||||
<returns>canvas 生成的临时文件路径 (本地路径)</returns>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXCanvas.ToTempFilePath(WeChatWASM.WXToTempFilePathParam)">
|
||||
<summary>
|
||||
异步的将当前 Canvas 保存为一个临时文件
|
||||
异步的将当前 SharedCanvas(开放数据域) 截图保存为一个临时文件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WeChatWASM.WXSharedCanvas">
|
||||
<summary>
|
||||
开放数据域的sharedCanvas
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXSharedCanvas.ToTempFilePathSync(WeChatWASM.WXToTempFilePathSyncParam)">
|
||||
<summary>
|
||||
同步的将当前 SharedCanvas(开放数据域) 保存为一个临时文件
|
||||
华为机型分享有已知bug,推荐使用异步版本
|
||||
</summary>
|
||||
<returns>canvas 生成的临时文件路径 (本地路径)</returns>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXSharedCanvas.ToTempFilePath(WeChatWASM.WXToTempFilePathParam)">
|
||||
<summary>
|
||||
异步的将当前 SharedCanvas(开放数据域) 保存为一个临时文件
|
||||
</summary>
|
||||
</member>
|
||||
<!-- Badly formed XML comment ignored for member "T:WeChatWASM.WXChat" -->
|
||||
@ -3107,6 +3124,26 @@
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.ReserveChannelsLiveOption.noticeId">
|
||||
<summary>
|
||||
预告 id,通过 getChannelsLiveNoticeInfo 接口获取
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.complete">
|
||||
<summary>
|
||||
接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.fail">
|
||||
<summary>
|
||||
接口调用失败的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.success">
|
||||
<summary>
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.AccountInfo.miniProgram">
|
||||
<summary>
|
||||
小程序账号信息
|
||||
@ -8574,11 +8611,6 @@
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.ReserveChannelsLiveOption.noticeId">
|
||||
<summary>
|
||||
预告 id,通过 getChannelsLiveNoticeInfo 接口获取
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.RestartMiniProgramOption.complete">
|
||||
<summary>
|
||||
接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e433b3740527c2a62e32be2cb3642757
|
||||
guid: 7a86865669cf8962db73b80475f73340
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
@ -199,14 +199,31 @@
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXCanvas.ToTempFilePathSync(WeChatWASM.WXToTempFilePathSyncParam)">
|
||||
<summary>
|
||||
同步的将当前 Canvas 保存为一个临时文件
|
||||
同步的将当前 SharedCanvas(开放数据域) 截屏保存为一个临时文件
|
||||
华为机型分享有已知bug,推荐使用异步版本
|
||||
</summary>
|
||||
<returns>canvas 生成的临时文件路径 (本地路径)</returns>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXCanvas.ToTempFilePath(WeChatWASM.WXToTempFilePathParam)">
|
||||
<summary>
|
||||
异步的将当前 Canvas 保存为一个临时文件
|
||||
异步的将当前 SharedCanvas(开放数据域) 截图保存为一个临时文件
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:WeChatWASM.WXSharedCanvas">
|
||||
<summary>
|
||||
开放数据域的sharedCanvas
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXSharedCanvas.ToTempFilePathSync(WeChatWASM.WXToTempFilePathSyncParam)">
|
||||
<summary>
|
||||
同步的将当前 SharedCanvas(开放数据域) 保存为一个临时文件
|
||||
华为机型分享有已知bug,推荐使用异步版本
|
||||
</summary>
|
||||
<returns>canvas 生成的临时文件路径 (本地路径)</returns>
|
||||
</member>
|
||||
<member name="M:WeChatWASM.WXSharedCanvas.ToTempFilePath(WeChatWASM.WXToTempFilePathParam)">
|
||||
<summary>
|
||||
异步的将当前 SharedCanvas(开放数据域) 保存为一个临时文件
|
||||
</summary>
|
||||
</member>
|
||||
<!-- Badly formed XML comment ignored for member "T:WeChatWASM.WXChat" -->
|
||||
@ -3113,6 +3130,26 @@
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.ReserveChannelsLiveOption.noticeId">
|
||||
<summary>
|
||||
预告 id,通过 getChannelsLiveNoticeInfo 接口获取
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.complete">
|
||||
<summary>
|
||||
接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.fail">
|
||||
<summary>
|
||||
接口调用失败的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.ReserveChannelsLiveOption.success">
|
||||
<summary>
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.AccountInfo.miniProgram">
|
||||
<summary>
|
||||
小程序账号信息
|
||||
@ -8580,11 +8617,6 @@
|
||||
接口调用成功的回调函数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:WeChatWASM.ReserveChannelsLiveOption.noticeId">
|
||||
<summary>
|
||||
预告 id,通过 getChannelsLiveNoticeInfo 接口获取
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:WeChatWASM.RestartMiniProgramOption.complete">
|
||||
<summary>
|
||||
接口调用结束的回调函数(调用成功、失败都会执行)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aafa0abf815bb0845a4166c5f523605c
|
||||
guid: 73f0f5fde7193ea9d6786ceb70926356
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
170
Runtime/WX.cs
170
Runtime/WX.cs
@ -278,7 +278,7 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.exitMiniProgram(Object object)](https://developers.weixin.qq.com/minigame/dev/api/navigate/wx.exitMiniProgram.html)
|
||||
/// 需要基础库: `2.17.3`
|
||||
/// 退出当前小程序。必须有点击行为才能调用成功。
|
||||
/// 退出当前小程序
|
||||
/// </summary>
|
||||
public static void ExitMiniProgram(ExitMiniProgramOption callback)
|
||||
{
|
||||
@ -628,7 +628,7 @@ namespace WeChatWASM
|
||||
/// **encryptedData 解密后得到的 GameClubData 的结构**
|
||||
/// | 属性 | 类型 | 说明 |
|
||||
/// | ------- | ------- | -------------------------------------- |
|
||||
/// | dataList | Array<GameClubDataByType> | 游戏圈相关数据的对象数组 |
|
||||
/// | dataList | Array\<GameClubDataByType\> | 游戏圈相关数据的对象数组 |
|
||||
/// **GameClubDataByType 的结构**
|
||||
/// | 属性 | 类型 | 说明 |
|
||||
/// | ------- |------- | -------------------------------------- |
|
||||
@ -737,9 +737,6 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.getPhoneNumber(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/user-info/wx.getPhoneNumber.html)
|
||||
/// 手机号快速验证,向用户申请,并在用户同意后,快速填写和验证手机 [具体说明](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/getPhoneNumber.html)
|
||||
/// ****
|
||||
/// ## 注意事项
|
||||
/// - 用户点击后才可进行调用
|
||||
/// </summary>
|
||||
public static void GetPhoneNumber(GetPhoneNumberOption callback)
|
||||
{
|
||||
@ -790,10 +787,11 @@ namespace WeChatWASM
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// wx.getScreenRecordingState({
|
||||
/// success: function (res) {
|
||||
/// console.log(res.state)
|
||||
/// },
|
||||
/// success: function (res) {
|
||||
/// console.log(res.state)
|
||||
/// },
|
||||
/// })
|
||||
/// ```
|
||||
/// </summary>
|
||||
public static void GetScreenRecordingState(GetScreenRecordingStateOption callback)
|
||||
{
|
||||
@ -1364,7 +1362,7 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.openCustomerServiceChat(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/service-chat/wx.openCustomerServiceChat.html)
|
||||
/// 需要基础库: `2.30.4`
|
||||
/// 打开微信客服,页面产生点击事件(例如 button 上 bindtap 的回调中)后才可调用。了解更多信息,可以参考[微信客服介绍](https://work.weixin.qq.com/kf/)。
|
||||
/// 打开微信客服,页面产生点击事件后才可调用。了解更多信息,可以参考[微信客服介绍](https://work.weixin.qq.com/kf/)。
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// wx.openCustomerServiceChat({
|
||||
@ -1382,7 +1380,7 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.openCustomerServiceConversation(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/customer-message/wx.openCustomerServiceConversation.html)
|
||||
/// 需要基础库: `2.0.3`
|
||||
/// 进入客服会话。要求在用户发生过至少一次 touch 事件后才能调用。后台接入方式与小程序一致,详见 [客服消息接入](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/customer-message/customer-message.html)
|
||||
/// 进入客服会话。要求在用户发生过至少一次 touch 事件后才能调用。后台接入方式与小程序一致,详见 [客服消息接入](#)
|
||||
/// **注意事项**
|
||||
/// - 在客服会话内点击小程序消息卡片进入小程序时,不能通过 wx.onShow 或 wx.getEnterOptionsSync 等接口获取启动路径和参数,而是应该通过 wx.openCustomerServiceConversation 接口的 success 回调获取启动路径和参数
|
||||
/// </summary>
|
||||
@ -1455,6 +1453,16 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.OpenSystemBluetoothSetting(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.operateGameRecorderVideo(Object object)](https://developers.weixin.qq.com/minigame/dev/api/game-recorder/wx.operateGameRecorderVideo.html)
|
||||
/// 需要基础库: `2.26.1`
|
||||
/// 分享游戏对局回放。安卓微信8.0.28开始支持,iOS微信8.0.30开始支持。
|
||||
/// </summary>
|
||||
public static void OperateGameRecorderVideo(OperateGameRecorderVideoOption callback)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OperateGameRecorderVideo(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.previewImage(Object object)](https://developers.weixin.qq.com/minigame/dev/api/media/image/wx.previewImage.html)
|
||||
/// 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
||||
@ -1738,7 +1746,6 @@ namespace WeChatWASM
|
||||
/// 需要基础库: `2.9.4`
|
||||
/// 调起小游戏系统订阅消息界面,返回用户订阅消息的操作结果。当用户勾选了订阅面板中的“总是保持以上选择,不再询问”时,模板消息会被添加到用户的小游戏设置页,通过 [wx.getSetting](https://developers.weixin.qq.com/minigame/dev/api/open-api/setting/wx.getSetting.html) 接口可获取用户对相关模板消息的订阅状态。
|
||||
/// ## 注意事项
|
||||
/// - 需要在 touchend 事件的回调中调用。
|
||||
/// - 使用前建议阅读 [小游戏系统订阅消息使用指引](https://developers.weixin.qq.com/minigame/dev/guide/open-ability/subscribe-system-message.html)。
|
||||
/// - 系统订阅消息只需要订阅一次,永久有效。
|
||||
/// **错误码**
|
||||
@ -2135,7 +2142,7 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.showShareMenu(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.showShareMenu.html)
|
||||
/// 需要基础库: `1.1.0`
|
||||
/// 显示当前页面的转发按钮
|
||||
/// 设置右上角点开的详情界面中的分享按钮是否可用
|
||||
/// ****
|
||||
/// ## 注意事项
|
||||
/// - "shareAppMessage"表示“发送给朋友”按钮,"shareTimeline"表示“分享到朋友圈”按钮
|
||||
@ -2550,16 +2557,6 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.ExitPointerLock();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.operateGameRecorderVideo(Object object)](https://developers.weixin.qq.com/minigame/dev/api/game-recorder/wx.operateGameRecorderVideo.html)
|
||||
/// 需要基础库: `2.26.1`
|
||||
/// 分享游戏对局回放。安卓微信8.0.28开始支持,iOS微信8.0.30开始支持。
|
||||
/// </summary>
|
||||
public static void OperateGameRecorderVideo(OperateGameRecorderVideoOption option)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OperateGameRecorderVideo(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.removeStorageSync(string key)](https://developers.weixin.qq.com/minigame/dev/api/storage/wx.removeStorageSync.html)
|
||||
/// [wx.removeStorage](https://developers.weixin.qq.com/minigame/dev/api/storage/wx.removeStorage.html) 的同步版本
|
||||
@ -2613,7 +2610,7 @@ namespace WeChatWASM
|
||||
/// <summary>
|
||||
/// [wx.reportUserBehaviorBranchAnalytics(Object object)](https://developers.weixin.qq.com/minigame/dev/api/data-analysis/wx.reportUserBehaviorBranchAnalytics.html)
|
||||
/// 需要基础库: `2.12.0`
|
||||
/// 用于分支相关的UI组件(一般是按钮)相关事件的上报,事件目前有曝光、点击两种
|
||||
/// 上报场景分析,用于UI组件(一般是按钮)相关事件的上报,事件目前有曝光、点击两种,查看[相关文档](https://developers.weixin.qq.com/minigame/analysis/selfanalysis.html)
|
||||
/// </summary>
|
||||
public static void ReportUserBehaviorBranchAnalytics(ReportUserBehaviorBranchAnalyticsOption option)
|
||||
{
|
||||
@ -2624,13 +2621,13 @@ namespace WeChatWASM
|
||||
/// [wx.requestPointerLock()](https://developers.weixin.qq.com/minigame/dev/api/render/cursor/wx.requestPointerLock.html)
|
||||
/// 需要基础库: `3.2.0`
|
||||
/// 锁定鼠标指针。锁定指针后,鼠标会被隐藏,可以通过 [wx.touchMove](#) 事件获取鼠标偏移量。 **此接口仅在 Windows、Mac 端支持,且必须在用户进行操作后才可调用。**
|
||||
/// **示例代码</title>
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// wx.onTouchEnd(() => {
|
||||
/// wx.requestPointerLock() // 触发鼠标锁定
|
||||
/// })
|
||||
/// ```
|
||||
/// <title>示例 demo**
|
||||
/// **示例 demo**
|
||||
/// 下方打开后点按窗口会鼠标锁定,同时会在 touchMove 时持续在控制台打印偏移量。
|
||||
/// [https://developers.weixin.qq.com/s/wGruMHm97tMF](https://developers.weixin.qq.com/s/wGruMHm97tMF)
|
||||
/// </summary>
|
||||
@ -2639,16 +2636,6 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.RequestPointerLock();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.reserveChannelsLive(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/channels/wx.reserveChannelsLive.html)
|
||||
/// 需要基础库: `2.19.0`
|
||||
/// 预约视频号直播
|
||||
/// </summary>
|
||||
public static void ReserveChannelsLive(ReserveChannelsLiveOption option)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.ReserveChannelsLive(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.revokeBufferURL(string url)](https://developers.weixin.qq.com/minigame/dev/api/storage/wx.revokeBufferURL.html)
|
||||
/// 需要基础库: `2.14.0`
|
||||
@ -2994,6 +2981,36 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.OffError(error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.onGamepadConnected(function listener)](https://developers.weixin.qq.com/minigame/dev/api/device/gamepad/wx.onGamepadConnected.html)
|
||||
/// 需要基础库: `3.6.4`
|
||||
/// 监听用户已连接游戏手柄的事件。
|
||||
/// </summary>
|
||||
public static void OnGamepadConnected(Action<OnGamepadConnectedListenerResult> result)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OnGamepadConnected(result);
|
||||
}
|
||||
|
||||
public static void OffGamepadConnected(Action<OnGamepadConnectedListenerResult> result)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OffGamepadConnected(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.onGamepadDisconnected(function listener)](https://developers.weixin.qq.com/minigame/dev/api/device/gamepad/wx.onGamepadDisconnected.html)
|
||||
/// 需要基础库: `3.6.4`
|
||||
/// 监听用户断开游戏手柄的事件。
|
||||
/// </summary>
|
||||
public static void OnGamepadDisconnected(Action<OnGamepadDisconnectedListenerResult> result)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OnGamepadDisconnected(result);
|
||||
}
|
||||
|
||||
public static void OffGamepadDisconnected(Action<OnGamepadDisconnectedListenerResult> result)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OffGamepadDisconnected(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.onHide(function listener)](https://developers.weixin.qq.com/minigame/dev/api/base/app/life-cycle/wx.onHide.html)
|
||||
/// 监听小游戏隐藏到后台事件。锁屏、按 HOME 键退到桌面、显示在聊天顶部等操作会触发此事件。
|
||||
@ -3055,7 +3072,7 @@ namespace WeChatWASM
|
||||
|
||||
/// <summary>
|
||||
/// [wx.onKeyboardComplete(function listener)](https://developers.weixin.qq.com/minigame/dev/api/device/keyboard/wx.onKeyboardComplete.html)
|
||||
/// 监听监听键盘收起的事件
|
||||
/// 监听键盘收起的事件
|
||||
/// </summary>
|
||||
public static void OnKeyboardComplete(Action<OnKeyboardInputListenerResult> result)
|
||||
{
|
||||
@ -3124,9 +3141,9 @@ namespace WeChatWASM
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// wx.onMemoryWarning(function () {
|
||||
/// console.log('onMemoryWarningReceive')
|
||||
/// console.log('onMemoryWarningReceive')
|
||||
/// })
|
||||
/// ``
|
||||
/// ```
|
||||
/// </summary>
|
||||
public static void OnMemoryWarning(Action<OnMemoryWarningListenerResult> result)
|
||||
{
|
||||
@ -3283,6 +3300,10 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.OnShareMessageToFriend(result);
|
||||
}
|
||||
|
||||
public static void OffShareMessageToFriend(Action<OnShareMessageToFriendListenerResult> result)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.OffShareMessageToFriend(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [wx.onShow(function listener)](https://developers.weixin.qq.com/minigame/dev/api/base/app/life-cycle/wx.onShow.html)
|
||||
@ -3512,6 +3533,24 @@ namespace WeChatWASM
|
||||
WXSDKManagerHandler.Instance.OffGameLiveStateChange(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Array.<Object> wx.getGamepads()](https://developers.weixin.qq.com/minigame/dev/api/device/gamepad/wx.getGamepads.html)
|
||||
/// 需要基础库: `3.6.4`
|
||||
/// 获取已连接的游戏手柄信息,仅在 PC 平台支持。
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// const gamepads = wx.getGamepads();
|
||||
/// console.log(gamepads);
|
||||
/// ```
|
||||
/// **示例代码片段**
|
||||
/// [在微信开发者工具中查看示例](https://developers.weixin.qq.com/s/6al1r2m17oV6)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string[] GetGamepads()
|
||||
{
|
||||
return WXSDKManagerHandler.GetGamepads();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [Boolean wx.setHandoffQuery(String query)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.setHandoffQuery.html)
|
||||
/// 需要基础库: `2.14.4`
|
||||
@ -3520,7 +3559,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool SetHandoffQuery(string query)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.SetHandoffQuery(query);
|
||||
return WXSDKManagerHandler.SetHandoffQuery(query);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3538,7 +3577,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AccountInfo GetAccountInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAccountInfoSync();
|
||||
return WXSDKManagerHandler.GetAccountInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3568,7 +3607,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AppAuthorizeSetting GetAppAuthorizeSetting()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAppAuthorizeSetting();
|
||||
return WXSDKManagerHandler.GetAppAuthorizeSetting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3589,7 +3628,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AppBaseInfo GetAppBaseInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAppBaseInfo();
|
||||
return WXSDKManagerHandler.GetAppBaseInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3599,7 +3638,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GetBatteryInfoSyncResult GetBatteryInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetBatteryInfoSync();
|
||||
return WXSDKManagerHandler.GetBatteryInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3620,7 +3659,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static DeviceInfo GetDeviceInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetDeviceInfo();
|
||||
return WXSDKManagerHandler.GetDeviceInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3652,7 +3691,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static EnterOptionsGame GetEnterOptionsSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetEnterOptionsSync();
|
||||
return WXSDKManagerHandler.GetEnterOptionsSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3667,7 +3706,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static T GetExptInfoSync<T>(string[] keys)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetExptInfoSync<T>(keys);
|
||||
return WXSDKManagerHandler.GetExptInfoSync<T>(keys);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3685,7 +3724,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static T GetExtConfigSync<T>()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetExtConfigSync<T>();
|
||||
return WXSDKManagerHandler.GetExtConfigSync<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3707,7 +3746,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static LaunchOptionsGame GetLaunchOptionsSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetLaunchOptionsSync();
|
||||
return WXSDKManagerHandler.GetLaunchOptionsSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3728,7 +3767,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static ClientRect GetMenuButtonBoundingClientRect()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetMenuButtonBoundingClientRect();
|
||||
return WXSDKManagerHandler.GetMenuButtonBoundingClientRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3758,7 +3797,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GetStorageInfoSyncOption GetStorageInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetStorageInfoSync();
|
||||
return WXSDKManagerHandler.GetStorageInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3767,7 +3806,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static SystemInfo GetSystemInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetSystemInfoSync();
|
||||
return WXSDKManagerHandler.GetSystemInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3786,7 +3825,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static SystemSetting GetSystemSetting()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetSystemSetting();
|
||||
return WXSDKManagerHandler.GetSystemSetting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3809,7 +3848,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static WindowInfo GetWindowInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetWindowInfo();
|
||||
return WXSDKManagerHandler.GetWindowInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3825,7 +3864,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static ImageData CreateImageData(double width, double height)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.CreateImageData(width, height);
|
||||
return WXSDKManagerHandler.CreateImageData(width, height);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3836,7 +3875,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static Path2D CreatePath2D()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.CreatePath2D();
|
||||
return WXSDKManagerHandler.CreatePath2D();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3847,7 +3886,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool IsPointerLocked()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.IsPointerLocked();
|
||||
return WXSDKManagerHandler.IsPointerLocked();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3862,7 +3901,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool IsVKSupport(string version)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.IsVKSupport(version);
|
||||
return WXSDKManagerHandler.IsVKSupport(version);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3876,16 +3915,16 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool SetCursor(string path, double x, double y)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.SetCursor(path, x, y);
|
||||
return WXSDKManagerHandler.SetCursor(path, x, y);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// [boolean wx.setMessageToFriendQuery(Object object)](https://developers.weixin.qq.com/minigame/dev/api/share/wx.setMessageToFriendQuery.html)
|
||||
/// 设置 wx.shareMessageToFriend 接口 query 字段的值
|
||||
/// **提示</title>
|
||||
/// **提示**
|
||||
/// 1. 此处的 query 参数与 wx.onShow 取到的启动查询参数 query 不是同一个概念,仅仅是启动查询参数会增加一个字段为 query。
|
||||
/// 2. query 参数如涉及 "?"和"&" 等特殊符号,需自行进行 encodeURIComponent 和 decodeURIComponent 等操作。
|
||||
/// <title>示例代码</title>
|
||||
/// **示例代码**
|
||||
/// ```js
|
||||
/// // 发送方
|
||||
/// wx.setMessageToFriendQuery({
|
||||
@ -3895,7 +3934,8 @@ namespace WeChatWASM
|
||||
/// // 预期接收方可以通过以下方式拿到设置
|
||||
/// wx.getEnterOptionsSync().query.shareMessageToFriendScene // 1
|
||||
/// wx.getEnterOptionsSync().query.query // 'testquery'
|
||||
/// <title>示例代码-特殊字符query**
|
||||
/// ```
|
||||
/// **示例代码-特殊字符query**
|
||||
/// ```js
|
||||
/// // 发送方
|
||||
/// wx.setMessageToFriendQuery({
|
||||
@ -3910,7 +3950,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool SetMessageToFriendQuery(SetMessageToFriendQueryOption option)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.SetMessageToFriendQuery(option);
|
||||
return WXSDKManagerHandler.SetMessageToFriendQuery(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3920,7 +3960,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static double GetTextLineHeight(GetTextLineHeightOption option)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetTextLineHeight(option);
|
||||
return WXSDKManagerHandler.GetTextLineHeight(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3930,7 +3970,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static string LoadFont(string path)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.LoadFont(path);
|
||||
return WXSDKManagerHandler.LoadFont(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3939,7 +3979,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GameLiveState GetGameLiveState()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetGameLiveState();
|
||||
return WXSDKManagerHandler.GetGameLiveState();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -446,9 +446,9 @@ namespace WeChatWASM
|
||||
/// 获取开放数据域,关系链相关可以参看 https://developers.weixin.qq.com/minigame/dev/guide/open-ability/open-data.html
|
||||
/// </summary>
|
||||
/// <returns>开放数据域对象</returns>
|
||||
public static WXOpenDataContext GetOpenDataContext()
|
||||
public static WXOpenDataContext GetOpenDataContext(OpenDataContextOption option = null)
|
||||
{
|
||||
return new WXOpenDataContext();
|
||||
return new WXOpenDataContext(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -1106,6 +1106,17 @@ namespace WeChatWASM
|
||||
{
|
||||
return WXSDKManagerHandler.CallJSFunctionWithReturn(sdkName, functionName, args);
|
||||
}
|
||||
|
||||
// TODO: 声明错误临时处理
|
||||
/// <summary>
|
||||
/// [wx.reserveChannelsLive(Object object)](https://developers.weixin.qq.com/minigame/dev/api/open-api/channels/wx.reserveChannelsLive.html)
|
||||
/// 需要基础库: `2.19.0`
|
||||
/// 预约视频号直播
|
||||
/// </summary>
|
||||
public static void ReserveChannelsLive(ReserveChannelsLiveOption option)
|
||||
{
|
||||
WXSDKManagerHandler.Instance.ReserveChannelsLive(option);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -264,9 +264,9 @@ public class WXProfileStatsScript : MonoBehaviour, WeChatWASM.WXSDKManagerHandle
|
||||
m_fpsCount++;
|
||||
m_fpsDeltaTime += Time.deltaTime;
|
||||
|
||||
if (m_fpsCount % 60 == 0)
|
||||
if (m_fpsCount % 60 == 0 && m_fpsDeltaTime != 0.0f)
|
||||
{
|
||||
m_fpsCount = 1;
|
||||
m_fpsCount = 0;
|
||||
fps = (int)Mathf.Ceil(60.0f / m_fpsDeltaTime);
|
||||
m_fpsDeltaTime = 0;
|
||||
}
|
||||
|
||||
@ -89,6 +89,11 @@ namespace WeChatWASM
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", false);
|
||||
#endif
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", true);
|
||||
#else
|
||||
WXRuntimeExtEnvDef.SETDEF("UNITY_6000_0_OR_NEWER", false);
|
||||
#endif
|
||||
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", true);
|
||||
|
||||
@ -34,7 +34,14 @@ namespace WXSDKPerf
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// This method is used to add an annotation to the performance data.
|
||||
/// The annotation string is uploaded to the server along with the current frame ID.
|
||||
/// </summary>
|
||||
/// <param name="InAnnotationString">The annotation string to be added. It should not be null or empty.</param>
|
||||
/// <remarks>
|
||||
/// If the provided annotation string is null or empty, an error message will be logged.
|
||||
/// </remarks>
|
||||
public static void Annotation(string InAnnotationString)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
@ -53,7 +60,20 @@ namespace WXSDKPerf
|
||||
|
||||
m_PerfEngineImplementation.Annotation(InAnnotationString);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查是否正在录制性能数据
|
||||
/// </summary>
|
||||
/// <returns>如果正在录制返回true,否则返回false</returns>
|
||||
public static bool IsRecording()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return false;
|
||||
#else
|
||||
return m_PerfEngineImplementation != null && m_PerfEngineImplementation.IsRecording();
|
||||
#endif
|
||||
}
|
||||
|
||||
private static void TakeAndUploadUnityMemorySnapshot()
|
||||
@ -75,7 +95,11 @@ namespace WXSDKPerf
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 指定luaState
|
||||
/// </summary>
|
||||
/// <param name="L">luaState</param>
|
||||
public static void SetLuaState(IntPtr L)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
@ -90,8 +114,116 @@ namespace WXSDKPerf
|
||||
m_PerfEngineImplementation.SetLuaState(L);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 声明自定义性能指标
|
||||
/// </summary>
|
||||
/// <param name="inStatName">性能指标名称</param>
|
||||
/// <param name="inStatCategory">性能指标类别</param>
|
||||
/// <param name="inStatInterpType">性能指标展示方式,0. 不插值. 1. 线性插值;2. Step插值;</param>
|
||||
public static void DeclareCustomStatInfo(string inStatName, string inStatCategory, int inStatInterpType = 1)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
if (m_PerfEngineImplementation == null)
|
||||
{
|
||||
UnityEngine.Debug.LogError("DeclareCustomStatInfo: Invalid m_PerfEngineImplementation! ");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PerfEngineImplementation.DeclareCustomStatInfo(inStatName, inStatCategory, inStatInterpType);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置自定义性能指标,目前只支持浮点数
|
||||
/// 若该指标未通过DeclareCustomStatInfo进行类别的声明,则将被归为默认自定义类别,以及使用默认线性插值
|
||||
/// </summary>
|
||||
/// <param name="inStatName">性能指标名称</param>
|
||||
/// <param name="inValue">性能指标数值</param>
|
||||
public static void SetCustomStatValue(string inStatName, float inValue)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
if (m_PerfEngineImplementation == null)
|
||||
{
|
||||
UnityEngine.Debug.LogError("SetCustomStatInfo: Invalid m_PerfEngineImplementation! ");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PerfEngineImplementation.SetCustomStatInfo(inStatName, inValue);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// 在自定义性能指标值的基础上增加一段数值。
|
||||
/// 如果未进行指标声明,将自动声明该指标,该指标将出现在报告的“Project Default Stat Category”中
|
||||
/// </summary>
|
||||
/// <param name="inStatName">性能指标名称</param>
|
||||
/// <param name="inValue">性能指标数值</param>
|
||||
public static void AddCustomStatInfoBy(string inStatName, float inValue)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
if (m_PerfEngineImplementation == null)
|
||||
{
|
||||
UnityEngine.Debug.LogError("AddCustomStatInfoBy: Invalid m_PerfEngineImplementation! ");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PerfEngineImplementation.AddCustomStatInfoBy(inStatName, inValue);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 手动开始记录
|
||||
/// </summary>
|
||||
/// <param name="inEnableStackTrace">是否启用堆栈跟踪</param>
|
||||
/// <param name="inEnableStatInfo">是否启用统计信息</param>
|
||||
/// <param name="inFrequentScreenShot">是否频繁截图</param>
|
||||
/// <param name="inEnablebRenderInst">是否记录渲染指令</param>
|
||||
/// <param name="inEnableCaptureResource">是否启用资源捕获</param>
|
||||
/// <param name="inEnableLuaMemoryMonitor">是否启用Lua内存监控</param>
|
||||
/// <param name="inEnableLuaFunctionMemoryTracking">是否启用Lua函数内存跟踪</param>
|
||||
public static void StartRecordManually(bool inEnableStackTrace, bool inEnableStatInfo, bool inFrequentScreenShot, bool inEnablebRenderInst,
|
||||
bool inEnableCaptureResource, bool inEnableLuaMemoryMonitor, bool inEnableLuaFunctionMemoryTracking)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
if (m_PerfEngineImplementation == null)
|
||||
{
|
||||
UnityEngine.Debug.LogError("StartRecordManually: Invalid m_PerfEngineImplementation! ");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PerfEngineImplementation.StartRecordManually(inEnableStackTrace, inEnableStatInfo, inFrequentScreenShot, inEnablebRenderInst,
|
||||
inEnableCaptureResource, inEnableLuaMemoryMonitor, inEnableLuaFunctionMemoryTracking);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动停止记录
|
||||
/// </summary>
|
||||
public static void StopRecordManually()
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return;
|
||||
#else
|
||||
if (m_PerfEngineImplementation == null)
|
||||
{
|
||||
UnityEngine.Debug.LogError("StartRecordManually: Invalid m_PerfEngineImplementation! ");
|
||||
return;
|
||||
}
|
||||
|
||||
m_PerfEngineImplementation.StopRecordManually();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ public class WXTouchInputOverride : BaseInput
|
||||
{
|
||||
base.OnEnable();
|
||||
#if UNITY_WEBGL && !UNITY_EDITOR
|
||||
if (string.IsNullOrEmpty(WeChatWASM.WX.GetDeviceInfo().platform)) return;
|
||||
if (string.IsNullOrEmpty(WeChatWASM.WX.GetSystemInfoSync().platform)) return;
|
||||
InitWechatTouchEvents();
|
||||
if (_standaloneInputModule)
|
||||
{
|
||||
@ -144,7 +144,30 @@ public class WXTouchInputOverride : BaseInput
|
||||
button.onClick.Invoke();
|
||||
button.onClick.SetPersistentListenerState(0, UnityEventCallState.Off);
|
||||
}
|
||||
}
|
||||
#if !UNITY_EDITOR
|
||||
Text text = selectedObject.GetComponent<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = true;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = true;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = false;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = false;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable no-multi-assign */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
const { version, SDKVersion } = wx.getAppBaseInfo();
|
||||
const { platform, system } = wx.getDeviceInfo();
|
||||
const { version, SDKVersion } = wx.getAppBaseInfo ? wx.getAppBaseInfo() : wx.getSystemInfoSync();
|
||||
const { platform, system } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
|
||||
const accountInfo = wx.getAccountInfoSync();
|
||||
const envVersion = accountInfo?.miniProgram?.envVersion;
|
||||
function compareVersion(v1, v2) {
|
||||
@ -17,6 +17,7 @@ function compareVersion(v1, v2) {
|
||||
.map(v => v.padStart(2, '0'))
|
||||
.join(''));
|
||||
}
|
||||
export const isDebug = false;
|
||||
export const isPc = platform === 'windows' || platform === 'mac';
|
||||
export const isIOS = platform === 'ios';
|
||||
export const isAndroid = platform === 'android';
|
||||
@ -63,7 +64,9 @@ const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1');
|
||||
// @ts-ignore
|
||||
const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid);
|
||||
// iOS系统版本>=17.5时,小游戏退后台会导致异常
|
||||
export const isIOS175 = compareVersion(systemVersion, '17.5') || isH5Renderer;
|
||||
export const isIOS175 = compareVersion(systemVersion, '17.5') && isH5Renderer;
|
||||
// 是否支持开放数据域渲染模式,使用ScreenCanvas模式可以优化ToTempFilePath的使用
|
||||
export const isSupportSharedCanvasMode = compareVersion(SDKVersion, '3.6.6');
|
||||
// 是否能以iOS高性能模式运行
|
||||
// 请勿修改GameGlobal.canUseH5Renderer赋值!!!
|
||||
GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ae20ea906e2a2be4a56e281bb00457a0
|
||||
guid: fe0bcf83e5927674a4a4198b13d502ad
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d44e34cd3ca3b2196e3bde9a91d17af5
|
||||
guid: 89da7514871218aac104ffcde6677d85
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ef14169da4b9ee5ea8193cb7b0aa17b
|
||||
guid: 06ec53b2d71a903129af210e7952c6d8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: abf2c8555e627babf06e35475f6ac7e1
|
||||
guid: a82792729d9f0f9812f8d360d55162bb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
],
|
||||
"plugins": {
|
||||
"UnityPlugin": {
|
||||
"version": "1.2.63",
|
||||
"version": "1.2.65",
|
||||
"provider": "wxe5a48f1ed5f544b7",
|
||||
"contexts": [
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f92a7defc2de54557688c48cfd6187a
|
||||
guid: bd94565b5f5f0c6f754c6fdf1e2f3f46
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 208a3d3b035439598cebd18db371ed31
|
||||
guid: 4fc440f3412e2458bf66719ae1d60924
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 040074cce8dcc4e7c914018c9d32e7e3
|
||||
guid: 5e75a0e04ac04517c16a8471b07c81e5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1384bc8cbbdeaedcc89a37b546ab6956
|
||||
guid: 52354d70a9efb4918dadbaab89605663
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22bceeda40fc20a2574640172bb5ee2c
|
||||
guid: f29feeb91e62e414a8c436059dc204f3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea26f1397a46231b336029635611c91d
|
||||
guid: b4068dcde906e960877018e073ed37ac
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 233b6f50c7b41bd0b43fb110d26d60e7
|
||||
guid: 48988177116c69c2b1e5efc5b9316299
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c89770e6eb650a852c2ede0d95a18ba2
|
||||
guid: ead859e2530842e680b7b013918eb849
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a8ccf87ca2e8b5533ff9c5943c0bd78e
|
||||
guid: 2e98cbff498d4e17791f38d542e0ff34
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a427c161f1a002c7d6205db1d25b4af2
|
||||
guid: 5ef3f0b6382e4ef978defdc6b96d1dad
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea0cac811524ccbcfe556550d3359416
|
||||
guid: 700f0e41d89e1bd39e81fcd907518b40
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 43c3f3df3658febd6f31815b5f8865e9
|
||||
guid: 1f1eabc1a223a4520e841735c6a6c597
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e3f33306a0f7712bbd5d9a00fb2803fc
|
||||
guid: 49ea2ada0b457c0991aeb39559886099
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dd96dbcc57d6fdabba37b6b0eaf7a73
|
||||
guid: e1fd3c58caaca70d86d1098a43a5bc10
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84f4c37b3d3f75af65a87cbae19f478a
|
||||
guid: 60e76236db56208a00ff86226f7a8910
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3e006600c6d7a534d0398dc3e064e616
|
||||
guid: 9c3732983037ca82075e610f2602e21a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d307099e356baa4d07d2767b0f2d52b
|
||||
guid: 0e94f7325962d5b14c97d84aeee56cc7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da16a73e2603b59c75d006937e366898
|
||||
guid: 581e44a63a9c7593d95a639a7526f016
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e73bfab43c8dadfb966f0c7c5a0d6a8
|
||||
guid: 97df967211e82448ccdfe83ee1a403d7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0afa943b1d7326b82e09ad11ee12ce1
|
||||
guid: 03a8004dfb12cca822f9b6abfc939bb5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5b5d5def2035bb5a6ba0fe31922c110f
|
||||
guid: 30f5b6fd4b64277ff72faea15cfd65c5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c8645a28cae8902edf5703237ca8b6af
|
||||
guid: 70dafc4543ef5e705c265c95284559a1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db36b24b6a7dbe9197be126b963c675c
|
||||
guid: a9ebf59502214c651ec435c855bd0c89
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ea4320007aa2db45535fcd3fedcc6e3f
|
||||
guid: 7782e956b2be6bb57afe9260238e2693
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 640d66690338eaecd8a7fb8318c12ed8
|
||||
guid: e3e0a09ed0d3a50696eea330cb6b1fcd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e039df48f6103eee9804da0dbf57680a
|
||||
guid: b50a86316eaac3d01beed54510c04bb5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -165,8 +165,8 @@ function bindGloblException() {
|
||||
GameGlobal.logmanager.info('game starting', bootinfo);
|
||||
console.info('game starting', bootinfo);
|
||||
}
|
||||
const appBaseInfo = wx.getAppBaseInfo();
|
||||
const deviceInfo = wx.getDeviceInfo();
|
||||
const appBaseInfo = wx.getAppBaseInfo ? wx.getAppBaseInfo() : wx.getSystemInfoSync();
|
||||
const deviceInfo = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
|
||||
printSystemInfo(appBaseInfo, deviceInfo);
|
||||
}
|
||||
bindGloblException();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9917ab127befc7ee177057e55d8f48a5
|
||||
guid: a47d28eb54d282c8f53feb05f758d5a7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -9,7 +9,7 @@ const wxTCPSocketMessageList = {};
|
||||
const getTCPSocketObject = getListObject(TCPSocketList, 'TCPSocket');
|
||||
let wxTCPSocketOnMessageCallback;
|
||||
function WX_CreateTCPSocket() {
|
||||
const obj = wx.createTCPSocket();
|
||||
const obj = wx.createTCPSocket({ type: 'IPv4' });
|
||||
const key = uid();
|
||||
TCPSocketList[key] = obj;
|
||||
return key;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 487cdf613f8cb752cbaca31e0d138de6
|
||||
guid: bfbeef2cd22dcd64e60e44d0a8fd5ddf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3da530387fb1faeecd13958909c406e0
|
||||
guid: 12b43839c796fac58c7d84c05abd0c66
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 198ad119d42105bf8716622dd232947a
|
||||
guid: b8475727c0402f86318adeb6fb238cbc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c642125e8cc4b90234ca12a935616295
|
||||
guid: c18c255df0aa5927af397234226f46f2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9139c53e73f708222b75ed3d06b5b598
|
||||
guid: 56b881ebf63d3dfc611a2a49fc5cf934
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b204482694e49e567887c4a911574bb
|
||||
guid: 840bf1578fb00b7bf77cff2f6c91ed61
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f21c4e5aa0f304c285728cb0c62de861
|
||||
guid: 8f92d7b25ccdc8a22bcbcc746f6c1db1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 543ffe10b513826c6454ef07dcc0df3a
|
||||
guid: 40795b00802a1b2d446be30f4b561132
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -5,6 +5,7 @@ import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayB
|
||||
import { WEBAudio, unityAudioVolume } from './store';
|
||||
import { TEMP_DIR_PATH } from './const';
|
||||
import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils';
|
||||
import { debugLog } from '../utils';
|
||||
|
||||
const defaultSoundLength = 441000;
|
||||
|
||||
@ -205,6 +206,7 @@ export class AudioChannelInstance {
|
||||
}
|
||||
}
|
||||
playUrl(startTime, url, startOffset, volume, soundClip) {
|
||||
debugLog('playUrl: ', url, startTime, startOffset, volume, soundClip);
|
||||
try {
|
||||
this.setup(url);
|
||||
if (!this.source || !this.source.mediaElement) {
|
||||
@ -238,6 +240,7 @@ export class AudioChannelInstance {
|
||||
}
|
||||
});
|
||||
this.source.mediaElement.onPause(() => {
|
||||
debugLog('onPause');
|
||||
if (typeof this.source !== 'undefined') {
|
||||
this.source.isPlaying = false;
|
||||
if (this.source.stopTicker) {
|
||||
@ -247,6 +250,7 @@ export class AudioChannelInstance {
|
||||
}
|
||||
});
|
||||
this.source.mediaElement.onStop(() => {
|
||||
debugLog('onStop');
|
||||
if (typeof this.source !== 'undefined') {
|
||||
if (this.source.playAfterStop) {
|
||||
this.source._reset();
|
||||
@ -263,6 +267,7 @@ export class AudioChannelInstance {
|
||||
}
|
||||
});
|
||||
this.source.mediaElement.onEnded(() => {
|
||||
debugLog('onEnded');
|
||||
if (typeof this.source !== 'undefined') {
|
||||
this.source._reset();
|
||||
this.disconnectSource();
|
||||
@ -272,6 +277,7 @@ export class AudioChannelInstance {
|
||||
}
|
||||
});
|
||||
this.source.mediaElement.onError((e) => {
|
||||
debugLog('onError', e);
|
||||
printErrMsg(e);
|
||||
const { errMsg } = e;
|
||||
|
||||
@ -350,6 +356,10 @@ export class AudioChannelInstance {
|
||||
disconnectSource() {
|
||||
if (this.source) {
|
||||
if (this.source.mediaElement) {
|
||||
if (this.source.stopTimeout) {
|
||||
clearTimeout(this.source.stopTimeout);
|
||||
delete this.source.stopTimeout;
|
||||
}
|
||||
destroyInnerAudio(this.source.instanceId, false);
|
||||
delete this.source.mediaElement;
|
||||
delete this.source;
|
||||
@ -669,6 +679,7 @@ export class AudioChannelInstance {
|
||||
if (startDelayMS > startDelayThresholdMS) {
|
||||
if (this.source.playTimeout) {
|
||||
clearTimeout(this.source.playTimeout);
|
||||
delete this.source.playTimeout;
|
||||
}
|
||||
this.source.playTimeout = setTimeout(() => {
|
||||
if (typeof this.source !== 'undefined') {
|
||||
@ -691,7 +702,11 @@ export class AudioChannelInstance {
|
||||
const stopDelayThresholdMS = 4;
|
||||
const stopDelayMS = stopTime * 1e3;
|
||||
if (stopDelayMS > stopDelayThresholdMS) {
|
||||
setTimeout(() => {
|
||||
if (this.source.stopTimeout) {
|
||||
clearTimeout(this.source.stopTimeout);
|
||||
delete this.source.stopTimeout;
|
||||
}
|
||||
this.source.stopTimeout = setTimeout(() => {
|
||||
if (this.source && this.source.mediaElement) {
|
||||
this.source.stopCache = true;
|
||||
this.source.mediaElement.stop();
|
||||
@ -964,6 +979,7 @@ export default {
|
||||
if (!WEBAudio.audioContext || WEBAudio.audioWebEnabled === 0) {
|
||||
return;
|
||||
}
|
||||
debugLog('_JS_Sound_Play', bufferInstance, channelInstance, offset, delay);
|
||||
WXWASMSDK._JS_Sound_Stop(channelInstance, 0);
|
||||
const soundClip = WEBAudio.audioInstances[bufferInstance];
|
||||
const channel = WEBAudio.audioInstances[channelInstance];
|
||||
@ -1160,6 +1176,7 @@ export default {
|
||||
if (WEBAudio.audioWebEnabled === 0) {
|
||||
return;
|
||||
}
|
||||
debugLog('_JS_Sound_Stop', channelInstance, delay);
|
||||
const channel = WEBAudio.audioInstances[channelInstance];
|
||||
channel.stop(delay);
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d5c8a36b05857d2fcfd0c13740f4714
|
||||
guid: d7517ecb8615c16170baf69c20c427ea
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e393ecc07f19956dbfd38a0c598a452e
|
||||
guid: a15fa9ada1385c3fada61234b9afdbe1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a39adf312ac62efae5555f371967bf8
|
||||
guid: f1cff63b9114265cb33cb295334e7517
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4378daad6e70739b33257ff7765e2751
|
||||
guid: 7398d524c42b08ddda808ef1b7003dc3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e6d0e1924f5c5161d30ce3de9501f731
|
||||
guid: 39569b07e98122a75f063486aff59dec
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e22e14f68f62ba0e165579bf51a291e
|
||||
guid: 7268c82badac77b42ab674127e0cad24
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,28 +1,6 @@
|
||||
import response from './response';
|
||||
import moduleHelper from './module-helper';
|
||||
import { formatJsonStr } from './utils';
|
||||
function getDefaultData(canvas, conf) {
|
||||
const config = formatJsonStr(conf);
|
||||
if (typeof config.x === 'undefined') {
|
||||
config.x = 0;
|
||||
}
|
||||
if (typeof config.y === 'undefined') {
|
||||
config.y = 0;
|
||||
}
|
||||
if (typeof config.width === 'undefined' || config.width === 0) {
|
||||
config.width = canvas.width;
|
||||
}
|
||||
if (typeof config.height === 'undefined' || config.height === 0) {
|
||||
config.height = canvas.height;
|
||||
}
|
||||
if (typeof config.destWidth === 'undefined' || config.destWidth === 0) {
|
||||
config.destWidth = canvas.width;
|
||||
}
|
||||
if (typeof config.destHeight === 'undefined' || config.destHeight === 0) {
|
||||
config.destHeight = canvas.height;
|
||||
}
|
||||
return config;
|
||||
}
|
||||
import { getDefaultData } from './utils';
|
||||
export default {
|
||||
WXToTempFilePathSync(conf) {
|
||||
return canvas.toTempFilePathSync(getDefaultData(canvas, conf));
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f2a11d5991144a86a670b20749578964
|
||||
guid: 8ab8faa140decd653ebeabd343784d64
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71c26f436eab689ed46507f13a66491f
|
||||
guid: 421f2d2040f5f38fe0d5af59065ac302
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60bfc910e7a9c20a5f71c797bdc7f15e
|
||||
guid: 87c14c69dd4eb26e8447e35832742580
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 816baf5107f79061712a8214e6ba0558
|
||||
guid: 60ef696fc84dc0e3718b82a95a37f542
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03de776a63b5a408671f180b6a8092c2
|
||||
guid: 115b938e924d976e84f8e4edcc2e7305
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4827657baaba28309e586f77f2fce47
|
||||
guid: a19d392e1978c8d1ed5cb69cb816366f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d5fb0bc71319775676a9f491eeb5898c
|
||||
guid: 38dac57c83a2204a4e578ead8281e0b3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -6,7 +6,7 @@ import fixCmapTable from './fix-cmap';
|
||||
import readMetrics from './read-metrics';
|
||||
import splitTTCToBufferOnlySC from './split-sc';
|
||||
|
||||
const { platform } = wx.getDeviceInfo();
|
||||
const { platform } = wx.getDeviceInfo ? wx.getDeviceInfo() : wx.getSystemInfoSync();
|
||||
|
||||
const tempCacheObj = {};
|
||||
let fontDataCache;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f93003429274e1d8b0d64bdbff499a1c
|
||||
guid: 7c213402d7d8c283f450610437eec11e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcf9a09d695049217ff8d741e0a06a8b
|
||||
guid: 4725d6b0f8da7852c7c643506dd97c7e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 275afe9204b59d1e517409ade9a6b253
|
||||
guid: cac2a977427ee6b288faa022d6469577
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: becbfe3b7e41d502cb7e38d88fb2f947
|
||||
guid: 921780162fce18101480ab9587263611
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -408,7 +408,9 @@ export default {
|
||||
},
|
||||
WX_FileSystemManagerReadSync(option, callbackId) {
|
||||
const fs = wx.getFileSystemManager();
|
||||
const res = fs.readSync(formatJsonStr(option));
|
||||
const optionConfig = formatJsonStr(option);
|
||||
optionConfig.arrayBuffer = new ArrayBuffer(optionConfig.arrayBuffer.length);
|
||||
const res = fs.readSync(optionConfig);
|
||||
cacheArrayBuffer(callbackId, res.arrayBuffer);
|
||||
return JSON.stringify({
|
||||
bytesRead: res.bytesRead,
|
||||
@ -438,16 +440,12 @@ export default {
|
||||
const optionConfig = formatJsonStr(option);
|
||||
optionConfig.data = data.buffer;
|
||||
const res = fs.writeSync(optionConfig);
|
||||
return JSON.stringify({
|
||||
mode: res.bytesWritten,
|
||||
});
|
||||
return JSON.stringify(res);
|
||||
},
|
||||
WX_FileSystemManagerWriteStringSync(option) {
|
||||
const fs = wx.getFileSystemManager();
|
||||
const res = fs.writeSync(formatJsonStr(option));
|
||||
return JSON.stringify({
|
||||
mode: res.bytesWritten,
|
||||
});
|
||||
return JSON.stringify(res);
|
||||
},
|
||||
WX_FileSystemManagerOpenSync(option) {
|
||||
const fs = wx.getFileSystemManager();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 10ac909295b27eed3bd665a5c33ff023
|
||||
guid: ba5be929c66fd1aed67edfc4591ba190
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6b4d470f7b1c1ab2b4d17badd352a731
|
||||
guid: 62f1c25c5517328a2743b8acfea2ce84
|
||||
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