2019-07-03 18:42:16 +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.
|
|
|
|
|
2019-07-29 00:15:54 +08:00
|
|
|
using System;
|
2019-07-03 18:42:16 +08:00
|
|
|
using osu.Framework.Bindables;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
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
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Adjusts the size of hit objects during their fade in animation.
|
|
|
|
/// </summary>
|
2021-06-28 23:54:21 +08:00
|
|
|
public abstract class OsuModObjectScaleTween : ModWithVisibilityAdjustment, IHidesApproachCircles
|
2019-07-03 18:42:16 +08:00
|
|
|
{
|
|
|
|
public override ModType Type => ModType.Fun;
|
|
|
|
|
|
|
|
public override double ScoreMultiplier => 1;
|
|
|
|
|
2020-07-17 22:12:01 +08:00
|
|
|
public abstract BindableNumber<float> StartScale { get; }
|
2019-07-03 18:42:16 +08:00
|
|
|
|
|
|
|
protected virtual float EndScale => 1;
|
|
|
|
|
2022-04-04 01:14:45 +08:00
|
|
|
public override Type[] IncompatibleMods => new[] { typeof(IRequiresApproachCircles), typeof(OsuModSpinIn), typeof(OsuModObjectScaleTween) };
|
2019-07-29 00:15:54 +08:00
|
|
|
|
2020-11-05 15:03:10 +08:00
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
2019-07-03 18:42:16 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-05 15:03:10 +08:00
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state) => applyCustomState(hitObject, state);
|
|
|
|
|
2020-11-05 14:52:06 +08:00
|
|
|
private void applyCustomState(DrawableHitObject drawable, ArmedState state)
|
2019-07-03 18:42:16 +08:00
|
|
|
{
|
2020-11-05 14:52:06 +08:00
|
|
|
if (drawable is DrawableSpinner)
|
|
|
|
return;
|
2019-07-03 18:42:16 +08:00
|
|
|
|
|
|
|
var h = (OsuHitObject)drawable.HitObject;
|
|
|
|
|
|
|
|
// apply grow effect
|
|
|
|
switch (drawable)
|
|
|
|
{
|
|
|
|
case DrawableSliderHead _:
|
|
|
|
case DrawableSliderTail _:
|
|
|
|
// special cases we should *not* be scaling.
|
|
|
|
break;
|
|
|
|
|
|
|
|
case DrawableSlider _:
|
|
|
|
case DrawableHitCircle _:
|
|
|
|
{
|
2019-07-29 00:15:54 +08:00
|
|
|
using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
2020-07-17 22:12:01 +08:00
|
|
|
drawable.ScaleTo(StartScale.Value).Then().ScaleTo(EndScale, h.TimePreempt, Easing.OutSine);
|
2019-07-03 18:42:16 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove approach circles
|
|
|
|
switch (drawable)
|
|
|
|
{
|
|
|
|
case DrawableHitCircle circle:
|
|
|
|
// we don't want to see the approach circle
|
2019-07-29 00:15:54 +08:00
|
|
|
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt))
|
2019-07-03 18:42:16 +08:00
|
|
|
circle.ApproachCircle.Hide();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|