mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 10:33:22 +08:00
Merge e920cfa187
into ce8e4120b7
This commit is contained in:
commit
1325a51d9f
@ -2,6 +2,7 @@
|
|||||||
// 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;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -10,7 +11,9 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.OnlinePlay.Components;
|
using osu.Game.Screens.OnlinePlay.Components;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Playlists
|
namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||||
{
|
{
|
||||||
@ -19,6 +22,9 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> gameBeatmap { get; set; } = null!;
|
private IBindable<WorkingBeatmap> gameBeatmap { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; } = null!;
|
||||||
|
|
||||||
private readonly Room room;
|
private readonly Room room;
|
||||||
|
|
||||||
public PlaylistsReadyButton(Room room)
|
public PlaylistsReadyButton(Room room)
|
||||||
@ -63,14 +69,14 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
Enabled.Value = hasRemainingAttempts && enoughTimeLeft;
|
Enabled.Value = hasRemainingAttempts && enoughTimeLeft();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LocalisableString TooltipText
|
public override LocalisableString TooltipText
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!enoughTimeLeft)
|
if (!enoughTimeLeft())
|
||||||
return "No time left!";
|
return "No time left!";
|
||||||
|
|
||||||
if (!hasRemainingAttempts)
|
if (!hasRemainingAttempts)
|
||||||
@ -80,9 +86,17 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool enoughTimeLeft =>
|
private bool enoughTimeLeft()
|
||||||
// This should probably consider the length of the currently selected item, rather than a constant 30 seconds.
|
{
|
||||||
room.EndDate != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < room.EndDate;
|
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
||||||
|
|
||||||
|
// We want to avoid users not being able to submit scores if they chose to not skip,
|
||||||
|
// so track length is chosen over playable length.
|
||||||
|
double trackLength = Math.Round(gameBeatmap.Value.Track.Length / rate);
|
||||||
|
|
||||||
|
// Additional 30 second delay added to account for load and/or submit time.
|
||||||
|
return room.EndDate != null && DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(trackLength) < room.EndDate;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
|
@ -401,7 +401,6 @@ namespace osu.Game.Screens.Select
|
|||||||
if (beatmap == null || bpmLabelContainer == null)
|
if (beatmap == null || bpmLabelContainer == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// this doesn't consider mods which apply variable rates, yet.
|
|
||||||
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
double rate = ModUtils.CalculateRateWithMods(mods.Value);
|
||||||
|
|
||||||
int bpmMax = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMaximum, rate);
|
int bpmMax = FormatUtils.RoundBPM(beatmap.ControlPointInfo.BPMMaximum, rate);
|
||||||
|
@ -286,6 +286,7 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
double rate = 1;
|
double rate = 1;
|
||||||
|
|
||||||
|
// TODO: This doesn't consider mods which apply variable rates, yet.
|
||||||
foreach (var mod in mods.OfType<IApplicableToRate>())
|
foreach (var mod in mods.OfType<IApplicableToRate>())
|
||||||
rate = mod.ApplyToRate(0, rate);
|
rate = mod.ApplyToRate(0, rate);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user