diff --git a/.DS_Store.meta b/.DS_Store.meta index e657f46c3..01362909e 100644 --- a/.DS_Store.meta +++ b/.DS_Store.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5e0c24fa575f4498a37298e963ed4a1f +guid: 73a34af70c50d0e97ed264ff0ecafaa0 DefaultImporter: externalObjects: {} userData: diff --git a/Editor/WXAssetPostprocessor.cs b/Editor/WXAssetPostprocessor.cs new file mode 100644 index 000000000..af64c8cfc --- /dev/null +++ b/Editor/WXAssetPostprocessor.cs @@ -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; + } +} diff --git a/Editor/WXAssetPostprocessor.cs.meta b/Editor/WXAssetPostprocessor.cs.meta new file mode 100644 index 000000000..5566e748b --- /dev/null +++ b/Editor/WXAssetPostprocessor.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e8dec6e99bf04b4f787998f122542793 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Editor/WXConvertCore.cs b/Editor/WXConvertCore.cs index 6ad692dfe..02b268dac 100644 --- a/Editor/WXConvertCore.cs +++ b/Editor/WXConvertCore.cs @@ -109,8 +109,16 @@ namespace WeChatWASM Debug.LogError("因构建模板检查失败终止导出。"); return WXExportError.BUILD_WEBGL_FAILED; } + if (CheckInvalidPerfIntegration()) + { + Debug.LogError("性能分析工具只能用于Development Build, 终止导出! "); + return WXExportError.BUILD_WEBGL_FAILED; + } + + CheckBuildTarget(); Init(); + ProcessWxPerfBinaries(); // JSLib SettingWXTextureMinJSLib(); UpdateGraphicAPI(); @@ -208,6 +216,42 @@ namespace WeChatWASM 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() { Emit(LifeCycle.beforeSwitchActiveBuildTarget); @@ -318,6 +362,16 @@ namespace WeChatWASM 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() { CompressAssemblyBrotli(); @@ -1410,6 +1464,9 @@ namespace WeChatWASM config.FontOptions.Mathematical_Operators ? "true" : "false", customUnicodeRange, boolConfigInfo, + config.CompileOptions.DevelopBuild ? "true" : "false", + config.CompileOptions.enablePerfAnalysis ? "true" : "false", + config.ProjectConf.MemorySize.ToString(), }); List replaceList = new List(replaceArrayList); diff --git a/Editor/WXEditorSettingHelper.cs b/Editor/WXEditorSettingHelper.cs index 833507dd3..2b5b09f7d 100644 --- a/Editor/WXEditorSettingHelper.cs +++ b/Editor/WXEditorSettingHelper.cs @@ -59,6 +59,8 @@ namespace WeChatWASM } //private static WXEditorScriptObject config = UnityUtil.GetEditorConf(); + private static bool m_EnablePerfTool = false; + private static string _dstCache; public void OnFocus() @@ -178,7 +180,7 @@ namespace WeChatWASM 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("scriptOnly", "Scripts Only Build"); 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("enableRenderAnalysis", "显示渲染日志(dev only)"); this.formCheckbox("brotliMT", "brotli多线程压缩(?)", "开启多线程压缩可以提高出包速度,但会降低压缩率。如若不使用wasm代码分包请勿用多线程出包上线"); + if (m_EnablePerfTool) + { + this.formCheckbox("enablePerfAnalysis", "集成性能分析工具", "将性能分析工具集成入Development Build包中", false, null, OnPerfAnalysisFeatureToggleChanged); + } + EditorGUILayout.EndVertical(); } + #if UNITY_INSTANTGAME foldInstantGame = EditorGUILayout.Foldout(foldInstantGame, "Instant Game - AutoStreaming"); if (foldInstantGame) @@ -461,6 +469,7 @@ namespace WeChatWASM this.setData("enableProfileStats", config.CompileOptions.enableProfileStats); this.setData("enableRenderAnalysis", config.CompileOptions.enableRenderAnalysis); this.setData("brotliMT", config.CompileOptions.brotliMT); + this.setData("enablePerfAnalysis", config.CompileOptions.enablePerfAnalysis); this.setData("autoUploadFirstBundle", true); // font options @@ -532,6 +541,7 @@ namespace WeChatWASM config.CompileOptions.enableProfileStats = this.getDataCheckbox("enableProfileStats"); config.CompileOptions.enableRenderAnalysis = this.getDataCheckbox("enableRenderAnalysis"); config.CompileOptions.brotliMT = this.getDataCheckbox("brotliMT"); + config.CompileOptions.enablePerfAnalysis = this.getDataCheckbox("enablePerfAnalysis"); // font options 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.Mathematical_Operators = this.getDataCheckbox("Mathematical_Operators"); config.FontOptions.CustomUnicode = this.getDataInput("CustomUnicode"); + + ApplyPerfAnalysisSetting(); } private string getDataInput(string target) @@ -640,7 +652,7 @@ namespace WeChatWASM GUILayout.EndHorizontal(); } - private void formCheckbox(string target, string label, string help = null, bool disable = false, Action setting = null) + private void formCheckbox(string target, string label, string help = null, bool disable = false, Action setting = null, Action onValueChanged = null) { if (!formCheckboxData.ContainsKey(target)) { @@ -657,7 +669,15 @@ namespace WeChatWASM GUILayout.Label(new GUIContent(label, help), GUILayout.Width(140)); } 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) { @@ -677,6 +697,46 @@ namespace WeChatWASM 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) { // 检查是否为空或空白 diff --git a/Editor/WXPluginVersion.cs b/Editor/WXPluginVersion.cs index 9e85b02f9..7a0151d18 100644 --- a/Editor/WXPluginVersion.cs +++ b/Editor/WXPluginVersion.cs @@ -2,7 +2,7 @@ { public class WXPluginVersion { - public static string pluginVersion = "202409090807"; // 这一行不要改他,导出的时候会自动替换 + public static string pluginVersion = "202409090817"; // 这一行不要改他,导出的时候会自动替换 } public class WXPluginConf diff --git a/Editor/wx-editor.dll b/Editor/wx-editor.dll index b98717367..0cd89137a 100644 Binary files a/Editor/wx-editor.dll and b/Editor/wx-editor.dll differ diff --git a/Editor/wx-editor.xml b/Editor/wx-editor.xml index c71aba3f8..1df2b5611 100644 --- a/Editor/wx-editor.xml +++ b/Editor/wx-editor.xml @@ -618,6 +618,11 @@ 是否显示渲染分析日志(develop build才生效) + + + 是否开启运行时性能分析工具(develop build才生效) + + iOS高性能模式自动GC间隔(毫秒) diff --git a/Runtime/.DS_Store.meta b/Runtime/.DS_Store.meta index 2b57e9b2a..4571a52c5 100644 --- a/Runtime/.DS_Store.meta +++ b/Runtime/.DS_Store.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c3dd1616370eb2aa6b9db9f990c9c33e +guid: d1c5b523ce6d78e33bdf6bbe6a5bf6ea DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/Plugins/SDK-Call-JS-Old.jslib b/Runtime/Plugins/SDK-Call-JS-Old.jslib index 70eec4403..f8675ae22 100755 --- a/Runtime/Plugins/SDK-Call-JS-Old.jslib +++ b/Runtime/Plugins/SDK-Call-JS-Old.jslib @@ -542,9 +542,13 @@ mergeInto(LibraryManager.library, { GameGlobal.avgExFrameTime = exTotalTime / 60; frameCount = 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 }, diff --git a/Runtime/Plugins/WXAssetBundle.jslib b/Runtime/Plugins/WXAssetBundle.jslib index 8f4b711fd..9314aaad2 100644 --- a/Runtime/Plugins/WXAssetBundle.jslib +++ b/Runtime/Plugins/WXAssetBundle.jslib @@ -269,6 +269,10 @@ var WXAssetBundleLibrary = { var err_msg = !!e ? e.toString() : 'unknown'; } 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){ var wxab_error = { stage: WXFS.WXABErrorSteps['kLoadBundleFromFile'], @@ -308,12 +312,16 @@ var WXAssetBundleLibrary = { return buffer; }, - UnCleanbyPath: function (ptr) { + UnCleanbyPath: function (ptr, fromFile) { var url = UTF8ToString(ptr); var path = WXFS.url2path(url); + if(fromFile && !GameGlobal.manager.fs.accessSync(path)){ + return false; + } if(!WXFS.disk.has(path)){ WXFS.disk.set(path, 0); } + return true; }, UnloadbyPath: function (ptr) { diff --git a/Runtime/Plugins/WxPerfJsBridge.jslib b/Runtime/Plugins/WxPerfJsBridge.jslib new file mode 100644 index 000000000..f9dbd70a7 --- /dev/null +++ b/Runtime/Plugins/WxPerfJsBridge.jslib @@ -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}); + //} + } +}); diff --git a/Runtime/Plugins/WxPerfJsBridge.jslib.meta b/Runtime/Plugins/WxPerfJsBridge.jslib.meta new file mode 100644 index 000000000..373be8acc --- /dev/null +++ b/Runtime/Plugins/WxPerfJsBridge.jslib.meta @@ -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: diff --git a/Runtime/Plugins/wx-perf.dll b/Runtime/Plugins/wx-perf.dll new file mode 100644 index 000000000..4f137a1fe Binary files /dev/null and b/Runtime/Plugins/wx-perf.dll differ diff --git a/Runtime/Plugins/wx-perf.dll.meta b/Runtime/Plugins/wx-perf.dll.meta new file mode 100644 index 000000000..a1d38627c --- /dev/null +++ b/Runtime/Plugins/wx-perf.dll.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f0cbdcf50f6d52cea758f1ea825443c0 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/Plugins/wx-perf.xml b/Runtime/Plugins/wx-perf.xml new file mode 100644 index 000000000..8be02f617 --- /dev/null +++ b/Runtime/Plugins/wx-perf.xml @@ -0,0 +1,18 @@ + + + + wx-perf + + + + + 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. + + The annotation string to be added. It should not be null or empty. + + If the provided annotation string is null or empty, an error message will be logged. + + + + diff --git a/Runtime/Plugins/wx-perf.xml.meta b/Runtime/Plugins/wx-perf.xml.meta new file mode 100644 index 000000000..f0d3a97e1 --- /dev/null +++ b/Runtime/Plugins/wx-perf.xml.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8ea3a597042b1e09596b698c5fcfd06b +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/Plugins/wx-runtime-editor.dll b/Runtime/Plugins/wx-runtime-editor.dll index 229c3da6a..20026f08f 100644 Binary files a/Runtime/Plugins/wx-runtime-editor.dll and b/Runtime/Plugins/wx-runtime-editor.dll differ diff --git a/Runtime/Plugins/wx-runtime.dll b/Runtime/Plugins/wx-runtime.dll index 3f8251608..932df71b3 100644 Binary files a/Runtime/Plugins/wx-runtime.dll and b/Runtime/Plugins/wx-runtime.dll differ diff --git a/Runtime/Plugins/wx_perf_2021.a b/Runtime/Plugins/wx_perf_2021.a new file mode 100644 index 000000000..4071db347 Binary files /dev/null and b/Runtime/Plugins/wx_perf_2021.a differ diff --git a/Runtime/Plugins/wx_perf_2021.a.meta b/Runtime/Plugins/wx_perf_2021.a.meta new file mode 100644 index 000000000..201212399 --- /dev/null +++ b/Runtime/Plugins/wx_perf_2021.a.meta @@ -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: diff --git a/Runtime/Plugins/wx_perf_2022.a b/Runtime/Plugins/wx_perf_2022.a new file mode 100644 index 000000000..71296d3fd Binary files /dev/null and b/Runtime/Plugins/wx_perf_2022.a differ diff --git a/Runtime/Plugins/wx_perf_2022.a.meta b/Runtime/Plugins/wx_perf_2022.a.meta new file mode 100644 index 000000000..326a8274b --- /dev/null +++ b/Runtime/Plugins/wx_perf_2022.a.meta @@ -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: diff --git a/Runtime/WXRuntimeExtDef.cs b/Runtime/WXRuntimeExtDef.cs new file mode 100644 index 000000000..069c718b6 --- /dev/null +++ b/Runtime/WXRuntimeExtDef.cs @@ -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; + }); + } + } + +} \ No newline at end of file diff --git a/Runtime/WXRuntimeExtDef.cs.meta b/Runtime/WXRuntimeExtDef.cs.meta new file mode 100644 index 000000000..e8a92958c --- /dev/null +++ b/Runtime/WXRuntimeExtDef.cs.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1bfa8a2ba04dd8c133e09ac1dcaa6539 +DefaultImporter: +externalObjects: {} +userData: +assetBundleName: +assetBundleVariant: \ No newline at end of file diff --git a/Runtime/WXSDKPerf.meta b/Runtime/WXSDKPerf.meta new file mode 100644 index 000000000..d62382e12 --- /dev/null +++ b/Runtime/WXSDKPerf.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aef8914ede3654c3fbed916372d75964 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/WXSDKPerf/WXPerfEngine.cs b/Runtime/WXSDKPerf/WXPerfEngine.cs new file mode 100644 index 000000000..1327a8132 --- /dev/null +++ b/Runtime/WXSDKPerf/WXPerfEngine.cs @@ -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 \ No newline at end of file diff --git a/Runtime/WXSDKPerf/WXPerfEngine.cs.meta b/Runtime/WXSDKPerf/WXPerfEngine.cs.meta new file mode 100644 index 000000000..ecf9068ca --- /dev/null +++ b/Runtime/WXSDKPerf/WXPerfEngine.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8cf919bdb0222454ca11dee03ff47d57 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Runtime/wechat-default/check-version.js b/Runtime/wechat-default/check-version.js index 705fd97ec..e9e0a97b3 100644 --- a/Runtime/wechat-default/check-version.js +++ b/Runtime/wechat-default/check-version.js @@ -62,6 +62,8 @@ const isPcBrotliInvalid = isPc && !compareVersion(SDKVersion, $LOAD_DATA_FROM_SU const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1'); // @ts-ignore const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid); +// iOS系统版本>=17.5时,小游戏退后台会导致异常 +export const isIOS175 = compareVersion(systemVersion, '17.5') || isH5Renderer; // 是否能以iOS高性能模式运行 // 请勿修改GameGlobal.canUseH5Renderer赋值!!! GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid; diff --git a/Runtime/wechat-default/check-version.js.meta b/Runtime/wechat-default/check-version.js.meta index efc89e0ac..bd2adc456 100644 --- a/Runtime/wechat-default/check-version.js.meta +++ b/Runtime/wechat-default/check-version.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 36392430e8c0cff4855b2f94a0f9cb92 +guid: 80ce982c9406122fb93fe0115a01783a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/data-package/game.js.meta b/Runtime/wechat-default/data-package/game.js.meta index 7f8112850..f6b31d1d3 100644 --- a/Runtime/wechat-default/data-package/game.js.meta +++ b/Runtime/wechat-default/data-package/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6cb10f5bb5f5feda747a6d58e6c0d121 +guid: 140c5d449a8ecde7799af56bb11e45c6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/events.js.meta b/Runtime/wechat-default/events.js.meta index bc24f5e76..0258c5461 100644 --- a/Runtime/wechat-default/events.js.meta +++ b/Runtime/wechat-default/events.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0c610f935c70f30554dae4d449fc05f4 +guid: 9982341bd072d3b7363aafd7e4f8a08a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.js b/Runtime/wechat-default/game.js index 7df58beb6..2d09dae72 100644 --- a/Runtime/wechat-default/game.js +++ b/Runtime/wechat-default/game.js @@ -29,6 +29,7 @@ const managerConfig = { contextConfig: { contextType: $WEBGL_VERSION, // 1: webgl1 2: webgl2 }, + PROFILER_UPLOAD_URL: '', }; GameGlobal.managerConfig = managerConfig; // 版本检查 diff --git a/Runtime/wechat-default/game.js.meta b/Runtime/wechat-default/game.js.meta index 0e5ba38d0..8da08c6a5 100644 --- a/Runtime/wechat-default/game.js.meta +++ b/Runtime/wechat-default/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c7687b8949896a6e2659249b3e899be0 +guid: 1699b678c88dce2aa43b5dc7fa7d36c5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/game.json b/Runtime/wechat-default/game.json index 4ae3eaeb3..47b3f18d8 100644 --- a/Runtime/wechat-default/game.json +++ b/Runtime/wechat-default/game.json @@ -23,7 +23,7 @@ ], "plugins": { "UnityPlugin": { - "version": "1.2.57", + "version": "1.2.60", "provider": "wxe5a48f1ed5f544b7", "contexts": [ { diff --git a/Runtime/wechat-default/game.json.meta b/Runtime/wechat-default/game.json.meta index 4e072ea48..59d03e748 100644 --- a/Runtime/wechat-default/game.json.meta +++ b/Runtime/wechat-default/game.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c695edc400191b2f49cfb73a65674e2b +guid: a6f905269b34bcae0fb55d79ab7e4b9d DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/background.jpg.meta b/Runtime/wechat-default/images/background.jpg.meta index 754c83b0b..9cc87fe40 100644 --- a/Runtime/wechat-default/images/background.jpg.meta +++ b/Runtime/wechat-default/images/background.jpg.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1562138b9097ab31b4d250f6c35ba405 +guid: d55535909fad016103bd59d07dbab675 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/images/unity_logo.png.meta b/Runtime/wechat-default/images/unity_logo.png.meta index fb1b1db27..28742a83f 100644 --- a/Runtime/wechat-default/images/unity_logo.png.meta +++ b/Runtime/wechat-default/images/unity_logo.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a9ca0da7a937153f8cc087e66ff1b826 +guid: 676358aaad286674fd9edeb7bb8c81a4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/data/index.js.meta b/Runtime/wechat-default/open-data/data/index.js.meta index 4bfd898ff..81a54c320 100644 --- a/Runtime/wechat-default/open-data/data/index.js.meta +++ b/Runtime/wechat-default/open-data/data/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a27fd22b3d72a08e51e28d2145febad6 +guid: dd7659f86d49d358568927fc70700732 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/data/utils.js.meta b/Runtime/wechat-default/open-data/data/utils.js.meta index 37cf85d37..f1fbb738a 100644 --- a/Runtime/wechat-default/open-data/data/utils.js.meta +++ b/Runtime/wechat-default/open-data/data/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bdab9eeacb77220ccac300f63f3596d6 +guid: 20d4939cbebfcea5282c75919c6bb827 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/index.js.meta b/Runtime/wechat-default/open-data/index.js.meta index 0bccda115..f3071be56 100644 --- a/Runtime/wechat-default/open-data/index.js.meta +++ b/Runtime/wechat-default/open-data/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 980c1028a001d666d020af0a75438eba +guid: b61afb460be19337714796fa8787fe94 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/loading.js.meta b/Runtime/wechat-default/open-data/loading.js.meta index a7c778a16..099d97b1e 100644 --- a/Runtime/wechat-default/open-data/loading.js.meta +++ b/Runtime/wechat-default/open-data/loading.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d426aeda43fe8e39f134aae1f9f31c3c +guid: 511a45dab3030dbe5ce9541ba21e5afc DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/avatar.png.meta b/Runtime/wechat-default/open-data/render/image/avatar.png.meta index feab0b1aa..30a597834 100644 --- a/Runtime/wechat-default/open-data/render/image/avatar.png.meta +++ b/Runtime/wechat-default/open-data/render/image/avatar.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0928928f169894a45c31e5a5d092475c +guid: b0819a420cb2a94f6f1a9d95d144ded6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button1.png.meta b/Runtime/wechat-default/open-data/render/image/button1.png.meta index feafa0735..5b039705e 100644 --- a/Runtime/wechat-default/open-data/render/image/button1.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button1.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 831ba8ca9ef8c6f1f2102224858cf82b +guid: 70cb71d826583f3509a9b54ec761300f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button2.png.meta b/Runtime/wechat-default/open-data/render/image/button2.png.meta index 55ceda986..d076425aa 100644 --- a/Runtime/wechat-default/open-data/render/image/button2.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button2.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d737d3583146ae800c176d5203f9fc40 +guid: 1e8d0cfe2edcf06a1195b8a06ecbd5a3 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/button3.png.meta b/Runtime/wechat-default/open-data/render/image/button3.png.meta index 24b5d06e7..07cad1d73 100644 --- a/Runtime/wechat-default/open-data/render/image/button3.png.meta +++ b/Runtime/wechat-default/open-data/render/image/button3.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 95c5ba8d5ec4ee303122666a2b106644 +guid: 3f368894a37535cbe7bc1bd80a09b1e4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/loading.png.meta b/Runtime/wechat-default/open-data/render/image/loading.png.meta index f0bd395a9..a7b779a11 100644 --- a/Runtime/wechat-default/open-data/render/image/loading.png.meta +++ b/Runtime/wechat-default/open-data/render/image/loading.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8f06ae66986cf93edef0a76366c1d68d +guid: cad5fceeec2da21c829a29b74102629e DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/nameBg.png.meta b/Runtime/wechat-default/open-data/render/image/nameBg.png.meta index 64af177cf..2b0f08895 100644 --- a/Runtime/wechat-default/open-data/render/image/nameBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/nameBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b8febd943c0a39b795330dba0a520153 +guid: 423ef10d550b1763dc176395faaf23e7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta b/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta index 41d9a7974..07534b95a 100644 --- a/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta +++ b/Runtime/wechat-default/open-data/render/image/rankAvatar.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 63cb751602c040a16ff1fc77cc096a65 +guid: 5d999bcabbb37b0b83408ac264b07410 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/rankBg.png.meta b/Runtime/wechat-default/open-data/render/image/rankBg.png.meta index b2a19bfbd..b5a545cc3 100644 --- a/Runtime/wechat-default/open-data/render/image/rankBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/rankBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 08c1b22b7889b8f4e982ae067cd162c5 +guid: 8c53b397c5befd989f545a3afc933837 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/shareBg.png.meta b/Runtime/wechat-default/open-data/render/image/shareBg.png.meta index 496eb37d6..c15dca0f4 100644 --- a/Runtime/wechat-default/open-data/render/image/shareBg.png.meta +++ b/Runtime/wechat-default/open-data/render/image/shareBg.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 03419eec1f30107bea6f33dce8bf68a8 +guid: 7b5b016ac57046df71ef36e60f17e14a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta b/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta index 546fdcbda..61447d47e 100644 --- a/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta +++ b/Runtime/wechat-default/open-data/render/image/shareBg2.png.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 844bbaa8b83a8d3212f3633a0a78fc09 +guid: d1d73fd72458595784608d7379d6282f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta b/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta index 4d39a4157..e9b401a18 100644 --- a/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta +++ b/Runtime/wechat-default/open-data/render/styles/friendRank.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 537c49719a45976f84dec8d88ff496c9 +guid: ab4a3e094253d52968312a6df7c67933 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/styles/tips.js.meta b/Runtime/wechat-default/open-data/render/styles/tips.js.meta index 6621035cf..05b2d9e96 100644 --- a/Runtime/wechat-default/open-data/render/styles/tips.js.meta +++ b/Runtime/wechat-default/open-data/render/styles/tips.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c5bf523fe19c255ca2797c6aa6739c44 +guid: 35c065c5557a8fce8ebaa2aec9965fe9 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta b/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta index d6f265316..0502d1a63 100644 --- a/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta +++ b/Runtime/wechat-default/open-data/render/tpls/friendRank.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3edc48e7289d5b637b34a560d8afe53c +guid: 3a6f7d5abc4cb9b0cc9ca2987fedc3ba DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/open-data/render/tpls/tips.js.meta b/Runtime/wechat-default/open-data/render/tpls/tips.js.meta index a44a7840f..983d18af3 100644 --- a/Runtime/wechat-default/open-data/render/tpls/tips.js.meta +++ b/Runtime/wechat-default/open-data/render/tpls/tips.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f31df8fd614f546340e7ef9975d0061f +guid: d33b1a1f08f8833caf80e8699e50e946 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugin-config.js.meta b/Runtime/wechat-default/plugin-config.js.meta index d644a3745..6ba0129fd 100644 --- a/Runtime/wechat-default/plugin-config.js.meta +++ b/Runtime/wechat-default/plugin-config.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 37c8b9b502beb21d10fb8e4e058d556f +guid: c3af73b35f666c8f93cf25a13958bfb5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/check-update.js.meta b/Runtime/wechat-default/plugins/check-update.js.meta index fa44b5b83..ba536cd59 100644 --- a/Runtime/wechat-default/plugins/check-update.js.meta +++ b/Runtime/wechat-default/plugins/check-update.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4b63d9c16db343ebf696e6afa020ffa9 +guid: a450c32f2e0f02032671846d27400bf6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/plugins/screen-adapter.js.meta b/Runtime/wechat-default/plugins/screen-adapter.js.meta index 634f9be60..558fd7c2f 100644 --- a/Runtime/wechat-default/plugins/screen-adapter.js.meta +++ b/Runtime/wechat-default/plugins/screen-adapter.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9341252b64902c8fa41edfc31862bc5f +guid: a8f2543e9cff6cfb8e5a478f86150e81 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/project.config.json.meta b/Runtime/wechat-default/project.config.json.meta index efba9c8da..26064476c 100644 --- a/Runtime/wechat-default/project.config.json.meta +++ b/Runtime/wechat-default/project.config.json.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: df8bb927d17760d4a009e226dc51ccce +guid: c474d7d3c09dff28024a5cffb20822ce DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/texture-config.js.meta b/Runtime/wechat-default/texture-config.js.meta index 11435ce2c..d2a4472a6 100644 --- a/Runtime/wechat-default/texture-config.js.meta +++ b/Runtime/wechat-default/texture-config.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d8ed23bd4d2dd4433b3f3def44b0944f +guid: ab240f2ed5701ec4f942949bae88e656 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-namespace.js b/Runtime/wechat-default/unity-namespace.js index e063df21c..e3b1002b5 100644 --- a/Runtime/wechat-default/unity-namespace.js +++ b/Runtime/wechat-default/unity-namespace.js @@ -53,6 +53,12 @@ const unityNamespace = { useBrotliMT: $USE_BROTLI_MT, // Boot config配置,包含例如wait-for-native-debugger、player-connection-ip等信息 bootConfig: '$BOOT_CONFIG_INFO', + // 是否以Development Build构建 + isDevelopmentBuild: $Is_Development_Build, + // 是否以Profiling Build导出 + isProfilingBuild: $Is_Profiling_Build, + // 预留的堆内存 + unityHeapReservedMemory: $UnityHeapReservedMemory, }; // 最佳实践检测配置 unityNamespace.monitorConfig = { diff --git a/Runtime/wechat-default/unity-namespace.js.meta b/Runtime/wechat-default/unity-namespace.js.meta index eef4261d0..3da30487f 100644 --- a/Runtime/wechat-default/unity-namespace.js.meta +++ b/Runtime/wechat-default/unity-namespace.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9d09b8bad0484a4b365e1bd890ae2e13 +guid: 9ce129488485173eb038dc5d61571a5b DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js index 47c41f473..9c3208e07 100644 --- a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js +++ b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertInfoToPointer, formatResponse, convertDataToPointer } from '../utils'; const TCPSocketList = {}; const wxTCPSocketBindWifiList = {}; diff --git a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta index 82aaff84f..1daa406ed 100644 --- a/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/TCPSocket/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 612f18c0d70f3507e549bc10e883c468 +guid: 9bc42fc10ff857b2dfee4a294d195ad0 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js index 531415439..da3a3a97a 100644 --- a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js +++ b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, uid, onEventCallback, offEventCallback, getListObject, convertDataToPointer, convertInfoToPointer, formatResponse } from '../utils'; const UDPSocketList = {}; const wxUDPSocketCloseList = {}; diff --git a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta index 302cc2799..06ad81154 100644 --- a/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/UDPSocket/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 098fd61fa416aa9d3b974b37dfde7acf +guid: ead095c73a3e48f4fa4b003b096a9986 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/ad.js b/Runtime/wechat-default/unity-sdk/ad.js index 4bcac8197..36ad7ce41 100644 --- a/Runtime/wechat-default/unity-sdk/ad.js +++ b/Runtime/wechat-default/unity-sdk/ad.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from './module-helper'; import response from './response'; import { formatJsonStr, uid } from './utils'; diff --git a/Runtime/wechat-default/unity-sdk/ad.js.meta b/Runtime/wechat-default/unity-sdk/ad.js.meta index 4ed9a035f..602479897 100644 --- a/Runtime/wechat-default/unity-sdk/ad.js.meta +++ b/Runtime/wechat-default/unity-sdk/ad.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2adea835f2d2156e45ea42b18a4eec4c +guid: e5e38cbc8707be2816cfd945061dbcee DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/common.js.meta b/Runtime/wechat-default/unity-sdk/audio/common.js.meta index 9c033c2ad..227d10a16 100644 --- a/Runtime/wechat-default/unity-sdk/audio/common.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/common.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d3b0732e2cb918dcf813a7b33b48d80 +guid: 256a7ce83e94b433abcd6736c5d48efe DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/const.js.meta b/Runtime/wechat-default/unity-sdk/audio/const.js.meta index 04fe34517..49dca9df0 100644 --- a/Runtime/wechat-default/unity-sdk/audio/const.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/const.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b4f116aff74f47e34dc8caf0336fcfb7 +guid: 8a32cc81f27cda7fee69bdc9e268b618 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/index.js.meta b/Runtime/wechat-default/unity-sdk/audio/index.js.meta index d361c63d4..9d19c40af 100644 --- a/Runtime/wechat-default/unity-sdk/audio/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 51a9b3d489deb95836286a9deae14e43 +guid: fe065c89efe8425918ab6058aa445487 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js index f7cd2c8c4..8c5471219 100644 --- a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js +++ b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from '../module-helper'; import { isSupportPlayBackRate } from '../../check-version'; import { audios, localAudioMap, downloadingAudioMap, innerAudioVolume, WEBAudio } from './store'; @@ -320,8 +321,8 @@ export default { if (key === 'onCanplay') { audios[id][key](() => { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration, buffered, referrerPolicy, volume } = audios[id]; setTimeout(() => { moduleHelper.send('OnAudioCallback', JSON.stringify({ diff --git a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta index 8ed01b5f7..1961085e0 100644 --- a/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/inner-audio.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 66d3cd7efbeded889f9cb865478926ff +guid: f298cb8e773a8a66b5d437cb26f0925a DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/store.js.meta b/Runtime/wechat-default/unity-sdk/audio/store.js.meta index b799d4ad8..a3827f02d 100644 --- a/Runtime/wechat-default/unity-sdk/audio/store.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/store.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c8a3a347a88f47703d2c3d2a937bfb12 +guid: 19fe8df4e2f23286b54fc3e1873c00de DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js index 4ed5b959a..74f032604 100644 --- a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js +++ b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js @@ -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 { TEMP_DIR_PATH } from './const'; import { createInnerAudio, destroyInnerAudio, printErrMsg, resumeWebAudio } from './utils'; @@ -14,6 +17,7 @@ function jsAudioCreateUncompressedSoundClip(buffer, error, length) { this.buffer = null; WEBAudio.audioBufferLength -= length; }, + resetGain() { }, getLength() { if (!this.buffer) { @@ -77,10 +81,11 @@ function jsAudioCreateCompressedSoundClip(audioData, ptr, length) { } delete this.url; }, + resetGain() { }, getLength() { return this.length || 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars getData(ptr, length) { console.warn('getData() is not supported for compressed sound.'); return 0; @@ -161,13 +166,18 @@ export class AudioChannelInstance { constructor(callback, userData) { if (WEBAudio.audioContext) { this.gain = WEBAudio.audioContext.createGain(); - if (this.gain) { - this.gain.connect(WEBAudio.audioContext.destination); - } + this.gain?.connect(WEBAudio.audioContext.destination); } this.callback = callback; this.userData = userData; } + resetGain() { + if (WEBAudio.audioContext && this.gain) { + this.gain.disconnect(); + this.gain = WEBAudio.audioContext.createGain(); + this.gain?.connect(WEBAudio.audioContext.destination); + } + } release() { this.disconnectSource(); if (this.gain) { @@ -276,8 +286,8 @@ export class AudioChannelInstance { }); const fn = () => { if (typeof this.source !== 'undefined' && this.source.mediaElement) { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration } = this.source.mediaElement; setTimeout(() => { if (soundClip && this.source && this.source.mediaElement) { @@ -538,7 +548,7 @@ export class AudioChannelInstance { } }, 100); }; - const innerPlay = () => { + const innerPlay = (callback) => { if (this.source && this.source.mediaElement) { if (isSupportBufferURL && this.source.readyToPlay) { if (this.source.stopCache) { @@ -551,6 +561,7 @@ export class AudioChannelInstance { innerFixPlay(); } this.source.mediaElement.play(); + callback?.(); } } else { @@ -561,8 +572,8 @@ export class AudioChannelInstance { this.source.needCanPlay = false; this.source.readyToPlay = true; if (typeof this.source.mediaElement !== 'undefined') { - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { duration } = this.source.mediaElement; @@ -582,6 +593,7 @@ export class AudioChannelInstance { } if (typeof this.source.mediaElement !== 'undefined') { this.source.mediaElement.play(); + callback?.(); } } }; @@ -594,7 +606,7 @@ export class AudioChannelInstance { } } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _reset = () => { if (!this.source) { return; @@ -609,7 +621,7 @@ export class AudioChannelInstance { this.source.stopTicker = undefined; } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _pauseMediaElement = () => { if (typeof this.source === 'undefined') { return; @@ -621,28 +633,22 @@ export class AudioChannelInstance { this.source.mediaElement.pause(); } }; - + // eslint-disable-next-line @typescript-eslint/naming-convention const _startPlayback = (offset) => { if (typeof this.source === 'undefined' || !this.source.mediaElement) { return; } if (this.source.playTimeout) { - if (typeof this.source.mediaElement.seek === 'function') { - this.source.mediaElement.seek(offset); - } - else { - this.source.mediaElement.currentTime = offset; - } + this.source.mediaElement.seek(offset); this.source.pauseRequested = false; return; } - innerPlay(); - if (typeof this.source.mediaElement.seek === 'function') { - this.source.mediaElement.seek(offset); - } - else { - this.source.mediaElement.currentTime = offset; - } + innerPlay(() => { + + if (this.source && this.source.mediaElement) { + this.source.mediaElement.seek(offset); + } + }); }; const start = (startTime, offset) => { if (typeof this.source === 'undefined') { @@ -710,22 +716,22 @@ export class AudioChannelInstance { start, stop, }; - - + // @ts-ignore + // eslint-disable-next-line @typescript-eslint/no-unused-vars const { buffered, referrerPolicy, volume } = getAudio; const { source } = this; Object.defineProperty(this.source, 'loopStart', { get() { return 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars set(v) { }, }); Object.defineProperty(source, 'loopEnd', { get() { return 0; }, - + // eslint-disable-next-line @typescript-eslint/no-unused-vars set(v) { }, }); Object.defineProperty(source, 'loop', { @@ -845,7 +851,7 @@ export default { if (!soundClip) { return defaultSoundLength; } - const length = soundClip.getLength() || defaultSoundLength; + const length = soundClip.getLength(); return length; }, _JS_Sound_GetLoadState(bufferInstance) { @@ -882,13 +888,18 @@ export default { clearTimeout(webAutoResumeTicker); webAutoResumeTicker = null; } - - if (!GameGlobal.isIOSHighPerformanceMode) { - WEBAudio.audioContext?.suspend(); - } + WEBAudio.audioContext?.suspend(); }); wx.onShow(() => { - WEBAudio.audioContext?.resume(); + + if (isIOS175) { + WEBAudio.audioContext?.close(); + WEBAudio.audioContext = wx.createWebAudioContext(); + Object.values(WEBAudio.audioInstances).forEach(it => it.resetGain()); + } + else { + WEBAudio.audioContext?.resume(); + } }); if (webAudioNeedResume) { @@ -1120,7 +1131,7 @@ export default { 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) { if (WEBAudio.audio3DSupport === 0 || WEBAudio.audioWebSupport === 0 || WEBAudio.audioWebEnabled === 0) { return; @@ -1186,7 +1197,7 @@ export default { if (!audioInstance) { return WEBAudio.FAKEMOD_SAMPLERATE; } - + // eslint-disable-next-line no-nested-ternary const buffer = audioInstance.buffer ? audioInstance.buffer : audioInstance.source diff --git a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta index 2bd346ca8..051247876 100644 --- a/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/unity-audio.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8346ff453fe21338b841aab61162337f +guid: eabe91b8833c9c17a78fab3e78254584 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/audio/utils.js b/Runtime/wechat-default/unity-sdk/audio/utils.js index 20c847d6b..1a0e39b9e 100644 --- a/Runtime/wechat-default/unity-sdk/audio/utils.js +++ b/Runtime/wechat-default/unity-sdk/audio/utils.js @@ -45,7 +45,7 @@ export const destroyInnerAudio = (id, useCache) => { Object.keys(state).forEach((key) => { try { - + // @ts-ignore audios[id][key] = state[key]; } catch (e) { } diff --git a/Runtime/wechat-default/unity-sdk/audio/utils.js.meta b/Runtime/wechat-default/unity-sdk/audio/utils.js.meta index 04488f2f1..082e34a0e 100644 --- a/Runtime/wechat-default/unity-sdk/audio/utils.js.meta +++ b/Runtime/wechat-default/unity-sdk/audio/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 68874cda8a2e82a30abc545d224953f4 +guid: fd977cc3c1136c0fb79153770b9f4515 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/authorize.js b/Runtime/wechat-default/unity-sdk/authorize.js index 3d89ea983..f3beba68d 100644 --- a/Runtime/wechat-default/unity-sdk/authorize.js +++ b/Runtime/wechat-default/unity-sdk/authorize.js @@ -7,7 +7,7 @@ export default { resolveFn = resolve; moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}'); }; - + // @ts-ignore wx.onNeedPrivacyAuthorization(callback); }, WX_PrivacyAuthorizeResolve(conf) { diff --git a/Runtime/wechat-default/unity-sdk/authorize.js.meta b/Runtime/wechat-default/unity-sdk/authorize.js.meta index 9ad1ec829..63f01c911 100644 --- a/Runtime/wechat-default/unity-sdk/authorize.js.meta +++ b/Runtime/wechat-default/unity-sdk/authorize.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6e5752ce8258890be0c62b17f5613c04 +guid: 672932a174d355e3488bac79d344dfb6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/bluetooth/index.js b/Runtime/wechat-default/unity-sdk/bluetooth/index.js index 2ee523f29..4a10e505b 100644 --- a/Runtime/wechat-default/unity-sdk/bluetooth/index.js +++ b/Runtime/wechat-default/unity-sdk/bluetooth/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { convertDataToPointer } from '../utils'; let wxOnBLECharacteristicValueChangeCallback; const OnBLECharacteristicValueChange = (res) => { diff --git a/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta b/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta index 891ee01b0..6b799eefd 100644 --- a/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/bluetooth/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f38e4a129c2abcd7f09dcd29a4e47f62 +guid: 4b0fe8d71f9ec24906c0ecc56d099e11 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/camera.js.meta b/Runtime/wechat-default/unity-sdk/camera.js.meta index 29612b18c..9ec15e345 100644 --- a/Runtime/wechat-default/unity-sdk/camera.js.meta +++ b/Runtime/wechat-default/unity-sdk/camera.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f5f0f8ec95bf588fc630fda410c4b8d2 +guid: 775b38f08776b58a57730141a84e7aea DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/canvas-context.js.meta b/Runtime/wechat-default/unity-sdk/canvas-context.js.meta index 6ad185fa6..18be0ce1e 100644 --- a/Runtime/wechat-default/unity-sdk/canvas-context.js.meta +++ b/Runtime/wechat-default/unity-sdk/canvas-context.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3118d92cedcd76cebc03aca7a42a59b4 +guid: dd7a051cad81fa34f1ac04ec8ca3c8d7 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/canvas.js.meta b/Runtime/wechat-default/unity-sdk/canvas.js.meta index 05884a1bf..eef31e48a 100644 --- a/Runtime/wechat-default/unity-sdk/canvas.js.meta +++ b/Runtime/wechat-default/unity-sdk/canvas.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5e736370d1b9ac986a749c86d9a1549f +guid: 45812845ec5b19b4d739930d907eff76 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/chat.js b/Runtime/wechat-default/unity-sdk/chat.js index 29ac9ccb7..2a0258122 100644 --- a/Runtime/wechat-default/unity-sdk/chat.js +++ b/Runtime/wechat-default/unity-sdk/chat.js @@ -10,7 +10,7 @@ function createMiniGameChat(options, callback) { try { if (typeof requirePlugin !== 'undefined') { if (!MiniGameChat) { - + // @ts-ignore MiniGameChat = requirePlugin('MiniGameChat', { enableRequireHostModule: true, customEnv: { @@ -124,7 +124,7 @@ export default { if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') { return; } - + // eslint-disable-next-line no-restricted-syntax for (const key in Object.keys(onList[eventType])) { const callback = onList[eventType][key]; if (callback) { diff --git a/Runtime/wechat-default/unity-sdk/chat.js.meta b/Runtime/wechat-default/unity-sdk/chat.js.meta index 98be8cbbf..e9558ac0b 100644 --- a/Runtime/wechat-default/unity-sdk/chat.js.meta +++ b/Runtime/wechat-default/unity-sdk/chat.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e786ced1ebda02a8a1dc72b8e93f0e2c +guid: cf540c20bdaa5744401e365120d43c43 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/cloud.js b/Runtime/wechat-default/unity-sdk/cloud.js index 33ea93874..babe75e4d 100644 --- a/Runtime/wechat-default/unity-sdk/cloud.js +++ b/Runtime/wechat-default/unity-sdk/cloud.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from './module-helper'; import { uid, formatJsonStr, formatResponse } from './utils'; const CloudIDObject = {}; @@ -21,7 +22,7 @@ const CloudList = {}; export default { WX_CloudCloud(option) { const config = formatJsonStr(option); - + // @ts-ignore const cloud = new wx.cloud.Cloud(config); CloudList[config.resourceEnv] = cloud; }, diff --git a/Runtime/wechat-default/unity-sdk/cloud.js.meta b/Runtime/wechat-default/unity-sdk/cloud.js.meta index a6f219807..62a3cfb77 100644 --- a/Runtime/wechat-default/unity-sdk/cloud.js.meta +++ b/Runtime/wechat-default/unity-sdk/cloud.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c491ec235907f84a7c4fbe37cf8903c +guid: e9d512cce216e9890efb86bb5b0543ab DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/conf.js.meta b/Runtime/wechat-default/unity-sdk/conf.js.meta index 14520a963..658746f00 100644 --- a/Runtime/wechat-default/unity-sdk/conf.js.meta +++ b/Runtime/wechat-default/unity-sdk/conf.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6fcae60b35180332300867b5879c19bf +guid: 4376dc0a98887a68d27b3a0030f0352f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/file-info.js.meta b/Runtime/wechat-default/unity-sdk/file-info.js.meta index 0a5d2a589..0319c0bb2 100644 --- a/Runtime/wechat-default/unity-sdk/file-info.js.meta +++ b/Runtime/wechat-default/unity-sdk/file-info.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1519c4f3477205b3a444554106587262 +guid: ef1416723718e4a7df78193268e8e5cd DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fix.js b/Runtime/wechat-default/unity-sdk/fix.js index a8dc486ef..b6e84c48e 100644 --- a/Runtime/wechat-default/unity-sdk/fix.js +++ b/Runtime/wechat-default/unity-sdk/fix.js @@ -1,3 +1,5 @@ +/* eslint-disable prefer-spread */ +/* eslint-disable prefer-rest-params */ export default { init() { @@ -15,13 +17,13 @@ export default { } return id; }; - + // @ts-ignore window.setTimeout = function (vCallback, nDelay) { const aArgs = Array.prototype.slice.call(arguments, 2); const id = getId(); const t = privateSetTimeout(vCallback instanceof Function ? () => { - + // @ts-ignore vCallback.apply(null, aArgs); delete wm[id]; } @@ -30,7 +32,7 @@ export default { return id; }; const privateClearTimeout = window.clearTimeout; - + // @ts-ignore window.clearTimeout = function (id) { if (id) { const t = wm[id]; @@ -41,13 +43,13 @@ export default { } }; const privateSetInterval = window.setInterval; - + // @ts-ignore window.setInterval = function (vCallback, nDelay) { const aArgs = Array.prototype.slice.call(arguments, 2); const id = getId(); const t = privateSetInterval(vCallback instanceof Function ? () => { - + // @ts-ignore vCallback.apply(null, aArgs); } : vCallback, nDelay); @@ -55,7 +57,7 @@ export default { return id; }; const privateClearInterval = window.clearInterval; - + // @ts-ignore window.clearInterval = function (id) { if (id) { const t = wm[id]; diff --git a/Runtime/wechat-default/unity-sdk/fix.js.meta b/Runtime/wechat-default/unity-sdk/fix.js.meta index deac5a990..947b04cb7 100644 --- a/Runtime/wechat-default/unity-sdk/fix.js.meta +++ b/Runtime/wechat-default/unity-sdk/fix.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1d2f45af35ac9a2deb89dbeb8a3c4db9 +guid: efa343cf6c75916ed5c857fbcba5a2d5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta b/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta index fb86104b3..35c059400 100644 --- a/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/fix-cmap.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 479377c954d7a65b2ea765c8ab25bfc5 +guid: 15f26c5a5559e568e46e7011e9fd718c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/index.js b/Runtime/wechat-default/unity-sdk/font/index.js index 3cbae2978..800648f74 100644 --- a/Runtime/wechat-default/unity-sdk/font/index.js +++ b/Runtime/wechat-default/unity-sdk/font/index.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from '../module-helper'; import { formatJsonStr } from '../utils'; @@ -94,7 +95,7 @@ function handleGetFontData(config, forceLoad = false) { if (!config && !canGetWxCommonFont) { return Promise.reject('invalid usage'); } - + // eslint-disable-next-line @typescript-eslint/no-misused-promises if (!getFontPromise || forceLoad) { getFontPromise = new Promise((resolve, reject) => { if (!canGetWxCommonFont && !!config) { diff --git a/Runtime/wechat-default/unity-sdk/font/index.js.meta b/Runtime/wechat-default/unity-sdk/font/index.js.meta index 738a1742c..d08a0317a 100644 --- a/Runtime/wechat-default/unity-sdk/font/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7b21c54777647e6f70311c17b42f422f +guid: ba091a11e5ee5d71a2c008219ce40b93 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta b/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta index 43c3654ed..14f05878f 100644 --- a/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/read-metrics.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0ecd8772354b76659e765bf077320ea9 +guid: 7463e777c48729cd63d38e8eb67c9265 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta b/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta index 51ce6bf55..caac475c8 100644 --- a/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/split-sc.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 82ea6fb984ab9015f3430ccc1b0ca1fd +guid: 67dc0287bf6fe0f971522221d4b83ed6 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/font/util.js.meta b/Runtime/wechat-default/unity-sdk/font/util.js.meta index c77cddd86..9af3cba9a 100644 --- a/Runtime/wechat-default/unity-sdk/font/util.js.meta +++ b/Runtime/wechat-default/unity-sdk/font/util.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 811b15cdcc678952edc3a365e1c1cc84 +guid: da739d61f88944527584e79754d7a110 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/fs.js b/Runtime/wechat-default/unity-sdk/fs.js index 41593114e..a245372af 100644 --- a/Runtime/wechat-default/unity-sdk/fs.js +++ b/Runtime/wechat-default/unity-sdk/fs.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import response from './response'; import moduleHelper from './module-helper'; import { cacheArrayBuffer, formatJsonStr, formatResponse } from './utils'; @@ -81,7 +82,7 @@ export default { WXWriteFileSync(filePath, data, encoding) { try { const fs = wx.getFileSystemManager(); - + // @ts-ignore fs.writeFileSync(filePath, data, encoding); fileInfoHandler.addFileInfo(filePath, data); } @@ -283,9 +284,9 @@ export default { ...config, success(res) { if (!Array.isArray(res.stats)) { - + // @ts-ignore C#中特殊处理 res.one_stat = res.stats; - + // @ts-ignore C#中特殊处理 res.stats = null; } moduleHelper.send('StatCallback', JSON.stringify({ @@ -302,11 +303,11 @@ export default { })); }, complete(res) { - + // @ts-ignore C#中特殊处理 if (!Array.isArray(res.stats)) { - + // @ts-ignore C#中特殊处理 res.one_stat = res.stats; - + // @ts-ignore C#中特殊处理 res.stats = null; } moduleHelper.send('StatCallback', JSON.stringify({ diff --git a/Runtime/wechat-default/unity-sdk/fs.js.meta b/Runtime/wechat-default/unity-sdk/fs.js.meta index 2078e3c53..f3ebe2aa2 100644 --- a/Runtime/wechat-default/unity-sdk/fs.js.meta +++ b/Runtime/wechat-default/unity-sdk/fs.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4829cb63c482e635a60457567b603e9b +guid: 83672bed7b1a4066ba7923b454e1c900 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-club.js b/Runtime/wechat-default/unity-sdk/game-club.js index 31779291f..e13b54b5f 100644 --- a/Runtime/wechat-default/unity-sdk/game-club.js +++ b/Runtime/wechat-default/unity-sdk/game-club.js @@ -15,15 +15,15 @@ const getObject = getListObject(gameClubButtonList, 'gameClubButton'); export default { WXCreateGameClubButton(conf) { const config = formatJsonStr(conf); - + // @ts-ignore config.style = JSON.parse(config.styleRaw); if (config.style.fontSize === 0) { - + // @ts-ignore config.style.fontSize = undefined; } - + // @ts-ignore config.type = typeEnum[config.type]; - + // @ts-ignore config.icon = iconEnum[config.icon]; const id = uid(); gameClubButtonList[id] = wx.createGameClubButton(config); diff --git a/Runtime/wechat-default/unity-sdk/game-club.js.meta b/Runtime/wechat-default/unity-sdk/game-club.js.meta index 92a09dc06..943e30729 100644 --- a/Runtime/wechat-default/unity-sdk/game-club.js.meta +++ b/Runtime/wechat-default/unity-sdk/game-club.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d79ec365dd23eae8a76196968ea8a880 +guid: 4c97c8d96f6b6bb80c08087ac3ec3d61 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/game-recorder.js b/Runtime/wechat-default/unity-sdk/game-recorder.js index 6959dd61b..3aa869b47 100644 --- a/Runtime/wechat-default/unity-sdk/game-recorder.js +++ b/Runtime/wechat-default/unity-sdk/game-recorder.js @@ -17,7 +17,7 @@ export default { if (!obj || typeof wxGameRecorderList === 'undefined' || typeof wxGameRecorderList[eventType] === 'undefined') { return; } - + // eslint-disable-next-line no-restricted-syntax for (const key in Object.keys(wxGameRecorderList[eventType])) { const callback = wxGameRecorderList[eventType][key]; if (callback) { diff --git a/Runtime/wechat-default/unity-sdk/game-recorder.js.meta b/Runtime/wechat-default/unity-sdk/game-recorder.js.meta index f90acb8ba..e8d3a594c 100644 --- a/Runtime/wechat-default/unity-sdk/game-recorder.js.meta +++ b/Runtime/wechat-default/unity-sdk/game-recorder.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 20218afcd8222566e1554ca4bb9b1185 +guid: d8d6963ae8d0c95a8165e5909db4ad63 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/gyroscope/index.js b/Runtime/wechat-default/unity-sdk/gyroscope/index.js index ada975e60..b2cf9f44f 100644 --- a/Runtime/wechat-default/unity-sdk/gyroscope/index.js +++ b/Runtime/wechat-default/unity-sdk/gyroscope/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatJsonStr, formatResponse, convertDataToPointer } from '../utils'; let wxStartGyroscopeCallback; let wxStopGyroscopeCallback; diff --git a/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta b/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta index ed975dc32..6a922bc4b 100644 --- a/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/gyroscope/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1681753fe3e60216656f78a4bc440a1d +guid: 6e938561025af5c6d10119956e8e3230 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/index.js.meta b/Runtime/wechat-default/unity-sdk/index.js.meta index 9c909807a..87e4ac46d 100644 --- a/Runtime/wechat-default/unity-sdk/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 314a84b15ec1b0ea4c020463673dd2b8 +guid: cd6a61fb1695dc31ffc116624eddf8b4 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/logger.js.meta b/Runtime/wechat-default/unity-sdk/logger.js.meta index b9f9996fa..507a72bee 100644 --- a/Runtime/wechat-default/unity-sdk/logger.js.meta +++ b/Runtime/wechat-default/unity-sdk/logger.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1d0789471f40e0676f4cb54b707cdc93 +guid: 04c414c709f3e74402581dd3c10c2ccd DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta b/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta index b5a0d7377..e399e8d7d 100644 --- a/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/mobileKeyboard/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8ef0a610c45e21df6b16ded32a9e4074 +guid: a951259ade3a4a5d2852c961bed38758 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/module-helper.js b/Runtime/wechat-default/unity-sdk/module-helper.js index fb5cb8f0f..9af0cfa2f 100644 --- a/Runtime/wechat-default/unity-sdk/module-helper.js +++ b/Runtime/wechat-default/unity-sdk/module-helper.js @@ -1,3 +1,4 @@ +/* eslint-disable no-underscore-dangle */ import { MODULE_NAME } from './conf'; export default { _send: null, @@ -8,7 +9,7 @@ export default { if (!this._send) { this.init(); } - + // @ts-ignore this._send(MODULE_NAME, method, str); }, }; diff --git a/Runtime/wechat-default/unity-sdk/module-helper.js.meta b/Runtime/wechat-default/unity-sdk/module-helper.js.meta index 622e1c23d..695125d0b 100644 --- a/Runtime/wechat-default/unity-sdk/module-helper.js.meta +++ b/Runtime/wechat-default/unity-sdk/module-helper.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d5038be8add35c103bbd14a95e681aee +guid: 46252bfca5a0c208cef62522c4beeb5c DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/open-data.js.meta b/Runtime/wechat-default/unity-sdk/open-data.js.meta index f14239e78..fd0878c72 100644 --- a/Runtime/wechat-default/unity-sdk/open-data.js.meta +++ b/Runtime/wechat-default/unity-sdk/open-data.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0fa25fd8f03412b66fc9201cc06566a3 +guid: 40a0a7d7589d171c672381b959e0c506 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/recorder.js.meta b/Runtime/wechat-default/unity-sdk/recorder.js.meta index e8df9c24c..3c5c4452f 100644 --- a/Runtime/wechat-default/unity-sdk/recorder.js.meta +++ b/Runtime/wechat-default/unity-sdk/recorder.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d739c4271ddfbf0cbb8d1404382be108 +guid: b416f840cd5e19ca1ddaf21f36730699 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resType.js.meta b/Runtime/wechat-default/unity-sdk/resType.js.meta index 799930d73..86aedbc8d 100644 --- a/Runtime/wechat-default/unity-sdk/resType.js.meta +++ b/Runtime/wechat-default/unity-sdk/resType.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8420f854ba8df05f948752a47babb9c2 +guid: 4764147b173612ddb7577c0847d7486f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta b/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta index 6c74d7a10..443dcb7f9 100644 --- a/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta +++ b/Runtime/wechat-default/unity-sdk/resTypeOther.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ddbcdc16a4f9fea511334582115d4be +guid: b4660fc8eb2d22b3e4c84b9a3cbb21c8 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/response.js b/Runtime/wechat-default/unity-sdk/response.js index 4251b7dc6..f5febd7b7 100644 --- a/Runtime/wechat-default/unity-sdk/response.js +++ b/Runtime/wechat-default/unity-sdk/response.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-this-alias */ import moduleHelper from './module-helper'; export default { handleText(s, f, c) { diff --git a/Runtime/wechat-default/unity-sdk/response.js.meta b/Runtime/wechat-default/unity-sdk/response.js.meta index ea0c4610d..b84ffe372 100644 --- a/Runtime/wechat-default/unity-sdk/response.js.meta +++ b/Runtime/wechat-default/unity-sdk/response.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ed150f93e86117864fb3e3bac382f648 +guid: 4c59776c89c2025c8c0d4cfa813b8765 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/sdk.js.meta b/Runtime/wechat-default/unity-sdk/sdk.js.meta index 254d00e7e..02b219338 100644 --- a/Runtime/wechat-default/unity-sdk/sdk.js.meta +++ b/Runtime/wechat-default/unity-sdk/sdk.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e6650f27bad2b24908010f077892bbe3 +guid: f7ed4c8c917b129f60264b95570e8648 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/share.js.meta b/Runtime/wechat-default/unity-sdk/share.js.meta index 502f52762..eb010b73d 100644 --- a/Runtime/wechat-default/unity-sdk/share.js.meta +++ b/Runtime/wechat-default/unity-sdk/share.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ec752356133932d5091110d7c5e3a956 +guid: 1d4fb7b46d64d9b47e588214004a3a76 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/storage.js b/Runtime/wechat-default/unity-sdk/storage.js index 8f5567e32..ed31b20ff 100644 --- a/Runtime/wechat-default/unity-sdk/storage.js +++ b/Runtime/wechat-default/unity-sdk/storage.js @@ -1,3 +1,4 @@ +/* eslint-disable no-underscore-dangle */ const PreLoadKeys = '$PreLoadKeys'; const storage = { _cacheData: {}, diff --git a/Runtime/wechat-default/unity-sdk/storage.js.meta b/Runtime/wechat-default/unity-sdk/storage.js.meta index fd5b1f3e9..3865f5656 100644 --- a/Runtime/wechat-default/unity-sdk/storage.js.meta +++ b/Runtime/wechat-default/unity-sdk/storage.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 29aa1c5fdca7e971245d8d90a8c1141b +guid: 0b0092691b92bf08c934ce88eb7cbc8f DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/texture.js b/Runtime/wechat-default/unity-sdk/texture.js index 47e884bcd..3c1445d19 100644 --- a/Runtime/wechat-default/unity-sdk/texture.js +++ b/Runtime/wechat-default/unity-sdk/texture.js @@ -1,3 +1,6 @@ +/* eslint-disable no-param-reassign */ +/* eslint-disable no-restricted-properties */ +/* eslint-disable no-plusplus */ import canvasContext from './canvas-context'; const downloadedTextures = {}; const downloadingTextures = {}; diff --git a/Runtime/wechat-default/unity-sdk/texture.js.meta b/Runtime/wechat-default/unity-sdk/texture.js.meta index 9c966cbee..2fa91bec4 100644 --- a/Runtime/wechat-default/unity-sdk/texture.js.meta +++ b/Runtime/wechat-default/unity-sdk/texture.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bc4cf81f3a7afb3a7794ade44f491458 +guid: 1abefff3efaea3f7dc503a827c4ed8e5 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/touch/index.js b/Runtime/wechat-default/unity-sdk/touch/index.js index 8af18b717..352e3a0f5 100644 --- a/Runtime/wechat-default/unity-sdk/touch/index.js +++ b/Runtime/wechat-default/unity-sdk/touch/index.js @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import { formatTouchEvent, convertOnTouchStartListenerResultToPointer } from '../utils'; let wxOnTouchCancelCallback; let wxOnTouchEndCallback; diff --git a/Runtime/wechat-default/unity-sdk/touch/index.js.meta b/Runtime/wechat-default/unity-sdk/touch/index.js.meta index 7c16b44b9..1d1c626a6 100644 --- a/Runtime/wechat-default/unity-sdk/touch/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/touch/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d172d9c236dba20b27400f6c781a27d +guid: 5c8c173edb557a50fb233b9e3fabcfbb DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/upload-file.js.meta b/Runtime/wechat-default/unity-sdk/upload-file.js.meta index c63261b1d..79defdc3f 100644 --- a/Runtime/wechat-default/unity-sdk/upload-file.js.meta +++ b/Runtime/wechat-default/unity-sdk/upload-file.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 92f2441824afca201b5aeab994ed06f5 +guid: aab8a8f24bc6e2a076e362e3cf01da03 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/userinfo.js.meta b/Runtime/wechat-default/unity-sdk/userinfo.js.meta index fcdf61e02..5b595c2bd 100644 --- a/Runtime/wechat-default/unity-sdk/userinfo.js.meta +++ b/Runtime/wechat-default/unity-sdk/userinfo.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: af83eab57ca5dce62c71ead323b56ad5 +guid: a3c7b02c7f63a4074839c2057c831a73 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/util.js.meta b/Runtime/wechat-default/unity-sdk/util.js.meta index cbc3c2ad7..e07634336 100644 --- a/Runtime/wechat-default/unity-sdk/util.js.meta +++ b/Runtime/wechat-default/unity-sdk/util.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0dd03298768bd87631e7b33c4f015823 +guid: 2cec2c8d664d6063f1cbee559203b31e DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/utils.js b/Runtime/wechat-default/unity-sdk/utils.js index a47a2eb35..a8d5da2c0 100644 --- a/Runtime/wechat-default/unity-sdk/utils.js +++ b/Runtime/wechat-default/unity-sdk/utils.js @@ -1,3 +1,4 @@ +/* eslint-disable no-param-reassign */ import moduleHelper from './module-helper'; import { ResType } from './resType'; import { ResTypeOther } from './resTypeOther'; diff --git a/Runtime/wechat-default/unity-sdk/utils.js.meta b/Runtime/wechat-default/unity-sdk/utils.js.meta index d3e3515b0..b1780020c 100644 --- a/Runtime/wechat-default/unity-sdk/utils.js.meta +++ b/Runtime/wechat-default/unity-sdk/utils.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d61d0b7625aa9de661b02b7575ae8ee +guid: f9dc81ff6f4f2679fce6e14a0a120e90 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video.js.meta b/Runtime/wechat-default/unity-sdk/video.js.meta index b2b239212..0642b3ee5 100644 --- a/Runtime/wechat-default/unity-sdk/video.js.meta +++ b/Runtime/wechat-default/unity-sdk/video.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 098d6df788c753f67343da433626f7d5 +guid: e47f69bf579fc76a52bc7f6fb257fe98 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/unity-sdk/video/index.js b/Runtime/wechat-default/unity-sdk/video/index.js index 639733761..41885f0ba 100644 --- a/Runtime/wechat-default/unity-sdk/video/index.js +++ b/Runtime/wechat-default/unity-sdk/video/index.js @@ -1,3 +1,5 @@ +/* eslint-disable @typescript-eslint/prefer-for-of */ +/* eslint-disable @typescript-eslint/naming-convention */ import { isH5Renderer, isSupportVideoPlayer, isPc, isDevtools } from '../../check-version'; let FrameworkData = null; const isWebVideo = isH5Renderer || isPc || isDevtools; @@ -26,9 +28,9 @@ function jsVideoEnded() { if (isDebug) { console.log('jsVideoEnded'); } - + // @ts-ignore if (this.onendedCallback) { - + // @ts-ignore dynCall_vi(this.onendedCallback, this.onendedRef); } } @@ -41,9 +43,9 @@ function _JS_Video_Create(url) { console.log('_JS_Video_Create', source); } if (isWebVideo) { - + // @ts-ignore const video = GameGlobal.manager.createWKVideo(source, FrameworkData.GLctx); - + // eslint-disable-next-line no-plusplus videoInstances[++videoInstanceIdCounter] = video; } else { @@ -52,12 +54,12 @@ function _JS_Video_Create(url) { videoDecoder = cacheVideoDecoder.pop(); } else { - + // @ts-ignore 8.0.38客户端+3.0.0基础库,才能正常使用type参数 videoDecoder = wx.createVideoDecoder({ type: 'wemedia', }); } - + // eslint-disable-next-line no-plusplus const videoInstance = { videoDecoder, videoWidth: 0, @@ -68,7 +70,7 @@ function _JS_Video_Create(url) { seeking: false, duration: 1, }; - + // eslint-disable-next-line no-plusplus videoInstances[++videoInstanceIdCounter] = videoInstance; videoDecoder.on('start', (res) => { if (isDebug) { @@ -111,10 +113,10 @@ function _JS_Video_Create(url) { videoInstance.onended?.(); } }); - + // @ts-ignore videoDecoder.on('frame', (res) => { - + // @ts-ignore videoInstance.currentTime = res.pts / 1000; videoInstance.frameData = new Uint8ClampedArray(res.data); }); @@ -125,7 +127,7 @@ function _JS_Video_Create(url) { videoDecoder.stop(); }; videoInstance.seek = (time) => { - + // @ts-ignore videoDecoder.avSync.seek({ stamp: time }); }; videoInstance.play(); diff --git a/Runtime/wechat-default/unity-sdk/video/index.js.meta b/Runtime/wechat-default/unity-sdk/video/index.js.meta index 2a011a5b8..962e088d2 100644 --- a/Runtime/wechat-default/unity-sdk/video/index.js.meta +++ b/Runtime/wechat-default/unity-sdk/video/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9009095e74053d5a5c8e36f7fcbcc42d +guid: 928ff08175cfa85a9b3e3ae247ddccef DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/wasmcode/game.js.meta b/Runtime/wechat-default/wasmcode/game.js.meta index 29208f974..7257663e6 100644 --- a/Runtime/wechat-default/wasmcode/game.js.meta +++ b/Runtime/wechat-default/wasmcode/game.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: fcc307fb64aa76bda5c599cf0e331162 +guid: f4dc973cd5e9cb634ac295ce9d2ba085 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/weapp-adapter.js b/Runtime/wechat-default/weapp-adapter.js index 344bb4fab..c9ca42b75 100644 --- a/Runtime/wechat-default/weapp-adapter.js +++ b/Runtime/wechat-default/weapp-adapter.js @@ -243,9 +243,18 @@ const isWK = false; value: true, }); let performance = void 0; + let ori_performance = wx.getPerformance(); const initTime = Date.now(); + const ori_initTime = ori_performance.now(); const clientPerfAdapter = Object.assign({}, { now: function now() { + if (GameGlobal.unityNamespace.isDevelopmentBuild + && GameGlobal.unityNamespace.isProfilingBuild + && !GameGlobal.unityNamespace.isDevtools + && !GameGlobal.isIOSHighPerformanceMode) { + // 由于wx.getPerformance()获取到的是微秒级,因此这里需要/1000.0,进行单位的统一 + return (ori_performance.now() - ori_initTime) * 0.001; + } return (Date.now() - initTime); }, }); diff --git a/Runtime/wechat-default/weapp-adapter.js.meta b/Runtime/wechat-default/weapp-adapter.js.meta index a0e79a723..d3baaa31c 100644 --- a/Runtime/wechat-default/weapp-adapter.js.meta +++ b/Runtime/wechat-default/weapp-adapter.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 2f6a3ed56d9b4a20cf0841d276b5b987 +guid: ce642a18256b476d9f93aa418098a934 DefaultImporter: externalObjects: {} userData: diff --git a/Runtime/wechat-default/workers/response/index.js.meta b/Runtime/wechat-default/workers/response/index.js.meta index 84656d0aa..9bea98cef 100644 --- a/Runtime/wechat-default/workers/response/index.js.meta +++ b/Runtime/wechat-default/workers/response/index.js.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 4bdcdb832b0b017cc8b47b7a3b036077 +guid: b1b5d0d08399ece57423902de12b09c1 DefaultImporter: externalObjects: {} userData: