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 System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
2018-05-07 10:59:17 +08:00
|
|
|
|
using JetBrains.Annotations;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK;
|
|
|
|
|
using osuTK.Graphics;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 18:04:31 +08:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2020-01-09 12:43:44 +08:00
|
|
|
|
using osu.Framework.Utils;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Framework.Graphics.Cursor;
|
2019-04-02 13:51:28 +08:00
|
|
|
|
using osu.Framework.Graphics.Effects;
|
2019-03-27 18:29:27 +08:00
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2018-05-07 10:59:17 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
2019-04-08 17:32:05 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-05-07 10:59:17 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select
|
|
|
|
|
{
|
2019-10-15 07:27:59 +08:00
|
|
|
|
public class BeatmapInfoWedge : VisibilityContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-09-25 07:06:33 +08:00
|
|
|
|
private const float shear_width = 36.75f;
|
|
|
|
|
|
2019-09-25 07:48:22 +08:00
|
|
|
|
private static readonly Vector2 wedged_container_shear = new Vector2(shear_width / SongSelect.WEDGED_CONTAINER_SIZE.Y, 0);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-05-07 10:59:17 +08:00
|
|
|
|
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
protected BufferedWedgeInfo Info;
|
|
|
|
|
|
|
|
|
|
public BeatmapInfoWedge()
|
|
|
|
|
{
|
|
|
|
|
Shear = wedged_container_shear;
|
|
|
|
|
Masking = true;
|
|
|
|
|
BorderColour = new Color4(221, 255, 255, 255);
|
|
|
|
|
BorderThickness = 2.5f;
|
|
|
|
|
Alpha = 0;
|
|
|
|
|
EdgeEffect = new EdgeEffectParameters
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Glow,
|
|
|
|
|
Colour = new Color4(130, 204, 255, 150),
|
|
|
|
|
Radius = 20,
|
|
|
|
|
Roundness = 15,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-07 10:59:17 +08:00
|
|
|
|
[BackgroundDependencyLoader(true)]
|
2018-06-26 15:32:20 +08:00
|
|
|
|
private void load([CanBeNull] Bindable<RulesetInfo> parentRuleset)
|
2018-05-07 10:59:17 +08:00
|
|
|
|
{
|
2018-06-26 17:24:34 +08:00
|
|
|
|
ruleset.BindTo(parentRuleset);
|
2018-06-01 17:03:16 +08:00
|
|
|
|
ruleset.ValueChanged += _ => updateDisplay();
|
2018-05-07 10:59:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
|
|
|
|
this.MoveToX(0, 800, Easing.OutQuint);
|
|
|
|
|
this.RotateTo(0, 800, Easing.OutQuint);
|
|
|
|
|
this.FadeIn(250);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
this.MoveToX(-100, 800, Easing.In);
|
|
|
|
|
this.RotateTo(10, 800, Easing.In);
|
|
|
|
|
this.FadeOut(500, Easing.In);
|
|
|
|
|
}
|
|
|
|
|
|
2018-05-07 10:59:17 +08:00
|
|
|
|
private WorkingBeatmap beatmap;
|
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
public WorkingBeatmap Beatmap
|
2018-05-07 10:59:17 +08:00
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
get => beatmap;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (beatmap == value) return;
|
|
|
|
|
|
|
|
|
|
beatmap = value;
|
|
|
|
|
updateDisplay();
|
|
|
|
|
}
|
2018-05-07 10:59:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-25 13:39:10 +08:00
|
|
|
|
public override bool IsPresent => base.IsPresent || Info == null; // Visibility is updated in the LoadComponentAsync callback
|
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
private BufferedWedgeInfo loadingInfo;
|
2018-05-07 10:59:17 +08:00
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
private void updateDisplay()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
void removeOldInfo()
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-06-11 13:28:52 +08:00
|
|
|
|
State.Value = beatmap == null ? Visibility.Hidden : Visibility.Visible;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
Info?.FadeOut(250);
|
|
|
|
|
Info?.Expire();
|
2018-06-01 17:03:16 +08:00
|
|
|
|
Info = null;
|
2018-05-13 11:55:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (beatmap == null)
|
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
removeOldInfo();
|
2018-05-13 11:55:54 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
LoadComponentAsync(loadingInfo = new BufferedWedgeInfo(beatmap, ruleset.Value)
|
2018-05-13 11:55:54 +08:00
|
|
|
|
{
|
|
|
|
|
Shear = -Shear,
|
2018-06-01 17:03:16 +08:00
|
|
|
|
Depth = Info?.Depth + 1 ?? 0
|
|
|
|
|
}, loaded =>
|
2018-05-13 11:55:54 +08:00
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
// ensure we are the most recent loaded wedge.
|
|
|
|
|
if (loaded != loadingInfo) return;
|
|
|
|
|
|
|
|
|
|
removeOldInfo();
|
|
|
|
|
Add(Info = loaded);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class BufferedWedgeInfo : BufferedContainer
|
|
|
|
|
{
|
|
|
|
|
public OsuSpriteText VersionLabel { get; private set; }
|
|
|
|
|
public OsuSpriteText TitleLabel { get; private set; }
|
|
|
|
|
public OsuSpriteText ArtistLabel { get; private set; }
|
2018-09-13 16:18:20 +08:00
|
|
|
|
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public FillFlowContainer MapperContainer { get; private set; }
|
|
|
|
|
public FillFlowContainer InfoLabelContainer { get; private set; }
|
2018-06-01 17:03:16 +08:00
|
|
|
|
|
2018-09-19 13:07:46 +08:00
|
|
|
|
private ILocalisedBindableString titleBinding;
|
|
|
|
|
private ILocalisedBindableString artistBinding;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
private readonly WorkingBeatmap beatmap;
|
2018-05-11 13:10:53 +08:00
|
|
|
|
private readonly RulesetInfo ruleset;
|
2018-05-07 10:59:17 +08:00
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
public BufferedWedgeInfo(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
2019-07-30 22:31:21 +08:00
|
|
|
|
: base(pixelSnapping: true)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
this.beatmap = beatmap;
|
|
|
|
|
ruleset = userRuleset ?? beatmap.BeatmapInfo.Ruleset;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-05-11 13:13:52 +08:00
|
|
|
|
[BackgroundDependencyLoader]
|
2018-09-19 13:07:46 +08:00
|
|
|
|
private void load(LocalisationManager localisation)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
var beatmapInfo = beatmap.BeatmapInfo;
|
|
|
|
|
var metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
CacheDrawnFrameBuffer = true;
|
2019-09-04 18:38:12 +08:00
|
|
|
|
RedrawOnScale = false;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
|
2018-09-19 13:07:46 +08:00
|
|
|
|
titleBinding = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title)));
|
2018-09-26 13:01:15 +08:00
|
|
|
|
artistBinding = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist)));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
// We will create the white-to-black gradient by modulating transparency and having
|
|
|
|
|
// a black backdrop. This results in an sRGB-space gradient and not linear space,
|
|
|
|
|
// transitioning from white to black more perceptually uniformly.
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
},
|
|
|
|
|
// We use a container, such that we can set the colour gradient to go across the
|
|
|
|
|
// vertices of the masked container instead of the vertices of the (larger) sprite.
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
// Zoomed-in and cropped beatmap background
|
2018-06-01 17:03:16 +08:00
|
|
|
|
new BeatmapBackgroundSprite(beatmap)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
FillMode = FillMode.Fill,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
new DifficultyColourBar(beatmapInfo)
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = 20,
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
2018-09-13 16:18:20 +08:00
|
|
|
|
Name = "Topleft-aligned metadata",
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2019-09-25 07:28:40 +08:00
|
|
|
|
Padding = new MarginPadding { Top = 10, Left = 25, Right = shear_width * 2.5f },
|
2019-09-25 07:06:33 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
VersionLabel = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = beatmapInfo.Version,
|
2019-02-20 15:52:36 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 24, italics: true),
|
2019-09-25 07:06:33 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Truncate = true,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
2018-09-13 16:18:20 +08:00
|
|
|
|
{
|
|
|
|
|
Name = "Topright-aligned metadata",
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Direction = FillDirection.Vertical,
|
2019-09-25 07:28:40 +08:00
|
|
|
|
Padding = new MarginPadding { Top = 14, Right = shear_width / 2 },
|
2018-09-13 16:18:20 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-09-20 11:35:07 +08:00
|
|
|
|
StatusPill = new BeatmapSetOnlineStatusPill
|
2018-09-13 16:18:20 +08:00
|
|
|
|
{
|
2018-09-20 11:35:07 +08:00
|
|
|
|
TextSize = 11,
|
|
|
|
|
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
2018-09-13 16:18:20 +08:00
|
|
|
|
Status = beatmapInfo.Status,
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new FillFlowContainer
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
Name = "Centre-aligned metadata",
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.TopLeft,
|
2019-09-25 07:28:40 +08:00
|
|
|
|
Y = -7,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
2019-09-25 07:28:40 +08:00
|
|
|
|
Padding = new MarginPadding { Left = 25, Right = shear_width },
|
2019-09-25 07:06:33 +08:00
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
TitleLabel = new OsuSpriteText
|
|
|
|
|
{
|
2019-02-20 15:52:36 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 28, italics: true),
|
2019-09-25 07:06:33 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Truncate = true,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
ArtistLabel = new OsuSpriteText
|
|
|
|
|
{
|
2019-02-20 15:52:36 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 17, italics: true),
|
2019-09-25 07:06:33 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Truncate = true,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
MapperContainer = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = 10 },
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = getMapper(metadata)
|
|
|
|
|
},
|
|
|
|
|
InfoLabelContainer = new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
Margin = new MarginPadding { Top = 20 },
|
|
|
|
|
Spacing = new Vector2(20, 0),
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Children = getInfoLabels()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2018-09-19 13:57:32 +08:00
|
|
|
|
|
2019-02-22 19:13:38 +08:00
|
|
|
|
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
|
|
|
|
|
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
|
2018-09-13 19:49:57 +08:00
|
|
|
|
|
|
|
|
|
// no difficulty means it can't have a status to show
|
|
|
|
|
if (beatmapInfo.Version == null)
|
|
|
|
|
StatusPill.Hide();
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void setMetadata(string source)
|
|
|
|
|
{
|
|
|
|
|
ArtistLabel.Text = artistBinding.Value;
|
|
|
|
|
TitleLabel.Text = string.IsNullOrEmpty(source) ? titleBinding.Value : source + " — " + titleBinding.Value;
|
|
|
|
|
ForceRedraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private InfoLabel[] getInfoLabels()
|
|
|
|
|
{
|
2018-06-01 17:03:16 +08:00
|
|
|
|
var b = beatmap.Beatmap;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
List<InfoLabel> labels = new List<InfoLabel>();
|
|
|
|
|
|
2018-06-01 17:03:16 +08:00
|
|
|
|
if (b?.HitObjects?.Any() == true)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
labels.Add(new InfoLabel(new BeatmapStatistic
|
|
|
|
|
{
|
|
|
|
|
Name = "Length",
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Regular.Clock,
|
2019-07-08 16:55:07 +08:00
|
|
|
|
Content = TimeSpan.FromMilliseconds(b.BeatmapInfo.Length).ToString(@"m\:ss"),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
labels.Add(new InfoLabel(new BeatmapStatistic
|
|
|
|
|
{
|
|
|
|
|
Name = "BPM",
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Regular.Circle,
|
2018-06-01 17:03:16 +08:00
|
|
|
|
Content = getBPMRange(b),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}));
|
|
|
|
|
|
2018-05-07 10:59:17 +08:00
|
|
|
|
IBeatmap playableBeatmap;
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// Try to get the beatmap with the user's ruleset
|
2019-04-10 16:13:12 +08:00
|
|
|
|
playableBeatmap = beatmap.GetPlayableBeatmap(ruleset, Array.Empty<Mod>());
|
2018-05-07 10:59:17 +08:00
|
|
|
|
}
|
|
|
|
|
catch (BeatmapInvalidForRulesetException)
|
|
|
|
|
{
|
|
|
|
|
// Can't be converted to the user's ruleset, so use the beatmap's own ruleset
|
2019-04-10 16:13:12 +08:00
|
|
|
|
playableBeatmap = beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset, Array.Empty<Mod>());
|
2018-05-07 10:59:17 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s)));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return labels.ToArray();
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-19 19:44:38 +08:00
|
|
|
|
private string getBPMRange(IBeatmap beatmap)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
double bpmMax = beatmap.ControlPointInfo.BPMMaximum;
|
|
|
|
|
double bpmMin = beatmap.ControlPointInfo.BPMMinimum;
|
|
|
|
|
|
|
|
|
|
if (Precision.AlmostEquals(bpmMin, bpmMax))
|
|
|
|
|
return $"{bpmMin:0}";
|
|
|
|
|
|
|
|
|
|
return $"{bpmMin:0}-{bpmMax:0} (mostly {beatmap.ControlPointInfo.BPMMode:0})";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private OsuSpriteText[] getMapper(BeatmapMetadata metadata)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(metadata.Author?.Username))
|
|
|
|
|
return Array.Empty<OsuSpriteText>();
|
|
|
|
|
|
|
|
|
|
return new[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "mapped by ",
|
2019-02-20 15:52:36 +08:00
|
|
|
|
Font = OsuFont.GetFont(size: 15),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = metadata.Author.Username,
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class InfoLabel : Container, IHasTooltip
|
|
|
|
|
{
|
2020-01-20 12:50:27 +08:00
|
|
|
|
public string TooltipText { get; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public InfoLabel(BeatmapStatistic statistic)
|
|
|
|
|
{
|
|
|
|
|
TooltipText = statistic.Name;
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Size = new Vector2(20),
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = OsuColour.FromHex(@"441288"),
|
2019-04-02 18:55:24 +08:00
|
|
|
|
Icon = FontAwesome.Solid.Square,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Rotation = 45,
|
|
|
|
|
},
|
|
|
|
|
new SpriteIcon
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Scale = new Vector2(0.8f),
|
|
|
|
|
Colour = OsuColour.FromHex(@"f7dd55"),
|
|
|
|
|
Icon = statistic.Icon,
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Colour = new Color4(255, 221, 85, 255),
|
2019-02-12 12:04:46 +08:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17),
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Margin = new MarginPadding { Left = 30 },
|
|
|
|
|
Text = statistic.Content,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-17 14:16:24 +08:00
|
|
|
|
private class DifficultyColourBar : Container
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2019-08-17 14:16:24 +08:00
|
|
|
|
private readonly BeatmapInfo beatmap;
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
public DifficultyColourBar(BeatmapInfo beatmap)
|
|
|
|
|
{
|
2019-08-17 14:16:24 +08:00
|
|
|
|
this.beatmap = beatmap;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2019-08-17 14:16:24 +08:00
|
|
|
|
private void load(OsuColour colours)
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
const float full_opacity_ratio = 0.7f;
|
|
|
|
|
|
2019-08-17 14:16:24 +08:00
|
|
|
|
var difficultyColour = colours.ForDifficultyRating(beatmap.DifficultyRating);
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-08-17 14:16:24 +08:00
|
|
|
|
Colour = difficultyColour,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Width = full_opacity_ratio,
|
|
|
|
|
},
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
RelativePositionAxes = Axes.Both,
|
2019-08-17 14:16:24 +08:00
|
|
|
|
Colour = difficultyColour,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Alpha = 0.5f,
|
|
|
|
|
X = full_opacity_ratio,
|
|
|
|
|
Width = 1 - full_opacity_ratio,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|