2019-01-24 16:43:03 +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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-06-28 16:34:04 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Framework.Graphics;
|
2021-03-25 16:04:35 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
2020-02-19 17:01:59 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
2021-03-25 16:04:35 +08:00
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2019-06-28 16:34:04 +08:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2021-03-25 16:04:35 +08:00
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Mods
|
|
|
|
|
{
|
2021-03-25 16:04:35 +08:00
|
|
|
|
public class CatchModHidden : ModHidden, IApplicableToDrawableRuleset<CatchHitObject>
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
public override string Description => @"Play with fading fruits.";
|
|
|
|
|
public override double ScoreMultiplier => 1.06;
|
2019-06-28 16:34:04 +08:00
|
|
|
|
|
|
|
|
|
private const double fade_out_offset_multiplier = 0.6;
|
|
|
|
|
private const double fade_out_duration_multiplier = 0.44;
|
|
|
|
|
|
2021-03-25 16:04:35 +08:00
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset)
|
|
|
|
|
{
|
|
|
|
|
var drawableCatchRuleset = (DrawableCatchRuleset)drawableRuleset;
|
|
|
|
|
var catchPlayfield = (CatchPlayfield)drawableCatchRuleset.Playfield;
|
|
|
|
|
|
2021-07-19 18:52:40 +08:00
|
|
|
|
catchPlayfield.Catcher.CatchFruitOnPlate = false;
|
2021-03-25 16:04:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-05-15 11:51:39 +08:00
|
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
2021-06-08 15:02:25 +08:00
|
|
|
|
=> ApplyNormalVisibilityState(hitObject, state);
|
2020-11-05 14:36:44 +08:00
|
|
|
|
|
2021-05-15 11:51:39 +08:00
|
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
|
|
|
|
{
|
2020-11-05 14:36:44 +08:00
|
|
|
|
if (!(hitObject is DrawableCatchHitObject catchDrawable))
|
2019-06-28 16:34:04 +08:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (catchDrawable.NestedHitObjects.Any())
|
|
|
|
|
{
|
|
|
|
|
foreach (var nestedDrawable in catchDrawable.NestedHitObjects)
|
|
|
|
|
{
|
|
|
|
|
if (nestedDrawable is DrawableCatchHitObject nestedCatchDrawable)
|
|
|
|
|
fadeOutHitObject(nestedCatchDrawable);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fadeOutHitObject(catchDrawable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void fadeOutHitObject(DrawableCatchHitObject drawable)
|
|
|
|
|
{
|
|
|
|
|
var hitObject = drawable.HitObject;
|
|
|
|
|
|
2021-10-27 12:04:41 +08:00
|
|
|
|
double offset = hitObject.TimePreempt * fade_out_offset_multiplier;
|
|
|
|
|
double duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
|
2019-06-28 16:34:04 +08:00
|
|
|
|
|
2021-05-14 21:23:56 +08:00
|
|
|
|
using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset))
|
2019-06-28 16:34:04 +08:00
|
|
|
|
drawable.FadeOut(duration);
|
|
|
|
|
}
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|