1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 08:02:55 +08:00

Merge branch 'master' into gameplay/key-counter-abstraction

This commit is contained in:
Bartłomiej Dach 2023-04-05 19:45:14 +02:00
commit 432f698697
No known key found for this signature in database
6 changed files with 48 additions and 24 deletions

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Taiko.Objects;
@ -35,20 +33,11 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
protected override bool OnMouseDown(MouseDownEvent e)
{
switch (e.Button)
{
case MouseButton.Left:
HitObject.Type = HitType.Centre;
EndPlacement(true);
return true;
if (e.Button != MouseButton.Left)
return false;
case MouseButton.Right:
HitObject.Type = HitType.Rim;
EndPlacement(true);
return true;
}
return false;
EndPlacement(true);
return true;
}
public override void UpdateTimeAndPosition(SnapResult result)

View File

@ -8,6 +8,7 @@ using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Osu;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;
using osuTK.Input;
@ -45,6 +46,18 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("Time still stopped", () => lastTime == Player.GameplayClockContainer.CurrentTime);
}
[Test]
public void TestDoesNotFailOnExit()
{
loadPlayerWithBeatmap();
AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddAssert("ensure rank is not fail", () => Player.ScoreProcessor.Rank.Value, () => Is.Not.EqualTo(ScoreRank.F));
AddStep("exit player", () => Player.Exit());
AddUntilStep("wait for exit", () => Player.Parent == null);
AddAssert("ensure rank is not fail", () => Player.ScoreProcessor.Rank.Value, () => Is.Not.EqualTo(ScoreRank.F));
}
[Test]
public void TestPauseViaSpaceWithSkip()
{

View File

@ -114,6 +114,19 @@ namespace osu.Game.Tests.Visual.Menus
}
}
[TestCase(OverlayActivation.All)]
[TestCase(OverlayActivation.Disabled)]
public void TestButtonKeyboardInputRespectsOverlayActivation(OverlayActivation mode)
{
AddStep($"set activation mode to {mode}", () => toolbar.OverlayActivationMode.Value = mode);
AddStep("hide toolbar", () => toolbar.Hide());
if (mode == OverlayActivation.Disabled)
AddAssert("check buttons not accepting input", () => InputManager.NonPositionalInputQueue.OfType<ToolbarButton>().Count(), () => Is.Zero);
else
AddAssert("check buttons accepting input", () => InputManager.NonPositionalInputQueue.OfType<ToolbarButton>().Count(), () => Is.Not.Zero);
}
[TestCase(OverlayActivation.All)]
[TestCase(OverlayActivation.Disabled)]
public void TestRespectsOverlayActivation(OverlayActivation mode)

View File

@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Toolbar
protected readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
// Toolbar and its components need keyboard input even when hidden.
public override bool PropagateNonPositionalInputSubTree => true;
public override bool PropagateNonPositionalInputSubTree => OverlayActivationMode.Value != OverlayActivation.Disabled;
public Toolbar()
{

View File

@ -206,17 +206,26 @@ namespace osu.Game.Rulesets.UI
this.parent = parent;
}
// When the debugger is attached, exceptions are expensive.
// Manually work around this by caching failed lookups and falling back straight to parent.
private readonly HashSet<(string, string)> failedLookups = new HashSet<(string, string)>();
public override IShader Load(string vertex, string fragment)
{
try
if (!failedLookups.Contains((vertex, fragment)))
{
return base.Load(vertex, fragment);
}
catch
{
// Shader lookup is very non-standard. Rather than returning null on missing shaders, exceptions are thrown.
return parent.Load(vertex, fragment);
try
{
return base.Load(vertex, fragment);
}
catch
{
// Shader lookup is very non-standard. Rather than returning null on missing shaders, exceptions are thrown.
failedLookups.Add((vertex, fragment));
}
}
return parent.Load(vertex, fragment);
}
}
}

View File

@ -1114,7 +1114,7 @@ namespace osu.Game.Screens.Play
GameplayState.HasQuit = true;
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
if (prepareScoreForDisplayTask == null)
if (prepareScoreForDisplayTask == null && DrawableRuleset.ReplayScore == null)
ScoreProcessor.FailScore(Score.ScoreInfo);
}