主要为代码质量更新

1. 匹配新版按钮控件的自动宽度写法

2. 统一Ez日志写入方向

3.移除历史修改:缓存启用mod列表,切换mod时保持通用mod开启状态

4.代码格式化、

5.修改文件名称表意,更直观
This commit is contained in:
LA
2026-03-07 00:07:44 +08:00
parent 67543806dc
commit 0b9f9f70d6
27 changed files with 132 additions and 145 deletions

View File

@@ -128,26 +128,7 @@ namespace osu.Game.Rulesets.Mania.LAsEzMania.Mods.LAsMods
public void ApplyToBeatmap(IBeatmap beatmap) public void ApplyToBeatmap(IBeatmap beatmap)
{ {
applyToBeatmapInternal((ManiaBeatmap)beatmap, null); applyToBeatmapInternal((ManiaBeatmap)beatmap);
}
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);
} }
private static List<PatternShiftChord> buildChords(List<PatternShiftNote> notes) private static List<PatternShiftChord> buildChords(List<PatternShiftNote> 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(); Seed.Value ??= RNG.Next();
var rng = new Random(Seed.Value.Value); var rng = new Random(Seed.Value.Value);

View File

@@ -19,6 +19,7 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select; 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)); string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym));
Logger.Error(ex, 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; return null;

View File

@@ -7,6 +7,7 @@ using System.Threading;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@@ -109,7 +110,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
// 如果克隆失败,则回退到使用原始实例。 // 如果克隆失败,则回退到使用原始实例。
// 这对缓存来说并不理想,但比完全破坏分析要好。 // 这对缓存来说并不理想,但比完全破坏分析要好。
if (Interlocked.Increment(ref modSnapshotFailCount) <= 10) 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); list.Add(mod);
} }

View File

