2018-05-29 10:13:56 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2018-12-07 18:38:46 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-05-29 10:13:56 +08:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi.Components
|
|
|
|
|
{
|
2018-12-07 18:38:46 +08:00
|
|
|
|
public class BeatmapTitle : CompositeDrawable
|
2018-05-29 10:13:56 +08:00
|
|
|
|
{
|
|
|
|
|
private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist;
|
|
|
|
|
|
|
|
|
|
public float TextSize
|
|
|
|
|
{
|
|
|
|
|
set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; }
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-20 14:17:33 +08:00
|
|
|
|
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
2018-05-29 10:13:56 +08:00
|
|
|
|
|
|
|
|
|
public BeatmapTitle()
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both;
|
|
|
|
|
|
2018-12-07 18:38:46 +08:00
|
|
|
|
InternalChild = new FillFlowContainer
|
2018-05-29 10:13:56 +08:00
|
|
|
|
{
|
2018-12-07 18:38:46 +08:00
|
|
|
|
AutoSizeAxes = Axes.Both,
|
|
|
|
|
Direction = FillDirection.Horizontal,
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", },
|
|
|
|
|
beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", },
|
|
|
|
|
beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", },
|
|
|
|
|
}
|
2018-05-29 10:13:56 +08:00
|
|
|
|
};
|
2018-12-07 18:38:46 +08:00
|
|
|
|
|
|
|
|
|
Beatmap.BindValueChanged(v => updateText());
|
2018-05-29 10:13:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
updateText();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void updateText()
|
|
|
|
|
{
|
2018-12-07 18:38:46 +08:00
|
|
|
|
if (!IsLoaded)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (Beatmap.Value == null)
|
2018-05-29 10:13:56 +08:00
|
|
|
|
{
|
|
|
|
|
beatmapTitle.Text = "Changing map";
|
|
|
|
|
beatmapDash.Text = beatmapArtist.Text = string.Empty;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-12-07 18:38:46 +08:00
|
|
|
|
beatmapTitle.Text = new LocalisedString((Beatmap.Value.Metadata.TitleUnicode, Beatmap.Value.Metadata.Title));
|
2018-05-29 10:13:56 +08:00
|
|
|
|
beatmapDash.Text = @" - ";
|
2018-12-07 18:38:46 +08:00
|
|
|
|
beatmapArtist.Text = new LocalisedString((Beatmap.Value.Metadata.ArtistUnicode, Beatmap.Value.Metadata.Artist));
|
2018-05-29 10:13:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|