1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 06:52:55 +08:00

Merge branch 'master' into realm-key-binding-store

This commit is contained in:
Dean Herbert 2021-03-31 15:00:47 +09:00
commit 710599c521
3 changed files with 27 additions and 4 deletions

View File

@ -43,6 +43,29 @@ namespace osu.Game.Tests.Visual.Navigation
exitViaEscapeAndConfirm(); exitViaEscapeAndConfirm();
} }
[Test]
public void TestRetryCountIncrements()
{
Player player = null;
PushAndConfirm(() => new TestSongSelect());
AddStep("import beatmap", () => ImportBeatmapTest.LoadQuickOszIntoOsu(Game).Wait());
AddUntilStep("wait for selected", () => !Game.Beatmap.IsDefault);
AddStep("press enter", () => InputManager.Key(Key.Enter));
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
AddAssert("retry count is 0", () => player.RestartCount == 0);
AddStep("attempt to retry", () => player.ChildrenOfType<HotkeyRetryOverlay>().First().Action());
AddUntilStep("wait for old player gone", () => Game.ScreenStack.CurrentScreen != player);
AddUntilStep("get new player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
AddAssert("retry count is 1", () => player.RestartCount == 1);
}
[Test] [Test]
public void TestRetryFromResults() public void TestRetryFromResults()
{ {

View File

@ -309,10 +309,8 @@ namespace osu.Game.Screens.Play
if (!this.IsCurrentScreen()) if (!this.IsCurrentScreen())
return; return;
var restartCount = player?.RestartCount + 1 ?? 0;
player = createPlayer(); player = createPlayer();
player.RestartCount = restartCount; player.RestartCount = restartCount++;
player.RestartRequested = restartRequested; player.RestartRequested = restartRequested;
LoadTask = LoadComponentAsync(player, _ => MetadataInfo.Loading = false); LoadTask = LoadComponentAsync(player, _ => MetadataInfo.Loading = false);
@ -428,6 +426,8 @@ namespace osu.Game.Screens.Play
private Bindable<bool> muteWarningShownOnce; private Bindable<bool> muteWarningShownOnce;
private int restartCount;
private void showMuteWarningIfNeeded() private void showMuteWarningIfNeeded()
{ {
if (!muteWarningShownOnce.Value) if (!muteWarningShownOnce.Value)

View File

@ -45,7 +45,7 @@ namespace osu.Game.Users
public double Accuracy; public double Accuracy;
[JsonIgnore] [JsonIgnore]
public string DisplayAccuracy => Accuracy.FormatAccuracy(); public string DisplayAccuracy => (Accuracy / 100).FormatAccuracy();
[JsonProperty(@"play_count")] [JsonProperty(@"play_count")]
public int PlayCount; public int PlayCount;