From 0b9f9f70d657a495dd3649b07fa7ec7c562f0f45 Mon Sep 17 00:00:00 2001 From: LA <1245661240@qq.com> Date: Sat, 7 Mar 2026 00:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BB=E8=A6=81=E4=B8=BA=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E8=B4=A8=E9=87=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 匹配新版按钮控件的自动宽度写法 2. 统一Ez日志写入方向 3.移除历史修改:缓存启用mod列表,切换mod时保持通用mod开启状态 4.代码格式化、 5.修改文件名称表意,更直观 --- .../Mods/LAsMods/ManiaModPatternShift.cs | 23 ++------------- .../Analysis/EzAnalysisCache.cs | 3 +- .../Analysis/EzAnalysisCacheLookup.cs | 3 +- .../Analysis/EzAnalysisPersistentStore.cs | 25 ++++++++-------- .../Analysis/EzAnalysisWarmupProcessor.cs | 21 +++++++------- .../Analysis/EzBeatmapXxySrCache.cs | 9 +++--- .../Analysis/EzManiaAnalysisPerf.cs | 3 +- .../Analysis/XxySrCalculatorBridge.cs | 5 ++-- .../Analysis/XxySrDebugJson.cs | 5 ++-- .../Audio/EzPreviewTrackManager.cs | 29 +++++++++++++++++-- .../Audio/InputAudioLatencyTracker.cs | 15 ++++------ .../Configuration/Ez2ConfigManager.cs | 1 + .../EzLocalTextureFactory.Preload.cs | 18 +++++------- .../LAsEzExtensions/EzLocalTextureFactory.cs | 25 +++++----------- .../Statistics/BaseEzScoreGraph.cs | 5 ++-- .../UserInterface/EzKeyModeSelector.cs | 4 ++- ...ateButton.cs => ShearedKSPreviewButton.cs} | 9 ++---- osu.Game/Online/TrustedDomainOnlineStore.cs | 3 +- osu.Game/OsuGameBase.cs | 4 +-- .../Objects/Drawables/DrawableHitObject.cs | 13 ++++----- osu.Game/Rulesets/Ruleset.cs | 27 ++++++----------- osu.Game/Screens/Edit/Editor.cs | 3 +- osu.Game/Screens/Play/SubmittingPlayer.cs | 8 +++-- .../ScoreHitEventGeneratorBridge.cs | 5 ++-- osu.Game/Screens/Select/BeatmapTitleWedge.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 8 +++-- osu.sln.DotSettings | 1 + 27 files changed, 132 insertions(+), 145 deletions(-) rename osu.Game/LAsEzExtensions/UserInterface/{ShearedTriStateButton.cs => ShearedKSPreviewButton.cs} (89%) diff --git a/osu.Game.Rulesets.Mania/LAsEzMania/Mods/LAsMods/ManiaModPatternShift.cs b/osu.Game.Rulesets.Mania/LAsEzMania/Mods/LAsMods/ManiaModPatternShift.cs index 3fd595d83e..2e72212b16 100644 --- a/osu.Game.Rulesets.Mania/LAsEzMania/Mods/LAsMods/ManiaModPatternShift.cs +++ b/osu.Game.Rulesets.Mania/LAsEzMania/Mods/LAsMods/ManiaModPatternShift.cs @@ -128,26 +128,7 @@ namespace osu.Game.Rulesets.Mania.LAsEzMania.Mods.LAsMods public void ApplyToBeatmap(IBeatmap beatmap) { - applyToBeatmapInternal((ManiaBeatmap)beatmap, null); - } - - public void ApplyToWorkingBeatmap(WorkingBeatmap workingBeatmap) - { - ArgumentNullException.ThrowIfNull(workingBeatmap); - - double trackLength = 0; - - try - { - if (workingBeatmap.TrackLoaded) - trackLength = workingBeatmap.Track.Length; - } - catch - { - trackLength = 0; - } - - applyToBeatmapInternal((ManiaBeatmap)workingBeatmap.Beatmap, workingBeatmap.Waveform, trackLength); + applyToBeatmapInternal((ManiaBeatmap)beatmap); } private static List buildChords(List notes) @@ -553,7 +534,7 @@ namespace osu.Game.Rulesets.Mania.LAsEzMania.Mods.LAsMods } } - private void applyToBeatmapInternal(ManiaBeatmap maniaBeatmap, Waveform? waveform, double? trackLength = null) + private void applyToBeatmapInternal(ManiaBeatmap maniaBeatmap) { Seed.Value ??= RNG.Next(); var rng = new Random(Seed.Value.Value); diff --git a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCache.cs b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCache.cs index de75cad9eb..df5a554eb4 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCache.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCache.cs @@ -19,6 +19,7 @@ using osu.Framework.Utils; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; using osu.Game.Screens.Select; @@ -475,7 +476,7 @@ namespace osu.Game.LAsEzExtensions.Analysis { string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym)); Logger.Error(ex, - $"[EzBeatmapManiaAnalysisCache] computeAnalysis failed. beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}"); + $"[EzBeatmapManiaAnalysisCache] computeAnalysis failed. beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}", Ez2ConfigManager.LOGGER_NAME); } return null; diff --git a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCacheLookup.cs b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCacheLookup.cs index 26856fd276..d3b0e9e1bc 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCacheLookup.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisCacheLookup.cs @@ -7,6 +7,7 @@ using System.Threading; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -109,7 +110,7 @@ namespace osu.Game.LAsEzExtensions.Analysis // 如果克隆失败,则回退到使用原始实例。 // 这对缓存来说并不理想,但比完全破坏分析要好。 if (Interlocked.Increment(ref modSnapshotFailCount) <= 10) - Logger.Log($"[EzBeatmapManiaAnalysisCache] Mod.DeepClone() failed for {mod.GetType().FullName}. Falling back to original instance.", LoggingTarget.Runtime, LogLevel.Important); + Logger.Log($"[EzBeatmapManiaAnalysisCache] Mod.DeepClone() failed for {mod.GetType().FullName}. Falling back to original instance.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); list.Add(mod); } diff --git a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisPersistentStore.cs b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisPersistentStore.cs index 51a1a0d677..f37513a639 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisPersistentStore.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisPersistentStore.cs @@ -14,6 +14,7 @@ using Microsoft.Data.Sqlite; using osu.Framework.Logging; using osu.Framework.Platform; using osu.Game.Beatmaps; +using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions.Analysis { @@ -37,7 +38,6 @@ namespace osu.Game.LAsEzExtensions.Analysis /// public static bool Enabled = true; - public static readonly string LOGGER_NAME = "ez_runtime"; public static readonly string DATABASE_FILENAME = $@"mania-analysis_v{ANALYSIS_VERSION}.sqlite"; // 手动维护:算法/序列化格式变更时递增。版本发生变化时,会强制重算所有已存条目。 @@ -105,7 +105,7 @@ namespace osu.Game.LAsEzExtensions.Analysis // forcing a full recompute (when changes are only schema/serialization related). tryClonePreviousDatabaseIfMissing(); - Logger.Log($"EzManiaAnalysisPersistentStore path: {dbPath}", LOGGER_NAME, LogLevel.Important); + Logger.Log($"EzManiaAnalysisPersistentStore path: {dbPath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); using var connection = openConnection(); @@ -275,7 +275,7 @@ LIMIT 1; if (!string.Equals(storedHash, beatmap.Hash, StringComparison.Ordinal)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] stored_hash mismatch for {beatmap.ID}: stored={storedHash} runtime={beatmap.Hash}", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] stored_hash mismatch for {beatmap.ID}: stored={storedHash} runtime={beatmap.Hash}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return false; } @@ -284,7 +284,7 @@ LIMIT 1; // - If stored md5 is present, require it to match. if (!string.IsNullOrEmpty(storedMd5) && !string.Equals(storedMd5, beatmap.MD5Hash, StringComparison.Ordinal)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] stored_md5 mismatch for {beatmap.ID}: stored={storedMd5} runtime={beatmap.MD5Hash}", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] stored_md5 mismatch for {beatmap.ID}: stored={storedMd5} runtime={beatmap.MD5Hash}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return false; } @@ -329,7 +329,7 @@ LIMIT 1; // Validate the analysis result to ensure it's reasonable if (!isValidAnalysisResult(result)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] Invalid analysis result for {beatmap.ID}, ignoring cached data.", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] Invalid analysis result for {beatmap.ID}, ignoring cached data.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return false; } @@ -339,7 +339,7 @@ LIMIT 1; } catch (Exception e) { - Logger.Error(e, "EzManiaAnalysisPersistentStore TryGet failed.", LOGGER_NAME); + Logger.Error(e, "EzManiaAnalysisPersistentStore TryGet failed.", Ez2ConfigManager.LOGGER_NAME); return false; } } @@ -362,7 +362,7 @@ LIMIT 1; // Validate the analysis result before storing if (!isValidAnalysisResult(analysis)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] Refusing to store invalid analysis result for {beatmap.ID}", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] Refusing to store invalid analysis result for {beatmap.ID}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return; } @@ -387,7 +387,7 @@ LIMIT 1; // 对比两个结果是否有差异 if (hasDifference(storedAnalysis, analysis)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] Data difference detected for {beatmap.ID}, updating SQLite.", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] Data difference detected for {beatmap.ID}, updating SQLite.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); Store(beatmap, analysis); } } @@ -508,7 +508,7 @@ LIMIT 1; // Validate the analysis result before storing if (!isValidAnalysisResult(analysis)) { - Logger.Log($"[EzManiaAnalysisPersistentStore] Refusing to store invalid analysis result for {beatmap.ID}", LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzManiaAnalysisPersistentStore] Refusing to store invalid analysis result for {beatmap.ID}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return; } @@ -707,13 +707,12 @@ ON CONFLICT(key) DO UPDATE SET value = excluded.value; try { File.Copy(bestCandidate, dbPath); - Logger.Log($"[EzManiaAnalysisPersistentStore] Cloned DB from v{bestVersion} to v{ANALYSIS_VERSION}: {Path.GetFileName(bestCandidate)} -> {Path.GetFileName(dbPath)}", - LoggingTarget.Database); + Logger.Log($"[EzManiaAnalysisPersistentStore] Cloned DB from v{bestVersion} to v{ANALYSIS_VERSION}: {Path.GetFileName(bestCandidate)} -> {Path.GetFileName(dbPath)}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); } catch (Exception e) { // If cloning fails, we simply fall back to creating a fresh DB and recomputing as needed. - Logger.Error(e, "[EzManiaAnalysisPersistentStore] Failed to clone previous DB; falling back to fresh database."); + Logger.Error(e, "[EzManiaAnalysisPersistentStore] Failed to clone previous DB; falling back to fresh database.", Ez2ConfigManager.LOGGER_NAME); } } @@ -924,7 +923,7 @@ ON CONFLICT(beatmap_id) DO UPDATE SET return; // 重建表,删除不识别的列 - Logger.Log($"[EzManiaAnalysisPersistentStore] Found unrecognized columns: {string.Join(", ", unrecognizedColumns)}; rebuilding table.", LoggingTarget.Database); + Logger.Log($"[EzManiaAnalysisPersistentStore] Found unrecognized columns: {string.Join(", ", unrecognizedColumns)}; rebuilding table.", Ez2ConfigManager.LOGGER_NAME); rebuildTableWithoutUnrecognizedColumns(connection, unrecognizedColumns); } diff --git a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisWarmupProcessor.cs b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisWarmupProcessor.cs index f9c2979564..ee5c807417 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzAnalysisWarmupProcessor.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzAnalysisWarmupProcessor.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; using osu.Game.Performance; @@ -72,13 +73,13 @@ namespace osu.Game.LAsEzExtensions.Analysis { if (!EzAnalysisPersistentStore.Enabled) { - Logger.Log("Mania analysis persistence is disabled; skipping warmup.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log("Mania analysis persistence is disabled; skipping warmup.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return; } List<(Guid id, string hash)> beatmaps = new List<(Guid id, string hash)>(); - Logger.Log("Querying for mania beatmaps to warm up analysis cache...", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log("Querying for mania beatmaps to warm up analysis cache...", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); realmAccess.Run(r => { @@ -125,12 +126,12 @@ namespace osu.Game.LAsEzExtensions.Analysis } Logger.Log($"Warmup beatmap query summary: total={totalBeatmaps}, total_with_set={totalWithSet}, mania_total={maniaTotal}, mania_with_set={maniaWithSet}, mania_hidden={maniaHidden}", - EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); if (maniaTotal == 0) { string dist = string.Join(", ", rulesetDistribution.OrderByDescending(kvp => kvp.Value).Take(10).Select(kvp => $"{kvp.Key}={kvp.Value}")); - Logger.Log($"Warmup beatmap ruleset distribution (first 2000): {dist}", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log($"Warmup beatmap ruleset distribution (first 2000): {dist}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); } }); @@ -143,13 +144,13 @@ namespace osu.Game.LAsEzExtensions.Analysis if (needingRecompute.Count == 0) { - Logger.Log("No beatmaps require mania analysis warmup.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log("No beatmaps require mania analysis warmup.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return; } - Logger.Log($"Found {needingRecompute.Count} beatmaps which require mania analysis warmup.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log($"Found {needingRecompute.Count} beatmaps which require mania analysis warmup.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); - Logger.Log($"Starting mania analysis warmup. total={needingRecompute.Count}", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log($"Starting mania analysis warmup. total={needingRecompute.Count}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); var notification = showProgressNotification(needingRecompute.Count, "Precomputing mania analysis for beatmaps", "beatmaps' mania analysis has been precomputed"); @@ -187,7 +188,7 @@ namespace osu.Game.LAsEzExtensions.Analysis } catch (Exception e) { - Logger.Log($"Background mania analysis warmup failed on {beatmap}: {e}", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log($"Background mania analysis warmup failed on {beatmap}: {e}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); ++failedCount; } @@ -242,7 +243,7 @@ namespace osu.Game.LAsEzExtensions.Analysis { if (notificationOverlay == null) { - Logger.Log("INotificationOverlay is null; mania analysis warmup progress notification will not be shown.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log("INotificationOverlay is null; mania analysis warmup progress notification will not be shown.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return null; } @@ -261,7 +262,7 @@ namespace osu.Game.LAsEzExtensions.Analysis try { notificationOverlay?.Post(notification); - Logger.Log("Posted mania analysis warmup progress notification.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Important); + Logger.Log("Posted mania analysis warmup progress notification.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); } catch (Exception e) { diff --git a/osu.Game/LAsEzExtensions/Analysis/EzBeatmapXxySrCache.cs b/osu.Game/LAsEzExtensions/Analysis/EzBeatmapXxySrCache.cs index a00eb8a430..1e9a9a121a 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzBeatmapXxySrCache.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzBeatmapXxySrCache.cs @@ -15,6 +15,7 @@ using osu.Framework.Threading; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -143,7 +144,7 @@ namespace osu.Game.LAsEzExtensions.Analysis string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym)); Logger.Log( $"xxy_SR aborted: playableBeatmap has 0 hitobjects. beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}", - EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Error); + Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); return null; } @@ -153,7 +154,7 @@ namespace osu.Game.LAsEzExtensions.Analysis // Defensive: avoid propagating invalid values to UI. if (double.IsNaN(sr) || double.IsInfinity(sr)) { - Logger.Log($"xxy_SR returned invalid value (NaN/Infinity). beatmapId={lookup.BeatmapInfo.ID} ruleset={lookup.Ruleset.ShortName}", EzAnalysisPersistentStore.LOGGER_NAME, + Logger.Log($"xxy_SR returned invalid value (NaN/Infinity). beatmapId={lookup.BeatmapInfo.ID} ruleset={lookup.Ruleset.ShortName}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); return null; } @@ -164,7 +165,7 @@ namespace osu.Game.LAsEzExtensions.Analysis string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym)); Logger.Log( $"xxy_SR abnormal value: {sr}. hitobjects={playableBeatmap.HitObjects.Count} beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}", - EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Error); + Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } return sr; @@ -178,7 +179,7 @@ namespace osu.Game.LAsEzExtensions.Analysis // 只记录异常:用于排查“值偏差非常大/计算失败导致空 pill”。 string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym)); Logger.Error(ex, $"xxy_SR compute exception. beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}", - EzAnalysisPersistentStore.LOGGER_NAME); + Ez2ConfigManager.LOGGER_NAME); return null; } } diff --git a/osu.Game/LAsEzExtensions/Analysis/EzManiaAnalysisPerf.cs b/osu.Game/LAsEzExtensions/Analysis/EzManiaAnalysisPerf.cs index dd8ee459e7..8b4f8dc6f5 100644 --- a/osu.Game/LAsEzExtensions/Analysis/EzManiaAnalysisPerf.cs +++ b/osu.Game/LAsEzExtensions/Analysis/EzManiaAnalysisPerf.cs @@ -5,6 +5,7 @@ using System; using System.Diagnostics; using System.Threading; using osu.Framework.Logging; +using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions.Analysis { @@ -286,7 +287,7 @@ namespace osu.Game.LAsEzExtensions.Analysis $"graph(set count/ms/KB pts)={graphCount}/{graphTotalMs:F2}/{graphTotalKb:F1} pts={graphPoints} avg={graphAvgMs:F2}ms/{graphAvgKb:F1}KB " + $"kpc(upd count/ms/KB cols bar)={kpcCount}/{kpcTotalMs:F2}/{kpcTotalKb:F1} cols={kpcCols} bar={kpcBar} avg={kpcAvgMs:F2}ms/{kpcAvgKb:F1}KB " + $"cache={cacheSize}/{cacheLimit} evict={evict} inflight(H/L)={highInflight}/{lowInflight}", - EzAnalysisPersistentStore.LOGGER_NAME, + Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); } } diff --git a/osu.Game/LAsEzExtensions/Analysis/XxySrCalculatorBridge.cs b/osu.Game/LAsEzExtensions/Analysis/XxySrCalculatorBridge.cs index 113ffe1dca..6ea83f9f7b 100644 --- a/osu.Game/LAsEzExtensions/Analysis/XxySrCalculatorBridge.cs +++ b/osu.Game/LAsEzExtensions/Analysis/XxySrCalculatorBridge.cs @@ -6,6 +6,7 @@ using System.Reflection; using System.Threading; using osu.Framework.Logging; using osu.Game.Beatmaps; +using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions.Analysis { @@ -56,7 +57,7 @@ namespace osu.Game.LAsEzExtensions.Analysis catch (Exception ex) { if (Interlocked.Increment(ref invokeFailCount) <= 10) - Logger.Error(ex, $"xxy_SR bridge invoke exception with clockRate. beatmapType={beatmap.GetType().FullName}, clockRate={clockRate}", EzAnalysisPersistentStore.LOGGER_NAME); + Logger.Error(ex, $"xxy_SR bridge invoke exception with clockRate. beatmapType={beatmap.GetType().FullName}, clockRate={clockRate}", Ez2ConfigManager.LOGGER_NAME); } } @@ -74,7 +75,7 @@ namespace osu.Game.LAsEzExtensions.Analysis catch (Exception ex) { if (Interlocked.Exchange(ref resolveFailLogged, 1) == 0) - Logger.Error(ex, $"xxy_SR bridge resolve exception for {calculator_type_name}.{calculator_method_name}.", EzAnalysisPersistentStore.LOGGER_NAME); + Logger.Error(ex, $"xxy_SR bridge resolve exception for {calculator_type_name}.{calculator_method_name}.", Ez2ConfigManager.LOGGER_NAME); return null; } diff --git a/osu.Game/LAsEzExtensions/Analysis/XxySrDebugJson.cs b/osu.Game/LAsEzExtensions/Analysis/XxySrDebugJson.cs index 4263bca78c..d389c125e8 100644 --- a/osu.Game/LAsEzExtensions/Analysis/XxySrDebugJson.cs +++ b/osu.Game/LAsEzExtensions/Analysis/XxySrDebugJson.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.Json; using osu.Framework.Logging; using osu.Game.Beatmaps; +using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions.Analysis { @@ -98,14 +99,14 @@ namespace osu.Game.LAsEzExtensions.Analysis { Logger.Log( FormatAbnormalSr(beatmap, "xxySR_null", null, xxySr), - EzAnalysisPersistentStore.LOGGER_NAME, + Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } else if (Math.Abs(star.Value - xxySr.Value) > 3) { Logger.Log( FormatAbnormalSr(beatmap, "xxySR_large_diff", star, xxySr), - EzAnalysisPersistentStore.LOGGER_NAME, + Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } } diff --git a/osu.Game/LAsEzExtensions/Audio/EzPreviewTrackManager.cs b/osu.Game/LAsEzExtensions/Audio/EzPreviewTrackManager.cs index 380f43d8ac..d98761c5b5 100644 --- a/osu.Game/LAsEzExtensions/Audio/EzPreviewTrackManager.cs +++ b/osu.Game/LAsEzExtensions/Audio/EzPreviewTrackManager.cs @@ -437,8 +437,8 @@ namespace osu.Game.LAsEzExtensions.Audio sampleScheduler.NextHitSoundIndex = findNextValidIndex(sampleScheduler.ScheduledHitSounds, 0, physicalTime - trigger_tolerance); sampleScheduler.NextStoryboardSampleIndex = findNextValidIndex(sampleScheduler.ScheduledStoryboardSamples, 0, physicalTime - trigger_tolerance); - // 清理已停止的活动通道 - sampleScheduler.ActiveChannels.RemoveAll(c => !c.Playing); + // 清理已停止的活动通道并归还资源 + cleanupInactiveChannels(); } double logicalTime = physicalTime; @@ -520,10 +520,33 @@ namespace osu.Game.LAsEzExtensions.Audio else break; } - sampleScheduler.ActiveChannels.RemoveAll(c => !c.Playing); + cleanupInactiveChannels(); playback.LastTrackTime = logicalTimeForEvents; } + private void cleanupInactiveChannels() + { + for (int i = sampleScheduler.ActiveChannels.Count - 1; i >= 0; i--) + { + var channel = sampleScheduler.ActiveChannels[i]; + + if (channel.Playing) + continue; + + try + { + if (!channel.IsDisposed && !channel.ManualFree) + channel.Dispose(); + } + catch + { + // Ignore disposal errors. + } + + sampleScheduler.ActiveChannels.RemoveAt(i); + } + } + private void triggerHitSound(HitSampleInfo[] samples) { if (samples.Length == 0) return; diff --git a/osu.Game/LAsEzExtensions/Audio/InputAudioLatencyTracker.cs b/osu.Game/LAsEzExtensions/Audio/InputAudioLatencyTracker.cs index 3efdce0ac7..cfc38505af 100644 --- a/osu.Game/LAsEzExtensions/Audio/InputAudioLatencyTracker.cs +++ b/osu.Game/LAsEzExtensions/Audio/InputAudioLatencyTracker.cs @@ -7,6 +7,7 @@ using osu.Framework.Audio.EzLatency; using osu.Framework.Bindables; using osu.Framework.Graphics.Sprites; using osu.Framework.Logging; +using osu.Game.LAsEzExtensions.Analysis; using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; @@ -139,18 +140,14 @@ namespace osu.Game.LAsEzExtensions.Audio if (!stats.HasData) { - Logger.Log("[EzOsuLatency] No latency data available for analysis", LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log("[EzOsuLatency] No latency data available for analysis", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return; } // 输出统计日志 - string message1 = - $"Input→Judgement: {stats.AvgInputToJudge:F2}ms, Input→Audio: {stats.AvgInputToPlayback:F2}ms, Audio→Judgement: {stats.AvgPlaybackToJudge:F2}ms (based on {stats.RecordCount} complete records)"; - string message2 = - $"Input→Judgement: {stats.AvgInputToJudge:F2}ms, \nInput→Audio: {stats.AvgInputToPlayback:F2}ms, \nAudio→Judgement: {stats.AvgPlaybackToJudge:F2}ms \n(based on {stats.RecordCount} complete records)"; + string message = $"Input→Judgement: {stats.AvgInputToJudge:F2}ms, \nInput→Audio: {stats.AvgInputToPlayback:F2}ms, \nAudio→Judgement: {stats.AvgPlaybackToJudge:F2}ms \n(based on {stats.RecordCount} complete records)"; - Logger.Log($"[EzOsuLatency] Latency Analysis: {message1}"); - Logger.Log($"[EzOsuLatency] Latency Analysis: \n{message2}", LoggingTarget.Runtime, LogLevel.Important); + Logger.Log($"[EzOsuLatency] Latency Analysis: {message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); // 显示通知 notificationOverlay?.Post(new SimpleNotification @@ -215,11 +212,11 @@ namespace osu.Game.LAsEzExtensions.Audio string extra = $" | input_struct=(in={inputData.InputTime:F2}, key={inputData.KeyValue ?? "-"}, judge={inputData.JudgeTime:F2}, play={inputData.PlaybackTime:F2})" + $" | hw_struct=(driver={hw.DriverTime:F2}, out_hw={hw.OutputHardwareTime:F2}, in_hw={hw.InputHardwareTime:F2}, diff={hw.LatencyDifference:F2})"; - Logger.Log(line + extra, LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log(line + extra, Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); } catch (Exception ex) { - Logger.Log($"InputAudioLatencyTracker: failed to handle new record: {ex.Message}", LoggingTarget.Runtime, LogLevel.Error); + Logger.Log($"InputAudioLatencyTracker: failed to handle new record: {ex.Message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } } } diff --git a/osu.Game/LAsEzExtensions/Configuration/Ez2ConfigManager.cs b/osu.Game/LAsEzExtensions/Configuration/Ez2ConfigManager.cs index c1b7c7784b..509dca6f5e 100644 --- a/osu.Game/LAsEzExtensions/Configuration/Ez2ConfigManager.cs +++ b/osu.Game/LAsEzExtensions/Configuration/Ez2ConfigManager.cs @@ -18,6 +18,7 @@ namespace osu.Game.LAsEzExtensions.Configuration { public class Ez2ConfigManager : IniConfigManager, IGameplaySettings { + public static readonly string LOGGER_NAME = "ez_runtime"; protected override string Filename => "EzSkinSettings.ini"; private readonly int[] commonKeyModes = { 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18 }; public float DefaultHitPosition = 180f; diff --git a/osu.Game/LAsEzExtensions/EzLocalTextureFactory.Preload.cs b/osu.Game/LAsEzExtensions/EzLocalTextureFactory.Preload.cs index a523a63426..8f6c904845 100644 --- a/osu.Game/LAsEzExtensions/EzLocalTextureFactory.Preload.cs +++ b/osu.Game/LAsEzExtensions/EzLocalTextureFactory.Preload.cs @@ -4,6 +4,8 @@ using System; using System.Threading.Tasks; using osu.Framework.Logging; +using osu.Game.LAsEzExtensions.Analysis; +using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions { @@ -29,8 +31,7 @@ namespace osu.Game.LAsEzExtensions try { string currentNoteSetName = noteSetName.Value; - Logger.Log($"[EzLocalTextureFactory] Starting preload for note set: {currentNoteSetName}", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Starting preload for note set: {currentNoteSetName}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); foreach (string component in preload_components) preloadComponent(component, currentNoteSetName); @@ -38,16 +39,12 @@ namespace osu.Game.LAsEzExtensions await Task.CompletedTask.ConfigureAwait(false); preloadCompleted = true; - Logger.Log($"[EzLocalTextureFactory] Preload completed for {preload_components.Length} components", - LoggingTarget.Runtime, LogLevel.Debug); - - Logger.Log($"[EzLocalTextureFactory] Cache stats after preload: {global_cache.Count} frame sets", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Preload completed for {preload_components.Length} components", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Cache stats after preload: {global_cache.Count} frame sets", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); } catch (Exception ex) { - Logger.Log($"[EzLocalTextureFactory] Preload failed: {ex.Message}", - LoggingTarget.Runtime, LogLevel.Error); + Logger.Log($"[EzLocalTextureFactory] Preload failed: {ex.Message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } finally { @@ -73,8 +70,7 @@ namespace osu.Game.LAsEzExtensions } catch (Exception ex) { - Logger.Log($"[EzLocalTextureFactory] Failed to preload {component}: {ex.Message}", - LoggingTarget.Runtime, LogLevel.Error); + Logger.Log($"[EzLocalTextureFactory] Failed to preload {component}: {ex.Message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error); } } diff --git a/osu.Game/LAsEzExtensions/EzLocalTextureFactory.cs b/osu.Game/LAsEzExtensions/EzLocalTextureFactory.cs index 7ec8e0196e..8e8c6926aa 100644 --- a/osu.Game/LAsEzExtensions/EzLocalTextureFactory.cs +++ b/osu.Game/LAsEzExtensions/EzLocalTextureFactory.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using osu.Framework.Logging; using osu.Framework.Platform; +using osu.Game.LAsEzExtensions.Analysis; using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Skinning; using osuTK; @@ -281,8 +282,7 @@ namespace osu.Game.LAsEzExtensions else { string frameFile = $"{basePath}.png"; - Logger.Log($"[EzLocalTextureFactory] Loading JudgementLine Frame: {frameFile}", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Loading JudgementLine Frame: {frameFile}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); var texture = textureStore.Get(frameFile); frames.Add(texture); @@ -353,8 +353,7 @@ namespace osu.Game.LAsEzExtensions if (texture == null) break; - Logger.Log($"[EzLocalTextureFactory] Added Stage Frames: {basePath}_{i}.png", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Added Stage Frames: {basePath}_{i}.png", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); frames.Add(texture); } @@ -365,8 +364,7 @@ namespace osu.Game.LAsEzExtensions if (texture != null) { - Logger.Log($"[EzLocalTextureFactory] Added Stage Frame: {basePath}", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Added Stage Frame: {basePath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); frames.Add(texture); } } @@ -418,8 +416,7 @@ namespace osu.Game.LAsEzExtensions if (texture == null) break; - Logger.Log($"[EzLocalTextureFactory] Added Keys Frames: {basePath}_{i}", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Added Keys Frames: {basePath}_{i}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); frames.Add(texture); } @@ -431,8 +428,7 @@ namespace osu.Game.LAsEzExtensions if (texture != null) { - Logger.Log($"[EzLocalTextureFactory] Added Keys Frame: {basePath}", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Added Keys Frame: {basePath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); frames.Add(texture); } } @@ -465,9 +461,6 @@ namespace osu.Game.LAsEzExtensions if (frames.Count > 0) { - Logger.Log($"[EzLocalTextureFactory] global_cache Caching {frames.Count} frames for {cacheKey}", - LoggingTarget.Runtime, LogLevel.Debug); - var newEntry = new CacheEntry(frames, true); global_cache.TryAdd(cacheKey, newEntry); } @@ -482,8 +475,7 @@ namespace osu.Game.LAsEzExtensions if (count1 > 0) { - Logger.Log($"[EzLocalTextureFactory] Clearing note_ratio_cache ({count1})", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Clearing note_ratio_cache ({count1})", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); note_ratio_cache.Clear(); } @@ -492,8 +484,7 @@ namespace osu.Game.LAsEzExtensions if (count2 > 0) { - Logger.Log($"[EzLocalTextureFactory] Clearing global_cache ({count2})", - LoggingTarget.Runtime, LogLevel.Debug); + Logger.Log($"[EzLocalTextureFactory] Clearing global_cache ({count2})", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); global_cache.Clear(); } } diff --git a/osu.Game/LAsEzExtensions/Statistics/BaseEzScoreGraph.cs b/osu.Game/LAsEzExtensions/Statistics/BaseEzScoreGraph.cs index 590f78fcf3..7e69a0bf58 100644 --- a/osu.Game/LAsEzExtensions/Statistics/BaseEzScoreGraph.cs +++ b/osu.Game/LAsEzExtensions/Statistics/BaseEzScoreGraph.cs @@ -13,6 +13,7 @@ using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -123,7 +124,7 @@ namespace osu.Game.LAsEzExtensions.Statistics double accuracy = v1ScoreProcessor.AccuracyClassic.Value; long totalScore = v1ScoreProcessor.TotalScore.Value; - Logger.Log($"[V1 ScoreProcessor]: {accuracy * 100:F2}%, Score: {totalScore / 10000}w"); + Logger.Log($"[V1 ScoreProcessor] {accuracy * 100:F2}%, Score: {totalScore / 10000}w", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); // Set properties instead of returning V1Accuracy = accuracy; @@ -173,7 +174,7 @@ namespace osu.Game.LAsEzExtensions.Statistics double accuracy = v2ScoreProcessor.Accuracy.Value; long totalScore = v2ScoreProcessor.TotalScore.Value; - Logger.Log($"[V2 ScoreProcessor] Accuracy: {accuracy * 100:F2}%, Score: {totalScore / 10000}w"); + Logger.Log($"[V2 ScoreProcessor] {accuracy * 100:F2}%, Score: {totalScore / 10000}w", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); // Set properties instead of returning V2Accuracy = accuracy; diff --git a/osu.Game/LAsEzExtensions/UserInterface/EzKeyModeSelector.cs b/osu.Game/LAsEzExtensions/UserInterface/EzKeyModeSelector.cs index abe14f186f..20bf83ab99 100644 --- a/osu.Game/LAsEzExtensions/UserInterface/EzKeyModeSelector.cs +++ b/osu.Game/LAsEzExtensions/UserInterface/EzKeyModeSelector.cs @@ -78,12 +78,14 @@ namespace osu.Game.LAsEzExtensions.UserInterface { new Drawable[] { - labelButton = new ShearedButton(50, 30) + labelButton = new ShearedButton() { Text = "Keys", TextSize = 16, Anchor = Anchor.Centre, Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, + Height = 30f, Shear = new Vector2(0), TooltipText = EzSongSelectStrings.CLEAR_SELECTION, }, diff --git a/osu.Game/LAsEzExtensions/UserInterface/ShearedTriStateButton.cs b/osu.Game/LAsEzExtensions/UserInterface/ShearedKSPreviewButton.cs similarity index 89% rename from osu.Game/LAsEzExtensions/UserInterface/ShearedTriStateButton.cs rename to osu.Game/LAsEzExtensions/UserInterface/ShearedKSPreviewButton.cs index bc692e4cfa..1d12a823a7 100644 --- a/osu.Game/LAsEzExtensions/UserInterface/ShearedTriStateButton.cs +++ b/osu.Game/LAsEzExtensions/UserInterface/ShearedKSPreviewButton.cs @@ -9,19 +9,14 @@ using osu.Game.LAsEzExtensions.Configuration; namespace osu.Game.LAsEzExtensions.UserInterface { - public partial class ShearedTriStateButton : ShearedButton + public partial class ShearedKSPreviewButton : ShearedButton { public Bindable State = new Bindable(); - public ShearedTriStateButton(float? width = null) - : base(width) - { - } - protected override void LoadComplete() { Action = () => State.Value = (KeySoundPreviewMode)(((int)State.Value + 1) % 3); - Logger.Log(State.Value.ToString()); + Logger.Log($@"[Ez]KeySoundPreviewMode: {State.Value.ToString()}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); State.BindValueChanged(_ => UpdateState(), true); base.LoadComplete(); diff --git a/osu.Game/Online/TrustedDomainOnlineStore.cs b/osu.Game/Online/TrustedDomainOnlineStore.cs index 73a6ec2120..6aa73e0cb6 100644 --- a/osu.Game/Online/TrustedDomainOnlineStore.cs +++ b/osu.Game/Online/TrustedDomainOnlineStore.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.IO.Stores; using osu.Framework.Logging; +using osu.Game.LAsEzExtensions.Analysis; using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Online; @@ -23,7 +24,7 @@ namespace osu.Game.Online // 任何从服务器获取资源的事件都会引发这个日志输出 if (!Uri.TryCreate(url, UriKind.Absolute, out Uri? uri1) || !uri1.Host.EndsWith(@".ppy.sh", StringComparison.OrdinalIgnoreCase)) { - Logger.Log($@"[Ez2Lazer] Using Custom ApiUrl {url}", LoggingTarget.Network, LogLevel.Important); + Logger.Log($@"[Ez2Lazer] Using Custom ApiUrl {url}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); } #endif diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 1f4ef5229b..19c76f7186 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -115,7 +115,7 @@ namespace osu.Game if (Ez2ConfigManager != null) { var serverPreset = Ez2ConfigManager.Get(Ez2Setting.ServerPreset); - Logger.Log($"[Ez] Using server preset: {serverPreset}"); + Logger.Log($"[EzServer] Using server preset: {serverPreset}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return serverPreset switch { @@ -125,7 +125,7 @@ namespace osu.Game }; } - Logger.Log("[Ez] Switch server failed: Ez2ConfigManager not initialized. Falling back to default configuration."); + Logger.Log("[EzServer] Switch server failed: Ez2ConfigManager not initialized. Falling back to default configuration.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); // 否则使用默认配置 return UseDevelopmentServer ? new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 85aec56e36..d8811e2514 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -166,8 +166,9 @@ namespace osu.Game.Rulesets.Objects.Drawables private IBindable offsetBindable; - // cached config for autoplay behaviour - private Ez2ConfigManager ezConfig; + [Resolved(CanBeNull = true)] + private Ez2ConfigManager ezConfig { get; set; } + private ScheduledDelegate autoplayDelegate; /// @@ -211,7 +212,7 @@ namespace osu.Game.Rulesets.Objects.Drawables } [BackgroundDependencyLoader] - private void load(IGameplaySettings gameplaySettings, ISkinSource skinSource, Ez2ConfigManager ezConfig) + private void load(IGameplaySettings gameplaySettings, ISkinSource skinSource) { positionalHitsoundsLevel.BindTo(gameplaySettings.PositionalHitsoundsLevel); comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount); @@ -225,9 +226,6 @@ namespace osu.Game.Rulesets.Objects.Drawables CurrentSkin = skinSource; CurrentSkin.SourceChanged += skinSourceChanged; - // cache config reference for autoplay scheduling - this.ezConfig = ezConfig; - // Choose the appropriate offset bindable once during load to avoid runtime reflection/namespace checks. if (ezConfig != null && drawableRuleset != null) { @@ -341,7 +339,7 @@ namespace osu.Game.Rulesets.Objects.Drawables UpdateComboColour(); } - // Schedule one-shot autoplay of this object's samples when configured to do so. + // 自动触发音效 try { bool isAutoPlayPlus = autoPlaySnapshot?.IsAutoPlayPlus ?? (ezConfig != null && ezConfig.Get(Ez2Setting.KeySoundPreviewMode) == KeySoundPreviewMode.AutoPlayPlus); @@ -370,7 +368,6 @@ namespace osu.Game.Rulesets.Objects.Drawables } catch { - // be defensive; don't let scheduling failures affect hitobject application } } diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index f61badcad2..905c4011dc 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -43,8 +43,6 @@ namespace osu.Game.Rulesets private static readonly ConcurrentDictionary mod_reference_cache = new ConcurrentDictionary(); - private Mod[]? cachedAllMods; - /// /// Version history: /// 2022.205.0 FramedReplayInputHandler.CollectPendingInputs renamed to FramedReplayHandler.CollectReplayInputs. @@ -89,22 +87,15 @@ namespace osu.Game.Rulesets /// This comes with considerable allocation overhead. If only accessing for reference purposes (ie. not changing bindables / settings) /// use instead. /// - public IEnumerable CreateAllMods() - { - if (cachedAllMods != null) - return cachedAllMods; - - return cachedAllMods = Enum.GetValues() - // Confine all mods of each mod type into a single IEnumerable - .SelectMany(GetModsFor) - // Filter out all null mods - // This is to handle old rulesets which were doing mods bad. Can be removed at some point we are sure nulls will not appear here. - // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract - .Where(mod => mod != null) - // Resolve MultiMods as their .Mods property - .SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod }) - .ToArray(); - } + public IEnumerable CreateAllMods() => Enum.GetValues() + // Confine all mods of each mod type into a single IEnumerable + .SelectMany(GetModsFor) + // Filter out all null mods + // This is to handle old rulesets which were doing mods bad. Can be removed at some point we are sure nulls will not appear here. + // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract + .Where(mod => mod != null) + // Resolve MultiMods as their .Mods property + .SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod }); /// /// Returns a fresh instance of the mod matching the specified acronym. diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 658c7b1767..2360febccb 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -1318,8 +1318,7 @@ namespace osu.Game.Screens.Edit yield return new EditorMenuItem(EditorStrings.OpenInfoPage, MenuItemType.Standard, () => (Game as OsuGame)?.OpenUrlExternally(editorBeatmap.BeatmapInfo.GetOnlineURL(api, editorBeatmap.BeatmapInfo.Ruleset))); yield return new EditorMenuItem(EditorStrings.OpenDiscussionPage, MenuItemType.Standard, - () => (Game as OsuGame)?.OpenUrlExternally( - $@"{api.Endpoints.WebsiteUrl}/beatmapsets/{editorBeatmap.BeatmapInfo.BeatmapSet!.OnlineID}/discussion/{editorBeatmap.BeatmapInfo.OnlineID}")); + () => (Game as OsuGame)?.OpenUrlExternally($@"{api.Endpoints.WebsiteUrl}/beatmapsets/{editorBeatmap.BeatmapInfo.BeatmapSet!.OnlineID}/discussion/{editorBeatmap.BeatmapInfo.OnlineID}")); } yield return new OsuMenuItemSpacer(); diff --git a/osu.Game/Screens/Play/SubmittingPlayer.cs b/osu.Game/Screens/Play/SubmittingPlayer.cs index d08e16a43d..d3ea50bf7d 100644 --- a/osu.Game/Screens/Play/SubmittingPlayer.cs +++ b/osu.Game/Screens/Play/SubmittingPlayer.cs @@ -15,6 +15,7 @@ using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Database; +using osu.Game.LAsEzExtensions.Analysis; using osu.Game.LAsEzExtensions.Audio; using osu.Game.LAsEzExtensions.Configuration; using osu.Game.Online; @@ -336,7 +337,8 @@ namespace osu.Game.Screens.Play if (Ruleset.Value.OnlineID == 3 && (hitMode != EzEnumHitMode.Lazer || !hasDefaultCutoffValues)) { - Logger.Log($"[EzMania]Score submission blocked by custom rating settings (HitMode={hitMode}, CutoffA={accCutoffABindable.Value:0.####}, CutoffS={accCutoffSBindable.Value:0.####})."); + Logger.Log($"[EzMania]Score submission blocked by custom rating settings (HitMode={hitMode}, CutoffA={accCutoffABindable.Value:0.####}, CutoffS={accCutoffSBindable.Value:0.####})." + , Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return Task.CompletedTask; } @@ -346,13 +348,13 @@ namespace osu.Game.Screens.Play if (Ruleset.Value.OnlineID == 3 && !offsetManiaBindable.IsDefault) { - Logger.Log($"[EzMania]Score submission blocked by offset settings."); + Logger.Log($"[EzMania]Score submission blocked by offset settings.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return Task.CompletedTask; } if (Ruleset.Value.OnlineID != 3 && !offsetNonStdBindable.IsDefault) { - Logger.Log($"[EzNoMania]Score submission blocked by offset settings."); + Logger.Log($"[EzNoMania]Score submission blocked by offset settings.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important); return Task.CompletedTask; } diff --git a/osu.Game/Screens/Ranking/Statistics/ScoreHitEventGeneratorBridge.cs b/osu.Game/Screens/Ranking/Statistics/ScoreHitEventGeneratorBridge.cs index 7c4f0cd367..f622ee5dc6 100644 --- a/osu.Game/Screens/Ranking/Statistics/ScoreHitEventGeneratorBridge.cs +++ b/osu.Game/Screens/Ranking/Statistics/ScoreHitEventGeneratorBridge.cs @@ -9,6 +9,7 @@ using System.Threading; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.LAsEzExtensions.Analysis; +using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Statistics; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; @@ -89,7 +90,7 @@ namespace osu.Game.Screens.Ranking.Statistics } catch (Exception ex) { - Logger.Error(ex, $"HitEvent generation via bridge failed. ruleset={score.ScoreInfo.Ruleset.ShortName}", EzAnalysisPersistentStore.LOGGER_NAME); + Logger.Error(ex, $"HitEvent generation via bridge failed. ruleset={score.ScoreInfo.Ruleset.ShortName}", Ez2ConfigManager.LOGGER_NAME); return null; } } @@ -152,7 +153,7 @@ namespace osu.Game.Screens.Ranking.Statistics } } - Logger.Log($"No HitEvent generator found for ruleset={key}. Skipping local generation.", EzAnalysisPersistentStore.LOGGER_NAME, LogLevel.Debug); + Logger.Log($"No HitEvent generator found for ruleset={key}. Skipping local generation.", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug); return null; } } diff --git a/osu.Game/Screens/Select/BeatmapTitleWedge.cs b/osu.Game/Screens/Select/BeatmapTitleWedge.cs index 5387fbdd33..da5c845bf3 100644 --- a/osu.Game/Screens/Select/BeatmapTitleWedge.cs +++ b/osu.Game/Screens/Select/BeatmapTitleWedge.cs @@ -305,7 +305,7 @@ namespace osu.Game.Screens.Select { float availableWidth = DrawWidth - playCount.DrawWidth - favouriteButton.DrawWidth - lengthStatistic.DrawWidth - bpmStatistic.DrawWidth - statisticsFlow.Spacing.X * 3 - SongSelect.WEDGE_CONTENT_MARGIN * 2; kpsGraph.Width = availableWidth; - // Logger.Log($"[EzTest] T: {DrawWidth}, {playCount.DrawWidth}, {favouriteButton.DrawWidth}, {lengthStatistic.DrawWidth}, {bpmStatistic.DrawWidth}"); + // Logger.Log($"[EzTest] T: {DrawWidth}, {playCount.DrawWidth}, {favouriteButton.DrawWidth}, {lengthStatistic.DrawWidth}, {bpmStatistic.DrawWidth}", EzAnalysisPersistentStore.LOGGER_NAME); } private CancellationTokenSource? onlineDisplayCancellationSource; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 7d5fe8ef67..81f969c737 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select private ShearedDropdown groupDropdown = null!; private CollectionDropdown collectionDropdown = null!; private EzKeyModeSelector csSelector = null!; - private ShearedTriStateButton keySoundPreviewButton = null!; + private ShearedKSPreviewButton ksPreviewButton = null!; private ShearedToggleButton xxySrFilterButton = null!; private ShearedDropdown kpcDropdown = null!; @@ -173,10 +173,11 @@ namespace osu.Game.Screens.Select Text = UserInterfaceStrings.ShowConverts, Height = 30f, }, - keySoundPreviewButton = new ShearedTriStateButton + ksPreviewButton = new ShearedKSPreviewButton { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + AutoSizeAxes = Axes.X, Text = "kSound", TooltipText = EzSongSelectStrings.KEY_SOUND_PREVIEW_TOOLTIP, Height = 30f, @@ -253,6 +254,7 @@ namespace osu.Game.Screens.Select { Anchor = Anchor.Centre, Origin = Anchor.Centre, + AutoSizeAxes = Axes.X, Text = "xxy SR", TooltipText = EzSongSelectStrings.XXY_SR_FILTER_TOOLTIP, Height = 30f, @@ -280,7 +282,7 @@ namespace osu.Game.Screens.Select difficultyRangeSlider.UpperBound = config.GetBindable(OsuSetting.DisplayStarsMaximum); ezConfig.BindWith(Ez2Setting.KpcDisplayMode, kpcDropdown.Current); ezConfig.BindWith(Ez2Setting.XxySRFilter, xxySrFilterButton.Active); - ezConfig.BindWith(Ez2Setting.KeySoundPreviewMode, keySoundPreviewButton.State); + ezConfig.BindWith(Ez2Setting.KeySoundPreviewMode, ksPreviewButton.State); config.BindWith(OsuSetting.ShowConvertedBeatmaps, showConvertedBeatmapsButton.Active); config.BindWith(OsuSetting.SongSelectSortingMode, sortDropdown.Current); config.BindWith(OsuSetting.SongSelectGroupMode, groupDropdown.Current); diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 4f15a0c2a1..1b4aa72dc6 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -369,6 +369,7 @@ KDDK KKDD KPS + KS LN LR LTRB