mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:02:55 +08:00
Merge pull request #13514 from peppy/mod-approach-different
Add osu! mod "Approach Different"
This commit is contained in:
commit
635b3cdf1c
102
osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs
Normal file
102
osu.Game.Rulesets.Osu/Mods/OsuModApproachDifferent.cs
Normal file
@ -0,0 +1,102 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public class OsuModApproachDifferent : Mod, IApplicableToDrawableHitObjects
|
||||
{
|
||||
public override string Name => "Approach Different";
|
||||
public override string Acronym => "AD";
|
||||
public override string Description => "Never trust the approach circles...";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override IconUsage? Icon { get; } = FontAwesome.Regular.Circle;
|
||||
|
||||
[SettingSource("Initial size", "Change the initial size of the approach circle, relative to hit circles.", 0)]
|
||||
public BindableFloat Scale { get; } = new BindableFloat(4)
|
||||
{
|
||||
Precision = 0.1f,
|
||||
MinValue = 2,
|
||||
MaxValue = 10,
|
||||
};
|
||||
|
||||
[SettingSource("Style", "Change the animation style of the approach circles.", 1)]
|
||||
public Bindable<AnimationStyle> Style { get; } = new Bindable<AnimationStyle>();
|
||||
|
||||
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||
{
|
||||
drawables.ForEach(drawable =>
|
||||
{
|
||||
drawable.ApplyCustomUpdateState += (drawableObject, state) =>
|
||||
{
|
||||
if (!(drawableObject is DrawableHitCircle drawableHitCircle)) return;
|
||||
|
||||
var hitCircle = drawableHitCircle.HitObject;
|
||||
|
||||
drawableHitCircle.ApproachCircle.ClearTransforms(targetMember: nameof(Scale));
|
||||
|
||||
using (drawableHitCircle.BeginAbsoluteSequence(hitCircle.StartTime - hitCircle.TimePreempt))
|
||||
drawableHitCircle.ApproachCircle.ScaleTo(Scale.Value).ScaleTo(1f, hitCircle.TimePreempt, getEasing(Style.Value));
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
private Easing getEasing(AnimationStyle style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
default:
|
||||
return Easing.None;
|
||||
|
||||
case AnimationStyle.Accelerate1:
|
||||
return Easing.In;
|
||||
|
||||
case AnimationStyle.Accelerate2:
|
||||
return Easing.InCubic;
|
||||
|
||||
case AnimationStyle.Accelerate3:
|
||||
return Easing.InQuint;
|
||||
|
||||
case AnimationStyle.Gravity:
|
||||
return Easing.InBack;
|
||||
|
||||
case AnimationStyle.Decelerate1:
|
||||
return Easing.Out;
|
||||
|
||||
case AnimationStyle.Decelerate2:
|
||||
return Easing.OutCubic;
|
||||
|
||||
case AnimationStyle.Decelerate3:
|
||||
return Easing.OutQuint;
|
||||
|
||||
case AnimationStyle.InOut1:
|
||||
return Easing.InOutCubic;
|
||||
|
||||
case AnimationStyle.InOut2:
|
||||
return Easing.InOutQuint;
|
||||
}
|
||||
}
|
||||
|
||||
public enum AnimationStyle
|
||||
{
|
||||
Gravity,
|
||||
InOut1,
|
||||
InOut2,
|
||||
Accelerate1,
|
||||
Accelerate2,
|
||||
Accelerate3,
|
||||
Decelerate1,
|
||||
Decelerate2,
|
||||
Decelerate3,
|
||||
}
|
||||
}
|
||||
}
|
@ -187,6 +187,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||
new OsuModTraceable(),
|
||||
new OsuModBarrelRoll(),
|
||||
new OsuModApproachDifferent(),
|
||||
};
|
||||
|
||||
case ModType.System:
|
||||
|
Loading…
Reference in New Issue
Block a user