mirror of
https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git
synced 2026-04-22 01:35:56 +08:00
Auto-publish release WXSDK.
This commit is contained in:
parent
a5a5f32fbd
commit
f5d307fde1
18
CHANGELOG.md
18
CHANGELOG.md
@ -6,10 +6,22 @@ Removed - 删除功能/接口
|
||||
Fixed - 修复问题
|
||||
Others - 其他
|
||||
-->
|
||||
## 2024-12-25 【预发布】
|
||||
PackageManager(git URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git#pre-v0.1.24
|
||||
## v0.1.25 【普通更新】
|
||||
### Feature
|
||||
* 普通: OffShareMessageToFriend支持
|
||||
* 普通:性能深入分析工具,支持Lua capture能力
|
||||
* 普通:性能深入分析工具,确保未勾选频繁截屏时,开始录制2s后自动截一次
|
||||
* 普通:Unity视频组件支持传入本地文件路径,业务可提前下载本地+设置微信本地路径进行播放
|
||||
### Fixed
|
||||
* 普通: 修正mac系统上针对AddressList的编译报错
|
||||
* 普通: 安卓开放数据域退后台需要重绘一次
|
||||
* 普通: 更新1.2.67修复鸿蒙includes报错
|
||||
* 普通: 适配插件版本升级到1.2.67
|
||||
|
||||
## 2024-1-7 【重要更新】
|
||||
### Feature
|
||||
* 重要:支持Unity6,预览版本不建议上线使用
|
||||
* 普通:OffShareMessageToFriend支持
|
||||
* 普通:性能深度分析工具版本更新
|
||||
### Fixed
|
||||
* 普通: reserveChannelsLive补充回调参数
|
||||
* 普通: 低基础库版本报错修复
|
||||
|
||||
8
Editor/LuaHooker.meta
Normal file
8
Editor/LuaHooker.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40c6637bb15e03e4d9dc2ccd6a5a494a
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Editor/LuaHooker/mac.meta
Normal file
8
Editor/LuaHooker/mac.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ad7c64672515f2846a69fbe2c3a0c3ab
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Editor/LuaHooker/mac/newstatehooker.dylib
Normal file
BIN
Editor/LuaHooker/mac/newstatehooker.dylib
Normal file
Binary file not shown.
64
Editor/LuaHooker/mac/newstatehooker.dylib.meta
Normal file
64
Editor/LuaHooker/mac/newstatehooker.dylib.meta
Normal file
@ -0,0 +1,64 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b2ed2be1f98c46c69f29eb343d66213
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
: Any
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Editor: 0
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: OSX
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Editor/LuaHooker/win.meta
Normal file
8
Editor/LuaHooker/win.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 46192946025b0e94c99441a1832ba866
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Editor/LuaHooker/win/newstatehooker.dll
Normal file
BIN
Editor/LuaHooker/win/newstatehooker.dll
Normal file
Binary file not shown.
82
Editor/LuaHooker/win/newstatehooker.dll.meta
Normal file
82
Editor/LuaHooker/win/newstatehooker.dll.meta
Normal file
@ -0,0 +1,82 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c53e55830d63074d8af0d0cf34587a8
|
||||
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: 0
|
||||
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:
|
||||
CPU: ARMv7
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
CPU: x86_64
|
||||
DefaultValueInitialized: true
|
||||
OS: Windows
|
||||
- first:
|
||||
Standalone: Linux64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
- first:
|
||||
Standalone: OSXUniversal
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
- first:
|
||||
Standalone: Win
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
- first:
|
||||
Standalone: Win64
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DontProcess: false
|
||||
PlaceholderPath:
|
||||
SDK: AnySDK
|
||||
ScriptingBackend: AnyScriptingBackend
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -11,8 +11,9 @@ using LitJson;
|
||||
using UnityEditor.Build;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using System.Runtime.InteropServices;
|
||||
using static WeChatWASM.LifeCycleEvent;
|
||||
|
||||
namespace WeChatWASM
|
||||
{
|
||||
public class WXConvertCore
|
||||
@ -25,7 +26,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 +79,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 +242,7 @@ namespace WeChatWASM
|
||||
try
|
||||
{
|
||||
string metaPath = AssetDatabase.GetTextMetaFilePathFromAssetPath(inAssetPath); // 获取.meta文件的路径
|
||||
string enableFlagStr = inEnabled? "1" : "0";
|
||||
string enableFlagStr = inEnabled ? "1" : "0";
|
||||
|
||||
// 读取.meta文件
|
||||
// 处理WebGL
|
||||
@ -409,7 +408,8 @@ 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",
|
||||
@ -802,7 +802,7 @@ namespace WeChatWASM
|
||||
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";
|
||||
PlayerSettings.WeixinMiniGame.emscriptenArgs += " -s EXPORTED_FUNCTIONS=_sbrk,_emscripten_stack_get_base,_emscripten_stack_get_end -s ERROR_ON_UNDEFINED_SYMBOLS=0";
|
||||
}
|
||||
|
||||
#else
|
||||
@ -1000,8 +1000,61 @@ namespace WeChatWASM
|
||||
return boot["resources"][key].Keys.Select(file => Path.Combine(config.ProjectConf.DST, webglDir, "Code", "wwwroot", "_framework", file)).ToArray();
|
||||
}
|
||||
|
||||
[DllImport("newstatehooker.dll", EntryPoint = "add_lua_newstate_hook")]
|
||||
private static extern int add_lua_newstate_hook_win(string filename);
|
||||
|
||||
[DllImport("newstatehooker", EntryPoint = "add_lua_newstate_hook")]
|
||||
private static extern int add_lua_newstate_hook_osx(string filename);
|
||||
|
||||
private static int add_lua_newstate_hook(string filename)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
return add_lua_newstate_hook_win(filename);
|
||||
}
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
return add_lua_newstate_hook_osx(filename);
|
||||
}
|
||||
|
||||
throw new System.NotSupportedException($"add_lua_newstate_hook not supported on: {RuntimeInformation.OSDescription}");
|
||||
}
|
||||
|
||||
private static void MaybeInstallLuaNewStateHook()
|
||||
{
|
||||
// 当前版本仅支持 win & mac, 不满足时直接跳过.
|
||||
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && !RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||
{
|
||||
Debug.LogWarning($"MaybeInstallLuaNewStateHook:: Cannot install lua runtime on {RuntimeInformation.OSDescription}");
|
||||
return;
|
||||
}
|
||||
|
||||
// 没有开启 perf tools, 不引入 newstate hook.
|
||||
if (!config.CompileOptions.enablePerfAnalysis)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string codePath = GetWebGLCodePath();
|
||||
try
|
||||
{
|
||||
var ret = add_lua_newstate_hook(codePath);
|
||||
if (ret != 0)
|
||||
{
|
||||
Debug.LogWarning($"cannot add lua new state hook: {ret}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"cannot add lua new state hook: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void finishExport()
|
||||
{
|
||||
MaybeInstallLuaNewStateHook();
|
||||
|
||||
int code = GenerateBinFile();
|
||||
if (code == 0)
|
||||
{
|
||||
@ -1099,11 +1152,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 =
|
||||
{
|
||||
@ -1124,15 +1182,31 @@ namespace WeChatWASM
|
||||
}
|
||||
};
|
||||
string[] files = { "game.js", "game.json", "project.config.json", "check-version.js" };
|
||||
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);
|
||||
@ -1152,13 +1226,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++)
|
||||
{
|
||||
@ -1219,6 +1294,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();
|
||||
@ -1232,6 +1311,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");
|
||||
@ -1306,9 +1489,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);
|
||||
@ -1326,7 +1518,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);
|
||||
}
|
||||
@ -1351,9 +1543,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);
|
||||
|
||||
@ -1375,7 +1576,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)
|
||||
{
|
||||
@ -1384,7 +1585,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)
|
||||
@ -1393,26 +1594,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()
|
||||
@ -1596,15 +1805,23 @@ namespace WeChatWASM
|
||||
// 添加player-connection-ip信息
|
||||
try
|
||||
{
|
||||
var host = Dns.GetHostEntry("");
|
||||
foreach (var ip in host.AddressList)
|
||||
{
|
||||
if (ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
|
||||
{
|
||||
sb.Append($"player-connection-ip={ip.ToString()}");
|
||||
break;
|
||||
}
|
||||
}
|
||||
var ips = Dns.GetHostEntry("").AddressList
|
||||
.Where(ip => ip.AddressFamily == AddressFamily.InterNetwork)
|
||||
.Select(ip => ip.ToString())
|
||||
.ToList();
|
||||
|
||||
// 优先选择局域网IP(192.168.x.x, 10.x.x.x, 172.16.x.x)
|
||||
var localNetworkIps = ips.Where(ip =>
|
||||
ip.StartsWith("192.168.") ||
|
||||
ip.StartsWith("10.") ||
|
||||
(ip.StartsWith("172.") && int.Parse(ip.Split('.')[1]) >= 16 && int.Parse(ip.Split('.')[1]) <= 31))
|
||||
.ToList();
|
||||
|
||||
// 如果有局域网IP则使用,否则使用其他IP,最后回退到127.0.0.1
|
||||
var selectedIp = localNetworkIps.Any() ? localNetworkIps.First() :
|
||||
ips.Any() ? ips.First() : "127.0.0.1";
|
||||
|
||||
sb.Append($"player-connection-ip={selectedIp}");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -1619,8 +1836,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();
|
||||
|
||||
@ -1630,7 +1845,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();
|
||||
|
||||
@ -1702,12 +1917,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" };
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
@ -474,7 +474,9 @@ namespace WeChatWASM
|
||||
this.setData("enableProfileStats", config.CompileOptions.enableProfileStats);
|
||||
this.setData("enableRenderAnalysis", config.CompileOptions.enableRenderAnalysis);
|
||||
this.setData("brotliMT", config.CompileOptions.brotliMT);
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
this.setData("enableWasm2023", config.CompileOptions.enableWasm2023);
|
||||
#endif
|
||||
this.setData("enablePerfAnalysis", config.CompileOptions.enablePerfAnalysis);
|
||||
this.setData("autoUploadFirstBundle", true);
|
||||
|
||||
@ -732,7 +734,7 @@ namespace WeChatWASM
|
||||
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), 性能分析工具将被禁用。", "确定");
|
||||
|
||||
@ -2,7 +2,7 @@ namespace WeChatWASM
|
||||
{
|
||||
public class WXPluginVersion
|
||||
{
|
||||
public static string pluginVersion = "202501140351"; // 这一行不要改他,导出的时候会自动替换
|
||||
public static string pluginVersion = "202503171123"; // 这一行不要改他,导出的时候会自动替换
|
||||
}
|
||||
|
||||
public class WXPluginConf
|
||||
|
||||
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d7b83e3894fbfbb6457aa27c31ac5caf
|
||||
guid: 9c8772d9b5e2eecb8a6a7ce6914a7606
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -10,13 +10,13 @@ internal class DisableKeyboardInput : MonoBehaviour
|
||||
private static void OnGameLaunch()
|
||||
{
|
||||
#if !UNITY_EDITOR
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = false;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = false;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f1319af276eb3da90110ad0336bd05c
|
||||
guid: b4b797696785c4e6c93ba24eb8129b15
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
#include "lua_adaptor_import.h"
|
||||
#include <emscripten/emscripten.h>
|
||||
|
||||
lua_Debug* lua_newdebugar() { return malloc(sizeof(lua_Debug)); }
|
||||
void lua_deletedebugar(lua_Debug* ar) { return free(ar); }
|
||||
@ -18,3 +19,12 @@ lua_State* lua_State_getmainthread(lua_State* L) { return G(L)->mainthread; }
|
||||
void (lua_do_sethook) (lua_State *L, lua_Hook func, int mask, int count) {
|
||||
lua_sethook(L, func, mask, count);
|
||||
}
|
||||
|
||||
extern void SetLuaState(lua_State* L);
|
||||
EMSCRIPTEN_KEEPALIVE lua_State* invoke_lua_newstate_with_wx_perf_callback(lua_Alloc f, void *ud) {
|
||||
lua_State* L;
|
||||
L = lua_newstate(f, ud);
|
||||
SetLuaState(L);
|
||||
|
||||
return L;
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 73eb62790c30cd1eb314fee2297a487f
|
||||
guid: 85b6a22dbed250c6ec25308d84ac0fcd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 84eba205dd398e80046ebcb0e3933159
|
||||
guid: 011bcbe196158c93aa2fc21095bdd907
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -3514,7 +3514,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool SetHandoffQuery(string query)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.SetHandoffQuery(query);
|
||||
return WXSDKManagerHandler.SetHandoffQuery(query);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3532,7 +3532,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AccountInfo GetAccountInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAccountInfoSync();
|
||||
return WXSDKManagerHandler.GetAccountInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3562,7 +3562,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AppAuthorizeSetting GetAppAuthorizeSetting()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAppAuthorizeSetting();
|
||||
return WXSDKManagerHandler.GetAppAuthorizeSetting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3583,7 +3583,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static AppBaseInfo GetAppBaseInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetAppBaseInfo();
|
||||
return WXSDKManagerHandler.GetAppBaseInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3593,7 +3593,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GetBatteryInfoSyncResult GetBatteryInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetBatteryInfoSync();
|
||||
return WXSDKManagerHandler.GetBatteryInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3614,7 +3614,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static DeviceInfo GetDeviceInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetDeviceInfo();
|
||||
return WXSDKManagerHandler.GetDeviceInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3646,7 +3646,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static EnterOptionsGame GetEnterOptionsSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetEnterOptionsSync();
|
||||
return WXSDKManagerHandler.GetEnterOptionsSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3661,7 +3661,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static T GetExptInfoSync<T>(string[] keys)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetExptInfoSync<T>(keys);
|
||||
return WXSDKManagerHandler.GetExptInfoSync<T>(keys);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3679,7 +3679,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static T GetExtConfigSync<T>()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetExtConfigSync<T>();
|
||||
return WXSDKManagerHandler.GetExtConfigSync<T>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3701,7 +3701,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static LaunchOptionsGame GetLaunchOptionsSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetLaunchOptionsSync();
|
||||
return WXSDKManagerHandler.GetLaunchOptionsSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3722,7 +3722,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static ClientRect GetMenuButtonBoundingClientRect()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetMenuButtonBoundingClientRect();
|
||||
return WXSDKManagerHandler.GetMenuButtonBoundingClientRect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3752,7 +3752,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GetStorageInfoSyncOption GetStorageInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetStorageInfoSync();
|
||||
return WXSDKManagerHandler.GetStorageInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3761,7 +3761,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static SystemInfo GetSystemInfoSync()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetSystemInfoSync();
|
||||
return WXSDKManagerHandler.GetSystemInfoSync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3780,7 +3780,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static SystemSetting GetSystemSetting()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetSystemSetting();
|
||||
return WXSDKManagerHandler.GetSystemSetting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3803,7 +3803,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static WindowInfo GetWindowInfo()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetWindowInfo();
|
||||
return WXSDKManagerHandler.GetWindowInfo();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3819,7 +3819,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>
|
||||
@ -3830,7 +3830,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static Path2D CreatePath2D()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.CreatePath2D();
|
||||
return WXSDKManagerHandler.CreatePath2D();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3841,7 +3841,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool IsPointerLocked()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.IsPointerLocked();
|
||||
return WXSDKManagerHandler.IsPointerLocked();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3856,7 +3856,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool IsVKSupport(string version)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.IsVKSupport(version);
|
||||
return WXSDKManagerHandler.IsVKSupport(version);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3870,7 +3870,7 @@ 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>
|
||||
@ -3904,7 +3904,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static bool SetMessageToFriendQuery(SetMessageToFriendQueryOption option)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.SetMessageToFriendQuery(option);
|
||||
return WXSDKManagerHandler.SetMessageToFriendQuery(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3914,7 +3914,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static double GetTextLineHeight(GetTextLineHeightOption option)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetTextLineHeight(option);
|
||||
return WXSDKManagerHandler.GetTextLineHeight(option);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3924,7 +3924,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static string LoadFont(string path)
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.LoadFont(path);
|
||||
return WXSDKManagerHandler.LoadFont(path);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -3933,7 +3933,7 @@ namespace WeChatWASM
|
||||
/// <returns></returns>
|
||||
public static GameLiveState GetGameLiveState()
|
||||
{
|
||||
return WXSDKManagerHandler.Instance.GetGameLiveState();
|
||||
return WXSDKManagerHandler.GetGameLiveState();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -149,23 +149,23 @@ public class WXTouchInputOverride : BaseInput
|
||||
Text text = selectedObject.GetComponent<Text>();
|
||||
if (text != null)
|
||||
{
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = true;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = true;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
#if PLATFORM_WEIXINMINIGAME
|
||||
WeixinMiniGameInput.mobileKeyboardSupport = false;
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
#elif PLATFORM_WEBGL
|
||||
#if UNITY_2022_1_OR_NEWER
|
||||
WebGLInput.mobileKeyboardSupport = false;
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23e5523b8a21516220ec1d8809e48b1c
|
||||
guid: a5072480883ba3bf507d63be3076b0b9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e035d5ee5d1c37c4894d4f123fe5cd0b
|
||||
guid: 77ea12af3ccf3a5d2dda7234b9a97158
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e852d98b219ba08b7afbaba4f5de8483
|
||||
guid: f20791af9638f6396b683c8bcb327761
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cee92dada4a11d33f76dd345cf0987d
|
||||
guid: b91be284ab85ff65ced71341dfdbef1a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
],
|
||||
"plugins": {
|
||||
"UnityPlugin": {
|
||||
"version": "1.2.65",
|
||||
"version": "1.2.71",
|
||||
"provider": "wxe5a48f1ed5f544b7",
|
||||
"contexts": [
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b82e616c795c3ae40caed7cb8b434469
|
||||
guid: 73ac43c2129af841c5846f54e6a7597f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: afb6ba80c6ea8bb344cc15087dc9b151
|
||||
guid: cb3d1ec7d619a10829c633b008b7784d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 34d1f2a3e07f3007e240a7172b7828ed
|
||||
guid: 4a92c7b5e411256ffb8ca7f6d00fae12
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 59a8ae5b3eee68f0f339441f4feea960
|
||||
guid: 7a90a3b2d7a8234a759a8f81c2603617
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef2b9a8367ea404419fb637d6ca5c825
|
||||
guid: 0869f1204c164d33a003a802dba07b42
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -14,6 +14,7 @@ setUserRecord(RANK_KEY, Math.ceil(Math.random() * 1000));
|
||||
const MessageType = {
|
||||
WX_RENDER: 'WXRender',
|
||||
WX_DESTROY: 'WXDestroy',
|
||||
WX_SHOW: 'WXShow',
|
||||
SHOW_FRIENDS_RANK: 'showFriendsRank',
|
||||
SHOW_GROUP_FRIENDS_RANK: 'showGroupFriendsRank',
|
||||
SET_USER_RECORD: 'setUserRecord',
|
||||
@ -130,6 +131,10 @@ function main() {
|
||||
case MessageType.WX_DESTROY:
|
||||
Layout.clearAll();
|
||||
break;
|
||||
// 来自 WX Unity SDK 的信息
|
||||
case MessageType.WX_SHOW:
|
||||
Layout.repaint();
|
||||
break;
|
||||
// 下面为业务自定义消息
|
||||
case MessageType.SHOW_FRIENDS_RANK:
|
||||
renderFriendsRank();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d37635a190f7c0b60d673ac710520aaa
|
||||
guid: 1be8ce26b1ee870f2f3195f13a42d547
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d728c0dff0c5cc83cf23fa6074a18165
|
||||
guid: 1a76c505b063f65f9b9b84246763ebee
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 430e3c24cd74aa5eb4f984d28b42f4e9
|
||||
guid: 9e66daa27ea177aa6db848ce17ae44ed
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 765465a03c8d17e4f69b8fd2efed7951
|
||||
guid: 69ed73721f121f820dd15a6e9d262728
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9d13b2e91e2730bfc12d7f07d8cc1961
|
||||
guid: 813e682f3cff3941611e374c580bbeee
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62a33f8e967edd6e3d3da555d73e0cf1
|
||||
guid: c8287bc1f5e570fa08cc90b800ee6a42
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 638327d1deaaf74b1c53e6efadbb7c36
|
||||
guid: 46df3b172cfe2e8c032480a228a0466c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f1f9867303f37840977896cfcf6d8550
|
||||
guid: 11576f7d0e33656b4fe5a0b9f66eb5fb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b02227c5e448a860be49857474fa597d
|
||||
guid: b195e2ac7c1491809c4848b9972da5db
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 962d58c3e3fbae7335ff7c48abb6ffbc
|
||||
guid: 10cd27e9d7e845c8619acebe60d1d5d4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77407bc30303166a8575c3bfc26e46ba
|
||||
guid: 67df44a83af3d4f84a0e54ba80380e34
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c25f454cb7aa74a7bd12b282484c4509
|
||||
guid: 40b24b5dfd72bea8eb5b98ce5bceda59
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 71b7fa43f6e3d25359b1ec47b9c9d983
|
||||
guid: eeef3c7abfa3c950474f814bbaa012b8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: beb096d986bd9b224984580a6fb65a26
|
||||
guid: 6fd8df7e2fb0c7f4be1b70943286edc3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 03892963e40d559f3a80e79a52f3f521
|
||||
guid: 6896959ef64519c19b368d20c7db62c5
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58d783f8b29220f2bc2a2af33c1993d4
|
||||
guid: 5435cf6cc1ecd220788f94762681a804
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcf14aa7177b92eb214abc87eda36010
|
||||
guid: 6de9114cf21d3e3369ce4c1de04c9a85
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 173df9e0e0950163803f4a7c0838eb7b
|
||||
guid: dcd38d36eab978ce1fff15d67caef5f0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ccc458ed346ff5a380974995687ade3
|
||||
guid: 4ff993f7ca5199e92edf4f0ce4518daf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 488df73adbfbaacd7e4476868f6a987d
|
||||
guid: 6e91fca92e038891fdce4160fd561469
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fee97d895b07af5249e6bf750766afaf
|
||||
guid: 532fdbd6aeb7a13322829827f6486b66
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6bb85131302268386e7933b91028ad76
|
||||
guid: b00e326f015a4b0ef18727963f459dd7
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d716a66117c023d74ac843315bb216b3
|
||||
guid: 6ebcb94cf742567501d7f62c2d613e37
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fa5b470a77ac470eae4af9bad3fb0f50
|
||||
guid: 6a1d5d82f93c83960b3923e25ef32767
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acfbcd35538bf120a9f21302879686e7
|
||||
guid: fb121ac6459373e58c66584c4a6f0b9b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 75e36cffbd962c24dba617b59e7bbe7c
|
||||
guid: 5463918ce948e672f91f859c397f819e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22ab42f1300baf4668872d602d7f028c
|
||||
guid: 611f2eac7879313613471374a172fd49
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 999ff4f56076db1e7c6ba91daa4a86fe
|
||||
guid: 34bd38532bd60a0659a92d37d7b6f0c2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e23e453b7f0560e6a8f69d50f5dc95e5
|
||||
guid: f60fcf687d832adac584c72d1a7d0e7a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 434c4f00c8fca1fcd9f4d3992d1a2914
|
||||
guid: 5a2b15f81eb43cbbac3762ed966b165c
|
||||
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: 400c3ac9ea6267854d7db4028414c2ca
|
||||
guid: 5afcbcc51de3663ff2a5af86bb3911e8
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 329c0172c4597569c9626b93db306bf5
|
||||
guid: dcd44741f8d8c786f376bedf6ebbb165
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22465590f1826cc1e699104592c0a737
|
||||
guid: 5391759bd4c8e3648734cf442a6df733
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 814d0bb2db0fb2252154c7391264d8cd
|
||||
guid: 16839fa9ae435887c3821a82ed8a7840
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 938b710e95885550e433ff445b627e33
|
||||
guid: 1345002ff19c9a52a588215425c86bec
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ff069780099930b5ea4aa12ab67e2461
|
||||
guid: 047d924cb85d4bd3918bdd85bc053d94
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdf9de933b75917823ee211ded429262
|
||||
guid: 9d03bad330ac311fdcae3e105f009f4a
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aaa32e1b5940f2fbba3141e861c094ab
|
||||
guid: 7729dfb3f07a371ded74719b8e1fcae2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8b28eb1005896b76c87ea3ed7b8ad3f1
|
||||
guid: 60e607f1e27a6f09d26067315a5e4a09
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6772904f95ec478561f55574e8677a5
|
||||
guid: 43bbce8c583d5e662fc6e87f6ffe1e1b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: deb5606aef4c6c6a9fdd7b4645f69c85
|
||||
guid: 7b2a0accadd2d9c5a8cefe49cf17df13
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b24cb29694a89624df33e48ff6bcd78d
|
||||
guid: d11a931481607679aad6f4d0ba555b5c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6fcee0670ae35ac49497e2acb8c316f9
|
||||
guid: 7b0068e3203e77201734beafb09fc718
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bb8803245f3345edeb82388f8a7a4ca
|
||||
guid: 43a6ff0f5c74f0f249e7eadcca5c1158
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd124ba4c068936b05a1debc4b9895e0
|
||||
guid: d9243b6184441fcc9386baf3e7f3ac9e
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 790920591862a7901fa455c66a1e0d25
|
||||
guid: e0dadd04df8cbcd2fac101fd5f33f0a2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f0751950bf9e0312b27dda2e0efb8e3e
|
||||
guid: 2abcd8d4ecb4d4496a2e97d354bade5c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 33e9d1b80cd6849eebf5f6a85662e9a2
|
||||
guid: 4e96e24be251f22e2c7374f80f1c0303
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef5adc23d489fc994759e536015e3861
|
||||
guid: 0e92306e6e6bdea3da55204b80a1c477
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 191df5dad7e34abd76070d24f92ee5bc
|
||||
guid: 3880288ceaa4b6f1f763f2a1f310d88c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6327b1676f918cf4ac8e500952832acd
|
||||
guid: 15621655ec61857e0b7782af74fd5fba
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0ad7be5509f3e79781ea42d5744a3b0
|
||||
guid: 8675badaca211aa87a95ae26f26760fb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dd72e6100645b33f6dba6e4e9f8bd32f
|
||||
guid: 286130610c231d9bbd524b54cbb198fb
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9a898af8549e712830e18b5429a932f3
|
||||
guid: 132e4901c71266a10bd6c50216dc47fa
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a286534fe5420f9600188f6d23087070
|
||||
guid: f7130979b8aa81c62505c37f378f3085
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
import response from './response';
|
||||
import moduleHelper from './module-helper';
|
||||
import { getDefaultData } from './utils';
|
||||
import { isDebug, isSupportSharedCanvasMode } from '../check-version';
|
||||
import { getDefaultData, debugLog } from './utils';
|
||||
import { isSupportSharedCanvasMode } from '../check-version';
|
||||
|
||||
let cachedOpenDataContext;
|
||||
let cachedSharedCanvas;
|
||||
@ -99,23 +99,24 @@ function stopHookUnityRender() {
|
||||
gl.deleteTexture(textureObject);
|
||||
textureObject = null;
|
||||
}
|
||||
wx.onShow(() => {
|
||||
if (cachedOpenDataContext) {
|
||||
getOpenDataContext().postMessage({
|
||||
type: 'WXShow',
|
||||
});
|
||||
}
|
||||
});
|
||||
export default {
|
||||
WXGetOpenDataContext(mode) {
|
||||
if (isDebug) {
|
||||
console.warn('WXGetOpenDataContext:', mode);
|
||||
}
|
||||
debugLog('WXGetOpenDataContext:', mode);
|
||||
getOpenDataContext(mode);
|
||||
},
|
||||
WXDataContextPostMessage(msg) {
|
||||
if (isDebug) {
|
||||
console.warn('WXDataContextPostMessage:', msg);
|
||||
}
|
||||
debugLog('WXDataContextPostMessage:', msg);
|
||||
getOpenDataContext().postMessage(msg);
|
||||
},
|
||||
WXShowOpenData(id, x, y, width, height) {
|
||||
if (isDebug) {
|
||||
console.warn('WXShowOpenData:', id, x, y, width, height);
|
||||
}
|
||||
debugLog('WXShowOpenData:', id, x, y, width, height);
|
||||
if (width <= 0 || height <= 0) {
|
||||
console.error('[unity-sdk]: WXShowOpenData要求 width 和 height 参数必须大于0');
|
||||
}
|
||||
@ -144,9 +145,7 @@ export default {
|
||||
}
|
||||
},
|
||||
WXHideOpenData() {
|
||||
if (isDebug) {
|
||||
console.warn('WXHideOpenData');
|
||||
}
|
||||
debugLog('WXHideOpenData');
|
||||
getOpenDataContext().postMessage({
|
||||
type: 'WXDestroy',
|
||||
});
|
||||
@ -161,9 +160,7 @@ export default {
|
||||
}
|
||||
},
|
||||
WXOpenDataToTempFilePathSync(conf) {
|
||||
if (isDebug) {
|
||||
console.warn('WXOpenDataToTempFilePathSync', conf);
|
||||
}
|
||||
debugLog('WXOpenDataToTempFilePathSync', conf);
|
||||
const sharedCanvas = getSharedCanvas();
|
||||
if (!sharedCanvas) {
|
||||
return 'Please use WX.GetOpenDataContext() first';
|
||||
@ -171,9 +168,7 @@ export default {
|
||||
return sharedCanvas.toTempFilePathSync(getDefaultData(sharedCanvas, conf));
|
||||
},
|
||||
WXOpenDataToTempFilePath(conf, s, f, c) {
|
||||
if (isDebug) {
|
||||
console.warn('WXOpenDataToTempFilePath', conf);
|
||||
}
|
||||
debugLog('WXOpenDataToTempFilePath', conf);
|
||||
if (conf) {
|
||||
const sharedCanvas = getSharedCanvas();
|
||||
if (!sharedCanvas) {
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0d3ceb2d7c6f51f1124481b1600fc8e
|
||||
guid: 3232385890c545d8d5ebbe7e6d250daa
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edbe428255e22c21ab6803c3caeec692
|
||||
guid: db0b7c32f76f44d8a0a520f8173718c2
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9c143faae305082cbf9bdb86f2287b71
|
||||
guid: 2ea791d32e0e935df5abdcdc0f6c872c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 98470893188962244d566f02b6180192
|
||||
guid: 883db8f30e5385a2a77aa7da8de5856b
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0d57ccae91450b0c345524b485955156
|
||||
guid: 63c45b67002dded48d4e3c9bce43f426
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a588d58139197326d36c6ce9b7ef520e
|
||||
guid: 07628ddd7737c4e05705cf2dc6932cdc
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 39723104e9c8e7d478dd161a3ce13852
|
||||
guid: 0e5d0981ba9df59dbb0d376476bc6b32
|
||||
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