Auto-publish.

This commit is contained in:
rainhong 2024-09-09 16:18:53 +08:00
parent b9b20d350f
commit 7985d5cc7e
139 changed files with 1087 additions and 165 deletions

View File

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

View File

@ -0,0 +1,179 @@
using UnityEditor;
using System;
using System.Reflection;
using System.IO;
public class WXAssetPostprocessor : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
foreach (string asset in importedAssets)
{
ProcessWxPerfPluginAsset(asset);
}
}
public static bool EnableWXPostProcess = false;
static void ProcessWxPerfPluginAsset(string wxPerfPluginAsset)
{
PluginImporter importer = AssetImporter.GetAtPath(wxPerfPluginAsset) as PluginImporter;
if (importer == null) return;
// 判断是否是wx_perf_2022.a/o文件
if (wxPerfPluginAsset.Contains("wx_perf_2022.a"))
{
if (IsCompatibleWithUnity202203OrNewer() && EnableWXPostProcess)
{
#if PLATFORM_WEIXINMINIGAME
if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame))
#else
if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL))
#endif
{
return;
}
EnablePluginAsset(wxPerfPluginAsset);
AssetDatabase.Refresh();
}
else
{
RemovePluginAssetAllCompatibility(wxPerfPluginAsset);
}
return;
}
// 判断是否是wx_perf_2021.a/o文件
if (wxPerfPluginAsset.Contains("wx_perf_2021.a"))
{
if (IsCompatibleWithUnity202103To202203() && EnableWXPostProcess)
{
// UnityEngine.Debug.Log($"Before --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}");
#if PLATFORM_WEIXINMINIGAME
if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame))
#else
if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL))
#endif
{
return;
}
EnablePluginAsset(wxPerfPluginAsset);
// UnityEngine.Debug.Log($"After --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}");
AssetDatabase.Refresh();
}
else
{
RemovePluginAssetAllCompatibility(wxPerfPluginAsset);
}
return;
}
if (wxPerfPluginAsset.Contains("WxPerfJsBridge.jslib"))
{
if (EnableWXPostProcess)
{
// UnityEngine.Debug.Log($"Before --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}");
#if PLATFORM_WEIXINMINIGAME
if (importer.GetCompatibleWithPlatform(BuildTarget.WeixinMiniGame))
#else
if (importer.GetCompatibleWithPlatform(BuildTarget.WebGL))
#endif
{
return;
}
EnablePluginAsset(wxPerfPluginAsset);
// UnityEngine.Debug.Log($"After --- WebGL: {importer.GetCompatibleWithPlatform(BuildTarget.WebGL)}, Editor: {importer.GetCompatibleWithEditor()}");
AssetDatabase.Refresh();
}
else
{
RemovePluginAssetAllCompatibility(wxPerfPluginAsset);
}
return;
}
}
static bool IsCompatibleWithUnity202203OrNewer()
{
#if UNITY_2022_3_OR_NEWER
return true;
#endif
return false;
}
static bool IsCompatibleWithUnity202103To202203()
{
#if UNITY_2022_3_OR_NEWER
return false;
#endif
#if !UNITY_2021_3_OR_NEWER
return false;
#endif
return true;
}
private static void RemovePluginAssetAllCompatibility(string inAssetPath)
{
PluginImporter importer = AssetImporter.GetAtPath(inAssetPath) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, false);
#else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, false);
#endif
AssetDatabase.WriteImportSettingsIfDirty(inAssetPath);
}
private static bool IsPluginAssetValid(PluginImporter inPluginImporter)
{
if (inPluginImporter == null) return false;
if (inPluginImporter.GetCompatibleWithEditor()) return true;
foreach (BuildTarget target in Enum.GetValues(typeof(BuildTarget)))
{
if (inPluginImporter.GetCompatibleWithPlatform(target))
{
return true;
}
}
return false;
}
private static void EnablePluginAsset(string inAssetPath)
{
PluginImporter importer = AssetImporter.GetAtPath(inAssetPath) as PluginImporter;
#if PLATFORM_WEIXINMINIGAME
importer.SetCompatibleWithPlatform(BuildTarget.WeixinMiniGame, EnableWXPostProcess);
#else
importer.SetCompatibleWithPlatform(BuildTarget.WebGL, EnableWXPostProcess);
#endif
AssetDatabase.WriteImportSettingsIfDirty(inAssetPath);
}
private static int GetEnabledFlagStringIndex(string inAllText, string inTagStr)
{
int tagStrIdx = inAllText.IndexOf(inTagStr);
int enabledStrIdx = inAllText.IndexOf("enabled: ", tagStrIdx);
// inAllText[enabledStrIdx] == 'e'
// And that is to say, inAllText[enabledStrIdx + 9] should be 0 or 1
return enabledStrIdx + 9;
}
}

View File

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

View File

@ -109,8 +109,16 @@ namespace WeChatWASM
Debug.LogError("因构建模板检查失败终止导出。"); Debug.LogError("因构建模板检查失败终止导出。");
return WXExportError.BUILD_WEBGL_FAILED; return WXExportError.BUILD_WEBGL_FAILED;
} }
if (CheckInvalidPerfIntegration())
{
Debug.LogError("性能分析工具只能用于Development Build, 终止导出! ");
return WXExportError.BUILD_WEBGL_FAILED;
}
CheckBuildTarget(); CheckBuildTarget();
Init(); Init();
ProcessWxPerfBinaries();
// JSLib // JSLib
SettingWXTextureMinJSLib(); SettingWXTextureMinJSLib();
UpdateGraphicAPI(); UpdateGraphicAPI();
@ -208,6 +216,42 @@ namespace WeChatWASM
return WXExportError.SUCCEED; return WXExportError.SUCCEED;
} }
private static void ProcessWxPerfBinaries()
{
string[] wxPerfPlugins;
string DS = WXAssetsTextTools.DS;
if (UnityUtil.GetSDKMode() == UnityUtil.SDKMode.Package)
{
wxPerfPlugins = new string[]
{
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}WxPerfJsBridge.jslib",
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}wx_perf_2022.a",
$"Packages{DS}com.qq.weixin.minigame{DS}Runtime{DS}Plugins{DS}wx_perf_2021.a",
};
}
else
{
string jsLibRootDir = $"Assets{DS}WX-WASM-SDK-V2{DS}Runtime{DS}Plugins{DS}";
// 下方顺序不可变动
wxPerfPlugins = new string[]
{
$"{jsLibRootDir}WxPerfJsBridge.jslib",
$"{jsLibRootDir}wx_perf_2022.a",
$"{jsLibRootDir}wx_perf_2021.a",
};
}
WXAssetPostprocessor.EnableWXPostProcess = config.CompileOptions.enablePerfAnalysis;
for (int i = 0; i < wxPerfPlugins.Length; i++)
{
var importer = AssetImporter.GetAtPath(wxPerfPlugins[i]) as PluginImporter;
importer.SaveAndReimport();
AssetDatabase.WriteImportSettingsIfDirty(wxPerfPlugins[i]);
AssetDatabase.Refresh();
}
}
private static void CheckBuildTarget() private static void CheckBuildTarget()
{ {
Emit(LifeCycle.beforeSwitchActiveBuildTarget); Emit(LifeCycle.beforeSwitchActiveBuildTarget);
@ -318,6 +362,16 @@ namespace WeChatWASM
return true; return true;
} }
// Assert when release + Perf-feature
private static bool CheckInvalidPerfIntegration()
{
const string MACRO_ENABLE_WX_PERF_FEATURE = "ENABLE_WX_PERF_FEATURE";
string defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
return (!config.CompileOptions.DevelopBuild) && (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) != -1);
}
private static void ConvertDotnetCode() private static void ConvertDotnetCode()
{ {
CompressAssemblyBrotli(); CompressAssemblyBrotli();
@ -1410,6 +1464,9 @@ namespace WeChatWASM
config.FontOptions.Mathematical_Operators ? "true" : "false", config.FontOptions.Mathematical_Operators ? "true" : "false",
customUnicodeRange, customUnicodeRange,
boolConfigInfo, boolConfigInfo,
config.CompileOptions.DevelopBuild ? "true" : "false",
config.CompileOptions.enablePerfAnalysis ? "true" : "false",
config.ProjectConf.MemorySize.ToString(),
}); });
List<Rule> replaceList = new List<Rule>(replaceArrayList); List<Rule> replaceList = new List<Rule>(replaceArrayList);

