osu/osu.Game/Beatmaps/Drawables/UpdateableOnlineBeatmapSetCover.cs

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

63 lines
1.8 KiB
C#
Raw Normal View History

// 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.
2018-05-28 22:11:26 +00:00
2022-06-17 07:37:17 +00:00
#nullable disable
using System;
2018-05-28 22:11:26 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
2018-05-28 22:11:26 +00:00
namespace osu.Game.Beatmaps.Drawables
{
public partial class UpdateableOnlineBeatmapSetCover : ModelBackedDrawable<IBeatmapSetOnlineInfo>
2018-05-28 22:11:26 +00:00
{
private readonly BeatmapSetCoverType coverType;
2019-02-28 04:31:40 +00:00
public IBeatmapSetOnlineInfo OnlineInfo
2018-05-28 22:11:26 +00:00
{
get => Model;
set => Model = value;
2018-05-28 22:11:26 +00:00
}
public new bool Masking
2018-05-28 22:11:26 +00:00
{
get => base.Masking;
set => base.Masking = value;
2018-05-28 22:11:26 +00:00
}
public UpdateableOnlineBeatmapSetCover(BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover)
2018-05-28 22:11:26 +00:00
{
this.coverType = coverType;
InternalChild = new Box
2018-05-28 22:11:26 +00:00
{
RelativeSizeAxes = Axes.Both,
2020-02-16 20:42:05 +00:00
Colour = OsuColour.Gray(0.2f),
2018-05-28 22:11:26 +00:00
};
}
protected override double LoadDelay => 500;
protected override double TransformDuration => 400;
2018-05-28 22:11:26 +00:00
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Func<Drawable> createContentFunc, double timeBeforeLoad)
=> new DelayedLoadUnloadWrapper(createContentFunc, timeBeforeLoad);
2021-01-23 20:29:32 +00:00
protected override Drawable CreateDrawable(IBeatmapSetOnlineInfo model)
2018-05-28 22:11:26 +00:00
{
if (model == null)
return null;
2018-05-28 22:11:26 +00:00
return new OnlineBeatmapSetCover(model, coverType)
2018-05-28 22:11:26 +00:00
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
};
2018-05-28 22:11:26 +00:00
}
}
}