mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Hide catcher during banana shower
This commit is contained in:
@ -2,15 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Testing;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Catch.Mods;
|
using osu.Game.Rulesets.Catch.Mods;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -61,47 +58,6 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
|||||||
AddUntilStep("wait for catcher to hide", () => catcherAlphaAlmostEquals(0));
|
AddUntilStep("wait for catcher to hide", () => catcherAlphaAlmostEquals(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestVisibleDuringBananaShower()
|
|
||||||
{
|
|
||||||
CreateModTest(new ModTestData
|
|
||||||
{
|
|
||||||
Mod = new CatchModNoScope
|
|
||||||
{
|
|
||||||
HiddenComboCount = { Value = 0 },
|
|
||||||
},
|
|
||||||
Autoplay = true,
|
|
||||||
PassCondition = () => true,
|
|
||||||
Beatmap = new Beatmap
|
|
||||||
{
|
|
||||||
HitObjects = new List<HitObject>
|
|
||||||
{
|
|
||||||
new Fruit
|
|
||||||
{
|
|
||||||
X = CatchPlayfield.CENTER_X,
|
|
||||||
StartTime = 1000,
|
|
||||||
},
|
|
||||||
new BananaShower
|
|
||||||
{
|
|
||||||
StartTime = 2000,
|
|
||||||
Duration = 2000,
|
|
||||||
},
|
|
||||||
new Fruit
|
|
||||||
{
|
|
||||||
X = CatchPlayfield.CENTER_X,
|
|
||||||
StartTime = 5000,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
AddUntilStep("wait for catcher to hide", () => catcherAlphaAlmostEquals(0));
|
|
||||||
AddUntilStep("wait for start of banana shower", isBananaShower);
|
|
||||||
AddUntilStep("wait for catcher to show", () => catcherAlphaAlmostEquals(1));
|
|
||||||
AddUntilStep("wait for end of banana shower", () => !isBananaShower());
|
|
||||||
AddUntilStep("wait for catcher to hide", () => catcherAlphaAlmostEquals(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestVisibleAfterComboBreak()
|
public void TestVisibleAfterComboBreak()
|
||||||
{
|
{
|
||||||
@ -143,8 +99,6 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
|||||||
AddUntilStep("wait for catcher to show", () => catcherAlphaAlmostEquals(1));
|
AddUntilStep("wait for catcher to show", () => catcherAlphaAlmostEquals(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool isBananaShower() => Player.ChildrenOfType<DrawableBananaShower>().SingleOrDefault() != null;
|
|
||||||
|
|
||||||
private bool isBreak() => Player.IsBreakTime.Value;
|
private bool isBreak() => Player.IsBreakTime.Value;
|
||||||
|
|
||||||
private bool catcherAlphaAlmostEquals(float alpha)
|
private bool catcherAlphaAlmostEquals(float alpha)
|
||||||
|
@ -2,26 +2,20 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Utils;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Mods
|
namespace osu.Game.Rulesets.Catch.Mods
|
||||||
{
|
{
|
||||||
public class CatchModNoScope : ModNoScope, IApplicableToBeatmap, IUpdatableByPlayfield
|
public class CatchModNoScope : ModNoScope, IUpdatableByPlayfield
|
||||||
{
|
{
|
||||||
public override string Description => "Where's the catcher?";
|
public override string Description => "Where's the catcher?";
|
||||||
|
|
||||||
public PeriodTracker BananaShowerPeriods;
|
|
||||||
|
|
||||||
[SettingSource(
|
[SettingSource(
|
||||||
"Hidden at combo",
|
"Hidden at combo",
|
||||||
"The combo count at which the catcher becomes completely hidden",
|
"The combo count at which the catcher becomes completely hidden",
|
||||||
@ -35,15 +29,10 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
MaxValue = 50,
|
MaxValue = 50,
|
||||||
};
|
};
|
||||||
|
|
||||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
|
||||||
{
|
|
||||||
BananaShowerPeriods = new PeriodTracker(beatmap.HitObjects.OfType<BananaShower>().Select(b => new Period(b.StartTime - TRANSITION_DURATION, b.EndTime)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Update(Playfield playfield)
|
public virtual void Update(Playfield playfield)
|
||||||
{
|
{
|
||||||
var catchPlayfield = (CatchPlayfield)playfield;
|
var catchPlayfield = (CatchPlayfield)playfield;
|
||||||
bool shouldAlwaysShowCatcher = IsBreakTime.Value || BananaShowerPeriods.IsInAny(catchPlayfield.Clock.CurrentTime);
|
bool shouldAlwaysShowCatcher = IsBreakTime.Value;
|
||||||
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
||||||
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user