2018-01-05 19:21:19 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-11-19 21:19:05 +08:00
|
|
|
|
// 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.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
|
|
|
|
{
|
2017-12-11 11:31:35 +08:00
|
|
|
|
public class DrawableMostPlayedRow : DrawableProfileRow
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly BeatmapInfo beatmap;
|
2017-11-27 04:52:35 +08:00
|
|
|
|
private readonly int playCount;
|
|
|
|
|
private OsuHoverContainer mapperContainer;
|
2017-11-19 21:19:05 +08:00
|
|
|
|
|
2017-12-11 11:31:35 +08:00
|
|
|
|
public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount)
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
|
|
|
|
this.beatmap = beatmap;
|
2017-11-27 04:52:35 +08:00
|
|
|
|
this.playCount = playCount;
|
|
|
|
|
}
|
2017-11-19 21:19:05 +08:00
|
|
|
|
|
2017-12-11 11:47:31 +08:00
|
|
|
|
protected override Drawable CreateLeftVisual() => new DelayedLoadWrapper(new BeatmapSetCover(beatmap.BeatmapSet, BeatmapSetCoverType.List)
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
FillMode = FillMode.Fit,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
OnLoadComplete = d => d.FadeInFromZero(500, Easing.OutQuint)
|
|
|
|
|
})
|
2017-11-27 04:52:35 +08:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
2017-12-11 11:47:31 +08:00
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.None,
|
|
|
|
|
Size = new Vector2(80, 50),
|
2017-11-27 04:52:35 +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[]
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
2017-11-27 04:52:35 +08:00
|
|
|
|
new OsuSpriteText
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
2017-11-27 04:52:35 +08:00
|
|
|
|
Text = @"mapped by ",
|
|
|
|
|
TextSize = 12,
|
|
|
|
|
},
|
|
|
|
|
mapperContainer = new OsuHoverContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
2017-11-27 04:52:35 +08:00
|
|
|
|
new OsuSpriteText
|
2017-11-19 21:19:05 +08:00
|
|
|
|
{
|
2017-11-27 04:52:35 +08:00
|
|
|
|
Text = beatmap.Metadata.AuthorString,
|
|
|
|
|
TextSize = 12,
|
|
|
|
|
Font = @"Exo2.0-MediumItalic"
|
2017-11-19 21:19:05 +08:00
|
|
|
|
}
|
2017-11-27 04:52:35 +08:00
|
|
|
|
}
|
2017-11-19 21:19:05 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
2017-11-27 04:52:35 +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(),
|
|
|
|
|
TextSize = 18,
|
|
|
|
|
Font = @"Exo2.0-SemiBoldItalic"
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomRight,
|
|
|
|
|
Origin = Anchor.BottomRight,
|
|
|
|
|
Text = @"times played ",
|
|
|
|
|
TextSize = 12,
|
|
|
|
|
Font = @"Exo2.0-RegularItalic"
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
});
|
2017-11-19 21:19:05 +08:00
|
|
|
|
|
2017-12-11 11:47:31 +08:00
|
|
|
|
if (profileOverlay != null)
|
2017-11-19 21:19:05 +08:00
|
|
|
|
mapperContainer.Action = () => profileOverlay.ShowUser(beatmap.BeatmapSet.Metadata.Author);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|