From 99c77d0239dc69077b4e58762c3640544b90c499 Mon Sep 17 00:00:00 2001 From: MATRIX-feather Date: Tue, 27 Feb 2024 21:52:46 +0800 Subject: [PATCH] =?UTF-8?q?misc:=20=E5=B0=9D=E8=AF=95=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E6=AD=8C=E6=9B=B2=E6=97=B6=E7=89=A9=E4=BB=B6?= =?UTF-8?q?=E5=88=86=E5=B8=83=E8=A1=A8=E9=97=AA=E7=83=81=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Feature/Gosumemory/Tracker/BeatmapStrainTracker.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Gosumemory/Tracker/BeatmapStrainTracker.cs b/osu.Game.Rulesets.IGPlayer/Feature/Gosumemory/Tracker/BeatmapStrainTracker.cs index 42bc188..6e2d1f4 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Gosumemory/Tracker/BeatmapStrainTracker.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Gosumemory/Tracker/BeatmapStrainTracker.cs @@ -62,7 +62,7 @@ public void UpdateStrain(WorkingBeatmap workingBeatmap) ppStrainCancellationTokenSource?.Cancel(); ppStrainCancellationTokenSource = new CancellationTokenSource(); - Task.Run(async () => await updateStrain(workingBeatmap), ppStrainCancellationTokenSource.Token) + Task.Run(async () => await updateStrain(workingBeatmap, Hub.GetDataRoot().MenuValues.PP.Strains), ppStrainCancellationTokenSource.Token) .ContinueWith(task => { if (!task.IsCompleted) return; @@ -84,8 +84,10 @@ public void UpdateStrain(WorkingBeatmap workingBeatmap) [Resolved] private Bindable globalRuleset { get; set; } = null!; - private Task updateStrain(WorkingBeatmap workingBeatmap) + private Task updateStrain(WorkingBeatmap workingBeatmap, float[]? defaultVal = null) { + defaultVal ??= new[] { 0f }; + try { double length = workingBeatmap.Track.Length; @@ -97,14 +99,12 @@ private Task updateStrain(WorkingBeatmap workingBeatmap) //todo: 没有音频的时候使用谱面长度来计算并更新分布和进度 if (Clock.CurrentTime - invokeTime >= 10 * 1000) { - Hub.GetDataRoot().MenuValues.PP.Strains = new[] { 0f }; - Logging.Log("谱面音频在10秒内都没有加载,将放弃计算物件分布...", level: LogLevel.Important); return Task.FromResult(new[] { 0f }); } scheduleStrainComputes = true; - return Task.FromResult(new [] { 0f }); + return Task.FromResult(defaultVal); } scheduleStrainComputes = false;