2019-05-30 00:51:59 +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.
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
2019-05-31 07:19:09 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2019-05-30 00:51:59 +08:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osuTK;
|
2019-05-31 07:19:09 +08:00
|
|
|
|
using System.Collections.Generic;
|
2019-05-30 00:51:59 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
|
|
|
|
{
|
2019-05-31 07:19:09 +08:00
|
|
|
|
public class DrawableMostPlayedBeatmap : OsuHoverContainer
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText mapperText;
|
|
|
|
|
private readonly Box background;
|
|
|
|
|
private const int cover_width = 100;
|
|
|
|
|
private const int corner_radius = 10;
|
|
|
|
|
private readonly SpriteIcon icon;
|
|
|
|
|
private readonly OsuSpriteText playCountText;
|
2019-05-30 01:24:01 +08:00
|
|
|
|
private readonly UnderscoredUserLink mapper;
|
2019-05-30 00:51:59 +08:00
|
|
|
|
|
2019-05-31 07:19:09 +08:00
|
|
|
|
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
|
|
|
|
|
2019-05-30 00:51:59 +08:00
|
|
|
|
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
|
|
|
|
{
|
2019-05-31 07:19:09 +08:00
|
|
|
|
Enabled.Value = true; //manually enabled, because we have no action
|
|
|
|
|
|
2019-05-30 00:51:59 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
Height = 60;
|
|
|
|
|
Masking = true;
|
|
|
|
|
CornerRadius = corner_radius;
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new UpdateableBeatmapSetCover
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = cover_width,
|
|
|
|
|
BeatmapSet = beatmap.BeatmapSet,
|
|
|
|
|
CoverType = BeatmapSetCoverType.List,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Left = cover_width - corner_radius },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Masking = true,
|
|
|
|
|
CornerRadius = corner_radius,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Left = 15, Right = 20 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-05-30 01:24:01 +08:00
|
|
|
|
new UnderscoredBeatmapLink(beatmap)
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
Margin = new MarginPadding { Bottom = 2 },
|
2019-05-30 01:36:14 +08:00
|
|
|
|
Text = new[]
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = new LocalisedString((
|
|
|
|
|
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
|
|
|
|
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
|
|
|
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold)
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
|
|
|
|
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular)
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Margin = new MarginPadding { Top = 2 },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
mapperText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "mapped by ",
|
|
|
|
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Regular),
|
|
|
|
|
},
|
2019-05-30 01:24:01 +08:00
|
|
|
|
mapper = new UnderscoredUserLink(beatmap.Metadata.Author.Id)
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
2019-05-30 01:36:14 +08:00
|
|
|
|
Text = new[]
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = beatmap.Metadata.Author.Username,
|
|
|
|
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
icon = new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Icon = FontAwesome.Solid.CaretRight,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(20),
|
|
|
|
|
},
|
|
|
|
|
playCountText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Text = playCount.ToString(),
|
|
|
|
|
Font = OsuFont.GetFont(size: 30, weight: FontWeight.Regular, fixedWidth: true),
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-30 01:24:01 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colors)
|
2019-05-30 00:51:59 +08:00
|
|
|
|
{
|
2019-05-31 07:19:09 +08:00
|
|
|
|
IdleColour = colors.GreySeafoam;
|
|
|
|
|
HoverColour = colors.GreySeafoamLight;
|
2019-05-30 00:51:59 +08:00
|
|
|
|
mapperText.Colour = mapper.Colour = colors.GreySeafoamLighter;
|
|
|
|
|
icon.Colour = playCountText.Colour = colors.Yellow;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|