1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 17:32:54 +08:00
osu-lazer/osu.Game.Rulesets.Catch/Mods/CatchModNoScope.cs

36 lines
1.3 KiB
C#
Raw Normal View History

// 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 osu.Framework.Bindables;
2022-08-11 04:09:11 +08:00
using osu.Framework.Localisation;
using osu.Game.Rulesets.Mods;
using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.UI;
namespace osu.Game.Rulesets.Catch.Mods
{
2021-11-10 09:10:05 +08:00
public class CatchModNoScope : ModNoScope, IUpdatableByPlayfield
{
2022-08-11 04:09:11 +08:00
public override LocalisableString Description => "Where's the catcher?";
2022-09-26 03:49:22 +08:00
public override BindableInt HiddenComboCount { get; } = new BindableInt(10)
{
MinValue = 0,
MaxValue = 50,
};
2021-11-10 19:00:36 +08:00
public void Update(Playfield playfield)
{
2021-11-10 08:53:30 +08:00
var catchPlayfield = (CatchPlayfield)playfield;
2021-11-10 09:10:05 +08:00
bool shouldAlwaysShowCatcher = IsBreakTime.Value;
2021-11-10 08:53:30 +08:00
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
// AlwaysPresent required for catcher to still act on input when fully hidden.
catchPlayfield.CatcherArea.AlwaysPresent = true;
2021-11-10 08:53:30 +08:00
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
}
}
}