2018-09-06 04:54:07 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Osu.Mods
|
|
|
|
|
{
|
|
|
|
|
public class OsuModDeflate : Mod, IApplicableToDrawableHitObjects
|
|
|
|
|
{
|
|
|
|
|
public override string Name => "Deflate";
|
|
|
|
|
public override string ShortenedName => "DF";
|
|
|
|
|
public override FontAwesome Icon => FontAwesome.fa_compress;
|
|
|
|
|
public override ModType Type => ModType.Fun;
|
|
|
|
|
public override string Description => "Become one with the approach circle...";
|
|
|
|
|
public override double ScoreMultiplier => 1;
|
|
|
|
|
|
|
|
|
|
public void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
|
|
|
|
{
|
|
|
|
|
foreach (var drawable in drawables)
|
|
|
|
|
drawable.ApplyCustomUpdateState += drawableOnApplyCustomUpdateState;
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-01 18:29:21 +08:00
|
|
|
|
private void drawableOnApplyCustomUpdateState(DrawableHitObject drawable, ArmedState state)
|
2018-09-06 04:54:07 +08:00
|
|
|
|
{
|
|
|
|
|
if (!(drawable is DrawableHitCircle d))
|
|
|
|
|
return;
|
|
|
|
|
d.ApproachCircle.Hide();
|
|
|
|
|
var h = d.HitObject;
|
|
|
|
|
using (d.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
|
|
|
|
{
|
|
|
|
|
var origScale = d.Scale;
|
2018-09-30 20:29:55 +08:00
|
|
|
|
d.ScaleTo(1.1f, 1) // if duration = 0 then components (i.e. flash) scale with it -> we don't want that
|
|
|
|
|
.Then()
|
2018-09-30 20:46:36 +08:00
|
|
|
|
.ScaleTo(origScale, h.TimePreempt)
|
|
|
|
|
.Then()
|
2018-09-30 20:49:52 +08:00
|
|
|
|
.FadeOut(800)
|
2018-09-30 20:46:36 +08:00
|
|
|
|
.ScaleTo(d.Scale * 1.5f, 400, Easing.OutQuad); // reapply overwritten ScaleTo
|
2018-09-06 04:54:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|