Skip to content

Commit

Permalink
Merge branch 'master' into mania-hitwindow-audio-rate-2
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach authored Sep 4, 2023
2 parents 0a1ba2e + 0da37e4 commit 8df63ee
Show file tree
Hide file tree
Showing 61 changed files with 1,106 additions and 304 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Please make sure you have the following prerequisites:

- A desktop platform with the [.NET 6.0 SDK](https://dotnet.microsoft.com/download) installed.

When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/).
When working with the codebase, we recommend using an IDE with intelligent code completion and syntax highlighting, such as the latest version of [Visual Studio](https://visualstudio.microsoft.com/vs/), [JetBrains Rider](https://www.jetbrains.com/rider/), or [Visual Studio Code](https://code.visualstudio.com/) with the [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig) and [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) plugin installed.

### Downloading the source code

Expand Down
2 changes: 1 addition & 1 deletion osu.Android.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.817.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.823.0" />
</ItemGroup>
<PropertyGroup>
<!-- Fody does not handle Android build well, and warns when unchanged.
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu.Tests/TestSceneHitCircle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public TestDrawableHitCircle(HitCircle h, bool auto, double hitOffset)

protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (auto && !userTriggered && timeOffset > hitOffset && CheckHittable?.Invoke(this, Time.Current) != false)
if (auto && !userTriggered && timeOffset > hitOffset && CheckHittable?.Invoke(this, Time.Current, HitResult.Great) == ClickAction.Hit)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);
Expand Down
81 changes: 71 additions & 10 deletions osu.Game.Rulesets.Osu.Tests/TestSceneHitCircleLateFade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Tests.Visual;
using osuTK;

Expand All @@ -23,7 +24,7 @@ public partial class TestSceneHitCircleLateFade : OsuTestScene
private float? alphaAtMiss;

[Test]
public void TestHitCircleClassicMod()
public void TestHitCircleClassicModMiss()
{
AddStep("Create hit circle", () =>
{
Expand Down Expand Up @@ -61,8 +62,27 @@ public void TestHitCircleClassicAndApproachCircleOnlyHiddenMods()
AddAssert("Transparent when missed", () => alphaAtMiss == 0);
}

/// <summary>
/// No early fade is expected to be applied if the hit circle has been hit.
/// </summary>
[Test]
public void TestHitCircleNoMod()
public void TestHitCircleClassicModHit()
{
TestDrawableHitCircle circle = null!;

AddStep("Create hit circle", () =>
{
SelectedMods.Value = new Mod[] { new OsuModClassic() };
circle = createCircle(true);
});

AddUntilStep("Wait until circle is hit", () => circle.Result?.Type == HitResult.Great);
AddUntilStep("Wait for miss window", () => Clock.CurrentTime, () => Is.GreaterThanOrEqualTo(circle.HitObject.StartTime + circle.HitObject.HitWindows.WindowFor(HitResult.Miss)));
AddAssert("Check circle is still visible", () => circle.Alpha, () => Is.GreaterThan(0));
}

[Test]
public void TestHitCircleNoModMiss()
{
AddStep("Create hit circle", () =>
{
Expand All @@ -74,6 +94,16 @@ public void TestHitCircleNoMod()
AddAssert("Opaque when missed", () => alphaAtMiss == 1);
}

[Test]
public void TestHitCircleNoModHit()
{
AddStep("Create hit circle", () =>
{
SelectedMods.Value = Array.Empty<Mod>();
createCircle(true);
});
}

[Test]
public void TestSliderClassicMod()
{
Expand All @@ -100,27 +130,32 @@ public void TestSliderNoMod()
AddAssert("Head circle opaque when missed", () => alphaAtMiss == 1);
}

private void createCircle()
private TestDrawableHitCircle createCircle(bool shouldHit = false)
{
alphaAtMiss = null;

DrawableHitCircle drawableHitCircle = new DrawableHitCircle(new HitCircle
TestDrawableHitCircle drawableHitCircle = new TestDrawableHitCircle(new HitCircle
{
StartTime = Time.Current + 500,
Position = new Vector2(250)
});
Position = new Vector2(250),
}, shouldHit);

drawableHitCircle.Scale = new Vector2(2f);

foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
mod.ApplyToDrawableHitObject(drawableHitCircle);

drawableHitCircle.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

drawableHitCircle.OnNewResult += (_, _) =>
drawableHitCircle.OnNewResult += (_, result) =>
{
alphaAtMiss = drawableHitCircle.Alpha;
if (!result.IsHit)
alphaAtMiss = drawableHitCircle.Alpha;
};

Child = drawableHitCircle;

return drawableHitCircle;
}

private void createSlider()
Expand All @@ -138,19 +173,45 @@ private void createSlider()
})
});

drawableSlider.Scale = new Vector2(2f);

drawableSlider.HitObject.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());

drawableSlider.OnLoadComplete += _ =>
{
foreach (var mod in SelectedMods.Value.OfType<IApplicableToDrawableHitObject>())
mod.ApplyToDrawableHitObject(drawableSlider.HeadCircle);

drawableSlider.HeadCircle.OnNewResult += (_, _) =>
drawableSlider.HeadCircle.OnNewResult += (_, result) =>
{
alphaAtMiss = drawableSlider.HeadCircle.Alpha;
if (!result.IsHit)
alphaAtMiss = drawableSlider.HeadCircle.Alpha;
};
};

Child = drawableSlider;
}

protected partial class TestDrawableHitCircle : DrawableHitCircle
{
private readonly bool shouldHit;

public TestDrawableHitCircle(HitCircle h, bool shouldHit)
: base(h)
{
this.shouldHit = shouldHit;
}

protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (shouldHit && !userTriggered && timeOffset >= 0)
{
// force success
ApplyResult(r => r.Type = HitResult.Great);
}
else
base.CheckForResult(userTriggered, timeOffset);
}
}
}
}
Loading

0 comments on commit 8df63ee

Please sign in to comment.