2021-07-26 08:40:50 +08: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-27 05:48:03 +08:00
|
|
|
using System;
|
2021-07-26 22:46:41 +08:00
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Game.Configuration;
|
2021-07-26 08:40:50 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
2021-07-26 22:46:41 +08:00
|
|
|
using osu.Game.Rulesets.Osu.Utils;
|
2021-07-26 08:40:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
|
|
|
public class OsuModMirror : ModMirror, IApplicableToHitObject
|
|
|
|
{
|
2021-07-28 18:19:28 +08:00
|
|
|
public override string Description => "Flip objects on the chosen axes.";
|
2021-07-27 05:48:03 +08:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock) };
|
2021-07-26 22:46:41 +08:00
|
|
|
|
2021-07-28 18:19:28 +08:00
|
|
|
[SettingSource("Mirrored axes", "Choose which axes objects are mirrored over.")]
|
2021-07-27 05:48:03 +08:00
|
|
|
public Bindable<MirrorType> Reflection { get; } = new Bindable<MirrorType>();
|
2021-07-26 22:46:41 +08:00
|
|
|
|
2021-07-26 08:40:50 +08:00
|
|
|
public void ApplyToHitObject(HitObject hitObject)
|
|
|
|
{
|
|
|
|
var osuObject = (OsuHitObject)hitObject;
|
2021-07-27 23:14:05 +08:00
|
|
|
|
2021-07-27 05:48:03 +08:00
|
|
|
switch (Reflection.Value)
|
|
|
|
{
|
|
|
|
case MirrorType.Horizontal:
|
2021-07-27 21:01:01 +08:00
|
|
|
OsuHitObjectGenerationUtils.ReflectHorizontally(osuObject);
|
2021-07-27 05:48:03 +08:00
|
|
|
break;
|
2021-07-27 21:01:01 +08:00
|
|
|
|
2021-07-27 05:48:03 +08:00
|
|
|
case MirrorType.Vertical:
|
2021-07-27 21:01:01 +08:00
|
|
|
OsuHitObjectGenerationUtils.ReflectVertically(osuObject);
|
2021-07-27 05:48:03 +08:00
|
|
|
break;
|
2021-07-27 21:01:01 +08:00
|
|
|
|
2021-07-27 05:48:03 +08:00
|
|
|
case MirrorType.Both:
|
2021-07-27 21:01:01 +08:00
|
|
|
OsuHitObjectGenerationUtils.ReflectHorizontally(osuObject);
|
|
|
|
OsuHitObjectGenerationUtils.ReflectVertically(osuObject);
|
2021-07-27 05:48:03 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public enum MirrorType
|
|
|
|
{
|
|
|
|
Horizontal,
|
|
|
|
Vertical,
|
|
|
|
Both
|
2021-07-26 08:40:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|