1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-28 10:17:19 +08:00

RankChart -> RankGraph

This commit is contained in:
Dean Herbert 2017-12-22 19:25:18 +09:00
parent 728d1cb7f6
commit 82909f6585
3 changed files with 11 additions and 19 deletions

View File

@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile
private readonly OsuTextFlowContainer infoTextLeft; private readonly OsuTextFlowContainer infoTextLeft;
private readonly LinkFlowContainer infoTextRight; private readonly LinkFlowContainer infoTextRight;
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText; private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
private readonly RankChart rankGraph; private readonly RankGraph rankGraph;
private readonly Container coverContainer, supporterTag; private readonly Container coverContainer, supporterTag;
private readonly Sprite levelBadge; private readonly Sprite levelBadge;
@ -287,7 +287,7 @@ namespace osu.Game.Overlays.Profile
Colour = Color4.Black.Opacity(0.25f), Colour = Color4.Black.Opacity(0.25f),
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
}, },
rankGraph = new RankChart rankGraph = new RankGraph
{ {
RelativeSizeAxes = Axes.Both RelativeSizeAxes = Axes.Both
} }

View File

@ -19,7 +19,7 @@ using osu.Framework.Configuration;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
{ {
public class RankChart : Container public class RankGraph : Container
{ {
private const float primary_textsize = 25; private const float primary_textsize = 25;
private const float secondary_textsize = 13; private const float secondary_textsize = 13;
@ -34,19 +34,18 @@ namespace osu.Game.Overlays.Profile
private KeyValuePair<int, int>[] ranks; private KeyValuePair<int, int>[] ranks;
public Bindable<User> User = new Bindable<User>(); public Bindable<User> User = new Bindable<User>();
public RankChart() public RankGraph()
{ {
Padding = new MarginPadding { Vertical = padding }; Padding = new MarginPadding { Vertical = padding };
Children = new Drawable[] Children = new Drawable[]
{ {
placeholder = new OsuSpriteText placeholder = new OsuSpriteText
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre, Origin = Anchor.Centre,
Text = "No recent plays", Text = "No recent plays",
TextSize = 14, TextSize = 14,
Font = @"Exo2.0-RegularItalic", Font = @"Exo2.0-RegularItalic",
Padding = new MarginPadding { Bottom = padding }
}, },
rankText = new OsuSpriteText rankText = new OsuSpriteText
{ {
@ -75,6 +74,7 @@ namespace osu.Game.Overlays.Profile
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 75,
Y = -secondary_textsize, Y = -secondary_textsize,
Alpha = 0, Alpha = 0,
} }
@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Profile
private void userChanged(User newUser) private void userChanged(User newUser)
{ {
placeholder.FadeTo(newUser == null ? 1 : 0, fade_duration, Easing.Out); placeholder.FadeIn(fade_duration, Easing.Out);
if (newUser == null) if (newUser == null)
{ {
@ -110,6 +110,8 @@ namespace osu.Game.Overlays.Profile
if (ranks.Length > 1) if (ranks.Length > 1)
{ {
placeholder.FadeOut(fade_duration, Easing.Out);
graph.DefaultValueCount = ranks.Length; graph.DefaultValueCount = ranks.Length;
graph.Values = ranks.Select(x => -(float)Math.Log(x.Value)); graph.Values = ranks.Select(x => -(float)Math.Log(x.Value));
graph.SetStaticBallPosition(); graph.SetStaticBallPosition();
@ -133,16 +135,6 @@ namespace osu.Game.Overlays.Profile
relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago"; relativeText.Text = dayIndex + 1 == ranks.Length ? "Now" : $"{ranked_days - ranks[dayIndex].Key} days ago";
} }
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
if ((invalidation & Invalidation.DrawSize) != 0)
{
graph.Height = DrawHeight - padding * 2 - primary_textsize - secondary_textsize * 2;
}
return base.Invalidate(invalidation, source, shallPropagate);
}
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
{ {
if (ranks?.Length > 1) if (ranks?.Length > 1)

View File

@ -499,7 +499,7 @@
<Compile Include="Overlays\Profile\Sections\Ranks\DrawableProfileScore.cs" /> <Compile Include="Overlays\Profile\Sections\Ranks\DrawableProfileScore.cs" />
<Compile Include="Overlays\Profile\ProfileHeader.cs" /> <Compile Include="Overlays\Profile\ProfileHeader.cs" />
<Compile Include="Overlays\Profile\ProfileSection.cs" /> <Compile Include="Overlays\Profile\ProfileSection.cs" />
<Compile Include="Overlays\Profile\RankChart.cs" /> <Compile Include="Overlays\Profile\RankGraph.cs" />
<Compile Include="Overlays\Profile\Sections\AboutSection.cs" /> <Compile Include="Overlays\Profile\Sections\AboutSection.cs" />
<Compile Include="Overlays\Profile\Sections\BeatmapsSection.cs" /> <Compile Include="Overlays\Profile\Sections\BeatmapsSection.cs" />
<Compile Include="Overlays\Profile\Sections\HistoricalSection.cs" /> <Compile Include="Overlays\Profile\Sections\HistoricalSection.cs" />