mirror of
https://github.com/ppy/osu.git
synced 2025-02-07 05:33:09 +08:00
Merge pull request #30905 from peppy/fix-multiple-offset-applications
Clear previous `LastLocalUserScore` when returning to song select
This commit is contained in:
commit
077719903b
@ -354,6 +354,23 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddAssert("retry count is 1", () => player.RestartCount == 1);
|
AddAssert("retry count is 1", () => player.RestartCount == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestLastScoreNullAfterExitingPlayer()
|
||||||
|
{
|
||||||
|
AddUntilStep("wait for last play null", getLastPlay, () => Is.Null);
|
||||||
|
|
||||||
|
var getOriginalPlayer = playToCompletion();
|
||||||
|
|
||||||
|
AddStep("attempt to retry", () => getOriginalPlayer().ChildrenOfType<HotkeyRetryOverlay>().First().Action());
|
||||||
|
AddUntilStep("wait for last play matches player", getLastPlay, () => Is.EqualTo(getOriginalPlayer().Score.ScoreInfo));
|
||||||
|
|
||||||
|
AddUntilStep("wait for player", () => Game.ScreenStack.CurrentScreen != getOriginalPlayer() && Game.ScreenStack.CurrentScreen is Player);
|
||||||
|
AddStep("exit player", () => (Game.ScreenStack.CurrentScreen as Player)?.Exit());
|
||||||
|
AddUntilStep("wait for last play null", getLastPlay, () => Is.Null);
|
||||||
|
|
||||||
|
ScoreInfo getLastPlay() => Game.Dependencies.Get<SessionStatics>().Get<ScoreInfo>(Static.LastLocalUserScore);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRetryImmediatelyAfterCompletion()
|
public void TestRetryImmediatelyAfterCompletion()
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Online.API.Requests.Responses;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
{
|
{
|
||||||
@ -77,7 +78,8 @@ namespace osu.Game.Configuration
|
|||||||
TouchInputActive,
|
TouchInputActive,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the local user's last score (can be completed or aborted).
|
/// Contains the local user's last score (can be completed or aborted) after exiting <see cref="Player"/>.
|
||||||
|
/// Will be cleared to <c>null</c> when leaving <see cref="PlayerLoader"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
LastLocalUserScore,
|
LastLocalUserScore,
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ using osu.Game.Localisation;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Performance;
|
using osu.Game.Performance;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -78,6 +79,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private FillFlowContainer disclaimers = null!;
|
private FillFlowContainer disclaimers = null!;
|
||||||
private OsuScrollContainer settingsScroll = null!;
|
private OsuScrollContainer settingsScroll = null!;
|
||||||
|
|
||||||
|
private Bindable<ScoreInfo?> lastScore = null!;
|
||||||
|
|
||||||
private Bindable<bool> showStoryboards = null!;
|
private Bindable<bool> showStoryboards = null!;
|
||||||
|
|
||||||
private bool backgroundBrightnessReduction;
|
private bool backgroundBrightnessReduction;
|
||||||
@ -179,6 +182,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
||||||
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
||||||
|
lastScore = sessionStatics.GetBindable<ScoreInfo?>(Static.LastLocalUserScore);
|
||||||
|
|
||||||
showStoryboards = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboards = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
|
||||||
const float padding = 25;
|
const float padding = 25;
|
||||||
@ -347,6 +352,8 @@ namespace osu.Game.Screens.Play
|
|||||||
highPerformanceSession?.Dispose();
|
highPerformanceSession?.Dispose();
|
||||||
highPerformanceSession = null;
|
highPerformanceSession = null;
|
||||||
|
|
||||||
|
lastScore.Value = null;
|
||||||
|
|
||||||
return base.OnExiting(e);
|
return base.OnExiting(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user