This commit is contained in:
DrabWeb
2017-04-29 05:39:52 -03:00
379 changed files with 8154 additions and 3309 deletions

View File

@ -10,18 +10,19 @@ using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Configuration;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.Sprites;
using osu.Framework.Extensions.Color4Extensions;
using System.Linq;
namespace osu.Game.Overlays
@ -43,9 +44,9 @@ namespace osu.Game.Overlays
private TrackManager trackManager;
private Bindable<WorkingBeatmap> beatmapSource;
private Bindable<bool> preferUnicode;
private WorkingBeatmap current;
private BeatmapDatabase beatmaps;
private LocalisationEngine localisation;
private Container dragContainer;
private Container playerContainer;
@ -86,7 +87,7 @@ namespace osu.Game.Overlays
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours)
private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, LocalisationEngine localisation)
{
activeColour = colours.Yellow;
@ -223,8 +224,7 @@ namespace osu.Game.Overlays
this.beatmaps = beatmaps;
trackManager = game.Audio.Track;
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None);
this.localisation = localisation;
beatmapSource = game.Beatmap ?? new Bindable<WorkingBeatmap>();
@ -306,7 +306,7 @@ namespace osu.Game.Overlays
trackManager.SetExclusive(current.Track);
current.Track.Start();
beatmapSource.Value = current;
});
}).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted);
updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev);
}
@ -320,16 +320,19 @@ namespace osu.Game.Overlays
{
Task.Run(() =>
{
if (beatmap?.Beatmap == null)
if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists
{
title.Current = null;
title.Text = @"Nothing to play";
artist.Current = null;
artist.Text = @"Nothing to play";
}
else
{
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
title.Text = preferUnicode ? metadata.TitleUnicode : metadata.Title;
artist.Text = preferUnicode ? metadata.ArtistUnicode : metadata.Artist;
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
playlist.Current = beatmap.BeatmapSetInfo;
}
});