1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 00:37:26 +08:00
osu-lazer/osu.Game/Online/Leaderboards/UpdateableRank.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
1.9 KiB
C#
Raw Normal View History

2019-06-19 08:50:16 +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.
2024-06-07 17:04:16 +08:00
using System;
2019-06-19 08:50:16 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2024-06-07 17:04:16 +08:00
using osu.Framework.Graphics.Transforms;
2019-06-19 08:50:16 +08:00
using osu.Game.Scoring;
namespace osu.Game.Online.Leaderboards
{
public partial class UpdateableRank : ModelBackedDrawable<ScoreRank?>
2019-06-19 08:50:16 +08:00
{
2024-06-07 17:04:16 +08:00
protected override double TransformDuration => 600;
protected override bool TransformImmediately => true;
public ScoreRank? Rank
2019-06-19 08:50:16 +08:00
{
get => Model;
set => Model = value;
}
public UpdateableRank(ScoreRank? rank = null)
2019-06-19 08:50:16 +08:00
{
Rank = rank;
}
2024-06-07 17:04:16 +08:00
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
{
return base.CreateDelayedLoadWrapper(createContentFunc, timeBeforeLoad)
.With(w =>
{
w.Anchor = Anchor.Centre;
w.Origin = Anchor.Centre;
});
}
2024-06-07 16:54:12 +08:00
protected override Drawable? CreateDrawable(ScoreRank? rank)
2019-06-19 08:50:16 +08:00
{
if (rank.HasValue)
{
return new DrawableRank(rank.Value)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
};
}
return null;
}
2024-06-07 17:04:16 +08:00
protected override TransformSequence<Drawable> ApplyShowTransforms(Drawable drawable)
{
drawable.ScaleTo(1);
return base.ApplyShowTransforms(drawable);
}
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable)
{
drawable.ScaleTo(1.8f, TransformDuration, Easing.Out);
return base.ApplyHideTransforms(drawable);
}
2019-06-19 08:50:16 +08:00
}
}