mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #12237 from peppy/fix-retry-count
Fix retry count not updating correctly
This commit is contained in:
commit
ffc28256d0
@ -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()
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user