diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index ec0b625fe4..e4faf7f783 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -8,6 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; @@ -19,20 +20,20 @@ namespace osu.Game.Overlays.Direct private readonly float vertical_padding = 5; private readonly Sprite background; - private readonly OsuSpriteText title, artist, mapperPrefix, mapper, source; + private readonly OsuSpriteText title, artist, authorPrefix, author, source; private readonly Statistic playCount, favouriteCount; private readonly FillFlowContainer difficultyIcons; protected override Sprite Background => background; protected override OsuSpriteText Title => title; protected override OsuSpriteText Artist => artist; - protected override OsuSpriteText Mapper => mapper; + protected override OsuSpriteText Author => author; protected override OsuSpriteText Source => source; protected override Statistic PlayCount => playCount; protected override Statistic FavouriteCount => favouriteCount; protected override FillFlowContainer DifficultyIcons => difficultyIcons; - public DirectGridPanel() + public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) { Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) CornerRadius = 4; @@ -113,13 +114,13 @@ namespace osu.Game.Overlays.Direct Direction = FillDirection.Horizontal, Children = new[] { - mapperPrefix = new OsuSpriteText + authorPrefix = new OsuSpriteText { Text = @"mapped by ", TextSize = 14, Shadow = false, }, - mapper = new OsuSpriteText + author = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", @@ -165,8 +166,8 @@ namespace osu.Game.Overlays.Direct [BackgroundDependencyLoader] private void load(OsuColour colours) { - mapperPrefix.Colour = colours.Gray5; - Mapper.Colour = colours.BlueDark; + authorPrefix.Colour = colours.Gray5; + Author.Colour = colours.BlueDark; Source.Colour = colours.Gray5; } } diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 00ef4c3206..b5146dbbe3 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -11,30 +11,31 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Colour; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Database; namespace osu.Game.Overlays.Direct { public class DirectListPanel : DirectPanel { - private readonly float horizontal_padding = 10; + private readonly float horizontal_padding = 10; private readonly float vertical_padding = 5; private readonly float height = 70; private readonly Sprite background; - private readonly OsuSpriteText title, artist, mapper, source; + private readonly OsuSpriteText title, artist, author, source; private readonly Statistic playCount, favouriteCount; private readonly FillFlowContainer difficultyIcons; protected override Sprite Background => background; protected override OsuSpriteText Title => title; protected override OsuSpriteText Artist => artist; - protected override OsuSpriteText Mapper => mapper; + protected override OsuSpriteText Author => author; protected override OsuSpriteText Source => source; protected override Statistic PlayCount => playCount; protected override Statistic FavouriteCount => favouriteCount; protected override FillFlowContainer DifficultyIcons => difficultyIcons; - public DirectListPanel() + public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap) { RelativeSizeAxes = Axes.X; Height = height; @@ -101,11 +102,11 @@ namespace osu.Game.Overlays.Direct Margin = new MarginPadding { Right = (height - vertical_padding * 2) + vertical_padding }, Children = new Drawable[] { - playCount = new Statistic(FontAwesome.fa_play_circle, 4579492) - { + playCount = new Statistic(FontAwesome.fa_play_circle) + { Margin = new MarginPadding { Right = 1 }, }, - favouriteCount = new Statistic(FontAwesome.fa_heart, 2659), + favouriteCount = new Statistic(FontAwesome.fa_heart), new FillFlowContainer { Anchor = Anchor.TopRight, @@ -119,7 +120,7 @@ namespace osu.Game.Overlays.Direct Text = @"mapped by ", TextSize = 14, }, - mapper = new OsuSpriteText + author = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-SemiBoldItalic", diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 8cb7f4f299..b163712e85 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; +using osu.Framework.Localisation; using osu.Game.Beatmaps.Drawables; using osu.Game.Database; using osu.Game.Graphics; @@ -19,28 +19,29 @@ namespace osu.Game.Overlays.Direct protected virtual Sprite Background { get; } protected virtual OsuSpriteText Title { get; } protected virtual OsuSpriteText Artist { get; } - protected virtual OsuSpriteText Mapper { get; } + protected virtual OsuSpriteText Author { get; } protected virtual OsuSpriteText Source { get; } protected virtual Statistic PlayCount { get; } protected virtual Statistic FavouriteCount { get; } protected virtual FillFlowContainer DifficultyIcons { get; } - [BackgroundDependencyLoader] - private void load(TextureStore textures, RulesetDatabase rulesets) + private BeatmapSetInfo setInfo; + + [BackgroundDependencyLoader] + private void load(LocalisationEngine localisation) + { + Title.Current = localisation.GetUnicodePreference(setInfo.Metadata.TitleUnicode, setInfo.Metadata.Title); + Artist.Current = localisation.GetUnicodePreference(setInfo.Metadata.ArtistUnicode, setInfo.Metadata.Artist); + Author.Text = setInfo.Metadata.Author; + Source.Text = @"from " + setInfo.Metadata.Source; + + foreach (var b in setInfo.Beatmaps) + DifficultyIcons.Add(new DifficultyIcon(b)); + } + + public DirectPanel(BeatmapSetInfo setInfo) { - Background.Texture = textures.Get(@"Backgrounds/bg4"); - - Title.Text = @"Platina"; - Artist.Text = @"Maaya Sakamoto"; - Mapper.Text = @"TicClick"; - Source.Text = @"from Cardcaptor Sakura"; - PlayCount.Value = 4579492; - FavouriteCount.Value = 2659; - - for (int i = 0; i < 4; i++) - { - DifficultyIcons.Add(new DifficultyIcon(new BeatmapInfo { Ruleset = rulesets.GetRuleset(i), StarDifficulty = i + 1 })); - } + this.setInfo = setInfo; } public class Statistic : FillFlowContainer diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index b7d27cf9e0..338ce2bd2d 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK; +using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Overlays.Direct; @@ -67,21 +69,49 @@ namespace osu.Game.Overlays }, }, }, - new DirectGridPanel - { + }; + + filter.Search.Exit = Hide; + } + + [BackgroundDependencyLoader] + private void load(RulesetDatabase rulesets) + { + var setInfo = new BeatmapSetInfo + { + Metadata = new BeatmapMetadata + { + Title = @"Platina", + Artist = @"Maaya Sakamoto", + Author = @"TicClick", + Source = @"Cardcaptor Sakura", + }, + Beatmaps = new List(), + }; + + for (int i = 0; i< 4; i++) + { + setInfo.Beatmaps.Add(new BeatmapInfo { + Ruleset = rulesets.GetRuleset(i), + StarDifficulty = i + 1, + }); + } + + Add(new Drawable[] + { + new DirectGridPanel(setInfo) + { Anchor = Anchor.Centre, Origin = Anchor.BottomCentre, Width = 300, }, - new DirectListPanel + new DirectListPanel(setInfo) { Anchor = Anchor.Centre, Origin = Anchor.TopCentre, Width = 0.8f, }, - }; - - filter.Search.Exit = Hide; + }); } protected override void PopIn()