View File

@ -59,6 +59,8 @@ namespace WeChatWASM
} }
//private static WXEditorScriptObject config = UnityUtil.GetEditorConf(); //private static WXEditorScriptObject config = UnityUtil.GetEditorConf();
private static bool m_EnablePerfTool = false;
private static string _dstCache; private static string _dstCache;
public void OnFocus() public void OnFocus()
@ -178,7 +180,7 @@ namespace WeChatWASM
EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true)); EditorGUILayout.BeginVertical("frameBox", GUILayout.ExpandWidth(true));
this.formCheckbox("developBuild", "Development Build"); this.formCheckbox("developBuild", "Development Build", "", false, null, OnDevelopmentBuildToggleChanged);
this.formCheckbox("autoProfile", "Auto connect Profiler"); this.formCheckbox("autoProfile", "Auto connect Profiler");
this.formCheckbox("scriptOnly", "Scripts Only Build"); this.formCheckbox("scriptOnly", "Scripts Only Build");
this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP); this.formCheckbox("il2CppOptimizeSize", "Il2Cpp Optimize Size(?)", "对应于Il2CppCodeGeneration选项勾选时使用OptimizeSize(默认推荐)生成代码小15%左右取消勾选则使用OptimizeSpeed。游戏中大量泛型集合的高频访问建议OptimizeSpeed在使用HybridCLR等第三方组件时只能用OptimizeSpeed。(Dotnet Runtime模式下该选项无效)", !UseIL2CPP);
@ -200,9 +202,15 @@ namespace WeChatWASM
this.formCheckbox("enableProfileStats", "显示性能面板"); this.formCheckbox("enableProfileStats", "显示性能面板");
this.formCheckbox("enableRenderAnalysis", "显示渲染日志(dev only)"); this.formCheckbox("enableRenderAnalysis", "显示渲染日志(dev only)");
this.formCheckbox("brotliMT", "brotli多线程压缩(?)", "开启多线程压缩可以提高出包速度但会降低压缩率。如若不使用wasm代码分包请勿用多线程出包上线"); this.formCheckbox("brotliMT", "brotli多线程压缩(?)", "开启多线程压缩可以提高出包速度但会降低压缩率。如若不使用wasm代码分包请勿用多线程出包上线");
if (m_EnablePerfTool)
{
this.formCheckbox("enablePerfAnalysis", "集成性能分析工具", "将性能分析工具集成入Development Build包中", false, null, OnPerfAnalysisFeatureToggleChanged);
}
EditorGUILayout.EndVertical(); EditorGUILayout.EndVertical();
} }
#if UNITY_INSTANTGAME #if UNITY_INSTANTGAME
foldInstantGame = EditorGUILayout.Foldout(foldInstantGame, "Instant Game - AutoStreaming"); foldInstantGame = EditorGUILayout.Foldout(foldInstantGame, "Instant Game - AutoStreaming");
if (foldInstantGame) if (foldInstantGame)
@ -461,6 +469,7 @@ namespace WeChatWASM
this.setData("enableProfileStats", config.CompileOptions.enableProfileStats); this.setData("enableProfileStats", config.CompileOptions.enableProfileStats);
this.setData("enableRenderAnalysis", config.CompileOptions.enableRenderAnalysis); this.setData("enableRenderAnalysis", config.CompileOptions.enableRenderAnalysis);
this.setData("brotliMT", config.CompileOptions.brotliMT); this.setData("brotliMT", config.CompileOptions.brotliMT);
this.setData("enablePerfAnalysis", config.CompileOptions.enablePerfAnalysis);
this.setData("autoUploadFirstBundle", true); this.setData("autoUploadFirstBundle", true);
// font options // font options
@ -532,6 +541,7 @@ namespace WeChatWASM
config.CompileOptions.enableProfileStats = this.getDataCheckbox("enableProfileStats"); config.CompileOptions.enableProfileStats = this.getDataCheckbox("enableProfileStats");
config.CompileOptions.enableRenderAnalysis = this.getDataCheckbox("enableRenderAnalysis"); config.CompileOptions.enableRenderAnalysis = this.getDataCheckbox("enableRenderAnalysis");
config.CompileOptions.brotliMT = this.getDataCheckbox("brotliMT"); config.CompileOptions.brotliMT = this.getDataCheckbox("brotliMT");
config.CompileOptions.enablePerfAnalysis = this.getDataCheckbox("enablePerfAnalysis");
// font options // font options
config.FontOptions.CJK_Unified_Ideographs = this.getDataCheckbox("CJK_Unified_Ideographs"); config.FontOptions.CJK_Unified_Ideographs = this.getDataCheckbox("CJK_Unified_Ideographs");
@ -553,6 +563,8 @@ namespace WeChatWASM
config.FontOptions.Geometric_Shapes = this.getDataCheckbox("Geometric_Shapes"); config.FontOptions.Geometric_Shapes = this.getDataCheckbox("Geometric_Shapes");
config.FontOptions.Mathematical_Operators = this.getDataCheckbox("Mathematical_Operators"); config.FontOptions.Mathematical_Operators = this.getDataCheckbox("Mathematical_Operators");
config.FontOptions.CustomUnicode = this.getDataInput("CustomUnicode"); config.FontOptions.CustomUnicode = this.getDataInput("CustomUnicode");
ApplyPerfAnalysisSetting();
} }
private string getDataInput(string target) private string getDataInput(string target)
@ -640,7 +652,7 @@ namespace WeChatWASM
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
private void formCheckbox(string target, string label, string help = null, bool disable = false, Action<bool> setting = null) private void formCheckbox(string target, string label, string help = null, bool disable = false, Action<bool> setting = null, Action<bool> onValueChanged = null)
{ {
if (!formCheckboxData.ContainsKey(target)) if (!formCheckboxData.ContainsKey(target))
{ {
@ -657,7 +669,15 @@ namespace WeChatWASM
GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140)); GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140));
} }
EditorGUI.BeginDisabledGroup(disable); EditorGUI.BeginDisabledGroup(disable);
formCheckboxData[target] = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]);
// Toggle the checkbox value based on the disable condition
bool newValue = EditorGUILayout.Toggle(disable ? false : formCheckboxData[target]);
// Update the checkbox data if the value has changed and invoke the onValueChanged action
if (newValue != formCheckboxData[target])
{
formCheckboxData[target] = newValue;
onValueChanged?.Invoke(newValue);
}
if (setting != null) if (setting != null)
{ {
@ -677,6 +697,46 @@ namespace WeChatWASM
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
private void OnDevelopmentBuildToggleChanged(bool InNewValue)
{
// 针对non-dev build取消性能分析工具的集成
if (!InNewValue)
{
this.setData("enablePerfAnalysis", false);
}
}
private void OnPerfAnalysisFeatureToggleChanged(bool InNewValue)
{
// 针对non-dev build取消性能分析工具的集成
if (!formCheckboxData["developBuild"] && InNewValue)
{
this.setData("enablePerfAnalysis", false);
}
}
private void ApplyPerfAnalysisSetting()
{
const string MACRO_ENABLE_WX_PERF_FEATURE = "ENABLE_WX_PERF_FEATURE";
string defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
if (this.getDataCheckbox("enablePerfAnalysis") && this.getDataCheckbox("developBuild"))
{
if (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) == -1)
{
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, MACRO_ENABLE_WX_PERF_FEATURE + $";{defineSymbols}");
}
}
else
{
// 删除掉已有的ENABLE_WX_PERF_FEATURE
if (defineSymbols.IndexOf(MACRO_ENABLE_WX_PERF_FEATURE) != -1)
{
defineSymbols = defineSymbols.Replace(MACRO_ENABLE_WX_PERF_FEATURE, "").Replace(";;", ";").Trim(';');
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, defineSymbols);
}
}
}
public static bool IsAbsolutePath(string path) public static bool IsAbsolutePath(string path)
{ {
// 检查是否为空或空白 // 检查是否为空或空白

View File

@ -2,7 +2,7 @@
{ {
public class WXPluginVersion public class WXPluginVersion
{ {
public static string pluginVersion = "202409090807"; // 这一行不要改他,导出的时候会自动替换 public static string pluginVersion = "202409090817"; // 这一行不要改他,导出的时候会自动替换
} }
public class WXPluginConf public class WXPluginConf

Binary file not shown.

View File

@ -618,6 +618,11 @@
是否显示渲染分析日志develop build才生效 是否显示渲染分析日志develop build才生效
</summary> </summary>
</member> </member>
<member name="F:WeChatWASM.CompileOptions.enablePerfAnalysis">
<summary>
是否开启运行时性能分析工具develop build才生效
</summary>
</member>
<member name="F:WeChatWASM.CompileOptions.iOSAutoGCInterval"> <member name="F:WeChatWASM.CompileOptions.iOSAutoGCInterval">
<summary> <summary>
iOS高性能模式自动GC间隔(毫秒) iOS高性能模式自动GC间隔(毫秒)

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c3dd1616370eb2aa6b9db9f990c9c33e guid: d1c5b523ce6d78e33bdf6bbe6a5bf6ea
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -542,9 +542,13 @@ mergeInto(LibraryManager.library, {
GameGlobal.avgExFrameTime = exTotalTime / 60; GameGlobal.avgExFrameTime = exTotalTime / 60;
frameCount = 0; frameCount = 0;
exTotalTime = 0; exTotalTime = 0;
} else if (typeof GameGlobal.avgExFrameTime === "undefined") {
GameGlobal.avgExFrameTime = exTotalTime / frameCount;
} }
}; };
}(); }();
//Set initial value to 0 for preventing GameGlobal.avgExFrameTime from being undefined in Unity 2019
GameGlobal.avgExFrameTime = 0;
} }
return GameGlobal.avgExFrameTime return GameGlobal.avgExFrameTime
}, },

