1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 19:43:22 +08:00

Make DrawableScore abstract and move shared class to own file

This commit is contained in:
Dean Herbert 2017-10-30 19:15:19 +09:00
parent 096998d5f4
commit 069f4b1fcf
4 changed files with 35 additions and 24 deletions

View File

@ -18,14 +18,14 @@ using osu.Game.Rulesets.UI;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableScore : Container
public abstract class DrawableScore : Container
{
protected readonly FillFlowContainer<OsuSpriteText> Stats;
private readonly FillFlowContainer metadata;
private readonly ModContainer modContainer;
protected readonly Score Score;
public DrawableScore(Score score)
protected DrawableScore(Score score)
{
Score = score;
@ -136,25 +136,4 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
}
}
}
public class TotalScore : DrawableScore
{
public TotalScore(Score score)
: base(score)
{
}
[BackgroundDependencyLoader]
private new void load()
{
Stats.Add(new OsuSpriteText
{
Text = Score.TotalScore.ToString("#,###"),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
}
}
}

View File

@ -0,0 +1,31 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class DrawableTotalScore : DrawableScore
{
public DrawableTotalScore(Score score)
: base(score)
{
}
[BackgroundDependencyLoader]
private new void load()
{
Stats.Add(new OsuSpriteText
{
Text = Score.TotalScore.ToString("#,###"),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
Font = "Exo2.0-BoldItalic",
});
}
}
}

View File

@ -123,7 +123,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
missing.Hide();
foreach (OnlineScore score in scores)
{
var drawableScore = type == ScoreType.Recent ? (DrawableScore)new TotalScore(score) : new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null);
var drawableScore = type == ScoreType.Recent ? (DrawableScore)new DrawableTotalScore(score) : new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null);
drawableScore.RelativeSizeAxes = Axes.X;
drawableScore.Height = 60;
scoreContainer.Add(drawableScore);

View File

@ -296,6 +296,7 @@
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawablePerformanceScore.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\PaginatedScoreContainer.cs" />
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableTotalScore.cs" />
<Compile Include="Overlays\Settings\SettingsButton.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyColouredContainer.cs" />