mirror of
https://github.com/ppy/osu.git
synced 2024-11-16 09:17:48 +08:00
87 lines
3.0 KiB
C#
87 lines
3.0 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Bindables;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Game.Graphics.UserInterface;
|
|
using osu.Game.Online.Solo;
|
|
using osu.Game.Scoring;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Screens.Ranking.Statistics.User
|
|
{
|
|
public partial class OverallRanking : CompositeDrawable
|
|
{
|
|
private const float transition_duration = 300;
|
|
|
|
private readonly ScoreInfo score;
|
|
|
|
public Bindable<SoloStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<SoloStatisticsUpdate?>();
|
|
|
|
private LoadingLayer loadingLayer = null!;
|
|
private FillFlowContainer content = null!;
|
|
|
|
public OverallRanking(ScoreInfo score)
|
|
{
|
|
this.score = score;
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load()
|
|
{
|
|
AutoSizeAxes = Axes.Y;
|
|
AutoSizeEasing = Easing.OutQuint;
|
|
AutoSizeDuration = transition_duration;
|
|
|
|
InternalChildren = new Drawable[]
|
|
{
|
|
loadingLayer = new LoadingLayer(withBox: false)
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
},
|
|
content = new FillFlowContainer
|
|
{
|
|
AlwaysPresent = true,
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
Direction = FillDirection.Vertical,
|
|
Spacing = new Vector2(10),
|
|
Children = new Drawable[]
|
|
{
|
|
new GlobalRankChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
new AccuracyChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
new MaximumComboChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
new RankedScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
new TotalScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
new PerformancePointsChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } }
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
protected override void LoadComplete()
|
|
{
|
|
base.LoadComplete();
|
|
|
|
StatisticsUpdate.BindValueChanged(onUpdateReceived, true);
|
|
FinishTransforms(true);
|
|
}
|
|
|
|
private void onUpdateReceived(ValueChangedEvent<SoloStatisticsUpdate?> update)
|
|
{
|
|
if (update.NewValue == null)
|
|
{
|
|
loadingLayer.Show();
|
|
content.FadeOut(transition_duration, Easing.OutQuint);
|
|
}
|
|
else
|
|
{
|
|
loadingLayer.Hide();
|
|
content.FadeIn(transition_duration, Easing.OutQuint);
|
|
}
|
|
}
|
|
}
|
|
}
|