Merge branch 'master' into do_not_check_cursor_visibility_on_each_update

This commit is contained in:
Dan Balasescu 2019-08-01 19:46:01 +09:00 committed by GitHub
commit 67b6964eb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 32 additions and 59 deletions

View File

@ -11,7 +11,6 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@ -108,7 +107,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
case ModType.Fun:
return new Mod[]
{
new MultiMod(new ModWindUp<CatchHitObject>(), new ModWindDown<CatchHitObject>())
new MultiMod(new ModWindUp(), new ModWindDown())
};
default:

View File

@ -13,7 +13,6 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Graphics;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@ -154,7 +153,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
case ModType.Fun:
return new Mod[]
{
new MultiMod(new ModWindUp<ManiaHitObject>(), new ModWindDown<ManiaHitObject>())
new MultiMod(new ModWindUp(), new ModWindDown())
};
default:

View File

@ -10,7 +10,7 @@
namespace osu.Game.Rulesets.Mania.Mods
{
public class ManiaModMirror : Mod, IApplicableToBeatmap<ManiaHitObject>
public class ManiaModMirror : Mod, IApplicableToBeatmap
{
public override string Name => "Mirror";
public override string Acronym => "MR";
@ -18,7 +18,7 @@ public class ManiaModMirror : Mod, IApplicableToBeatmap<ManiaHitObject>
public override double ScoreMultiplier => 1;
public override bool Ranked => true;
public void ApplyToBeatmap(Beatmap<ManiaHitObject> beatmap)
public void ApplyToBeatmap(IBeatmap beatmap)
{
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;

View File

@ -13,7 +13,7 @@
namespace osu.Game.Rulesets.Mania.Mods
{
public class ManiaModRandom : Mod, IApplicableToBeatmap<ManiaHitObject>
public class ManiaModRandom : Mod, IApplicableToBeatmap
{
public override string Name => "Random";
public override string Acronym => "RD";
@ -22,7 +22,7 @@ public class ManiaModRandom : Mod, IApplicableToBeatmap<ManiaHitObject>
public override string Description => @"Shuffle around the keys!";
public override double ScoreMultiplier => 1;
public void ApplyToBeatmap(Beatmap<ManiaHitObject> beatmap)
public void ApplyToBeatmap(IBeatmap beatmap)
{
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(item => RNG.Next()).ToList();

View File

@ -14,7 +14,6 @@
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Beatmaps.Legacy;
@ -136,7 +135,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
new OsuModWiggle(),
new OsuModSpinIn(),
new MultiMod(new OsuModGrow(), new OsuModDeflate()),
new MultiMod(new ModWindUp<OsuHitObject>(), new ModWindDown<OsuHitObject>()),
new MultiMod(new ModWindUp(), new ModWindDown()),
};
case ModType.System:

View File

@ -12,7 +12,6 @@
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Bindings;
using osu.Game.Rulesets.Replays.Types;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Replays;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets.Difficulty;
@ -107,7 +106,7 @@ public override IEnumerable<Mod> GetModsFor(ModType type)
case ModType.Fun:
return new Mod[]
{
new MultiMod(new ModWindUp<TaikoHitObject>(), new ModWindDown<TaikoHitObject>())
new MultiMod(new ModWindUp(), new ModWindDown())
};
default:

View File

@ -141,6 +141,9 @@ public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods)
processor?.PostProcess();
foreach (var mod in mods.OfType<IApplicableToBeatmap>())
mod.ApplyToBeatmap(converted);
return converted;
}

View File

@ -27,6 +27,7 @@ public enum BeatmapSetType
{
Favourite,
RankedAndApproved,
Loved,
Unranked,
Graveyard
}

View File

@ -18,6 +18,7 @@ public BeatmapsSection()
{
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, "Loved Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Unranked, User, "Pending Beatmaps"),
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, "Graveyarded Beatmaps"),
};

View File

@ -2,21 +2,18 @@
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
/// <summary>
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/>
/// after conversion and post-processing has completed.
/// Interface for a <see cref="Mod"/> that applies changes to a <see cref="Beatmap"/> after conversion and post-processing has completed.
/// </summary>
public interface IApplicableToBeatmap<TObject> : IApplicableMod
where TObject : HitObject
public interface IApplicableToBeatmap : IApplicableMod
{
/// <summary>
/// Applies this <see cref="IApplicableToBeatmap{TObject}"/> to a <see cref="Beatmap{TObject}"/>.
/// Applies this <see cref="IApplicableToBeatmap"/> to an <see cref="IBeatmap"/>.
/// </summary>
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> to apply to.</param>
void ApplyToBeatmap(Beatmap<TObject> beatmap);
/// <param name="beatmap">The <see cref="IBeatmap"/> to apply to.</param>
void ApplyToBeatmap(IBeatmap beatmap);
}
}

View File

@ -13,27 +13,21 @@
namespace osu.Game.Rulesets.Mods
{
public abstract class ModTimeRamp : Mod
public abstract class ModTimeRamp : Mod, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap
{
public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
protected abstract double FinalRateAdjustment { get; }
}
public abstract class ModTimeRamp<T> : ModTimeRamp, IUpdatableByPlayfield, IApplicableToClock, IApplicableToBeatmap<T>
where T : HitObject
{
private double finalRateTime;
private double beginRampTime;
private IAdjustableClock clock;
/// <summary>
/// The point in the beatmap at which the final ramping rate should be reached.
/// </summary>
private const double final_rate_progress = 0.75f;
public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
protected abstract double FinalRateAdjustment { get; }
private double finalRateTime;
private double beginRampTime;
private IAdjustableClock clock;
public virtual void ApplyToClock(IAdjustableClock clock)
{
this.clock = clock;
@ -44,7 +38,7 @@ public virtual void ApplyToClock(IAdjustableClock clock)
applyAdjustment(1);
}
public virtual void ApplyToBeatmap(Beatmap<T> beatmap)
public virtual void ApplyToBeatmap(IBeatmap beatmap)
{
HitObject lastObject = beatmap.HitObjects.LastOrDefault();

View File

@ -4,12 +4,10 @@
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
public class ModWindDown<T> : ModTimeRamp<T>
where T : HitObject
public class ModWindDown : ModTimeRamp
{
public override string Name => "Wind Down";
public override string Acronym => "WD";
@ -19,6 +17,6 @@ public class ModWindDown<T> : ModTimeRamp<T>
protected override double FinalRateAdjustment => -0.25;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp<T>)).ToArray();
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
}
}

View File

@ -4,12 +4,10 @@
using System;
using System.Linq;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Rulesets.Mods
{
public class ModWindUp<T> : ModTimeRamp<T>
where T : HitObject
public class ModWindUp : ModTimeRamp
{
public override string Name => "Wind Up";
public override string Acronym => "WU";
@ -19,6 +17,6 @@ public class ModWindUp<T> : ModTimeRamp<T>
protected override double FinalRateAdjustment => 0.5;
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown<T>)).ToArray();
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown)).ToArray();
}
}

View File

@ -109,8 +109,6 @@ protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap, IReadO
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
applyBeatmapMods(mods);
KeyBindingInputManager = CreateInputManager();
playfield = new Lazy<Playfield>(CreatePlayfield);
@ -269,19 +267,6 @@ public void Attach(KeyCounterDisplay keyCounter) =>
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor<TObject>(this);
/// <summary>
/// Applies the active mods to the Beatmap.
/// </summary>
/// <param name="mods"></param>
private void applyBeatmapMods(IReadOnlyList<Mod> mods)
{
if (mods == null)
return;
foreach (var mod in mods.OfType<IApplicableToBeatmap<TObject>>())
mod.ApplyToBeatmap(Beatmap);
}
/// <summary>
/// Applies the active mods to this DrawableRuleset.
/// </summary>