2022-12-23 21:27:22 +08:00
|
|
|
// 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;
|
2024-02-29 06:13:31 +08:00
|
|
|
using osu.Game.Online;
|
2022-12-23 21:27:22 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Statistics.User
|
|
|
|
{
|
|
|
|
public partial class OverallRanking : CompositeDrawable
|
|
|
|
{
|
|
|
|
private const float transition_duration = 300;
|
|
|
|
|
2024-02-23 02:50:46 +08:00
|
|
|
public Bindable<UserStatisticsUpdate?> StatisticsUpdate { get; } = new Bindable<UserStatisticsUpdate?>();
|
2022-12-23 21:27:22 +08:00
|
|
|
|
|
|
|
private LoadingLayer loadingLayer = null!;
|
2023-07-13 00:58:38 +08:00
|
|
|
private GridContainer content = null!;
|
2022-12-23 21:27:22 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
AutoSizeEasing = Easing.OutQuint;
|
|
|
|
AutoSizeDuration = transition_duration;
|
|
|
|
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
loadingLayer = new LoadingLayer(withBox: false)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
2023-07-13 00:58:38 +08:00
|
|
|
content = new GridContainer
|
2022-12-23 21:27:22 +08:00
|
|
|
{
|
|
|
|
AlwaysPresent = true,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2023-07-13 00:58:38 +08:00
|
|
|
ColumnDimensions = new[]
|
2022-12-23 21:27:22 +08:00
|
|
|
{
|
2023-07-13 00:58:38 +08:00
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 30),
|
|
|
|
new Dimension(),
|
|
|
|
},
|
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 10),
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 10),
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new GlobalRankChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
new SimpleStatisticTable.Spacer(),
|
|
|
|
new PerformancePointsChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
},
|
|
|
|
new Drawable[] { },
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new MaximumComboChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
new SimpleStatisticTable.Spacer(),
|
|
|
|
new AccuracyChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
},
|
|
|
|
new Drawable[] { },
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
new RankedScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
new SimpleStatisticTable.Spacer(),
|
|
|
|
new TotalScoreChangeRow { StatisticsUpdate = { BindTarget = StatisticsUpdate } },
|
|
|
|
}
|
2022-12-23 21:27:22 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2022-12-24 17:27:28 +08:00
|
|
|
StatisticsUpdate.BindValueChanged(onUpdateReceived, true);
|
2022-12-23 21:27:22 +08:00
|
|
|
FinishTransforms(true);
|
|
|
|
}
|
|
|
|
|
2024-02-23 02:50:46 +08:00
|
|
|
private void onUpdateReceived(ValueChangedEvent<UserStatisticsUpdate?> update)
|
2022-12-23 21:27:22 +08:00
|
|
|
{
|
|
|
|
if (update.NewValue == null)
|
|
|
|
{
|
|
|
|
loadingLayer.Show();
|
|
|
|
content.FadeOut(transition_duration, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
loadingLayer.Hide();
|
|
|
|
content.FadeIn(transition_duration, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|