mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Apply changes to the BreakTracker and more adjustment
This commit is contained in:
@ -2,20 +2,22 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Lists;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class BreakTracker : Component
|
public class BreakTracker : Component
|
||||||
{
|
{
|
||||||
private readonly ScoreProcessor scoreProcessor;
|
private readonly ScoreProcessor scoreProcessor;
|
||||||
|
|
||||||
private readonly double gameplayStartTime;
|
private readonly double gameplayStartTime;
|
||||||
|
|
||||||
|
private readonly PeriodTracker tracker = new PeriodTracker();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the gameplay is currently in a break.
|
/// Whether the gameplay is currently in a break.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,22 +25,14 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly BindableBool isBreakTime = new BindableBool();
|
private readonly BindableBool isBreakTime = new BindableBool();
|
||||||
|
|
||||||
private readonly IntervalList<double> breakIntervals = new IntervalList<double>();
|
|
||||||
|
|
||||||
public IReadOnlyList<BreakPeriod> Breaks
|
public IReadOnlyList<BreakPeriod> Breaks
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
isBreakTime.Value = false;
|
isBreakTime.Value = false;
|
||||||
breakIntervals.Clear();
|
|
||||||
|
|
||||||
foreach (var b in value)
|
tracker.Periods = value?.Where(b => b.HasEffect)
|
||||||
{
|
.Select(b => new Period(b.StartTime, b.EndTime - BreakOverlay.BREAK_FADE_DURATION));
|
||||||
if (!b.HasEffect)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
breakIntervals.Add(b.StartTime, b.EndTime - BreakOverlay.BREAK_FADE_DURATION);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +48,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
var time = Clock.CurrentTime;
|
var time = Clock.CurrentTime;
|
||||||
|
|
||||||
isBreakTime.Value = breakIntervals.IsInAnyInterval(time)
|
isBreakTime.Value = tracker.Contains(time)
|
||||||
|| time < gameplayStartTime
|
|| time < gameplayStartTime
|
||||||
|| scoreProcessor?.HasCompleted == true;
|
|| scoreProcessor?.HasCompleted == true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user