Add bindable boolean for break times

This commit is contained in:
iiSaLMaN 2019-07-25 11:07:53 +03:00
parent ae66a7e9e4
commit 7b82d184bd

View File

@ -2,7 +2,9 @@
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@ -35,6 +37,11 @@ namespace osu.Game.Screens.Play
public override bool RemoveCompletedTransforms => false;
/// <summary>
/// Whether we are currently in the break time range.
/// </summary>
public readonly BindableBool IsBreakTime = new BindableBool();
private readonly Container remainingTimeAdjustmentBox;
private readonly Container remainingTimeBox;
private readonly RemainingTimeCounter remainingTimeCounter;
@ -109,6 +116,13 @@ namespace osu.Game.Screens.Play
initializeBreaks();
}
protected override void Update()
{
base.Update();
IsBreakTime.Value = breaks.Where(b => b.HasEffect).Any(b => Clock.CurrentTime >= b.StartTime && Clock.CurrentTime <= b.EndTime);
}
private void initializeBreaks()
{
if (!IsLoaded) return; // we need a clock.