-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29616 from peppy/break-overlay-animation
Add beat-synced animation to break overlay
- Loading branch information
Showing
5 changed files
with
107 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable disable | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Framework.Bindables; | ||
|
@@ -18,7 +16,7 @@ public partial class BreakTracker : Component | |
private readonly ScoreProcessor scoreProcessor; | ||
private readonly double gameplayStartTime; | ||
|
||
private PeriodTracker breaks; | ||
private PeriodTracker breaks = new PeriodTracker(Enumerable.Empty<Period>()); | ||
|
||
/// <summary> | ||
/// Whether the gameplay is currently in a break. | ||
|
@@ -27,6 +25,8 @@ public partial class BreakTracker : Component | |
|
||
private readonly BindableBool isBreakTime = new BindableBool(true); | ||
|
||
public readonly Bindable<Period?> CurrentPeriod = new Bindable<Period?>(); | ||
|
||
public IReadOnlyList<BreakPeriod> Breaks | ||
{ | ||
set | ||
|
@@ -39,7 +39,7 @@ public IReadOnlyList<BreakPeriod> Breaks | |
} | ||
} | ||
|
||
public BreakTracker(double gameplayStartTime = 0, ScoreProcessor scoreProcessor = null) | ||
public BreakTracker(double gameplayStartTime, ScoreProcessor scoreProcessor) | ||
{ | ||
this.gameplayStartTime = gameplayStartTime; | ||
this.scoreProcessor = scoreProcessor; | ||
|
@@ -55,9 +55,16 @@ private void updateBreakTime() | |
{ | ||
double time = Clock.CurrentTime; | ||
|
||
isBreakTime.Value = breaks?.IsInAny(time) == true | ||
|| time < gameplayStartTime | ||
|| scoreProcessor?.HasCompleted.Value == true; | ||
if (breaks.IsInAny(time, out var currentBreak)) | ||
{ | ||
CurrentPeriod.Value = currentBreak; | ||
isBreakTime.Value = true; | ||
} | ||
else | ||
{ | ||
CurrentPeriod.Value = null; | ||
isBreakTime.Value = time < gameplayStartTime || scoreProcessor.HasCompleted.Value; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters