Skip to content

Commit 432f698

Browse files
committed
Merge branch 'master' into gameplay/key-counter-abstraction
2 parents 6239789 + ff59313 commit 432f698

File tree

6 files changed

+49
-25
lines changed

6 files changed

+49
-25
lines changed

osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs

+5-16
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4-
#nullable disable
5-
64
using osu.Framework.Input.Events;
75
using osu.Game.Rulesets.Edit;
86
using osu.Game.Rulesets.Taiko.Objects;
@@ -35,20 +33,11 @@ protected override void LoadComplete()
3533

3634
protected override bool OnMouseDown(MouseDownEvent e)
3735
{
38-
switch (e.Button)
39-
{
40-
case MouseButton.Left:
41-
HitObject.Type = HitType.Centre;
42-
EndPlacement(true);
43-
return true;
44-
45-
case MouseButton.Right:
46-
HitObject.Type = HitType.Rim;
47-
EndPlacement(true);
48-
return true;
49-
}
50-
51-
return false;
36+
if (e.Button != MouseButton.Left)
37+
return false;
38+
39+
EndPlacement(true);
40+
return true;
5241
}
5342

5443
public override void UpdateTimeAndPosition(SnapResult result)

osu.Game.Tests/Visual/Gameplay/TestSceneReplayPlayer.cs

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using osu.Game.Beatmaps;
99
using osu.Game.Rulesets;
1010
using osu.Game.Rulesets.Osu;
11+
using osu.Game.Scoring;
1112
using osu.Game.Screens.Play;
1213
using osu.Game.Tests.Beatmaps;
1314
using osuTK.Input;
@@ -45,6 +46,18 @@ public void TestPauseViaSpace()
4546
AddAssert("Time still stopped", () => lastTime == Player.GameplayClockContainer.CurrentTime);
4647
}
4748

49+
[Test]
50+
public void TestDoesNotFailOnExit()
51+
{
52+
loadPlayerWithBeatmap();
53+
54+
AddUntilStep("wait for first hit", () => Player.ScoreProcessor.TotalScore.Value > 0);
55+
AddAssert("ensure rank is not fail", () => Player.ScoreProcessor.Rank.Value, () => Is.Not.EqualTo(ScoreRank.F));
56+
AddStep("exit player", () => Player.Exit());
57+
AddUntilStep("wait for exit", () => Player.Parent == null);
58+
AddAssert("ensure rank is not fail", () => Player.ScoreProcessor.Rank.Value, () => Is.Not.EqualTo(ScoreRank.F));
59+
}
60+
4861
[Test]
4962
public void TestPauseViaSpaceWithSkip()
5063
{

osu.Game.Tests/Visual/Menus/TestSceneToolbar.cs

+13
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,19 @@ public void TestRulesetSwitchingShortcut(bool toolbarHidden)
114114
}
115115
}
116116

117+
[TestCase(OverlayActivation.All)]
118+
[TestCase(OverlayActivation.Disabled)]
119+
public void TestButtonKeyboardInputRespectsOverlayActivation(OverlayActivation mode)
120+
{
121+
AddStep($"set activation mode to {mode}", () => toolbar.OverlayActivationMode.Value = mode);
122+
AddStep("hide toolbar", () => toolbar.Hide());
123+
124+
if (mode == OverlayActivation.Disabled)
125+
AddAssert("check buttons not accepting input", () => InputManager.NonPositionalInputQueue.OfType<ToolbarButton>().Count(), () => Is.Zero);
126+
else
127+
AddAssert("check buttons accepting input", () => InputManager.NonPositionalInputQueue.OfType<ToolbarButton>().Count(), () => Is.Not.Zero);
128+
}
129+
117130
[TestCase(OverlayActivation.All)]
118131
[TestCase(OverlayActivation.Disabled)]
119132
public void TestRespectsOverlayActivation(OverlayActivation mode)

osu.Game/Overlays/Toolbar/Toolbar.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public partial class Toolbar : OverlayContainer, IKeyBindingHandler<GlobalAction
4242
protected readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
4343

4444
// Toolbar and its components need keyboard input even when hidden.
45-
public override bool PropagateNonPositionalInputSubTree => true;
45+
public override bool PropagateNonPositionalInputSubTree => OverlayActivationMode.Value != OverlayActivation.Disabled;
4646

4747
public Toolbar()
4848
{

osu.Game/Rulesets/UI/DrawableRulesetDependencies.cs

+16-7
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,26 @@ public RulesetShaderManager(IRenderer renderer, NamespacedResourceStore<byte[]>
206206
this.parent = parent;
207207
}
208208

209+
// When the debugger is attached, exceptions are expensive.
210+
// Manually work around this by caching failed lookups and falling back straight to parent.
211+
private readonly HashSet<(string, string)> failedLookups = new HashSet<(string, string)>();
212+
209213
public override IShader Load(string vertex, string fragment)
210214
{
211-
try
212-
{
213-
return base.Load(vertex, fragment);
214-
}
215-
catch
215+
if (!failedLookups.Contains((vertex, fragment)))
216216
{
217-
// Shader lookup is very non-standard. Rather than returning null on missing shaders, exceptions are thrown.
218-
return parent.Load(vertex, fragment);
217+
try
218+
{
219+
return base.Load(vertex, fragment);
220+
}
221+
catch
222+
{
223+
// Shader lookup is very non-standard. Rather than returning null on missing shaders, exceptions are thrown.
224+
failedLookups.Add((vertex, fragment));
225+
}
219226
}
227+
228+
return parent.Load(vertex, fragment);
220229
}
221230
}
222231
}

osu.Game/Screens/Play/Player.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ public override bool OnExiting(ScreenExitEvent e)
11141114
GameplayState.HasQuit = true;
11151115

11161116
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
1117-
if (prepareScoreForDisplayTask == null)
1117+
if (prepareScoreForDisplayTask == null && DrawableRuleset.ReplayScore == null)
11181118
ScoreProcessor.FailScore(Score.ScoreInfo);
11191119
}
11201120

0 commit comments

Comments
 (0)