mirror of
https://github.com/ppy/osu.git
synced 2026-05-21 15:50:38 +08:00
Store pause timestamps (rounded to ms) instead of general count
This commit is contained in:
@@ -13,6 +13,7 @@ using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO.Legacy;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Replays;
|
||||
@@ -321,7 +322,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
CountryCode = CountryCode.PL
|
||||
};
|
||||
scoreInfo.ClientVersion = "2023.1221.0";
|
||||
scoreInfo.PauseCount = 3;
|
||||
scoreInfo.Pauses.AddRange([111111, 222222, 333333]);
|
||||
|
||||
var beatmap = new TestBeatmap(ruleset);
|
||||
var score = new Score
|
||||
@@ -346,7 +347,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(decodedAfterEncode.ScoreInfo.Mods, Is.EqualTo(scoreInfo.Mods));
|
||||
Assert.That(decodedAfterEncode.ScoreInfo.ClientVersion, Is.EqualTo("2023.1221.0"));
|
||||
Assert.That(decodedAfterEncode.ScoreInfo.RealmUser.OnlineID, Is.EqualTo(3035836));
|
||||
Assert.That(decodedAfterEncode.ScoreInfo.PauseCount, Is.EqualTo(3));
|
||||
Assert.That(decodedAfterEncode.ScoreInfo.Pauses, Is.EquivalentTo(new[] { 111111, 222222, 333333 }));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
pauseViaBackAction();
|
||||
pauseViaBackAction();
|
||||
confirmPausedWithNoOverlay();
|
||||
AddAssert("score pause count incremented", () => Player.Score.ScoreInfo.PauseCount, () => Is.EqualTo(1));
|
||||
AddAssert("pause recorded", () => Player.Score.ScoreInfo.Pauses, () => Has.Length.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
pauseViaPauseGameplayAction();
|
||||
pauseViaPauseGameplayAction();
|
||||
confirmPausedWithNoOverlay();
|
||||
AddAssert("score pause count incremented", () => Player.Score.ScoreInfo.PauseCount, () => Is.EqualTo(1));
|
||||
AddAssert("pause recorded", () => Player.Score.ScoreInfo.Pauses, () => Has.Length.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -87,8 +87,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty("legacy_score_id")]
|
||||
public ulong? LegacyScoreId { get; set; }
|
||||
|
||||
[JsonProperty("pause_count")]
|
||||
public int PauseCount { get; set; }
|
||||
[JsonProperty("pauses")]
|
||||
public int[] Pauses { get; set; } = [];
|
||||
|
||||
#region osu-web API additions (not stored to database).
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Mods = score.APIMods,
|
||||
Statistics = score.Statistics.Where(kvp => kvp.Value != 0).ToDictionary(),
|
||||
MaximumStatistics = score.MaximumStatistics.Where(kvp => kvp.Value != 0).ToDictionary(),
|
||||
PauseCount = score.PauseCount,
|
||||
Pauses = score.Pauses.ToArray(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace osu.Game.Scoring.Legacy
|
||||
[JsonProperty("total_score_without_mods")]
|
||||
public long? TotalScoreWithoutMods { get; set; }
|
||||
|
||||
[JsonProperty("pause_count")]
|
||||
public int PauseCount { get; set; }
|
||||
[JsonProperty("pauses")]
|
||||
public int[] Pauses { get; set; } = [];
|
||||
|
||||
public static LegacyReplaySoloScoreInfo FromScore(ScoreInfo score) => new LegacyReplaySoloScoreInfo
|
||||
{
|
||||
@@ -62,7 +62,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
Rank = score.Rank,
|
||||
UserID = score.User.OnlineID,
|
||||
TotalScoreWithoutMods = score.TotalScoreWithoutMods > 0 ? score.TotalScoreWithoutMods : null,
|
||||
PauseCount = score.PauseCount,
|
||||
Pauses = score.Pauses.ToArray(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.IO.Legacy;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Replays;
|
||||
@@ -143,7 +144,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
else
|
||||
PopulateTotalScoreWithoutMods(score.ScoreInfo);
|
||||
|
||||
score.ScoreInfo.PauseCount = readScore.PauseCount;
|
||||
score.ScoreInfo.Pauses.AddRange(readScore.Pauses);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace osu.Game.Scoring
|
||||
[MapTo("MaximumStatistics")]
|
||||
public string MaximumStatisticsJson { get; set; } = string.Empty;
|
||||
|
||||
public int PauseCount { get; set; }
|
||||
public IList<int> Pauses { get; } = null!;
|
||||
|
||||
public ScoreInfo(BeatmapInfo? beatmap = null, RulesetInfo? ruleset = null, RealmUser? realmUser = null)
|
||||
{
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace osu.Game.Screens.Play
|
||||
bool paused = base.Pause();
|
||||
|
||||
if (!wasPaused && paused)
|
||||
Score.ScoreInfo.PauseCount++;
|
||||
Score.ScoreInfo.Pauses.Add((int)Math.Round(GameplayClockContainer.CurrentTime));
|
||||
|
||||
return paused;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user