1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:13:31 +08:00

Handle rulesets that don't support composition a bit better

This commit is contained in:
smoogipoo 2017-11-29 18:38:12 +09:00
parent 309eb4edd7
commit ee35422efc
3 changed files with 9 additions and 5 deletions

View File

@ -154,6 +154,7 @@ namespace osu.Game.Screens.Edit
}
currentScreen.Beatmap.BindTo(Beatmap);
currentScreen.ExitRequested = Exit;
screenContainer.Add(currentScreen);
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Logging;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
@ -76,18 +77,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose
};
timeline.Beatmap.BindTo(Beatmap);
Beatmap.ValueChanged += beatmapChanged;
}
private void beatmapChanged(WorkingBeatmap newBeatmap)
{
var ruleset = newBeatmap.BeatmapInfo.Ruleset.CreateInstance();
var composer = ruleset.CreateHitObjectComposer();
var ruleset = newBeatmap.BeatmapInfo.Ruleset?.CreateInstance();
var composer = ruleset?.CreateHitObjectComposer();
if (composer == null)
{
// Todo: Handle this
//throw new InvalidOperationException($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");
ExitRequested?.Invoke();
return;
}

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -10,6 +11,8 @@ namespace osu.Game.Screens.Edit.Screens
{
public class EditorScreen : Container
{
public Action ExitRequested;
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected override Container<Drawable> Content => content;