2019-01-31 09:03:43 +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.
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using osu.Framework.Graphics;
|
2019-03-27 10:29:27 +00:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
2019-01-31 09:03:43 +00:00
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects;
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
{
|
|
|
|
internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects
|
|
|
|
{
|
|
|
|
public override string Name => "Grow";
|
2019-02-14 09:05:23 +00:00
|
|
|
|
2019-01-31 09:03:43 +00:00
|
|
|
public override string Acronym => "GR";
|
2019-02-14 09:05:23 +00:00
|
|
|
|
2019-04-02 10:55:24 +00:00
|
|
|
public override IconUsage Icon => FontAwesome.Solid.ArrowsAltV;
|
2019-02-14 09:05:23 +00:00
|
|
|
|
2019-01-31 09:03:43 +00:00
|
|
|
public override ModType Type => ModType.Fun;
|
2019-02-14 09:05:23 +00:00
|
|
|
|
2019-01-31 09:03:43 +00:00
|
|
|
public override string Description => "Hit them at the right size!";
|
2019-02-14 09:05:23 +00:00
|
|
|
|
2019-01-31 09:03:43 +00:00
|
|
|
public override double ScoreMultiplier => 1;
|
|
|
|
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
{
|
|
|
|
foreach (var drawable in drawables)
|
|
|
|
{
|
2019-02-14 09:05:23 +00:00
|
|
|
switch (drawable)
|
|
|
|
{
|
|
|
|
case DrawableSpinner _:
|
|
|
|
continue;
|
2019-04-01 03:16:05 +00:00
|
|
|
|
2019-02-14 09:05:23 +00:00
|
|
|
default:
|
|
|
|
drawable.ApplyCustomUpdateState += ApplyCustomState;
|
|
|
|
break;
|
|
|
|
}
|
2019-01-31 09:03:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-02-14 09:05:23 +00:00
|
|
|
protected virtual void ApplyCustomState(DrawableHitObject drawable, ArmedState state)
|
2019-01-31 09:58:09 +00:00
|
|
|
{
|
2019-02-14 09:05:23 +00:00
|
|
|
var h = (OsuHitObject)drawable.HitObject;
|
2019-01-31 09:03:43 +00:00
|
|
|
|
2019-02-14 09:47:05 +00:00
|
|
|
// apply grow effect
|
|
|
|
switch (drawable)
|
|
|
|
{
|
|
|
|
case DrawableSliderHead _:
|
|
|
|
case DrawableSliderTail _:
|
|
|
|
// special cases we should *not* be scaling.
|
|
|
|
break;
|
2019-04-01 03:16:05 +00:00
|
|
|
|
2019-02-14 09:47:05 +00:00
|
|
|
case DrawableSlider _:
|
|
|
|
case DrawableHitCircle _:
|
|
|
|
{
|
|
|
|
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
|
|
|
drawable.ScaleTo(0.5f).Then().ScaleTo(1, h.TimePreempt, Easing.OutSine);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2019-01-31 09:03:43 +00:00
|
|
|
|
2019-02-14 09:47:05 +00:00
|
|
|
// remove approach circles
|
2019-02-14 09:05:23 +00:00
|
|
|
switch (drawable)
|
|
|
|
{
|
|
|
|
case DrawableHitCircle circle:
|
|
|
|
// we don't want to see the approach circle
|
|
|
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
|
|
|
circle.ApproachCircle.Hide();
|
|
|
|
break;
|
|
|
|
}
|
2019-01-31 09:03:43 +00:00
|
|
|
}
|
|
|
|
}
|
2019-02-14 09:05:23 +00:00
|
|
|
}
|