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:
@@ -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]
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -1046,7 +1046,7 @@ namespace osu.Game.Screens.Play
|
||||
// already resuming
|
||||
&& !IsResuming;
|
||||
|
||||
public bool Pause()
|
||||
public virtual bool Pause()
|
||||
{
|
||||
if (!pausingSupportedByCurrentState) return false;
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user