1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 11:42:56 +08:00

review modifications: change xmldoc wording, configure with enum instead of bool, declare incompatibility with hr

This commit is contained in:
Gabe Livengood 2021-07-26 17:48:03 -04:00
parent 49160e4482
commit c7c261ba03
No known key found for this signature in database
GPG Key ID: 70321B78DAECE683
3 changed files with 29 additions and 12 deletions

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.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Mods;
@ -16,6 +17,8 @@ namespace osu.Game.Rulesets.Osu.Mods
{
public override double ScoreMultiplier => 1.06;
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust), typeof(ModMirror) };
public void ApplyToHitObject(HitObject hitObject)
{
var osuObject = (OsuHitObject)hitObject;

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.Linq;
using osu.Framework.Bindables;
using osu.Game.Configuration;
@ -17,21 +18,34 @@ namespace osu.Game.Rulesets.Osu.Mods
public class OsuModMirror : ModMirror, IApplicableToHitObject
{
public override string Description => "Reflect the playfield.";
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
[SettingSource("Reflect Horizontally", "Reflect the playfield horizontally.")]
public Bindable<bool> ReflectY { get; } = new BindableBool(true);
[SettingSource("Reflect Vertically", "Reflect the playfield vertically.")]
public Bindable<bool> ReflectX { get; } = new BindableBool(false);
[SettingSource("Reflection", "Change the type of reflection.")]
public Bindable<MirrorType> Reflection { get; } = new Bindable<MirrorType>();
public void ApplyToHitObject(HitObject hitObject)
{
if (!(ReflectY.Value || ReflectX.Value))
return; // TODO deselect the mod if possible so replays and submissions don't have purposeless mods attached.
var osuObject = (OsuHitObject)hitObject;
if (ReflectY.Value)
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject);
if (ReflectX.Value)
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject);
switch (Reflection.Value)
{
case MirrorType.Horizontal:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject);
break;
case MirrorType.Vertical:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject);
break;
case MirrorType.Both:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject);
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject);
break;
}
}
public enum MirrorType
{
Horizontal,
Vertical,
Both
}
}
}

View File

@ -106,7 +106,7 @@ namespace osu.Game.Rulesets.Osu.Utils
}
/// <summary>
/// Reflects an OsuHitObject's position horizontally (over the 'y axis').
/// Reflects an OsuHitObject's position horizontally.
/// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param>
/// <returns>The reflected OsuHitObject.</returns>
@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Utils
}
/// <summary>
/// Reflects an OsuHitObject's position vertically (over the 'x axis').
/// Reflects an OsuHitObject's position vertically.
/// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param>
/// <returns>The reflected OsuHitObject.</returns>