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