1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

review modifications: change xmldocs, change reflection method name, remove reflection method returns, simplify incompat. mod list

This commit is contained in:
Gabe Livengood 2021-07-27 09:01:01 -04:00
parent c7c261ba03
commit c741366c72
No known key found for this signature in database
GPG Key ID: 70321B78DAECE683
3 changed files with 16 additions and 20 deletions

View File

@ -17,13 +17,13 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
public override double ScoreMultiplier => 1.06; public override double ScoreMultiplier => 1.06;
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust), typeof(ModMirror) }; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModMirror)).ToArray();
public void ApplyToHitObject(HitObject hitObject) public void ApplyToHitObject(HitObject hitObject)
{ {
var osuObject = (OsuHitObject)hitObject; var osuObject = (OsuHitObject)hitObject;
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject); OsuHitObjectGenerationUtils.ReflectVertically(osuObject);
} }
} }
} }

View File

@ -29,14 +29,16 @@ namespace osu.Game.Rulesets.Osu.Mods
switch (Reflection.Value) switch (Reflection.Value)
{ {
case MirrorType.Horizontal: case MirrorType.Horizontal:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject); OsuHitObjectGenerationUtils.ReflectHorizontally(osuObject);
break; break;
case MirrorType.Vertical: case MirrorType.Vertical:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject); OsuHitObjectGenerationUtils.ReflectVertically(osuObject);
break; break;
case MirrorType.Both: case MirrorType.Both:
OsuHitObjectGenerationUtils.ReflectOsuHitObjectHorizontally(osuObject); OsuHitObjectGenerationUtils.ReflectHorizontally(osuObject);
OsuHitObjectGenerationUtils.ReflectOsuHitObjectVertically(osuObject); OsuHitObjectGenerationUtils.ReflectVertically(osuObject);
break; break;
} }
} }

View File

@ -106,16 +106,15 @@ namespace osu.Game.Rulesets.Osu.Utils
} }
/// <summary> /// <summary>
/// Reflects an OsuHitObject's position horizontally. /// Reflects the position of the <see cref="OsuHitObject"/> in the playfield vertically.
/// </summary> /// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param> /// <param name="osuObject">The object to reflect.</param>
/// <returns>The reflected OsuHitObject.</returns> public static void ReflectHorizontally(OsuHitObject osuObject)
public static OsuHitObject ReflectOsuHitObjectHorizontally(OsuHitObject osuObject)
{ {
osuObject.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - osuObject.X, osuObject.Position.Y); osuObject.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - osuObject.X, osuObject.Position.Y);
if (!(osuObject is Slider slider)) if (!(osuObject is Slider slider))
return osuObject; return;
slider.NestedHitObjects.OfType<SliderTick>().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y)); slider.NestedHitObjects.OfType<SliderTick>().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y));
slider.NestedHitObjects.OfType<SliderRepeat>().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y)); slider.NestedHitObjects.OfType<SliderRepeat>().ForEach(h => h.Position = new Vector2(OsuPlayfield.BASE_SIZE.X - h.Position.X, h.Position.Y));
@ -125,21 +124,18 @@ namespace osu.Game.Rulesets.Osu.Utils
point.Position.Value = new Vector2(-point.Position.Value.X, point.Position.Value.Y); point.Position.Value = new Vector2(-point.Position.Value.X, point.Position.Value.Y);
slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value); slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value);
return osuObject;
} }
/// <summary> /// <summary>
/// Reflects an OsuHitObject's position vertically. /// Reflects the position of the <see cref="OsuHitObject"/> in the playfield horizontally.
/// </summary> /// </summary>
/// <param name="osuObject">The OsuHitObject to be reflected.</param> /// <param name="osuObject">The object to reflect.</param>
/// <returns>The reflected OsuHitObject.</returns> public static void ReflectVertically(OsuHitObject osuObject)
public static OsuHitObject ReflectOsuHitObjectVertically(OsuHitObject osuObject)
{ {
osuObject.Position = new Vector2(osuObject.Position.X, OsuPlayfield.BASE_SIZE.Y - osuObject.Y); osuObject.Position = new Vector2(osuObject.Position.X, OsuPlayfield.BASE_SIZE.Y - osuObject.Y);
if (!(osuObject is Slider slider)) if (!(osuObject is Slider slider))
return osuObject; return;
slider.NestedHitObjects.OfType<SliderTick>().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); slider.NestedHitObjects.OfType<SliderTick>().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y));
slider.NestedHitObjects.OfType<SliderRepeat>().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y)); slider.NestedHitObjects.OfType<SliderRepeat>().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Position.Y));
@ -149,8 +145,6 @@ namespace osu.Game.Rulesets.Osu.Utils
point.Position.Value = new Vector2(point.Position.Value.X, -point.Position.Value.Y); point.Position.Value = new Vector2(point.Position.Value.X, -point.Position.Value.Y);
slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value); slider.Path = new SliderPath(controlPoints, slider.Path.ExpectedDistance.Value);
return osuObject;
} }
} }
} }