From 82909f6585eb372a91e37d3479d448300e7f217d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Dec 2017 19:25:18 +0900 Subject: [PATCH] RankChart -> RankGraph --- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- .../Profile/{RankChart.cs => RankGraph.cs} | 24 +++++++------------ osu.Game/osu.Game.csproj | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) rename osu.Game/Overlays/Profile/{RankChart.cs => RankGraph.cs} (88%) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 509e05329b..a706799664 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Profile private readonly OsuTextFlowContainer infoTextLeft; private readonly LinkFlowContainer infoTextRight; private readonly FillFlowContainer scoreText, scoreNumberText; - private readonly RankChart rankGraph; + private readonly RankGraph rankGraph; private readonly Container coverContainer, supporterTag; private readonly Sprite levelBadge; @@ -287,7 +287,7 @@ namespace osu.Game.Overlays.Profile Colour = Color4.Black.Opacity(0.25f), RelativeSizeAxes = Axes.Both }, - rankGraph = new RankChart + rankGraph = new RankGraph { RelativeSizeAxes = Axes.Both } diff --git a/osu.Game/Overlays/Profile/RankChart.cs b/osu.Game/Overlays/Profile/RankGraph.cs similarity index 88% rename from osu.Game/Overlays/Profile/RankChart.cs rename to osu.Game/Overlays/Profile/RankGraph.cs index 73030acadd..b5933d6fec 100644 --- a/osu.Game/Overlays/Profile/RankChart.cs +++ b/osu.Game/Overlays/Profile/RankGraph.cs @@ -19,7 +19,7 @@ using osu.Framework.Configuration; namespace osu.Game.Overlays.Profile { - public class RankChart : Container + public class RankGraph : Container { private const float primary_textsize = 25; private const float secondary_textsize = 13; @@ -34,19 +34,18 @@ namespace osu.Game.Overlays.Profile private KeyValuePair[] ranks; public Bindable User = new Bindable(); - public RankChart() + public RankGraph() { Padding = new MarginPadding { Vertical = padding }; Children = new Drawable[] { placeholder = new OsuSpriteText { - Anchor = Anchor.BottomCentre, - Origin = Anchor.BottomCentre, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, Text = "No recent plays", TextSize = 14, Font = @"Exo2.0-RegularItalic", - Padding = new MarginPadding { Bottom = padding } }, rankText = new OsuSpriteText { @@ -75,6 +74,7 @@ namespace osu.Game.Overlays.Profile Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, + Height = 75, Y = -secondary_textsize, Alpha = 0, } @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Profile private void userChanged(User newUser) { - placeholder.FadeTo(newUser == null ? 1 : 0, fade_duration, Easing.Out); + placeholder.FadeIn(fade_duration, Easing.Out); if (newUser == null) { @@ -110,6 +110,8 @@ namespace osu.Game.Overlays.Profile if (ranks.Length > 1) { + placeholder.FadeOut(fade_duration, Easing.Out); + graph.DefaultValueCount = ranks.Length; graph.Values = ranks.Select(x => -(float)Math.Log(x.Value)); 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"; } - 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) { if (ranks?.Length > 1) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 199d51a8c1..1004d9dc95 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -499,7 +499,7 @@ - +