mirror of https://github.com/ppy/osu
Fix removal of the last one beatmap.
This commit is contained in:
parent
14a22f032f
commit
3913a0a9ee
|
@ -210,7 +210,7 @@ private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
trackManager = osuGame.Audio.Track;
|
trackManager = osuGame.Audio.Track;
|
||||||
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
preferUnicode = config.GetBindable<bool>(OsuConfig.ShowUnicode);
|
||||||
|
@ -247,6 +247,8 @@ protected override void Update()
|
||||||
|
|
||||||
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
if (current.Track.HasCompleted && !current.Track.Looping) next();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
playButton.Icon = FontAwesome.fa_play_circle_o;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preferUnicode_changed(object sender, EventArgs e)
|
private void preferUnicode_changed(object sender, EventArgs e)
|
||||||
|
@ -337,12 +339,16 @@ private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (beatmap?.Beatmap == null)
|
if (beatmap?.Beatmap == null)
|
||||||
//todo: we may need to display some default text here (currently in the constructor).
|
{
|
||||||
return;
|
title.Text = @"Nothing to play";
|
||||||
|
artist.Text = @"Nothing to play";
|
||||||
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
}
|
||||||
title.Text = unicodeString(metadata.Title, metadata.TitleUnicode);
|
else
|
||||||
artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
|
{
|
||||||
|
BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
|
||||||
|
title.Text = unicodeString(metadata.Title, metadata.TitleUnicode);
|
||||||
|
artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
MusicControllerBackground newBackground;
|
MusicControllerBackground newBackground;
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
@ -56,8 +55,15 @@ private void load(OsuGameBase game)
|
||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap?.BeatmapInfo == null)
|
if (beatmap?.BeatmapInfo == null)
|
||||||
|
{
|
||||||
|
FadeOut(250);
|
||||||
|
beatmapInfoContainer?.FadeOut(250);
|
||||||
|
beatmapInfoContainer?.Expire();
|
||||||
|
beatmapInfoContainer = null;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FadeIn(250);
|
||||||
var lastContainer = beatmapInfoContainer;
|
var lastContainer = beatmapInfoContainer;
|
||||||
|
|
||||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
||||||
|
@ -84,7 +90,7 @@ public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
//get statistics fromt he current ruleset.
|
//get statistics fromt he current ruleset.
|
||||||
Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s)));
|
labels.AddRange(Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s)));
|
||||||
}
|
}
|
||||||
|
|
||||||
(beatmapInfoContainer = new BufferedContainer
|
(beatmapInfoContainer = new BufferedContainer
|
||||||
|
@ -191,7 +197,7 @@ public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
|
|
||||||
private string getBPMRange(Beatmap beatmap)
|
private string getBPMRange(Beatmap beatmap)
|
||||||
{
|
{
|
||||||
double bpmMax = beatmap.BPMMaximum;
|
double bpmMax = beatmap.BPMMaximum;
|
||||||
double bpmMin = beatmap.BPMMinimum;
|
double bpmMin = beatmap.BPMMinimum;
|
||||||
|
|
||||||
if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm";
|
if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm";
|
||||||
|
|
|
@ -326,8 +326,7 @@ private void changeBackground(WorkingBeatmap beatmap)
|
||||||
backgroundModeBeatmap.FadeTo(1, 250);
|
backgroundModeBeatmap.FadeTo(1, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap != null)
|
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
||||||
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -337,11 +336,11 @@ protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
base.OnBeatmapChanged(beatmap);
|
base.OnBeatmapChanged(beatmap);
|
||||||
|
|
||||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
beatmap?.Mods.BindTo(modSelect.SelectedMods);
|
||||||
|
|
||||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
||||||
changeBackground(beatmap);
|
changeBackground(beatmap);
|
||||||
carousel.SelectBeatmap(beatmap.BeatmapInfo);
|
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in New Issue