@@ -14,6 +14,7 @@ using Microsoft.Data.Sqlite;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions.Analysis namespace osu.Game.LAsEzExtensions.Analysis
{ {
@@ -37,7 +38,6 @@ namespace osu.Game.LAsEzExtensions.Analysis
/// </summary> /// </summary>
public static bool Enabled = true; 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"; 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). // forcing a full recompute (when changes are only schema/serialization related).
tryClonePreviousDatabaseIfMissing(); tryClonePreviousDatabaseIfMissing();
Logger.Log($"EzManiaAnalysisPersistentStore path: {dbPath}", LOGGER_NAME, LogLevel.Important); Logger.Log($"EzManiaAnalysisPersistentStore path: {dbPath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important);
using var connection = openConnection(); using var connection = openConnection();
@@ -275,7 +275,7 @@ LIMIT 1;
if (!string.Equals(storedHash, beatmap.Hash, StringComparison.Ordinal)) 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; return false;
} }
@@ -284,7 +284,7 @@ LIMIT 1;
// - If stored md5 is present, require it to match. // - If stored md5 is present, require it to match.
if (!string.IsNullOrEmpty(storedMd5) && !string.Equals(storedMd5, beatmap.MD5Hash, StringComparison.Ordinal)) 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; return false;
} }
@@ -329,7 +329,7 @@ LIMIT 1;
// Validate the analysis result to ensure it's reasonable // Validate the analysis result to ensure it's reasonable
if (!isValidAnalysisResult(result)) 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; return false;
} }
@@ -339,7 +339,7 @@ LIMIT 1;
} }
catch (Exception e) catch (Exception e)
{ {
Logger.Error(e, "EzManiaAnalysisPersistentStore TryGet failed.", LOGGER_NAME); Logger.Error(e, "EzManiaAnalysisPersistentStore TryGet failed.", Ez2ConfigManager.LOGGER_NAME);
return false; return false;
} }
} }
@@ -362,7 +362,7 @@ LIMIT 1;
// Validate the analysis result before storing // Validate the analysis result before storing
if (!isValidAnalysisResult(analysis)) 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; return;
} }
@@ -387,7 +387,7 @@ LIMIT 1;
// 对比两个结果是否有差异 // 对比两个结果是否有差异
if (hasDifference(storedAnalysis, analysis)) 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); Store(beatmap, analysis);
} }
} }
@@ -508,7 +508,7 @@ LIMIT 1;
// Validate the analysis result before storing // Validate the analysis result before storing
if (!isValidAnalysisResult(analysis)) 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; return;
} }
@@ -707,13 +707,12 @@ ON CONFLICT(key) DO UPDATE SET value = excluded.value;
try try
{ {
File.Copy(bestCandidate, dbPath); File.Copy(bestCandidate, dbPath);
Logger.Log($"[EzManiaAnalysisPersistentStore] Cloned DB from v{bestVersion} to v{ANALYSIS_VERSION}: {Path.GetFileName(bestCandidate)} -> {Path.GetFileName(dbPath)}", Logger.Log($"[EzManiaAnalysisPersistentStore] Cloned DB from v{bestVersion} to v{ANALYSIS_VERSION}: {Path.GetFileName(bestCandidate)} -> {Path.GetFileName(dbPath)}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Important);
LoggingTarget.Database);
} }
catch (Exception e) catch (Exception e)
{ {
// If cloning fails, we simply fall back to creating a fresh DB and recomputing as needed. // 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; 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); rebuildTableWithoutUnrecognizedColumns(connection, unrecognizedColumns);
} }

View File

@@ -11,6 +11,7 @@ using osu.Framework.Graphics;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using osu.Game.Performance; using osu.Game.Performance;
@@ -72,13 +73,13 @@ namespace osu.Game.LAsEzExtensions.Analysis
{ {
if (!EzAnalysisPersistentStore.Enabled) 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; return;
} }
List<(Guid id, string hash)> beatmaps = new List<(Guid id, string hash)>(); 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 => 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}", 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) if (maniaTotal == 0)
{ {
string dist = string.Join(", ", rulesetDistribution.OrderByDescending(kvp => kvp.Value).Take(10).Select(kvp => $"{kvp.Key}={kvp.Value}")); 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) 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; 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"); 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) 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; ++failedCount;
} }
@@ -242,7 +243,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
{ {
if (notificationOverlay == null) 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; return null;
} }
@@ -261,7 +262,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
try try
{ {
notificationOverlay?.Post(notification); 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) catch (Exception e)
{ {

View File

@@ -15,6 +15,7 @@ using osu.Framework.Threading;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; 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)); string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym));
Logger.Log( Logger.Log(
$"xxy_SR aborted: playableBeatmap has 0 hitobjects. beatmapId={lookup.BeatmapInfo.ID} diff=\"{lookup.BeatmapInfo.DifficultyName}\" ruleset={lookup.Ruleset.ShortName} mods={mods}", $"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; return null;
} }
@@ -153,7 +154,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
// Defensive: avoid propagating invalid values to UI. // Defensive: avoid propagating invalid values to UI.
if (double.IsNaN(sr) || double.IsInfinity(sr)) 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); LogLevel.Error);
return null; 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)); string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym));
Logger.Log( 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}", $"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; return sr;
@@ -178,7 +179,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
// 只记录异常:用于排查“值偏差非常大/计算失败导致空 pill”。 // 只记录异常:用于排查“值偏差非常大/计算失败导致空 pill”。
string mods = lookup.OrderedMods.Length == 0 ? "(none)" : string.Join(',', lookup.OrderedMods.Select(m => m.Acronym)); 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}", 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; return null;
} }
} }

View File

@@ -5,6 +5,7 @@ using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading; using System.Threading;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions.Analysis 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 " + $"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 " + $"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}", $"cache={cacheSize}/{cacheLimit} evict={evict} inflight(H/L)={highInflight}/{lowInflight}",
EzAnalysisPersistentStore.LOGGER_NAME, Ez2ConfigManager.LOGGER_NAME,
LogLevel.Important); LogLevel.Important);
} }
} }

View File

