1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:13:18 +08:00

Handle cases where HitObjects were not parsed.

This commit is contained in:
Dean Herbert 2017-02-15 12:38:10 +09:00
parent 753232533a
commit d570a6d308
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
2 changed files with 14 additions and 5 deletions

View File

@ -23,6 +23,7 @@ using System.Linq;
using osu.Game.Beatmaps;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
namespace osu.Game.Screens.Play
{
@ -75,9 +76,14 @@ namespace osu.Game.Screens.Play
{
if (Beatmap == null)
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
if ((Beatmap?.Beatmap?.HitObjects.Count ?? 0) == 0)
throw new Exception("No valid objects were found!");
}
catch
catch (Exception e)
{
Logger.Log($"Could not load this beatmap sucessfully ({e})!", LoggingTarget.Runtime, LogLevel.Error);
//couldn't load, hard abort!
Exit();
return;
@ -117,7 +123,8 @@ namespace osu.Game.Screens.Play
pauseOverlay = new PauseOverlay
{
Depth = -1,
OnResume = delegate {
OnResume = delegate
{
Delay(400);
Schedule(Resume);
},
@ -277,9 +284,9 @@ namespace osu.Game.Screens.Play
protected override void OnEntering(GameMode last)
{
base.OnEntering(last);
(Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000);
Background?.FadeTo((100f- dimLevel)/100, 1000);
Background?.FadeTo((100f - dimLevel) / 100, 1000);
Content.Alpha = 0;
dimLevel.ValueChanged += dimChanged;
@ -287,6 +294,8 @@ namespace osu.Game.Screens.Play
protected override bool OnExiting(GameMode next)
{
if (pauseOverlay == null) return false;
if (pauseOverlay.State != Visibility.Visible && !canPause) return true;
if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map

View File

@ -74,7 +74,7 @@ namespace osu.Game.Screens.Select
{
Name = "Length",
Icon = FontAwesome.fa_clock_o,
Content = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
}));
labels.Add(new InfoLabel(new BeatmapStatistic