mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 00:42:55 +08:00
Add to more places
This commit is contained in:
parent
ec2674e1ea
commit
c1838902a6
@ -9,16 +9,20 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class RollingCounter<T> : Container
|
||||
public abstract class RollingCounter<T> : Container, IHasCurrentValue<T>
|
||||
where T : struct, IEquatable<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The current value.
|
||||
/// </summary>
|
||||
public Bindable<T> Current = new Bindable<T>();
|
||||
private readonly BindableWithCurrent<T> current = new BindableWithCurrent<T>();
|
||||
|
||||
public Bindable<T> Current
|
||||
{
|
||||
get => current.Current;
|
||||
set => current.Current = value;
|
||||
}
|
||||
|
||||
private SpriteText displayedCountSpriteText;
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
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;
|
||||
@ -38,6 +39,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
private readonly FillFlowContainer<InfoColumn> statisticsColumns;
|
||||
private readonly ModsInfoColumn modsColumn;
|
||||
|
||||
[Resolved]
|
||||
private ScoreManager scoreManager { get; set; }
|
||||
|
||||
public TopScoreStatisticsSection()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -87,6 +91,15 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (score != null)
|
||||
totalScoreColumn.Current = scoreManager.GetTotalScoreString(score);
|
||||
}
|
||||
|
||||
private ScoreInfo score;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the score to be displayed.
|
||||
/// </summary>
|
||||
@ -94,7 +107,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
set
|
||||
{
|
||||
totalScoreColumn.Text = $@"{value.TotalScore:N0}";
|
||||
if (score == value)
|
||||
return;
|
||||
|
||||
score = value;
|
||||
|
||||
accuracyColumn.Text = value.DisplayAccuracy;
|
||||
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
||||
ppColumn.Alpha = value.Beatmap?.Status == BeatmapSetOnlineStatus.Ranked ? 1 : 0;
|
||||
@ -102,6 +119,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
statisticsColumns.ChildrenEnumerable = value.SortedStatistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
||||
modsColumn.Mods = value.Mods;
|
||||
|
||||
if (IsLoaded)
|
||||
totalScoreColumn.Current = scoreManager.GetTotalScoreString(value);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,6 +210,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
set => text.Text = value;
|
||||
}
|
||||
|
||||
public Bindable<string> Current
|
||||
{
|
||||
get => text.Current;
|
||||
set => text.Current = value;
|
||||
}
|
||||
}
|
||||
|
||||
private class ModsInfoColumn : InfoColumn
|
||||
|
@ -30,6 +30,9 @@ namespace osu.Game.Screens.Ranking.Contracted
|
||||
{
|
||||
private readonly ScoreInfo score;
|
||||
|
||||
[Resolved]
|
||||
private ScoreManager scoreManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ContractedPanelMiddleContent"/>.
|
||||
/// </summary>
|
||||
@ -160,7 +163,7 @@ namespace osu.Game.Screens.Ranking.Contracted
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = score.TotalScore.ToString("N0"),
|
||||
Current = scoreManager.GetTotalScoreString(score),
|
||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, fixedWidth: true),
|
||||
Spacing = new Vector2(-1, 0)
|
||||
},
|
||||
|
@ -25,15 +25,16 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
/// </summary>
|
||||
public class ExpandedPanelMiddleContent : CompositeDrawable
|
||||
{
|
||||
private readonly ScoreInfo score;
|
||||
private const float padding = 10;
|
||||
|
||||
private readonly ScoreInfo score;
|
||||
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
|
||||
|
||||
private FillFlowContainer starAndModDisplay;
|
||||
|
||||
private RollingCounter<long> scoreCounter;
|
||||
|
||||
private const float padding = 10;
|
||||
[Resolved]
|
||||
private ScoreManager scoreManager { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
||||
@ -238,7 +239,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
using (BeginDelayedSequence(AccuracyCircle.ACCURACY_TRANSFORM_DELAY, true))
|
||||
{
|
||||
scoreCounter.FadeIn();
|
||||
scoreCounter.Current.Value = score.TotalScore;
|
||||
scoreCounter.Current = scoreManager.GetTotalScore(score);
|
||||
|
||||
double delay = 0;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user