1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 16:50:21 +08:00

Track count of times gameplay was paused on ScoreInfo

This commit is contained in:
Bartłomiej Dach
2025-07-07 09:53:26 +02:00
Unverified
parent 65cc89a64d
commit f082b60c9b
4 changed files with 18 additions and 1 deletions
@@ -69,6 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay
pauseViaBackAction();
pauseViaBackAction();
confirmPausedWithNoOverlay();
AddAssert("score pause count incremented", () => Player.Score.ScoreInfo.PauseCount, () => Is.EqualTo(1));
}
[Test]
@@ -77,6 +78,7 @@ namespace osu.Game.Tests.Visual.Gameplay
pauseViaPauseGameplayAction();
pauseViaPauseGameplayAction();
confirmPausedWithNoOverlay();
AddAssert("score pause count incremented", () => Player.Score.ScoreInfo.PauseCount, () => Is.EqualTo(1));
}
[Test]
+3
View File
@@ -155,6 +155,9 @@ namespace osu.Game.Scoring
[MapTo("MaximumStatistics")]
public string MaximumStatisticsJson { get; set; } = string.Empty;
[Ignored]
public int PauseCount { get; set; }
public ScoreInfo(BeatmapInfo? beatmap = null, RulesetInfo? ruleset = null, RealmUser? realmUser = null)
{
Ruleset = ruleset ?? new RulesetInfo();
+1 -1
View File
@@ -1046,7 +1046,7 @@ namespace osu.Game.Screens.Play
// already resuming
&& !IsResuming;
public bool Pause()
public virtual bool Pause()
{
if (!pausingSupportedByCurrentState) return false;
+12
View File
@@ -234,6 +234,18 @@ namespace osu.Game.Screens.Play
spectatorClient.BeginPlaying(token, GameplayState, Score);
}
public override bool Pause()
{
bool wasPaused = GameplayClockContainer.IsPaused.Value;
bool paused = base.Pause();
if (!wasPaused && paused)
Score.ScoreInfo.PauseCount++;
return paused;
}
protected override void OnFail()
{
base.OnFail();