1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 01:49:53 +08:00

Fix failing tests

This commit is contained in:
Salman Ahmed
2023-12-30 07:41:55 +03:00
Unverified
parent 01219fa371
commit 02f5ea200e
3 changed files with 21 additions and 18 deletions
@@ -7,9 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Screens.Play.HUD;
using osu.Game.Skinning;
@@ -24,15 +22,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
protected override double RollingDuration => 500;
protected override Easing RollingEasing => Easing.OutQuint;
private DrawableManiaRuleset maniaRuleset = null!;
bool ISerialisableDrawable.SupportsClosestAnchor => false;
[BackgroundDependencyLoader]
private void load(DrawableRuleset ruleset, ScoreProcessor scoreProcessor)
private void load(ScoreProcessor scoreProcessor)
{
maniaRuleset = (DrawableManiaRuleset)ruleset;
Current.BindTo(scoreProcessor.Combo);
Current.BindValueChanged(combo =>
{
@@ -50,6 +44,9 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
UsesFixedAnchor = true;
}
[Resolved]
private IScrollingInfo scrollingInfo { get; set; } = null!;
private IBindable<ScrollingDirection> direction = null!;
protected override void LoadComplete()
@@ -57,7 +54,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
base.LoadComplete();
text.Alpha = Current.Value > 0 ? 1 : 0;
direction = maniaRuleset.ScrollingInfo.Direction.GetBoundCopy();
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => updateAnchor());
// two schedules are required so that updateAnchor is executed in the next frame,
@@ -3,9 +3,8 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
using osuTK;
@@ -15,15 +14,11 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
{
public partial class LegacyManiaComboCounter : LegacyComboCounter, ISerialisableDrawable
{
private DrawableManiaRuleset maniaRuleset = null!;
bool ISerialisableDrawable.SupportsClosestAnchor => false;
[BackgroundDependencyLoader]
private void load(ISkinSource skin, DrawableRuleset ruleset)
private void load(ISkinSource skin)
{
maniaRuleset = (DrawableManiaRuleset)ruleset;
DisplayedCountText.Anchor = Anchor.Centre;
DisplayedCountText.Origin = Anchor.Centre;
@@ -34,13 +29,16 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
UsesFixedAnchor = true;
}
[Resolved]
private IScrollingInfo scrollingInfo { get; set; } = null!;
private IBindable<ScrollingDirection> direction = null!;
protected override void LoadComplete()
{
base.LoadComplete();
direction = maniaRuleset.ScrollingInfo.Direction.GetBoundCopy();
direction = scrollingInfo.Direction.GetBoundCopy();
direction.BindValueChanged(_ => updateAnchor());
// two schedules are required so that updateAnchor is executed in the next frame,
@@ -50,8 +48,12 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
private void updateAnchor()
{
Anchor &= ~(Anchor.y0 | Anchor.y2);
Anchor |= direction.Value == ScrollingDirection.Up ? Anchor.y2 : Anchor.y0;
// if the anchor isn't a vertical center, set top or bottom anchor based on scroll direction
if (!Anchor.HasFlagFast(Anchor.y1))
{
Anchor &= ~(Anchor.y0 | Anchor.y2);
Anchor |= direction.Value == ScrollingDirection.Up ? Anchor.y2 : Anchor.y0;
}
// since we flip the vertical anchor when changing scroll direction,
// we can use the sign of the Y value as an indicator to make the combo counter displayed correctly.
+4
View File
@@ -32,6 +32,7 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Scoring;
using osu.Game.Scoring.Legacy;
using osu.Game.Screens.Play.HUD;
@@ -224,6 +225,9 @@ namespace osu.Game.Screens.Play
DrawableRuleset = ruleset.CreateDrawableRulesetWith(playableBeatmap, gameplayMods);
dependencies.CacheAs(DrawableRuleset);
if (DrawableRuleset is IDrawableScrollingRuleset scrollingRuleset)
dependencies.CacheAs(scrollingRuleset.ScrollingInfo);
ScoreProcessor = ruleset.CreateScoreProcessor();
ScoreProcessor.Mods.Value = gameplayMods;
ScoreProcessor.ApplyBeatmap(playableBeatmap);