2019-01-24 08:43:03 +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.
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2021-06-11 07:07:38 +00:00
|
|
|
|
using osu.Framework.Graphics;
|
2018-01-09 04:41:57 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2021-06-11 10:09:40 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects;
|
2021-05-15 03:51:39 +00:00
|
|
|
|
using osu.Game.Rulesets.Objects.Drawables;
|
2021-06-11 10:09:40 +00:00
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
2021-09-17 08:14:56 +00:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
2021-09-17 08:14:56 +00:00
|
|
|
|
using osu.Game.Rulesets.Taiko.UI;
|
|
|
|
|
using osu.Game.Rulesets.UI;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-01-09 04:41:57 +00:00
|
|
|
|
namespace osu.Game.Rulesets.Taiko.Mods
|
|
|
|
|
{
|
2021-09-17 08:14:56 +00:00
|
|
|
|
public class TaikoModHidden : ModHidden, IApplicableToDrawableRuleset<TaikoHitObject>
|
2018-01-09 04:41:57 +00:00
|
|
|
|
{
|
2018-03-14 03:07:03 +00:00
|
|
|
|
public override string Description => @"Beats fade out before you hit them!";
|
2022-07-18 04:22:25 +00:00
|
|
|
|
public override double ScoreMultiplier => UsesDefaultConfiguration ? 1.06 : 1;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
|
2021-09-17 08:27:54 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// How far away from the hit target should hitobjects start to fade out.
|
|
|
|
|
/// Range: [0, 1]
|
|
|
|
|
/// </summary>
|
2021-09-21 06:20:04 +00:00
|
|
|
|
private const float fade_out_start_time = 1f;
|
2021-09-17 08:27:54 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How long hitobjects take to fade out, in terms of the scrolling length.
|
|
|
|
|
/// Range: [0, 1]
|
|
|
|
|
/// </summary>
|
2021-09-21 06:20:04 +00:00
|
|
|
|
private const float fade_out_duration = 0.375f;
|
2021-09-17 08:27:54 +00:00
|
|
|
|
|
2022-08-01 16:48:23 +00:00
|
|
|
|
private DrawableTaikoRuleset drawableRuleset = null!;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
|
2021-09-17 08:14:56 +00:00
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
2021-05-15 03:51:39 +00:00
|
|
|
|
{
|
2021-09-17 08:14:56 +00:00
|
|
|
|
this.drawableRuleset = (DrawableTaikoRuleset)drawableRuleset;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-17 08:14:56 +00:00
|
|
|
|
protected override void ApplyIncreasedVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
2021-06-11 07:07:38 +00:00
|
|
|
|
{
|
2021-09-17 08:39:34 +00:00
|
|
|
|
ApplyNormalVisibilityState(hitObject, state);
|
2021-05-15 03:51:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ApplyNormalVisibilityState(DrawableHitObject hitObject, ArmedState state)
|
|
|
|
|
{
|
2021-06-11 07:07:38 +00:00
|
|
|
|
switch (hitObject)
|
|
|
|
|
{
|
2022-06-24 12:25:23 +00:00
|
|
|
|
case DrawableDrumRollTick:
|
|
|
|
|
case DrawableHit:
|
2021-09-17 08:14:56 +00:00
|
|
|
|
double preempt = drawableRuleset.TimeRange.Value / drawableRuleset.ControlPointAt(hitObject.HitObject.StartTime).Multiplier;
|
2021-09-17 08:27:54 +00:00
|
|
|
|
double start = hitObject.HitObject.StartTime - preempt * fade_out_start_time;
|
|
|
|
|
double duration = preempt * fade_out_duration;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
|
2021-06-16 07:32:59 +00:00
|
|
|
|
using (hitObject.BeginAbsoluteSequence(start))
|
|
|
|
|
{
|
|
|
|
|
hitObject.FadeOut(duration);
|
2021-06-11 07:07:38 +00:00
|
|
|
|
|
2021-06-16 07:32:59 +00:00
|
|
|
|
// DrawableHitObject sets LifetimeEnd to LatestTransformEndTime if it isn't manually changed.
|
|
|
|
|
// in order for the object to not be killed before its actual end time (as the latest transform ends earlier), set lifetime end explicitly.
|
|
|
|
|
hitObject.LifetimeEnd = state == ArmedState.Idle || !hitObject.AllJudged
|
|
|
|
|
? hitObject.HitObject.GetEndTime() + hitObject.HitObject.HitWindows.WindowFor(HitResult.Miss)
|
|
|
|
|
: hitObject.HitStateUpdateTime;
|
|
|
|
|
}
|
2021-06-11 07:07:38 +00:00
|
|
|
|
|
2021-06-16 07:32:59 +00:00
|
|
|
|
break;
|
2021-06-11 07:07:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2018-01-09 04:41:57 +00:00
|
|
|
|
}
|
|
|
|
|
}
|