1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 21:27:54 +08:00

General fixes.

This commit is contained in:
smoogipooo 2017-03-13 21:05:09 +09:00
parent 7d129ebd6d
commit 842f938439
6 changed files with 14 additions and 40 deletions

View File

@ -76,10 +76,6 @@
<Project>{C92A607B-1FDD-4954-9F92-03FF547D9080}</Project> <Project>{C92A607B-1FDD-4954-9F92-03FF547D9080}</Project>
<Name>osu.Game.Modes.Osu</Name> <Name>osu.Game.Modes.Osu</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\osu.Game.Modes.Taiko\osu.Game.Modes.Taiko.csproj">
<Project>{F167E17A-7DE6-4AF5-B920-A5112296C695}</Project>
<Name>osu.Game.Modes.Taiko</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game\osu.Game.csproj"> <ProjectReference Include="..\osu.Game\osu.Game.csproj">
<Project>{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}</Project> <Project>{0D3FBF8A-7464-4CF7-8C90-3E7886DF2D4D}</Project>
<Name>osu.Game</Name> <Name>osu.Game</Name>

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Modes.Mania.Objects; using osu.Game.Modes.Mania.Objects;
using System.Collections.Generic; using System.Collections.Generic;

View File

@ -1,10 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes.Mods; using osu.Game.Modes.Mods;
using osu.Game.Modes.Osu.Objects; using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.UI;
using System; using System;
using System.Linq; using System.Linq;
@ -88,22 +88,14 @@ namespace osu.Game.Modes.Osu.Mods
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) }; public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
} }
public class OsuModAutoplay : ModAutoplay, IApplyableMod<OsuHitObject> public class OsuModAutoplay : ModAutoplay<OsuHitObject>
{ {
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray(); public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
public void Apply(HitRenderer<OsuHitObject> hitRenderer) protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap) => new Score
{ {
Attach(hitRenderer, new Score Replay = new OsuAutoReplay(beatmap)
{ };
Replay = new OsuAutoReplay(hitRenderer.Beatmap)
});
}
public void Revert(HitRenderer<OsuHitObject> hitRenderer)
{
Detach(hitRenderer);
}
} }
public class OsuModTarget : Mod public class OsuModTarget : Mod

View File

@ -19,11 +19,5 @@ namespace osu.Game.Modes.Mods
/// </summary> /// </summary>
/// <param name="hitRenderer">The HitRenderer to apply the mod to.</param> /// <param name="hitRenderer">The HitRenderer to apply the mod to.</param>
void Apply(HitRenderer<TObject> hitRenderer); 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

@ -1,7 +1,9 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Modes.Objects;
using osu.Game.Modes.UI; using osu.Game.Modes.UI;
using System; using System;
@ -145,24 +147,16 @@ namespace osu.Game.Modes.Mods
public override string Description => "Watch a perfect automated play through the song"; public override string Description => "Watch a perfect automated play through the song";
public override double ScoreMultiplier => 0; public override double ScoreMultiplier => 0;
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) }; public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
}
/// <summary> public abstract class ModAutoplay<T> : ModAutoplay, IApplyableMod<T>
/// Attaches a replay score to a HitRenderer. where T : HitObject
/// </summary> {
/// <param name="hitRenderer">The HitRenderer to attach the score to.</param> protected abstract Score CreateReplayScore(Beatmap<T> beatmap);
/// <param name="score">The score to attach.</param>
protected void Attach(HitRenderer hitRenderer, Score score)
{
hitRenderer.InputManager.ReplayInputHandler = score?.Replay?.GetInputHandler();
}
/// <summary> public void Apply(HitRenderer<T> hitRenderer)
/// Detaches the active replay score from a HitRenderer.
/// </summary>
/// <param name="hitRenderer">The HitRenderer to detach the score from.</param>
protected void Detach(HitRenderer hitRenderer)
{ {
hitRenderer.InputManager.ReplayInputHandler = null; hitRenderer.InputManager.ReplayInputHandler = CreateReplayScore(hitRenderer.Beatmap)?.Replay?.GetInputHandler();
} }
} }

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Modes.Mods namespace osu.Game.Modes.Mods
{ {
public enum ModType public enum ModType