mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 18:43:04 +08:00
Use metadata field of WorkingBeatmap.
This commit is contained in:
parent
4f49151984
commit
146d57953d
@ -51,14 +51,12 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Title,
|
||||
TextSize = 22,
|
||||
Shadow = true,
|
||||
},
|
||||
artist = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -81,8 +79,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LocalisationEngine localisation)
|
||||
{
|
||||
title.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.TitleUnicode, beatmap.BeatmapSetInfo.Metadata.Title);
|
||||
artist.Current = localisation.GetUnicodePreference(beatmap.BeatmapSetInfo.Metadata.ArtistUnicode, beatmap.BeatmapSetInfo.Metadata.Artist);
|
||||
title.Current = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
|
||||
artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
|
||||
}
|
||||
|
||||
private class PanelBackground : BufferedContainer
|
||||
|
@ -51,13 +51,13 @@ namespace osu.Game.Database
|
||||
|
||||
protected override Texture GetBackground()
|
||||
{
|
||||
if (BeatmapInfo?.Metadata?.BackgroundFile == null)
|
||||
if (Metadata?.BackgroundFile == null)
|
||||
return null;
|
||||
|
||||
try
|
||||
{
|
||||
using (var reader = getReader())
|
||||
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(BeatmapInfo.Metadata.BackgroundFile);
|
||||
return new TextureStore(new RawTextureLoaderStore(reader), false).Get(Metadata.BackgroundFile);
|
||||
}
|
||||
catch { return null; }
|
||||
}
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Database
|
||||
{
|
||||
try
|
||||
{
|
||||
var trackData = getReader()?.GetStream(BeatmapInfo.Metadata.AudioFile);
|
||||
var trackData = getReader()?.GetStream(Metadata.AudioFile);
|
||||
return trackData == null ? null : new TrackBass(trackData);
|
||||
}
|
||||
catch { return null; }
|
||||
|
@ -315,7 +315,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
else
|
||||
{
|
||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||
BeatmapMetadata metadata = beatmap.Metadata;
|
||||
title.Current = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
|
||||
artist.Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);
|
||||
}
|
||||
|
@ -65,7 +65,6 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private Bindable<bool> menuMusic;
|
||||
private TrackManager trackManager;
|
||||
private WorkingBeatmap song;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps)
|
||||
@ -79,8 +78,7 @@ namespace osu.Game.Screens.Menu
|
||||
List<BeatmapSetInfo> choosableBeatmapSets = beatmaps.Query<BeatmapSetInfo>().ToList();
|
||||
if (choosableBeatmapSets.Count > 0)
|
||||
{
|
||||
song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren<BeatmapSetInfo>(choosableBeatmapSets[RNG.Next(0, choosableBeatmapSets.Count - 1)].ID).Beatmaps[0]);
|
||||
Beatmap = song;
|
||||
Beatmap = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren<BeatmapSetInfo>(choosableBeatmapSets[RNG.Next(0, choosableBeatmapSets.Count - 1)].ID).Beatmaps[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,15 +104,15 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnEntering(last);
|
||||
buttons.FadeInFromZero(500);
|
||||
if (last is Intro && song != null)
|
||||
if (last is Intro && Beatmap != null)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
trackManager.SetExclusive(song.Track);
|
||||
song.Track.Seek(song.Beatmap.Metadata.PreviewTime);
|
||||
if (song.Beatmap.Metadata.PreviewTime == -1)
|
||||
song.Track.Seek(song.Track.Length * 0.4f);
|
||||
song.Track.Start();
|
||||
trackManager.SetExclusive(Beatmap.Track);
|
||||
Beatmap.Track.Seek(Beatmap.Metadata.PreviewTime);
|
||||
if (Beatmap.Metadata.PreviewTime == -1)
|
||||
Beatmap.Track.Seek(Beatmap.Track.Length * 0.4f);
|
||||
Beatmap.Track.Start();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
Icon = FontAwesome.fa_trash_o;
|
||||
HeaderText = @"Confirm deletion of";
|
||||
BodyText = $@"{beatmap.Beatmap?.Metadata?.Artist} - {beatmap.Beatmap?.Metadata?.Title}";
|
||||
BodyText = $@"{beatmap?.Metadata?.Artist} - {beatmap?.Metadata?.Title}";
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
|
@ -343,7 +343,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
trackManager.SetExclusive(track);
|
||||
if (preview)
|
||||
track.Seek(Beatmap.Beatmap.Metadata.PreviewTime);
|
||||
track.Seek(Beatmap.Metadata.PreviewTime);
|
||||
track.Start();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user