Add class constraint

This commit is contained in:
smoogipoo 2020-08-06 17:02:42 +09:00
parent fe8c462498
commit e8ab3cff3c
3 changed files with 5 additions and 3 deletions

View File

@ -11,6 +11,6 @@ namespace osu.Game.Rulesets.Mods
/// </summary>
public interface IApplicableToTrack : IApplicableMod
{
void ApplyToTrack<T>(T track) where T : ITrack, IAdjustableAudioComponent;
void ApplyToTrack<T>(T track) where T : class, ITrack, IAdjustableAudioComponent;
}
}

View File

@ -12,7 +12,8 @@ public abstract class ModRateAdjust : Mod, IApplicableToAudio
{
public abstract BindableNumber<double> SpeedChange { get; }
public virtual void ApplyToTrack<T>(T track) where T : ITrack, IAdjustableAudioComponent
public virtual void ApplyToTrack<T>(T track)
where T : class, ITrack, IAdjustableAudioComponent
{
track.AddAdjustment(AdjustableProperty.Tempo, SpeedChange);
}

View File

@ -51,7 +51,8 @@ protected ModTimeRamp()
AdjustPitch.BindValueChanged(applyPitchAdjustment);
}
public void ApplyToTrack<T>(T track) where T : ITrack, IAdjustableAudioComponent
public void ApplyToTrack<T>(T track)
where T : class, ITrack, IAdjustableAudioComponent
{
this.track = track;