mirror of
https://github.com/ppy/osu.git
synced 2024-11-19 12:12:54 +08:00
113 lines
4.0 KiB
C#
113 lines
4.0 KiB
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Framework.Graphics.Shapes;
|
|
using osu.Game.Beatmaps;
|
|
using osu.Game.Beatmaps.Drawables;
|
|
using osu.Game.Graphics.Containers;
|
|
using osu.Game.Graphics.Sprites;
|
|
using OpenTK;
|
|
using OpenTK.Graphics;
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
|
{
|
|
public class MostPlayedBeatmapDrawable : DrawableBeatmapRow
|
|
{
|
|
private readonly BeatmapInfo beatmap;
|
|
private readonly int playCount;
|
|
private OsuHoverContainer mapperContainer;
|
|
|
|
public MostPlayedBeatmapDrawable(BeatmapInfo beatmap, int playCount)
|
|
{
|
|
this.beatmap = beatmap;
|
|
this.playCount = playCount;
|
|
}
|
|
|
|
protected override Drawable CreatePicture() => new Container
|
|
{
|
|
Anchor = Anchor.CentreLeft,
|
|
Origin = Anchor.CentreLeft,
|
|
AutoSizeAxes = Axes.Both,
|
|
Children = new Drawable[]
|
|
{
|
|
new Box //Image Background while loading
|
|
{
|
|
Size = new Vector2(80, 50),
|
|
Colour = Color4.Black,
|
|
},
|
|
new DelayedLoadWrapper(new BeatmapSetCover(beatmap.BeatmapSet, BeatmapSetCoverType.List)
|
|
{
|
|
RelativeSizeAxes = Axes.Both,
|
|
FillMode = FillMode.Fit,
|
|
}),
|
|
},
|
|
};
|
|
|
|
[BackgroundDependencyLoader(true)]
|
|
private void load(UserProfileOverlay profileOverlay)
|
|
{
|
|
LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap));
|
|
LeftFlowContainer.Add(new FillFlowContainer
|
|
{
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
Direction = FillDirection.Horizontal,
|
|
Children = new Drawable[]
|
|
{
|
|
new OsuSpriteText
|
|
{
|
|
Text = @"mapped by ",
|
|
TextSize = 12,
|
|
},
|
|
mapperContainer = new OsuHoverContainer
|
|
{
|
|
AutoSizeAxes = Axes.Both,
|
|
Children = new Drawable[]
|
|
{
|
|
new OsuSpriteText
|
|
{
|
|
Text = beatmap.Metadata.AuthorString,
|
|
TextSize = 12,
|
|
Font = @"Exo2.0-MediumItalic"
|
|
}
|
|
}
|
|
},
|
|
}
|
|
});
|
|
|
|
RightFlowContainer.Add(new FillFlowContainer
|
|
{
|
|
Anchor = Anchor.TopRight,
|
|
Origin = Anchor.TopRight,
|
|
AutoSizeAxes = Axes.Both,
|
|
Direction = FillDirection.Horizontal,
|
|
Children = new[]
|
|
{
|
|
new OsuSpriteText
|
|
{
|
|
Anchor = Anchor.BottomRight,
|
|
Origin = Anchor.BottomRight,
|
|
Text = playCount.ToString(),
|
|
TextSize = 18,
|
|
Font = @"Exo2.0-SemiBoldItalic"
|
|
},
|
|
new OsuSpriteText
|
|
{
|
|
Anchor = Anchor.BottomRight,
|
|
Origin = Anchor.BottomRight,
|
|
Text = @"times played ",
|
|
TextSize = 12,
|
|
Font = @"Exo2.0-RegularItalic"
|
|
},
|
|
}
|
|
});
|
|
|
|
if(profileOverlay != null)
|
|
mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author);
|
|
}
|
|
}
|
|
}
|