mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +08:00
Show available information in RankChart.
This commit is contained in:
parent
6967fb1105
commit
9e3935a732
@ -23,7 +23,7 @@ namespace osu.Game.Users.Profile
|
||||
private readonly OsuTextFlowContainer infoTextLeft, infoTextRight;
|
||||
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
|
||||
|
||||
private readonly Container coverContainer;
|
||||
private readonly Container coverContainer, chartContainer;
|
||||
private readonly Sprite levelBadge;
|
||||
private readonly SpriteText levelText;
|
||||
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
|
||||
@ -217,7 +217,7 @@ namespace osu.Game.Users.Profile
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
chartContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
@ -229,10 +229,6 @@ namespace osu.Game.Users.Profile
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0.25f),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new RankChart(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -327,6 +323,8 @@ namespace osu.Game.Users.Profile
|
||||
gradeS.Show();
|
||||
gradeA.Count = user.Statistics.GradesCount.A;
|
||||
gradeA.Show();
|
||||
|
||||
chartContainer.Add(new RankChart(user) { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -23,8 +22,8 @@ namespace osu.Game.Users.Profile
|
||||
private readonly SpriteText rankText, performanceText, relativeText;
|
||||
private readonly RankChartLineGraph graph;
|
||||
|
||||
private int[] ranks, performances;
|
||||
private int rank, performance, countryRank;
|
||||
private int[] ranks;
|
||||
private decimal?[] performances;
|
||||
|
||||
private const float primary_textsize = 25, secondary_textsize = 13, padding = 10;
|
||||
|
||||
@ -33,6 +32,7 @@ namespace osu.Game.Users.Profile
|
||||
public RankChart(User user)
|
||||
{
|
||||
this.user = user;
|
||||
|
||||
Padding = new MarginPadding { Vertical = padding };
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -69,20 +69,22 @@ namespace osu.Game.Users.Profile
|
||||
BallMove = showHistoryRankTexts
|
||||
}
|
||||
};
|
||||
ranks = new[] { user.Statistics.Rank };
|
||||
performances = new decimal?[] { user.Statistics.PP };
|
||||
}
|
||||
|
||||
private void updateRankTexts()
|
||||
{
|
||||
rankText.Text = $"#{rank:#,#}";
|
||||
performanceText.Text = $"{performance:#,#}pp";
|
||||
relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,#}";
|
||||
rankText.Text = user.Statistics.Rank > 0 ? $"#{user.Statistics.Rank:#,0}" : "no rank";
|
||||
performanceText.Text = user.Statistics.PP != null ? $"{user.Statistics.PP:#,0}pp" : string.Empty;
|
||||
//relativeText.Text = $"{user.Country?.FullName} #{countryRank:#,0}";
|
||||
}
|
||||
|
||||
private void showHistoryRankTexts(int dayIndex)
|
||||
{
|
||||
rankText.Text = $"#{ranks[dayIndex]:#,#}";
|
||||
performanceText.Text = $"{performances[dayIndex]:#,#}pp";
|
||||
relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago";
|
||||
rankText.Text = ranks[dayIndex] > 0 ? $"#{ranks[dayIndex]:#,0}" : "no rank";
|
||||
performanceText.Text = performances[dayIndex] != null ? $"{performances[dayIndex]:#,0}pp" : string.Empty;
|
||||
//relativeText.Text = dayIndex == ranks.Length ? "Now" : $"{ranks.Length - dayIndex} days ago";
|
||||
//plural should be handled in a general way
|
||||
}
|
||||
|
||||
@ -90,20 +92,10 @@ namespace osu.Game.Users.Profile
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
graph.Colour = colours.Yellow;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
System.Threading.Thread.Sleep(1000);
|
||||
|
||||
// put placeholder data here to show the transform
|
||||
rank = 12345;
|
||||
countryRank = 678;
|
||||
performance = 4567;
|
||||
ranks = Enumerable.Range(1234, 80).ToArray();
|
||||
performances = ranks.Select(x => 6000 - x).ToArray();
|
||||
// use logarithmic coordinates
|
||||
graph.Values = ranks.Select(x => -(float)Math.Log(x));
|
||||
graph.ResetBall();
|
||||
});
|
||||
// use logarithmic coordinates
|
||||
graph.Values = ranks.Select(x => -(float)Math.Log(x));
|
||||
graph.ResetBall();
|
||||
}
|
||||
|
||||
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
|
||||
|
Loading…
Reference in New Issue
Block a user