mirror of
https://github.com/ppy/osu
synced 2025-01-24 14:53:18 +00:00
Disable playlist start button when attempts have been exhausted
This commit is contained in:
parent
bffd9162ba
commit
1c578f285a
@ -32,11 +32,32 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
Triangles.ColourLight = colours.GreenLight;
|
||||
}
|
||||
|
||||
private bool hasRemainingAttempts = true;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
userScore.BindValueChanged(aggregate =>
|
||||
{
|
||||
if (maxAttempts.Value == null)
|
||||
return;
|
||||
|
||||
int remaining = maxAttempts.Value.Value - aggregate.NewValue.PlaylistItemAttempts.Sum(a => a.Attempts);
|
||||
|
||||
hasRemainingAttempts = remaining > 0;
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
Enabled.Value = endDate.Value != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value;
|
||||
}
|
||||
Enabled.Value = hasRemainingAttempts && enoughTimeLeft;
|
||||
}
|
||||
|
||||
private bool enoughTimeLeft =>
|
||||
// This should probably consider the length of the currently selected item, rather than a constant 30 seconds.
|
||||
endDate.Value != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user