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-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
2019-02-12 12:04:46 +08:00
|
|
|
|
using osu.Game.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
|
|
|
|
{
|
|
|
|
|
public class DrawableMostPlayedRow : DrawableProfileRow
|
|
|
|
|
{
|
|
|
|
|
private readonly BeatmapInfo beatmap;
|
|
|
|
|
private readonly int playCount;
|
|
|
|
|
private OsuHoverContainer mapperContainer;
|
|
|
|
|
|
|
|
|
|
public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount)
|
|
|
|
|
{
|
|
|
|
|
this.beatmap = beatmap;
|
|
|
|
|
this.playCount = playCount;
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-29 06:31:20 +08:00
|
|
|
|
protected override Drawable CreateLeftVisual() => new UpdateableBeatmapSetCover
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
2018-05-29 06:31:20 +08:00
|
|
|
|
Origin = Anchor.CentreLeft,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Size = new Vector2(80, 50),
|
2018-05-29 06:31:20 +08:00
|
|
|
|
BeatmapSet = beatmap.BeatmapSet,
|
|
|
|
|
CoverType = BeatmapSetCoverType.List,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
[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 ",
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 12)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
mapperContainer = new OsuHoverContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = beatmap.Metadata.AuthorString,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Medium, italics: true)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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(),
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.SemiBold, italics: true)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
|
Text = @"times played ",
|
2019-02-20 15:52:36 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (profileOverlay != null)
|
|
|
|
|
mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|