Attempt to fix things.

This commit is contained in:
smoogipooo 2017-03-12 22:38:50 +09:00
parent 447cc17de8
commit 7d129ebd6d
6 changed files with 21 additions and 24 deletions

View File

@ -3,9 +3,7 @@
using osu.Framework.Input.Handlers;
using osu.Game.Beatmaps;
using osu.Game.Modes;
using osu.Game.Modes.Mods;
using osu.Game.Modes.Osu;
using osu.Game.Modes.Osu.Mods;
using osu.Game.Screens.Play;
using System;

View File

@ -1,13 +0,0 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Mods;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.UI;
namespace osu.Game.Modes.Osu.Mods
{
internal interface IApplyableOsuMod : IApplyableMod<HitRenderer<OsuHitObject>>
{
}
}

View File

@ -88,7 +88,7 @@ namespace osu.Game.Modes.Osu.Mods
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
}
public class OsuModAutoplay : ModAutoplay, IApplyableOsuMod
public class OsuModAutoplay : ModAutoplay, IApplyableMod<OsuHitObject>
{
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();

View File

@ -44,7 +44,6 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Beatmaps\OsuBeatmapConverter.cs" />
<Compile Include="Mods\IApplyableOsuMod.cs" />
<Compile Include="Objects\BezierApproximator.cs" />
<Compile Include="Objects\CircularArcApproximator.cs" />
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />

View File

@ -2,14 +2,28 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Modes.Objects;
using osu.Game.Modes.UI;
namespace osu.Game.Modes.Mods
{
public interface IApplyableMod<TRenderer>
where TRenderer : HitRenderer
/// <summary>
/// An interface for mods that are applied to a HitRenderer.
/// </summary>
/// <typeparam name="TObject">The type of HitObject the HitRenderer contains.</typeparam>
public interface IApplyableMod<TObject>
where TObject : HitObject
{
void Apply(TRenderer hitRenderer);
void Revert(TRenderer hitRenderer);
/// <summary>
/// Applies the mod to a HitRenderer.
/// </summary>
/// <param name="hitRenderer">The HitRenderer to apply the mod to.</param>
void Apply(HitRenderer<TObject> hitRenderer);
/// <summary>
/// Reverts any changes applied to a HitRenderer through <see cref="Apply(HitRenderer{TObject})"/>.
/// </summary>
/// <param name="hitRenderer">The HitRenderer to revert from.</param>
void Revert(HitRenderer<TObject> hitRenderer);
}
}

View File

@ -104,10 +104,9 @@ namespace osu.Game.Modes.UI
foreach (var mod in mods)
{
var applyable = mod as IApplyableMod<HitRenderer<TObject>>;
var applyable = mod as IApplyableMod<TObject>;
if (applyable != null)
applyable.Apply(this);
applyable?.Apply(this);
}
}