@@ -6,6 +6,7 @@ using System.Reflection;
using System.Threading; using System.Threading;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions.Analysis namespace osu.Game.LAsEzExtensions.Analysis
{ {
@@ -56,7 +57,7 @@ namespace osu.Game.LAsEzExtensions.Analysis
catch (Exception ex) catch (Exception ex)
{ {
if (Interlocked.Increment(ref invokeFailCount) <= 10) 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) catch (Exception ex)
{ {
if (Interlocked.Exchange(ref resolveFailLogged, 1) == 0) 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; return null;
} }

View File

@@ -7,6 +7,7 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions.Analysis namespace osu.Game.LAsEzExtensions.Analysis
{ {
@@ -98,14 +99,14 @@ namespace osu.Game.LAsEzExtensions.Analysis
{ {
Logger.Log( Logger.Log(
FormatAbnormalSr(beatmap, "xxySR_null", null, xxySr), FormatAbnormalSr(beatmap, "xxySR_null", null, xxySr),
EzAnalysisPersistentStore.LOGGER_NAME, Ez2ConfigManager.LOGGER_NAME,
LogLevel.Error); LogLevel.Error);
} }
else if (Math.Abs(star.Value - xxySr.Value) > 3) else if (Math.Abs(star.Value - xxySr.Value) > 3)
{ {
Logger.Log( Logger.Log(
FormatAbnormalSr(beatmap, "xxySR_large_diff", star, xxySr), FormatAbnormalSr(beatmap, "xxySR_large_diff", star, xxySr),
EzAnalysisPersistentStore.LOGGER_NAME, Ez2ConfigManager.LOGGER_NAME,
LogLevel.Error); LogLevel.Error);
} }
} }

View File

@@ -437,8 +437,8 @@ namespace osu.Game.LAsEzExtensions.Audio
sampleScheduler.NextHitSoundIndex = findNextValidIndex(sampleScheduler.ScheduledHitSounds, 0, physicalTime - trigger_tolerance); sampleScheduler.NextHitSoundIndex = findNextValidIndex(sampleScheduler.ScheduledHitSounds, 0, physicalTime - trigger_tolerance);
sampleScheduler.NextStoryboardSampleIndex = findNextValidIndex(sampleScheduler.ScheduledStoryboardSamples, 0, physicalTime - trigger_tolerance); sampleScheduler.NextStoryboardSampleIndex = findNextValidIndex(sampleScheduler.ScheduledStoryboardSamples, 0, physicalTime - trigger_tolerance);
// 清理已停止的活动通道 // 清理已停止的活动通道并归还资源
sampleScheduler.ActiveChannels.RemoveAll(c => !c.Playing); cleanupInactiveChannels();
} }
double logicalTime = physicalTime; double logicalTime = physicalTime;
@@ -520,10 +520,33 @@ namespace osu.Game.LAsEzExtensions.Audio
else break; else break;
} }
sampleScheduler.ActiveChannels.RemoveAll(c => !c.Playing); cleanupInactiveChannels();
playback.LastTrackTime = logicalTimeForEvents; 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) private void triggerHitSound(HitSampleInfo[] samples)
{ {
if (samples.Length == 0) return; if (samples.Length == 0) return;

View File

@@ -7,6 +7,7 @@ using osu.Framework.Audio.EzLatency;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
@@ -139,18 +140,14 @@ namespace osu.Game.LAsEzExtensions.Audio
if (!stats.HasData) 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; return;
} }
// 输出统计日志 // 输出统计日志
string message1 = 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)";
$"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)";
Logger.Log($"[EzOsuLatency] Latency Analysis: {message1}"); Logger.Log($"[EzOsuLatency] Latency Analysis: {message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
Logger.Log($"[EzOsuLatency] Latency Analysis: \n{message2}", LoggingTarget.Runtime, LogLevel.Important);
// 显示通知 // 显示通知
notificationOverlay?.Post(new SimpleNotification 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})" + 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})"; $" | 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) 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);
} }
} }
} }

View File

