Only show global rankings on results screen when progressing from gameplay

This commit is contained in:
Bartłomiej Dach
2022-12-26 23:25:54 +01:00
parent 2470991aaa
commit 01cf96e240
2 changed files with 23 additions and 5 deletions

View File

@ -1159,7 +1159,10 @@ namespace osu.Game.Screens.Play
/// </summary>
/// <param name="score">The <see cref="ScoreInfo"/> to be displayed in the results screen.</param>
/// <returns>The <see cref="ResultsScreen"/>.</returns>
protected virtual ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score, true);
protected virtual ResultsScreen CreateResults(ScoreInfo score) => new SoloResultsScreen(score, true)
{
ShowUserStatistics = true
};
private void fadeOut(bool instant = false)
{

View File

@ -20,6 +20,12 @@ namespace osu.Game.Screens.Ranking
{
public partial class SoloResultsScreen : ResultsScreen
{
/// <summary>
/// Whether the user's personal statistics should be shown on the extended statistics panel
/// after clicking the score panel associated with the <see cref="ResultsScreen.Score"/> being presented.
/// </summary>
public bool ShowUserStatistics { get; init; }
private GetScoresRequest getScoreRequest;
[Resolved]
@ -39,13 +45,22 @@ namespace osu.Game.Screens.Ranking
{
base.LoadComplete();
soloStatisticsWatcher.RegisterForStatisticsUpdateAfter(Score, update => statisticsUpdate.Value = update);
if (ShowUserStatistics)
soloStatisticsWatcher.RegisterForStatisticsUpdateAfter(Score, update => statisticsUpdate.Value = update);
}
protected override StatisticsPanel CreateStatisticsPanel() => new SoloStatisticsPanel(Score)
protected override StatisticsPanel CreateStatisticsPanel()
{
StatisticsUpdate = { BindTarget = statisticsUpdate }
};
if (ShowUserStatistics)
{
return new SoloStatisticsPanel(Score)
{
StatisticsUpdate = { BindTarget = statisticsUpdate }
};
}
return base.CreateStatisticsPanel();
}
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
{