View File

@ -269,6 +269,10 @@ var WXAssetBundleLibrary = {
var err_msg = !!e ? e.toString() : 'unknown'; var err_msg = !!e ? e.toString() : 'unknown';
} }
var expected_size = WXFS.disk.get(path); var expected_size = WXFS.disk.get(path);
if(expected_size === 0){
WXFS.disk.set(path, res.byteLength);
expected_size = res.byteLength;
}
if(!res || res.byteLength != expected_size){ if(!res || res.byteLength != expected_size){
var wxab_error = { var wxab_error = {
stage: WXFS.WXABErrorSteps['kLoadBundleFromFile'], stage: WXFS.WXABErrorSteps['kLoadBundleFromFile'],
@ -308,12 +312,16 @@ var WXAssetBundleLibrary = {
return buffer; return buffer;
}, },
UnCleanbyPath: function (ptr) { UnCleanbyPath: function (ptr, fromFile) {
var url = UTF8ToString(ptr); var url = UTF8ToString(ptr);
var path = WXFS.url2path(url); var path = WXFS.url2path(url);
if(fromFile && !GameGlobal.manager.fs.accessSync(path)){
return false;
}
if(!WXFS.disk.has(path)){ if(!WXFS.disk.has(path)){
WXFS.disk.set(path, 0); WXFS.disk.set(path, 0);
} }
return true;
}, },
UnloadbyPath: function (ptr) { UnloadbyPath: function (ptr) {

View File

@ -0,0 +1,85 @@
mergeInto(LibraryManager.library, {
JSInitProfiler: function(savePathPtr, metaInfoPtr) {
const savePath = UTF8ToString(savePathPtr);
// const uploadUrl = UTF8ToString(uploadUrlPtr);
const metaInfo = UTF8ToString(metaInfoPtr);
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.initProfiler) {
const uploadUrl = GameGlobal.managerConfig.PROFILER_UPLOAD_URL;
GameGlobal.manager.initProfiler({'savePath': savePath, 'uploadUrl': uploadUrl, 'meta': metaInfo, 'cb': _JSInitProfilerCallback, 'errorCb': _JSProfilerErrorCallback});
//}
},
JSStartProfiler: function() {
//const savePath = UTF8ToString(savePathPtr);
//const uploadUrl = UTF8ToString(uploadUrlPtr);
//const metaInfo = UTF8ToString(metaInfoPtr);
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) {
GameGlobal.manager.profiler.startProfile();
//}
},
StartJSProfilerRecord: function(frameId, interval, savePathPtr) {
const savePath = UTF8ToString(savePathPtr);
if (GameGlobal && GameGlobal.unityNamespace && GameGlobal.unityNamespace.ProfileWebgl && GameGlobal.unityNamespace.ProfileWebgl.startRecord) {
GameGlobal.unityNamespace.ProfileWebgl.startRecord(frameId, interval, savePath);
}
},
StopJSProfilerRecord: function() {
if (GameGlobal && GameGlobal.unityNamespace && GameGlobal.unityNamespace.ProfileWebgl && GameGlobal.unityNamespace.ProfileWebgl.stopRecord) {
GameGlobal.unityNamespace.ProfileWebgl.stopRecord();
}
},
JSProfilerUploadString: function(dataPtr, bufSize, namePtr, dirPtr, id, inStartFrameIdx, inEndFrameIdx) {
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) {
const name = UTF8ToString(namePtr);
const dir = UTF8ToString(dirPtr);
const content = UTF8ToString(dataPtr);
GameGlobal.manager.profiler.uploadString({'str': content, 'len': bufSize, 'fileName': name, 'uploadDir': dir, 'id': id, 'cb': _JSPerfUploadStringCallback, 'startFrameIdx': inStartFrameIdx, 'endFrameIdx': inEndFrameIdx});
//}
},
JSProfilerUploadAnnotation: function(inAnnotationDataPtr, inFrameIdx) {
const annotationData = UTF8ToString(inAnnotationDataPtr);
GameGlobal.manager.profiler.uploadAnnotation({'annotationData': annotationData, 'annotationFrameIDX': inFrameIdx});
},
JSGetMetaDataInfo: function() {
var convertPluginVersion = GameGlobal.unityNamespace.convertPluginVersion;
var unityHeapReservedMemory = GameGlobal.unityNamespace.unityHeapReservedMemory;
var contextType = GameGlobal.managerConfig.contextConfig.contextType;
var webglVersion;
switch (contextType) {
case 1:
webglVersion = "webgl1";
break;
case 2:
webglVersion = "webgl2";
break;
case 3:
webglVersion = "auto";
break;
default:
webglVersion = "unknown";
}
var metaDataString = "convertPluginVersion="
+ convertPluginVersion + "\nwebglVersion=" + webglVersion +
"\nunityHeapReservedMemory=" + unityHeapReservedMemory + "\ndpr=" +
window.devicePixelRatio + "\n";
var lengthBytes = lengthBytesUTF8(metaDataString) + 1;
var stringOnWasmHeap = _malloc(lengthBytes);
stringToUTF8(metaDataString, stringOnWasmHeap, lengthBytes);
return stringOnWasmHeap;
},
JSFreeIntPtr: function(ptr) {
_free(ptr);
},
JSProfilerUploadStringWithDir: function(dataPtr, bufSize, namePtr, dirPtr) {
//if (GameGlobal && GameGlobal.manager && GameGlobal.manager.profiler) {
const name = UTF8ToString(namePtr);
const dir = UTF8ToString(dirPtr);
const content = UTF8ToString(dataPtr);
GameGlobal.manager.profiler.uploadStringWithDir({'str': content, 'len': bufSize, 'fileName': name, 'uploadDir': dir, 'cb': _JSProfilerUploadStringWithDirCallback});
//}
}
});

View File

@ -0,0 +1,79 @@
fileFormatVersion: 2
guid: de46a37ac18378340bae0bc523c46892
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 1
Exclude Linux64: 1
Exclude OSXUniversal: 1
Exclude WeixinMiniGame: 0
Exclude Win: 1
Exclude Win64: 1
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Facebook: WebGL
second:
enabled: 1
settings: {}
- 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:
WebGL: WebGL
second:
enabled: 1
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 1
settings: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Runtime/Plugins/wx-perf.dll Normal file

Binary file not shown.

View File

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

View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>wx-perf</name>
</assembly>
<members>
<member name="M:WXSDKPerf.WXPerfEngine_Implementation.Annotation(System.String)">
<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>
</member>
</members>
</doc>

View File

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

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: 0dedb8177ed8f384d9833f379a1b9b2a
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 1
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: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
WebGL: WebGL
second:
enabled: 0
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 0
settings: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,74 @@
fileFormatVersion: 2
guid: 187d3306362e8bec07846a683aeb77da
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 1
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
: Any
second:
enabled: 0
settings:
Exclude Editor: 1
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: 0
settings:
CPU: AnyCPU
DefaultValueInitialized: true
OS: AnyOS
- first:
Standalone: Linux64
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: OSXUniversal
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win
second:
enabled: 0
settings:
CPU: None
- first:
Standalone: Win64
second:
enabled: 0
settings:
CPU: None
- first:
WebGL: WebGL
second:
enabled: 0
settings: {}
- first:
WeixinMiniGame: WeixinMiniGame
second:
enabled: 0
settings: {}
userData:
assetBundleName:
assetBundleVariant:

133
Runtime/WXRuntimeExtDef.cs Normal file
View File

@ -0,0 +1,133 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
namespace WeChatWASM
{
public class WXRuntimeExtDef
{
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)]
static void OnWXRuntimeExtDefLoadRuntimeMethod()
{
Init();
}
private static void Init()
{
#if UNITY_2018_1_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2018_1_OR_NEWER", false);
#endif
#if UNITY_2020_1_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2020_1_OR_NEWER", false);
#endif
#if UNITY_2021_1_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_1_OR_NEWER", false);
#endif
#if UNITY_2021_2_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_2_OR_NEWER", false);
#endif
#if UNITY_2021_3_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2021_3_OR_NEWER", false);
#endif
#if UNITY_EDITOR_OSX
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_OSX", false);
#endif
#if UNITY_EDITOR_LINUX
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_EDITOR_LINUX", false);
#endif
#if UNITY_2020
WXRuntimeExtEnvDef.SETDEF("UNITY_2020", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2020", false);
#endif
#if UNITY_2021
WXRuntimeExtEnvDef.SETDEF("UNITY_2021", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2021", false);
#endif
#if UNITY_2022
WXRuntimeExtEnvDef.SETDEF("UNITY_2022", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2022", false);
#endif
#if UNITY_2022_2_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_2022_2_OR_NEWER", false);
#endif
#if UNITY_INSTANTGAME
WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", true);
#else
WXRuntimeExtEnvDef.SETDEF("UNITY_INSTANTGAME", false);
#endif
#if WEIXINMINIGAME
WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", true);
#else
WXRuntimeExtEnvDef.SETDEF("WEIXINMINIGAME", false);
#endif
#if TUANJIE_2022_3_OR_NEWER
WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", true);
#else
WXRuntimeExtEnvDef.SETDEF("TUANJIE_2022_3_OR_NEWER", false);
#endif
#if PLATFORM_WEIXINMINIGAME
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", true);
#else
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEIXINMINIGAME", false);
#endif
#if PLATFORM_WEBGL
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", true);
#else
WXRuntimeExtEnvDef.SETDEF("PLATFORM_WEBGL", false);
#endif
RegisterController();
}
private static void RegisterController()
{
// Example:
/*
WXRuntimeExtDef.RegisterAction("xxx", (args) =>
{
#if UNITY_2018
return 1;
#else
return 0;
#endif
});
*/
WXRuntimeExtEnvDef.RegisterAction("Unity.GetObjectInstanceID", (args) =>
{
#if UNITY_2021_3_OR_NEWER
if (args is UnityEngine.Object unityObject)
{
return unityObject.GetInstanceID();
}
#endif
// unityObject.GetInstanceID() would never return 0.
return 0;
});
}
}
}

View File

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

8
Runtime/WXSDKPerf.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: aef8914ede3654c3fbed916372d75964
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,49 @@
#if ENABLE_WX_PERF_FEATURE
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Xml;
using UnityEngine;
using UnityEngine.Scripting;
using WXPerf;
namespace WXSDKPerf
{
[Preserve]
[ComVisible(false)]
public class WXPerfEngine
{
static WXPerfEngine_Implementation m_PerfEngineImplementation = null;
[RuntimeInitializeOnLoadMethod]
public static void StartWXPerfEngine()
{
#if UNITY_EDITOR
return;
#endif
m_PerfEngineImplementation = new WXPerfEngine_Implementation();
m_PerfEngineImplementation.StartPerfEngine();
}
public static void Annotation(string InAnnotationString)
{
#if UNITY_EDITOR
return;
#endif
if (m_PerfEngineImplementation == null)
{
UnityEngine.Debug.LogError("Annotation: Invalid m_PerfEngineImplementation! ");
return;
}
m_PerfEngineImplementation.Annotation(InAnnotationString);
}
}
}
#endif // ENABLE_WX_PERF_FEATURE

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8cf919bdb0222454ca11dee03ff47d57
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -62,6 +62,8 @@ const isPcBrotliInvalid = isPc && !compareVersion(SDKVersion, $LOAD_DATA_FROM_SU
const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1'); const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1');
// @ts-ignore // @ts-ignore
const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid); const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid);
// iOS系统版本>=17.5时,小游戏退后台会导致异常
export const isIOS175 = compareVersion(systemVersion, '17.5') || isH5Renderer;
// 是否能以iOS高性能模式运行 // 是否能以iOS高性能模式运行
// 请勿修改GameGlobal.canUseH5Renderer赋值 // 请勿修改GameGlobal.canUseH5Renderer赋值
GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid; GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid;

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 36392430e8c0cff4855b2f94a0f9cb92 guid: 80ce982c9406122fb93fe0115a01783a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6cb10f5bb5f5feda747a6d58e6c0d121 guid: 140c5d449a8ecde7799af56bb11e45c6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0c610f935c70f30554dae4d449fc05f4 guid: 9982341bd072d3b7363aafd7e4f8a08a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -29,6 +29,7 @@ const managerConfig = {
contextConfig: { contextConfig: {
contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2 contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2
}, },
PROFILER_UPLOAD_URL: '',
}; };
GameGlobal.managerConfig = managerConfig; GameGlobal.managerConfig = managerConfig;
// 版本检查 // 版本检查

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c7687b8949896a6e2659249b3e899be0 guid: 1699b678c88dce2aa43b5dc7fa7d36c5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -23,7 +23,7 @@
], ],
"plugins": { "plugins": {
"UnityPlugin": { "UnityPlugin": {
"version": "1.2.57", "version": "1.2.60",
"provider": "wxe5a48f1ed5f544b7", "provider": "wxe5a48f1ed5f544b7",
"contexts": [ "contexts": [
{ {

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c695edc400191b2f49cfb73a65674e2b guid: a6f905269b34bcae0fb55d79ab7e4b9d
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1562138b9097ab31b4d250f6c35ba405 guid: d55535909fad016103bd59d07dbab675
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a9ca0da7a937153f8cc087e66ff1b826 guid: 676358aaad286674fd9edeb7bb8c81a4
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: a27fd22b3d72a08e51e28d2145febad6 guid: dd7659f86d49d358568927fc70700732
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: bdab9eeacb77220ccac300f63f3596d6 guid: 20d4939cbebfcea5282c75919c6bb827
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 980c1028a001d666d020af0a75438eba guid: b61afb460be19337714796fa8787fe94
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d426aeda43fe8e39f134aae1f9f31c3c guid: 511a45dab3030dbe5ce9541ba21e5afc
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0928928f169894a45c31e5a5d092475c guid: b0819a420cb2a94f6f1a9d95d144ded6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 831ba8ca9ef8c6f1f2102224858cf82b guid: 70cb71d826583f3509a9b54ec761300f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d737d3583146ae800c176d5203f9fc40 guid: 1e8d0cfe2edcf06a1195b8a06ecbd5a3
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 95c5ba8d5ec4ee303122666a2b106644 guid: 3f368894a37535cbe7bc1bd80a09b1e4
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: b8febd943c0a39b795330dba0a520153 guid: 423ef10d550b1763dc176395faaf23e7
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 63cb751602c040a16ff1fc77cc096a65 guid: 5d999bcabbb37b0b83408ac264b07410
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 08c1b22b7889b8f4e982ae067cd162c5 guid: 8c53b397c5befd989f545a3afc933837
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 03419eec1f30107bea6f33dce8bf68a8 guid: 7b5b016ac57046df71ef36e60f17e14a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 844bbaa8b83a8d3212f3633a0a78fc09 guid: d1d73fd72458595784608d7379d6282f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 537c49719a45976f84dec8d88ff496c9 guid: ab4a3e094253d52968312a6df7c67933
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c5bf523fe19c255ca2797c6aa6739c44 guid: 35c065c5557a8fce8ebaa2aec9965fe9
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f31df8fd614f546340e7ef9975d0061f guid: d33b1a1f08f8833caf80e8699e50e946
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 37c8b9b502beb21d10fb8e4e058d556f guid: c3af73b35f666c8f93cf25a13958bfb5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 9341252b64902c8fa41edfc31862bc5f guid: a8f2543e9cff6cfb8e5a478f86150e81
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: df8bb927d17760d4a009e226dc51ccce guid: c474d7d3c09dff28024a5cffb20822ce
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: d8ed23bd4d2dd4433b3f3def44b0944f guid: ab240f2ed5701ec4f942949bae88e656
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -53,6 +53,12 @@ const unityNamespace = {
useBrotliMT: $USE_BROTLI_MT, useBrotliMT: $USE_BROTLI_MT,
// Boot config配置包含例如wait-for-native-debugger、player-connection-ip等信息 // Boot config配置包含例如wait-for-native-debugger、player-connection-ip等信息
bootConfig: '$BOOT_CONFIG_INFO', bootConfig: '$BOOT_CONFIG_INFO',
// 是否以Development Build构建
isDevelopmentBuild: $Is_Development_Build,
// 是否以Profiling Build导出
isProfilingBuild: $Is_Profiling_Build,
// 预留的堆内存
unityHeapReservedMemory: $UnityHeapReservedMemory,
}; };
// 最佳实践检测配置 // 最佳实践检测配置
unityNamespace.monitorConfig = { unityNamespace.monitorConfig = {

View File

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

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertInfoToPointer, formatResponse, convertDataToPointer } from '../utils'; import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertInfoToPointer, formatResponse, convertDataToPointer } from '../utils';
const TCPSocketList = {}; const TCPSocketList = {};
const wxTCPSocketBindWifiList = {}; const wxTCPSocketBindWifiList = {};

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 612f18c0d70f3507e549bc10e883c468 guid: 9bc42fc10ff857b2dfee4a294d195ad0
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertDataToPointer, convertInfoToPointer, formatResponse } from '../utils'; import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertDataToPointer, convertInfoToPointer, formatResponse } from '../utils';
const UDPSocketList = {}; const UDPSocketList = {};
const wxUDPSocketCloseList = {}; const wxUDPSocketCloseList = {};

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 098fd61fa416aa9d3b974b37dfde7acf guid: ead095c73a3e48f4fa4b003b096a9986
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import moduleHelper from './module-helper'; import moduleHelper from './module-helper';
import response from './response'; import response from './response';
import { formatJsonStr, uid } from './utils'; import { formatJsonStr, uid } from './utils';

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 2adea835f2d2156e45ea42b18a4eec4c guid: e5e38cbc8707be2816cfd945061dbcee
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8d3b0732e2cb918dcf813a7b33b48d80 guid: 256a7ce83e94b433abcd6736c5d48efe
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 51a9b3d489deb95836286a9deae14e43 guid: fe065c89efe8425918ab6058aa445487
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import moduleHelper from '../module-helper'; import moduleHelper from '../module-helper';
import { isSupportPlayBackRate } from '../../check-version'; import { isSupportPlayBackRate } from '../../check-version';
import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store'; import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store';
@ -320,8 +321,8 @@ export default {
if (key === 'onCanplay') { if (key === 'onCanplay') {
audios[id][key](() => { audios[id][key](() => {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration, buffered, referrerPolicy, volume } = audios[id]; const { duration, buffered, referrerPolicy, volume } = audios[id];
setTimeout(() => { setTimeout(() => {
moduleHelper.send('OnAudioCallback', JSON.stringify({ moduleHelper.send('OnAudioCallback', JSON.stringify({

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 66d3cd7efbeded889f9cb865478926ff guid: f298cb8e773a8a66b5d437cb26f0925a
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: c8a3a347a88f47703d2c3d2a937bfb12 guid: 19fe8df4e2f23286b54fc3e1873c00de
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,4 +1,7 @@
import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayBackRate, isSupportInnerAudio, } from '../../check-version'; /* eslint-disable no-param-reassign */
/* eslint-disable eqeqeq */
/* eslint-disable no-plusplus */
import { isAndroid, isPc, webAudioNeedResume, isSupportBufferURL, isSupportPlayBackRate, isSupportInnerAudio, isIOS175, } from '../../check-version';
import { WEBAudio, unityAudioVolume } from './store'; import { WEBAudio, unityAudioVolume } from './store';
import { TEMP_DIR_PATH } from './const'; import { TEMP_DIR_PATH } from './const';
import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils'; import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils';
@ -14,6 +17,7 @@ function jsAudioCreateUncompressedSoundClip(buffer, error, length) {
this.buffer = null; this.buffer = null;
WEBAudio.audioBufferLength -= length; WEBAudio.audioBufferLength -= length;
}, },
resetGain() { },
getLength() { getLength() {
if (!this.buffer) { if (!this.buffer) {
@ -77,10 +81,11 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) {
} }
delete this.url; delete this.url;
}, },
resetGain() { },
getLength() { getLength() {
return this.length || 0; return this.length || 0;
}, },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
getData(ptr, length) { getData(ptr, length) {
console.warn('getData() is not supported for compressed sound.'); console.warn('getData() is not supported for compressed sound.');
return 0; return 0;
@ -161,13 +166,18 @@ export class AudioChannelInstance {
constructor(callback, userData) { constructor(callback, userData) {
if (WEBAudio.audioContext) { if (WEBAudio.audioContext) {
this.gain = WEBAudio.audioContext.createGain(); this.gain = WEBAudio.audioContext.createGain();
if (this.gain) { this.gain?.connect(WEBAudio.audioContext.destination);
this.gain.connect(WEBAudio.audioContext.destination);
}
} }
this.callback = callback; this.callback = callback;
this.userData = userData; this.userData = userData;
} }
resetGain() {
if (WEBAudio.audioContext && this.gain) {
this.gain.disconnect();
this.gain = WEBAudio.audioContext.createGain();
this.gain?.connect(WEBAudio.audioContext.destination);
}
}
release() { release() {
this.disconnectSource(); this.disconnectSource();
if (this.gain) { if (this.gain) {
@ -276,8 +286,8 @@ export class AudioChannelInstance {
}); });
const fn = () => { const fn = () => {
if (typeof this.source !== 'undefined' && this.source.mediaElement) { if (typeof this.source !== 'undefined' && this.source.mediaElement) {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration } = this.source.mediaElement; const { duration } = this.source.mediaElement;
setTimeout(() => { setTimeout(() => {
if (soundClip && this.source && this.source.mediaElement) { if (soundClip && this.source && this.source.mediaElement) {
@ -538,7 +548,7 @@ export class AudioChannelInstance {
} }
}, 100); }, 100);
}; };
const innerPlay = () => { const innerPlay = (callback) => {
if (this.source && this.source.mediaElement) { if (this.source && this.source.mediaElement) {
if (isSupportBufferURL && this.source.readyToPlay) { if (isSupportBufferURL && this.source.readyToPlay) {
if (this.source.stopCache) { if (this.source.stopCache) {
@ -551,6 +561,7 @@ export class AudioChannelInstance {
innerFixPlay(); innerFixPlay();
} }
this.source.mediaElement.play(); this.source.mediaElement.play();
callback?.();
} }
} }
else { else {
@ -561,8 +572,8 @@ export class AudioChannelInstance {
this.source.needCanPlay = false; this.source.needCanPlay = false;
this.source.readyToPlay = true; this.source.readyToPlay = true;
if (typeof this.source.mediaElement !== 'undefined') { if (typeof this.source.mediaElement !== 'undefined') {
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { duration } = this.source.mediaElement; const { duration } = this.source.mediaElement;
@ -582,6 +593,7 @@ export class AudioChannelInstance {
} }
if (typeof this.source.mediaElement !== 'undefined') { if (typeof this.source.mediaElement !== 'undefined') {
this.source.mediaElement.play(); this.source.mediaElement.play();
callback?.();
} }
} }
}; };
@ -594,7 +606,7 @@ export class AudioChannelInstance {
} }
} }
}; };
// eslint-disable-next-line @typescript-eslint/naming-convention
const _reset = () => { const _reset = () => {
if (!this.source) { if (!this.source) {
return; return;
@ -609,7 +621,7 @@ export class AudioChannelInstance {
this.source.stopTicker = undefined; this.source.stopTicker = undefined;
} }
}; };
// eslint-disable-next-line @typescript-eslint/naming-convention
const _pauseMediaElement = () => { const _pauseMediaElement = () => {
if (typeof this.source === 'undefined') { if (typeof this.source === 'undefined') {
return; return;
@ -621,28 +633,22 @@ export class AudioChannelInstance {
this.source.mediaElement.pause(); this.source.mediaElement.pause();
} }
}; };
// eslint-disable-next-line @typescript-eslint/naming-convention
const _startPlayback = (offset) => { const _startPlayback = (offset) => {
if (typeof this.source === 'undefined' || !this.source.mediaElement) { if (typeof this.source === 'undefined' || !this.source.mediaElement) {
return; return;
} }
if (this.source.playTimeout) { if (this.source.playTimeout) {
if (typeof this.source.mediaElement.seek === 'function') {
this.source.mediaElement.seek(offset); this.source.mediaElement.seek(offset);
}
else {
this.source.mediaElement.currentTime = offset;
}
this.source.pauseRequested = false; this.source.pauseRequested = false;
return; return;
} }
innerPlay(); innerPlay(() => {
if (typeof this.source.mediaElement.seek === 'function') {
if (this.source && this.source.mediaElement) {
this.source.mediaElement.seek(offset); this.source.mediaElement.seek(offset);
} }
else { });
this.source.mediaElement.currentTime = offset;
}
}; };
const start = (startTime, offset) => { const start = (startTime, offset) => {
if (typeof this.source === 'undefined') { if (typeof this.source === 'undefined') {
@ -710,22 +716,22 @@ export class AudioChannelInstance {
start, start,
stop, stop,
}; };
// @ts-ignore
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { buffered, referrerPolicy, volume } = getAudio; const { buffered, referrerPolicy, volume } = getAudio;
const { source } = this; const { source } = this;
Object.defineProperty(this.source, 'loopStart', { Object.defineProperty(this.source, 'loopStart', {
get() { get() {
return 0; return 0;
}, },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
set(v) { }, set(v) { },
}); });
Object.defineProperty(source, 'loopEnd', { Object.defineProperty(source, 'loopEnd', {
get() { get() {
return 0; return 0;
}, },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
set(v) { }, set(v) { },
}); });
Object.defineProperty(source, 'loop', { Object.defineProperty(source, 'loop', {
@ -845,7 +851,7 @@ export default {
if (!soundClip) { if (!soundClip) {
return defaultSoundLength; return defaultSoundLength;
} }
const length = soundClip.getLength() || defaultSoundLength; const length = soundClip.getLength();
return length; return length;
}, },
_JS_Sound_GetLoadState(bufferInstance) { _JS_Sound_GetLoadState(bufferInstance) {
@ -882,13 +888,18 @@ export default {
clearTimeout(webAutoResumeTicker); clearTimeout(webAutoResumeTicker);
webAutoResumeTicker = null; webAutoResumeTicker = null;
} }
if (!GameGlobal.isIOSHighPerformanceMode) {
WEBAudio.audioContext?.suspend(); WEBAudio.audioContext?.suspend();
}
}); });
wx.onShow(() => { wx.onShow(() => {
if (isIOS175) {
WEBAudio.audioContext?.close();
WEBAudio.audioContext = wx.createWebAudioContext();
Object.values(WEBAudio.audioInstances).forEach(it => it.resetGain());
}
else {
WEBAudio.audioContext?.resume(); WEBAudio.audioContext?.resume();
}
}); });
if (webAudioNeedResume) { if (webAudioNeedResume) {
@ -1120,7 +1131,7 @@ export default {
printErrMsg(`Invalid audio pitch ${v} specified to WebAudio backend!`); printErrMsg(`Invalid audio pitch ${v} specified to WebAudio backend!`);
} }
}, },
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_JS_Sound_SetPosition(channelInstance, x, y, z) { _JS_Sound_SetPosition(channelInstance, x, y, z) {
if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) { if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) {
return; return;
@ -1186,7 +1197,7 @@ export default {
if (!audioInstance) { if (!audioInstance) {
return WEBAudio.FAKEMOD_SAMPLERATE; return WEBAudio.FAKEMOD_SAMPLERATE;
} }
// eslint-disable-next-line no-nested-ternary
const buffer = audioInstance.buffer const buffer = audioInstance.buffer
? audioInstance.buffer ? audioInstance.buffer
: audioInstance.source : audioInstance.source

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 8346ff453fe21338b841aab61162337f guid: eabe91b8833c9c17a78fab3e78254584
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -45,7 +45,7 @@ export const destroyInnerAudio = (id, useCache) => {
Object.keys(state).forEach((key) => { Object.keys(state).forEach((key) => {
try { try {
// @ts-ignore
audios[id][key] = state[key]; audios[id][key] = state[key];
} }
catch (e) { } catch (e) { }

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 68874cda8a2e82a30abc545d224953f4 guid: fd977cc3c1136c0fb79153770b9f4515
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -7,7 +7,7 @@ export default {
resolveFn = resolve; resolveFn = resolve;
moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}'); moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}');
}; };
// @ts-ignore
wx.onNeedPrivacyAuthorization(callback); wx.onNeedPrivacyAuthorization(callback);
}, },
WX_PrivacyAuthorizeResolve(conf) { WX_PrivacyAuthorizeResolve(conf) {

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6e5752ce8258890be0c62b17f5613c04 guid: 672932a174d355e3488bac79d344dfb6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { convertDataToPointer } from '../utils'; import { convertDataToPointer } from '../utils';
let wxOnBLECharacteristicValueChangeCallback; let wxOnBLECharacteristicValueChangeCallback;
const OnBLECharacteristicValueChange = (res) => { const OnBLECharacteristicValueChange = (res) => {

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f5f0f8ec95bf588fc630fda410c4b8d2 guid: 775b38f08776b58a57730141a84e7aea
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 3118d92cedcd76cebc03aca7a42a59b4 guid: dd7a051cad81fa34f1ac04ec8ca3c8d7
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 5e736370d1b9ac986a749c86d9a1549f guid: 45812845ec5b19b4d739930d907eff76
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -10,7 +10,7 @@ function createMiniGameChat(options, callback) {
try { try {
if (typeof requirePlugin !== 'undefined') { if (typeof requirePlugin !== 'undefined') {
if (!MiniGameChat) { if (!MiniGameChat) {
// @ts-ignore
MiniGameChat = requirePlugin('MiniGameChat', { MiniGameChat = requirePlugin('MiniGameChat', {
enableRequireHostModule: true, enableRequireHostModule: true,
customEnv: { customEnv: {
@ -124,7 +124,7 @@ export default {
if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') { if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') {
return; return;
} }
// eslint-disable-next-line no-restricted-syntax
for (const key in Object.keys(onList[eventType])) { for (const key in Object.keys(onList[eventType])) {
const callback = onList[eventType][key]; const callback = onList[eventType][key];
if (callback) { if (callback) {

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e786ced1ebda02a8a1dc72b8e93f0e2c guid: cf540c20bdaa5744401e365120d43c43
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import moduleHelper from './module-helper'; import moduleHelper from './module-helper';
import { uid, formatJsonStr, formatResponse } from './utils'; import { uid, formatJsonStr, formatResponse } from './utils';
const CloudIDObject = {}; const CloudIDObject = {};
@ -21,7 +22,7 @@ const CloudList = {};
export default { export default {
WX_CloudCloud(option) { WX_CloudCloud(option) {
const config = formatJsonStr(option); const config = formatJsonStr(option);
// @ts-ignore
const cloud = new wx.cloud.Cloud(config); const cloud = new wx.cloud.Cloud(config);
CloudList[config.resourceEnv] = cloud; CloudList[config.resourceEnv] = cloud;
}, },

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1c491ec235907f84a7c4fbe37cf8903c guid: e9d512cce216e9890efb86bb5b0543ab
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 6fcae60b35180332300867b5879c19bf guid: 4376dc0a98887a68d27b3a0030f0352f
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1519c4f3477205b3a444554106587262 guid: ef1416723718e4a7df78193268e8e5cd
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,5 @@
/* eslint-disable prefer-spread */
/* eslint-disable prefer-rest-params */
export default { export default {
init() { init() {
@ -15,13 +17,13 @@ export default {
} }
return id; return id;
}; };
// @ts-ignore
window.setTimeout = function (vCallback, nDelay) { window.setTimeout = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2); const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId(); const id = getId();
const t = privateSetTimeout(vCallback instanceof Function const t = privateSetTimeout(vCallback instanceof Function
? () => { ? () => {
// @ts-ignore
vCallback.apply(null, aArgs); vCallback.apply(null, aArgs);
delete wm[id]; delete wm[id];
} }
@ -30,7 +32,7 @@ export default {
return id; return id;
}; };
const privateClearTimeout = window.clearTimeout; const privateClearTimeout = window.clearTimeout;
// @ts-ignore
window.clearTimeout = function (id) { window.clearTimeout = function (id) {
if (id) { if (id) {
const t = wm[id]; const t = wm[id];
@ -41,13 +43,13 @@ export default {
} }
}; };
const privateSetInterval = window.setInterval; const privateSetInterval = window.setInterval;
// @ts-ignore
window.setInterval = function (vCallback, nDelay) { window.setInterval = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2); const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId(); const id = getId();
const t = privateSetInterval(vCallback instanceof Function const t = privateSetInterval(vCallback instanceof Function
? () => { ? () => {
// @ts-ignore
vCallback.apply(null, aArgs); vCallback.apply(null, aArgs);
} }
: vCallback, nDelay); : vCallback, nDelay);
@ -55,7 +57,7 @@ export default {
return id; return id;
}; };
const privateClearInterval = window.clearInterval; const privateClearInterval = window.clearInterval;
// @ts-ignore
window.clearInterval = function (id) { window.clearInterval = function (id) {
if (id) { if (id) {
const t = wm[id]; const t = wm[id];

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 1d2f45af35ac9a2deb89dbeb8a3c4db9 guid: efa343cf6c75916ed5c857fbcba5a2d5
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 479377c954d7a65b2ea765c8ab25bfc5 guid: 15f26c5a5559e568e46e7011e9fd718c
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import moduleHelper from '../module-helper'; import moduleHelper from '../module-helper';
import { formatJsonStr } from '../utils'; import { formatJsonStr } from '../utils';
@ -94,7 +95,7 @@ function handleGetFontData(config, forceLoad = false) {
if (!config && !canGetWxCommonFont) { if (!config && !canGetWxCommonFont) {
return Promise.reject('invalid usage'); return Promise.reject('invalid usage');
} }
// eslint-disable-next-line @typescript-eslint/no-misused-promises
if (!getFontPromise || forceLoad) { if (!getFontPromise || forceLoad) {
getFontPromise = new Promise((resolve, reject) => { getFontPromise = new Promise((resolve, reject) => {
if (!canGetWxCommonFont && !!config) { if (!canGetWxCommonFont && !!config) {

View File

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

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 0ecd8772354b76659e765bf077320ea9 guid: 7463e777c48729cd63d38e8eb67c9265
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 82ea6fb984ab9015f3430ccc1b0ca1fd guid: 67dc0287bf6fe0f971522221d4b83ed6
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 811b15cdcc678952edc3a365e1c1cc84 guid: da739d61f88944527584e79754d7a110
DefaultImporter: DefaultImporter:
externalObjects: {} externalObjects: {}
userData: userData:

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