2021-07-26 00:40:50 +00:00
|
|
|
// 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.
|
|
|
|
|
2021-07-26 21:48:03 +00:00
|
|
|
using System;
|
2021-07-26 00:40:50 +00:00
|
|
|
using System.Linq;
|
2021-07-26 14:46:41 +00:00
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Configuration;
|
2021-07-26 00:40:50 +00:00
|
|
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.UI;
|
2021-07-26 14:46:41 +00:00
|
|
|
using osu.Game.Rulesets.Osu.Utils;
|
2021-07-26 00:40:50 +00:00
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
|
|
|
public class OsuModMirror : ModMirror, IApplicableToHitObject
|
|
|
|
{
|
2021-07-26 14:46:41 +00:00
|
|
|
public override string Description => "Reflect the playfield.";
|
2021-07-26 21:48:03 +00:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
|
2021-07-26 14:46:41 +00:00
|
|
|
|
2021-07-26 21:48:03 +00:00
|
|
|
[SettingSource("Reflection", "Change the type of reflection.")]
|
|
|
|
public Bindable<MirrorType> Reflection { get; } = new Bindable<MirrorType>();
|
2021-07-26 14:46:41 +00:00
|
|
|
|
2021-07-26 00:40:50 +00:00
|
|
|
public void ApplyToHitObject(HitObject hitObject)
|
|
|
|
{
|
|
|
|
var osuObject = (OsuHitObject)hitObject;
|
2021-07-26 21:48:03 +00:00
|
|
|
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
|
2021-07-26 00:40:50 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|