mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 12:15:34 +08:00
Colourise hit result statistics
This commit is contained in:
parent
5f09c70f75
commit
66558ca8c5
@ -5,7 +5,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
@ -62,7 +61,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
|
||||
var bottomStatistics = new List<StatisticDisplay>();
|
||||
foreach (var stat in score.SortedStatistics)
|
||||
bottomStatistics.Add(new CounterStatistic(stat.Key.GetDescription(), stat.Value));
|
||||
bottomStatistics.Add(new HitResultStatistic(stat.Key, stat.Value));
|
||||
|
||||
statisticDisplays.AddRange(topStatistics);
|
||||
statisticDisplays.AddRange(bottomStatistics);
|
||||
|
@ -0,0 +1,27 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
{
|
||||
public class HitResultStatistic : CounterStatistic
|
||||
{
|
||||
private readonly HitResult result;
|
||||
|
||||
public HitResultStatistic(HitResult result, int count)
|
||||
: base(result.GetDescription(), count)
|
||||
{
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
HeaderText.Colour = colours.ForHitResult(result);
|
||||
}
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
@ -16,8 +17,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
/// </summary>
|
||||
public abstract class StatisticDisplay : CompositeDrawable
|
||||
{
|
||||
private readonly string header;
|
||||
protected SpriteText HeaderText { get; private set; }
|
||||
|
||||
private readonly string header;
|
||||
private Drawable content;
|
||||
|
||||
/// <summary>
|
||||
@ -53,7 +55,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#222")
|
||||
},
|
||||
new OsuSpriteText
|
||||
HeaderText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
Loading…
Reference in New Issue
Block a user