mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
Move pp score representation to own file
This commit is contained in:
parent
fcb88de626
commit
dce7d1c910
@ -0,0 +1,49 @@
|
||||
// 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;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
{
|
||||
public class DrawablePerformanceScore : DrawableScore
|
||||
{
|
||||
private readonly double? weight;
|
||||
|
||||
public DrawablePerformanceScore(Score score, double? weight = null)
|
||||
: base(score)
|
||||
{
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private new void load(OsuColour colour)
|
||||
{
|
||||
double pp = Score.PP ?? 0;
|
||||
Stats.Add(new OsuSpriteText
|
||||
{
|
||||
Text = $"{pp:0}pp",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
TextSize = 18,
|
||||
Font = "Exo2.0-BoldItalic",
|
||||
});
|
||||
|
||||
if (weight.HasValue)
|
||||
{
|
||||
Stats.Add(new OsuSpriteText
|
||||
{
|
||||
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Colour = colour.GrayA,
|
||||
TextSize = 11,
|
||||
Font = "Exo2.0-RegularItalic",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -136,47 +136,13 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
}
|
||||
}
|
||||
}
|
||||
public class PPScore : DrawableScore
|
||||
{
|
||||
private readonly double? weight;
|
||||
|
||||
public PPScore(Score score, double? weight = null) : base(score)
|
||||
{
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private new void load(OsuColour colour)
|
||||
{
|
||||
double pp = Score.PP ?? 0;
|
||||
Stats.Add(new OsuSpriteText
|
||||
{
|
||||
Text = $"{pp:0}pp",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
TextSize = 18,
|
||||
Font = "Exo2.0-BoldItalic",
|
||||
});
|
||||
|
||||
if (weight.HasValue)
|
||||
{
|
||||
Stats.Add(new OsuSpriteText
|
||||
{
|
||||
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Colour = colour.GrayA,
|
||||
TextSize = 11,
|
||||
Font = "Exo2.0-RegularItalic",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TotalScore : DrawableScore
|
||||
{
|
||||
public TotalScore(Score score) : base(score)
|
||||
{ }
|
||||
public TotalScore(Score score)
|
||||
: base(score)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private new void load()
|
||||
|
@ -122,7 +122,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 PPScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null);
|
||||
var drawableScore = type == ScoreType.Recent ? (DrawableScore)new TotalScore(score) : new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null);
|
||||
drawableScore.RelativeSizeAxes = Axes.X;
|
||||
drawableScore.Height = 60;
|
||||
scoreContainer.Add(drawableScore);
|
||||
|
@ -294,6 +294,7 @@
|
||||
<Compile Include="Migrations\OsuDbContextModelSnapshot.cs" />
|
||||
<Compile Include="Online\API\Requests\GetBeatmapSetRequest.cs" />
|
||||
<Compile Include="Online\API\Requests\GetBeatmapSetsResponse.cs" />
|
||||
<Compile Include="Overlays\Profile\Sections\Ranks\DrawablePerformanceScore.cs" />
|
||||
<Compile Include="Overlays\Profile\Sections\Ranks\ScoreContainer.cs" />
|
||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
|
||||
@ -822,4 +823,4 @@
|
||||
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets" Condition="Exists('$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.osx.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.osx.targets')" />
|
||||
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets" Condition="Exists('$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.linux.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.linux.targets')" />
|
||||
<Import Project="$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets" Condition="Exists('$(SolutionDir)\packages\SQLitePCLRaw.lib.e_sqlite3.v110_xp.1.1.8\build\net35\SQLitePCLRaw.lib.e_sqlite3.v110_xp.targets')" />
|
||||
</Project>
|
||||
</Project>
|
Loading…
Reference in New Issue
Block a user