mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 04:13:03 +08:00
Add overall ranking display to solo results
This commit is contained in:
parent
3abdf557ea
commit
da519acb20
@ -7,11 +7,14 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.Solo;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Ranking
|
namespace osu.Game.Screens.Ranking
|
||||||
{
|
{
|
||||||
@ -22,11 +25,28 @@ namespace osu.Game.Screens.Ranking
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SoloStatisticsWatcher soloStatisticsWatcher { get; set; }
|
||||||
|
|
||||||
|
private readonly Bindable<SoloStatisticsUpdate> statisticsUpdate = new Bindable<SoloStatisticsUpdate>();
|
||||||
|
|
||||||
public SoloResultsScreen(ScoreInfo score, bool allowRetry)
|
public SoloResultsScreen(ScoreInfo score, bool allowRetry)
|
||||||
: base(score, allowRetry)
|
: base(score, allowRetry)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
soloStatisticsWatcher.RegisterForStatisticsUpdateAfter(Score, update => statisticsUpdate.Value = update);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override StatisticsPanel CreateStatisticsPanel() => new SoloStatisticsPanel(Score)
|
||||||
|
{
|
||||||
|
StatisticsUpdate = { BindTarget = statisticsUpdate }
|
||||||
|
};
|
||||||
|
|
||||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||||
{
|
{
|
||||||
if (Score.BeatmapInfo.OnlineID <= 0 || Score.BeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
|
if (Score.BeatmapInfo.OnlineID <= 0 || Score.BeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
|
||||||
|
51
osu.Game/Screens/Ranking/Statistics/SoloStatisticsPanel.cs
Normal file
51
osu.Game/Screens/Ranking/Statistics/SoloStatisticsPanel.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.Solo;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Ranking.Statistics.User;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Ranking.Statistics
|
||||||
|
{
|
||||||
|
public partial class SoloStatisticsPanel : StatisticsPanel
|
||||||
|
{
|
||||||
|
private readonly ScoreInfo achievedScore;
|
||||||
|
|
||||||
|
public SoloStatisticsPanel(ScoreInfo achievedScore)
|
||||||
|
{
|
||||||
|
this.achievedScore = achievedScore;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bindable<SoloStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
|
||||||
|
|
||||||
|
protected override ICollection<StatisticRow> CreateStatisticRows(ScoreInfo newScore, IBeatmap playableBeatmap)
|
||||||
|
{
|
||||||
|
var rows = base.CreateStatisticRows(newScore, playableBeatmap);
|
||||||
|
|
||||||
|
if (newScore.UserID == achievedScore.UserID && newScore.OnlineID == achievedScore.OnlineID)
|
||||||
|
{
|
||||||
|
rows = rows.Append(new StatisticRow
|
||||||
|
{
|
||||||
|
Columns = new[]
|
||||||
|
{
|
||||||
|
new StatisticItem("Overall Ranking", () => new OverallRanking
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Width = 0.5f,
|
||||||
|
StatisticsUpdate = { BindTarget = StatisticsUpdate }
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}).ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user