1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-05 10:53:10 +08:00

Add safety type check to DrawableScrollingRuleset

This commit is contained in:
Dean Herbert 2019-03-20 11:34:06 +09:00
parent 45b8bfcfd3
commit 936c3e1ed9

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
@ -69,7 +70,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
/// <summary>
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
/// inside this <see cref="DrawableRuleset{TPlayfield,TObject}"/>.
/// inside this <see cref="DrawableRuleset{TObject}"/>.
/// </summary>
/// <returns></returns>
private readonly SortedList<MultiplierControlPoint> controlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
@ -166,6 +167,14 @@ namespace osu.Game.Rulesets.UI.Scrolling
return false;
}
protected override void LoadComplete()
{
base.LoadComplete();
if (!(Playfield is ScrollingPlayfield))
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
}
public bool OnReleased(GlobalAction action) => false;
private class LocalScrollingInfo : IScrollingInfo