@@ -18,6 +18,7 @@ namespace osu.Game.LAsEzExtensions.Configuration
{ {
public class Ez2ConfigManager : IniConfigManager<Ez2Setting>, IGameplaySettings public class Ez2ConfigManager : IniConfigManager<Ez2Setting>, IGameplaySettings
{ {
public static readonly string LOGGER_NAME = "ez_runtime";
protected override string Filename => "EzSkinSettings.ini"; protected override string Filename => "EzSkinSettings.ini";
private readonly int[] commonKeyModes = { 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18 }; private readonly int[] commonKeyModes = { 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 18 };
public float DefaultHitPosition = 180f; public float DefaultHitPosition = 180f;

View File

@@ -4,6 +4,8 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions namespace osu.Game.LAsEzExtensions
{ {
@@ -29,8 +31,7 @@ namespace osu.Game.LAsEzExtensions
try try
{ {
string currentNoteSetName = noteSetName.Value; string currentNoteSetName = noteSetName.Value;
Logger.Log($"[EzLocalTextureFactory] Starting preload for note set: {currentNoteSetName}", Logger.Log($"[EzLocalTextureFactory] Starting preload for note set: {currentNoteSetName}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
foreach (string component in preload_components) foreach (string component in preload_components)
preloadComponent(component, currentNoteSetName); preloadComponent(component, currentNoteSetName);
@@ -38,16 +39,12 @@ namespace osu.Game.LAsEzExtensions
await Task.CompletedTask.ConfigureAwait(false); await Task.CompletedTask.ConfigureAwait(false);
preloadCompleted = true; preloadCompleted = true;
Logger.Log($"[EzLocalTextureFactory] Preload completed for {preload_components.Length} components", Logger.Log($"[EzLocalTextureFactory] Preload completed for {preload_components.Length} components", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug); Logger.Log($"[EzLocalTextureFactory] Cache stats after preload: {global_cache.Count} frame sets", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
Logger.Log($"[EzLocalTextureFactory] Cache stats after preload: {global_cache.Count} frame sets",
LoggingTarget.Runtime, LogLevel.Debug);
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Log($"[EzLocalTextureFactory] Preload failed: {ex.Message}", Logger.Log($"[EzLocalTextureFactory] Preload failed: {ex.Message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error);
LoggingTarget.Runtime, LogLevel.Error);
} }
finally finally
{ {
@@ -73,8 +70,7 @@ namespace osu.Game.LAsEzExtensions
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Log($"[EzLocalTextureFactory] Failed to preload {component}: {ex.Message}", Logger.Log($"[EzLocalTextureFactory] Failed to preload {component}: {ex.Message}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Error);
LoggingTarget.Runtime, LogLevel.Error);
} }
} }

View File

@@ -15,6 +15,7 @@ using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
@@ -281,8 +282,7 @@ namespace osu.Game.LAsEzExtensions
else else
{ {
string frameFile = $"{basePath}.png"; string frameFile = $"{basePath}.png";
Logger.Log($"[EzLocalTextureFactory] Loading JudgementLine Frame: {frameFile}", Logger.Log($"[EzLocalTextureFactory] Loading JudgementLine Frame: {frameFile}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
var texture = textureStore.Get(frameFile); var texture = textureStore.Get(frameFile);
frames.Add(texture); frames.Add(texture);
@@ -353,8 +353,7 @@ namespace osu.Game.LAsEzExtensions
if (texture == null) break; if (texture == null) break;
Logger.Log($"[EzLocalTextureFactory] Added Stage Frames: {basePath}_{i}.png", Logger.Log($"[EzLocalTextureFactory] Added Stage Frames: {basePath}_{i}.png", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
frames.Add(texture); frames.Add(texture);
} }
@@ -365,8 +364,7 @@ namespace osu.Game.LAsEzExtensions
if (texture != null) if (texture != null)
{ {
Logger.Log($"[EzLocalTextureFactory] Added Stage Frame: {basePath}", Logger.Log($"[EzLocalTextureFactory] Added Stage Frame: {basePath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
frames.Add(texture); frames.Add(texture);
} }
} }
@@ -418,8 +416,7 @@ namespace osu.Game.LAsEzExtensions
if (texture == null) break; if (texture == null) break;
Logger.Log($"[EzLocalTextureFactory] Added Keys Frames: {basePath}_{i}", Logger.Log($"[EzLocalTextureFactory] Added Keys Frames: {basePath}_{i}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
frames.Add(texture); frames.Add(texture);
} }
@@ -431,8 +428,7 @@ namespace osu.Game.LAsEzExtensions
if (texture != null) if (texture != null)
{ {
Logger.Log($"[EzLocalTextureFactory] Added Keys Frame: {basePath}", Logger.Log($"[EzLocalTextureFactory] Added Keys Frame: {basePath}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
frames.Add(texture); frames.Add(texture);
} }
} }
@@ -465,9 +461,6 @@ namespace osu.Game.LAsEzExtensions
if (frames.Count > 0) 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); var newEntry = new CacheEntry(frames, true);
global_cache.TryAdd(cacheKey, newEntry); global_cache.TryAdd(cacheKey, newEntry);
} }
@@ -482,8 +475,7 @@ namespace osu.Game.LAsEzExtensions
if (count1 > 0) if (count1 > 0)
{ {
Logger.Log($"[EzLocalTextureFactory] Clearing note_ratio_cache ({count1})", Logger.Log($"[EzLocalTextureFactory] Clearing note_ratio_cache ({count1})", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
note_ratio_cache.Clear(); note_ratio_cache.Clear();
} }
@@ -492,8 +484,7 @@ namespace osu.Game.LAsEzExtensions
if (count2 > 0) if (count2 > 0)
{ {
Logger.Log($"[EzLocalTextureFactory] Clearing global_cache ({count2})", Logger.Log($"[EzLocalTextureFactory] Clearing global_cache ({count2})", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
LoggingTarget.Runtime, LogLevel.Debug);
global_cache.Clear(); global_cache.Clear();
} }
} }

View File

@@ -13,6 +13,7 @@ using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
@@ -123,7 +124,7 @@ namespace osu.Game.LAsEzExtensions.Statistics
double accuracy = v1ScoreProcessor.AccuracyClassic.Value; double accuracy = v1ScoreProcessor.AccuracyClassic.Value;
long totalScore = v1ScoreProcessor.TotalScore.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 // Set properties instead of returning
V1Accuracy = accuracy; V1Accuracy = accuracy;
@@ -173,7 +174,7 @@ namespace osu.Game.LAsEzExtensions.Statistics
double accuracy = v2ScoreProcessor.Accuracy.Value; double accuracy = v2ScoreProcessor.Accuracy.Value;
long totalScore = v2ScoreProcessor.TotalScore.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 // Set properties instead of returning
V2Accuracy = accuracy; V2Accuracy = accuracy;

View File

@@ -78,12 +78,14 @@ namespace osu.Game.LAsEzExtensions.UserInterface
{ {
new Drawable[] new Drawable[]
{ {
labelButton = new ShearedButton(50, 30) labelButton = new ShearedButton()
{ {
Text = "Keys", Text = "Keys",
TextSize = 16, TextSize = 16,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
Height = 30f,
Shear = new Vector2(0), Shear = new Vector2(0),
TooltipText = EzSongSelectStrings.CLEAR_SELECTION, TooltipText = EzSongSelectStrings.CLEAR_SELECTION,
}, },

View File

@@ -9,19 +9,14 @@ using osu.Game.LAsEzExtensions.Configuration;
namespace osu.Game.LAsEzExtensions.UserInterface namespace osu.Game.LAsEzExtensions.UserInterface
{ {
public partial class ShearedTriStateButton : ShearedButton public partial class ShearedKSPreviewButton : ShearedButton
{ {
public Bindable<KeySoundPreviewMode> State = new Bindable<KeySoundPreviewMode>(); public Bindable<KeySoundPreviewMode> State = new Bindable<KeySoundPreviewMode>();
public ShearedTriStateButton(float? width = null)
: base(width)
{
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
Action = () => State.Value = (KeySoundPreviewMode)(((int)State.Value + 1) % 3); 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); State.BindValueChanged(_ => UpdateState(), true);
base.LoadComplete(); base.LoadComplete();

View File

@@ -4,6 +4,7 @@
using System; using System;
using osu.Framework.IO.Stores; using osu.Framework.IO.Stores;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.LAsEzExtensions.Online; 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)) 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 #endif

View File

@@ -115,7 +115,7 @@ namespace osu.Game
if (Ez2ConfigManager != null) if (Ez2ConfigManager != null)
{ {
var serverPreset = Ez2ConfigManager.Get<ServerPreset>(Ez2Setting.ServerPreset); var serverPreset = Ez2ConfigManager.Get<ServerPreset>(Ez2Setting.ServerPreset);
Logger.Log($"[Ez] Using server preset: {serverPreset}"); Logger.Log($"[EzServer] Using server preset: {serverPreset}", Ez2ConfigManager.LOGGER_NAME, LogLevel.Debug);
return serverPreset switch 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(); return UseDevelopmentServer ? new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration();

View File

@@ -166,8 +166,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
private IBindable<double> offsetBindable; private IBindable<double> offsetBindable;
// cached config for autoplay behaviour [Resolved(CanBeNull = true)]
private Ez2ConfigManager ezConfig; private Ez2ConfigManager ezConfig { get; set; }
private ScheduledDelegate autoplayDelegate; private ScheduledDelegate autoplayDelegate;
/// <summary> /// <summary>
@@ -211,7 +212,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IGameplaySettings gameplaySettings, ISkinSource skinSource, Ez2ConfigManager ezConfig) private void load(IGameplaySettings gameplaySettings, ISkinSource skinSource)
{ {
positionalHitsoundsLevel.BindTo(gameplaySettings.PositionalHitsoundsLevel); positionalHitsoundsLevel.BindTo(gameplaySettings.PositionalHitsoundsLevel);
comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount); comboColourBrightness.BindTo(gameplaySettings.ComboColourNormalisationAmount);
@@ -225,9 +226,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
CurrentSkin = skinSource; CurrentSkin = skinSource;
CurrentSkin.SourceChanged += skinSourceChanged; 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. // Choose the appropriate offset bindable once during load to avoid runtime reflection/namespace checks.
if (ezConfig != null && drawableRuleset != null) if (ezConfig != null && drawableRuleset != null)
{ {
@@ -341,7 +339,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
UpdateComboColour(); UpdateComboColour();
} }
// Schedule one-shot autoplay of this object's samples when configured to do so. // 自动触发音效
try try
{ {
bool isAutoPlayPlus = autoPlaySnapshot?.IsAutoPlayPlus ?? (ezConfig != null && ezConfig.Get<KeySoundPreviewMode>(Ez2Setting.KeySoundPreviewMode) == KeySoundPreviewMode.AutoPlayPlus); bool isAutoPlayPlus = autoPlaySnapshot?.IsAutoPlayPlus ?? (ezConfig != null && ezConfig.Get<KeySoundPreviewMode>(Ez2Setting.KeySoundPreviewMode) == KeySoundPreviewMode.AutoPlayPlus);
@@ -370,7 +368,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
} }
catch catch
{ {
// be defensive; don't let scheduling failures affect hitobject application
} }
} }

View File

@@ -43,8 +43,6 @@ namespace osu.Game.Rulesets
private static readonly ConcurrentDictionary<string, IMod[]> mod_reference_cache = new ConcurrentDictionary<string, IMod[]>(); private static readonly ConcurrentDictionary<string, IMod[]> mod_reference_cache = new ConcurrentDictionary<string, IMod[]>();
private Mod[]? cachedAllMods;
/// <summary> /// <summary>
/// Version history: /// Version history:
/// 2022.205.0 FramedReplayInputHandler.CollectPendingInputs renamed to FramedReplayHandler.CollectReplayInputs. /// 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) /// This comes with considerable allocation overhead. If only accessing for reference purposes (ie. not changing bindables / settings)
/// use <see cref="AllMods"/> instead. /// use <see cref="AllMods"/> instead.
/// </remarks> /// </remarks>
public IEnumerable<Mod> CreateAllMods() public IEnumerable<Mod> CreateAllMods() => Enum.GetValues<ModType>()
{ // Confine all mods of each mod type into a single IEnumerable<Mod>
if (cachedAllMods != null) .SelectMany(GetModsFor)
return cachedAllMods; // 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.
return cachedAllMods = Enum.GetValues<ModType>() // ReSharper disable once ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract
// Confine all mods of each mod type into a single IEnumerable<Mod> .Where(mod => mod != null)
.SelectMany(GetModsFor) // Resolve MultiMods as their .Mods property
// Filter out all null mods .SelectMany(mod => (mod as MultiMod)?.Mods ?? new[] { mod });
// 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();
}
/// <summary> /// <summary>
/// Returns a fresh instance of the mod matching the specified acronym. /// Returns a fresh instance of the mod matching the specified acronym.

View File

@@ -1318,8 +1318,7 @@ namespace osu.Game.Screens.Edit
yield return new EditorMenuItem(EditorStrings.OpenInfoPage, MenuItemType.Standard, yield return new EditorMenuItem(EditorStrings.OpenInfoPage, MenuItemType.Standard,
() => (Game as OsuGame)?.OpenUrlExternally(editorBeatmap.BeatmapInfo.GetOnlineURL(api, editorBeatmap.BeatmapInfo.Ruleset))); () => (Game as OsuGame)?.OpenUrlExternally(editorBeatmap.BeatmapInfo.GetOnlineURL(api, editorBeatmap.BeatmapInfo.Ruleset)));
yield return new EditorMenuItem(EditorStrings.OpenDiscussionPage, MenuItemType.Standard, yield return new EditorMenuItem(EditorStrings.OpenDiscussionPage, MenuItemType.Standard,
() => (Game as OsuGame)?.OpenUrlExternally( () => (Game as OsuGame)?.OpenUrlExternally($@"{api.Endpoints.WebsiteUrl}/beatmapsets/{editorBeatmap.BeatmapInfo.BeatmapSet!.OnlineID}/discussion/{editorBeatmap.BeatmapInfo.OnlineID}"));
$@"{api.Endpoints.WebsiteUrl}/beatmapsets/{editorBeatmap.BeatmapInfo.BeatmapSet!.OnlineID}/discussion/{editorBeatmap.BeatmapInfo.OnlineID}"));
} }
yield return new OsuMenuItemSpacer(); yield return new OsuMenuItemSpacer();

View File

@@ -15,6 +15,7 @@ using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Database; using osu.Game.Database;
using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Audio; using osu.Game.LAsEzExtensions.Audio;
using osu.Game.LAsEzExtensions.Configuration; using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.Online; using osu.Game.Online;
@@ -336,7 +337,8 @@ namespace osu.Game.Screens.Play
if (Ruleset.Value.OnlineID == 3 && (hitMode != EzEnumHitMode.Lazer || !hasDefaultCutoffValues)) 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; return Task.CompletedTask;
} }
@@ -346,13 +348,13 @@ namespace osu.Game.Screens.Play
if (Ruleset.Value.OnlineID == 3 && !offsetManiaBindable.IsDefault) 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; return Task.CompletedTask;
} }
if (Ruleset.Value.OnlineID != 3 && !offsetNonStdBindable.IsDefault) 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; return Task.CompletedTask;
} }

View File

@@ -9,6 +9,7 @@ using System.Threading;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.LAsEzExtensions.Analysis; using osu.Game.LAsEzExtensions.Analysis;
using osu.Game.LAsEzExtensions.Configuration;
using osu.Game.LAsEzExtensions.Statistics; using osu.Game.LAsEzExtensions.Statistics;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
@@ -89,7 +90,7 @@ namespace osu.Game.Screens.Ranking.Statistics
} }
catch (Exception ex) 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; 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; return null;
} }
} }

View File

@@ -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; float availableWidth = DrawWidth - playCount.DrawWidth - favouriteButton.DrawWidth - lengthStatistic.DrawWidth - bpmStatistic.DrawWidth - statisticsFlow.Spacing.X * 3 - SongSelect.WEDGE_CONTENT_MARGIN * 2;
kpsGraph.Width = availableWidth; 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; private CancellationTokenSource? onlineDisplayCancellationSource;

View File

@@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select
private ShearedDropdown<GroupMode> groupDropdown = null!; private ShearedDropdown<GroupMode> groupDropdown = null!;
private CollectionDropdown collectionDropdown = null!; private CollectionDropdown collectionDropdown = null!;
private EzKeyModeSelector csSelector = null!; private EzKeyModeSelector csSelector = null!;
private ShearedTriStateButton keySoundPreviewButton = null!; private ShearedKSPreviewButton ksPreviewButton = null!;
private ShearedToggleButton xxySrFilterButton = null!; private ShearedToggleButton xxySrFilterButton = null!;
private ShearedDropdown<KpcDisplayMode> kpcDropdown = null!; private ShearedDropdown<KpcDisplayMode> kpcDropdown = null!;
@@ -173,10 +173,11 @@ namespace osu.Game.Screens.Select
Text = UserInterfaceStrings.ShowConverts, Text = UserInterfaceStrings.ShowConverts,
Height = 30f, Height = 30f,
}, },
keySoundPreviewButton = new ShearedTriStateButton ksPreviewButton = new ShearedKSPreviewButton
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.X,
Text = "kSound", Text = "kSound",
TooltipText = EzSongSelectStrings.KEY_SOUND_PREVIEW_TOOLTIP, TooltipText = EzSongSelectStrings.KEY_SOUND_PREVIEW_TOOLTIP,
Height = 30f, Height = 30f,
@@ -253,6 +254,7 @@ namespace osu.Game.Screens.Select
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
AutoSizeAxes = Axes.X,
Text = "xxy SR", Text = "xxy SR",
TooltipText = EzSongSelectStrings.XXY_SR_FILTER_TOOLTIP, TooltipText = EzSongSelectStrings.XXY_SR_FILTER_TOOLTIP,
Height = 30f, Height = 30f,
@@ -280,7 +282,7 @@ namespace osu.Game.Screens.Select
difficultyRangeSlider.UpperBound = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum); difficultyRangeSlider.UpperBound = config.GetBindable<double>(OsuSetting.DisplayStarsMaximum);
ezConfig.BindWith(Ez2Setting.KpcDisplayMode, kpcDropdown.Current); ezConfig.BindWith(Ez2Setting.KpcDisplayMode, kpcDropdown.Current);
ezConfig.BindWith(Ez2Setting.XxySRFilter, xxySrFilterButton.Active); 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.ShowConvertedBeatmaps, showConvertedBeatmapsButton.Active);
config.BindWith(OsuSetting.SongSelectSortingMode, sortDropdown.Current); config.BindWith(OsuSetting.SongSelectSortingMode, sortDropdown.Current);
config.BindWith(OsuSetting.SongSelectGroupMode, groupDropdown.Current); config.BindWith(OsuSetting.SongSelectGroupMode, groupDropdown.Current);

View File

@@ -369,6 +369,7 @@
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KDDK/@EntryIndexedValue">KDDK</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KDDK/@EntryIndexedValue">KDDK</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KKDD/@EntryIndexedValue">KKDD</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KKDD/@EntryIndexedValue">KKDD</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KPS/@EntryIndexedValue">KPS</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KPS/@EntryIndexedValue">KPS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=KS/@EntryIndexedValue">KS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LN/@EntryIndexedValue">LN</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LN/@EntryIndexedValue">LN</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LR/@EntryIndexedValue">LR</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LR/@EntryIndexedValue">LR</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String> <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=LTRB/@EntryIndexedValue">LTRB</s:String>