2021-11-09 14:11:19 +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;
|
|
|
|
using System.Linq;
|
2021-11-10 00:57:22 +00:00
|
|
|
using osu.Framework.Bindables;
|
2021-11-09 14:11:19 +00:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
using osu.Framework.Utils;
|
2021-11-10 00:57:22 +00:00
|
|
|
using osu.Game.Configuration;
|
|
|
|
using osu.Game.Overlays.Settings;
|
2021-11-09 14:11:19 +00:00
|
|
|
using osu.Game.Rulesets.Catch.Objects;
|
|
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
|
|
using osu.Game.Rulesets.UI;
|
|
|
|
using osu.Game.Utils;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Catch.Mods
|
|
|
|
{
|
2021-11-10 00:53:30 +00:00
|
|
|
public class CatchModNoScope : ModNoScope, IApplicableToBeatmap, IUpdatableByPlayfield
|
2021-11-09 14:11:19 +00:00
|
|
|
{
|
|
|
|
public override string Description => "Where's the catcher?";
|
|
|
|
|
|
|
|
public PeriodTracker BananaShowerPeriods;
|
|
|
|
|
2021-11-10 00:57:22 +00:00
|
|
|
[SettingSource(
|
|
|
|
"Hidden at combo",
|
|
|
|
"The combo count at which the catcher becomes completely hidden",
|
|
|
|
SettingControlType = typeof(SettingsSlider<int, HiddenComboSlider>)
|
|
|
|
)]
|
|
|
|
public override BindableInt HiddenComboCount { get; } = new BindableInt
|
|
|
|
{
|
|
|
|
Default = 10,
|
|
|
|
Value = 10,
|
|
|
|
MinValue = 0,
|
|
|
|
MaxValue = 50,
|
|
|
|
};
|
|
|
|
|
2021-11-09 14:11:19 +00:00
|
|
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
|
|
|
{
|
|
|
|
BananaShowerPeriods = new PeriodTracker(beatmap.HitObjects.OfType<BananaShower>().Select(b => new Period(b.StartTime - TRANSITION_DURATION, b.EndTime)));
|
|
|
|
}
|
|
|
|
|
2021-11-10 00:53:30 +00:00
|
|
|
public virtual void Update(Playfield playfield)
|
2021-11-09 14:11:19 +00:00
|
|
|
{
|
2021-11-10 00:53:30 +00:00
|
|
|
var catchPlayfield = (CatchPlayfield)playfield;
|
|
|
|
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(catchPlayfield.Clock.CurrentTime);
|
|
|
|
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
|
|
|
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
2021-11-09 14:11:19 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|