Skip to content

Commit 44a427f

Browse files
authored
Merge pull request #35399 from smoogipoo/qp-view-beatmap
Fix quick play "view beatmap" not showing beatmap overlay
2 parents 85ab0d6 + 9a08931 commit 44a427f

File tree

3 files changed

+34
-20
lines changed

3 files changed

+34
-20
lines changed

osu.Game.Tests/Visual/Matchmaking/TestSceneBeatmapSelectPanel.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using NUnit.Framework;
55
using osu.Framework.Allocation;
66
using osu.Framework.Graphics;
7+
using osu.Game.Graphics.Cursor;
78
using osu.Game.Online.API;
89
using osu.Game.Online.API.Requests.Responses;
910
using osu.Game.Online.Rooms;
@@ -23,10 +24,17 @@ public void TestBeatmapPanel()
2324
{
2425
BeatmapSelectPanel? panel = null;
2526

26-
AddStep("add panel", () => Child = panel = new BeatmapSelectPanel(new MultiplayerPlaylistItem())
27+
AddStep("add panel", () =>
2728
{
28-
Anchor = Anchor.Centre,
29-
Origin = Anchor.Centre,
29+
Child = new OsuContextMenuContainer
30+
{
31+
RelativeSizeAxes = Axes.Both,
32+
Child = panel = new BeatmapSelectPanel(new MultiplayerPlaylistItem())
33+
{
34+
Anchor = Anchor.Centre,
35+
Origin = Anchor.Centre,
36+
}
37+
};
3038
});
3139

3240
AddStep("add maarvin", () => panel!.AddUser(new APIUser

osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/BeatmapCardMatchmaking.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
22
// See the LICENCE file in the repository root for full licence text.
33

4+
using System.Collections.Generic;
45
using System.Linq;
56
using osu.Framework.Allocation;
67
using osu.Framework.Audio;
@@ -19,6 +20,7 @@
1920
using osu.Game.Graphics.Containers;
2021
using osu.Game.Graphics.Sprites;
2122
using osu.Game.Graphics.UserInterface;
23+
using osu.Game.Localisation;
2224
using osu.Game.Online.API;
2325
using osu.Game.Online.API.Requests.Responses;
2426
using osu.Game.Overlays;
@@ -315,7 +317,7 @@ public override MenuItem[] ContextMenuItems
315317
{
316318
get
317319
{
318-
var items = base.ContextMenuItems.ToList();
320+
List<MenuItem> items = [new OsuMenuItem(ContextMenuStrings.ViewBeatmap, MenuItemType.Highlighted, DefaultAction)];
319321

320322
foreach (var button in buttonContainer.Buttons)
321323
{

osu.Game/Screens/OnlinePlay/Matchmaking/Match/BeatmapSelect/BeatmapSelectPanel.cs

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ public partial class BeatmapSelectPanel : Container
4545

4646
private BeatmapCardMatchmaking? card;
4747

48-
public override bool PropagatePositionalInputSubTree => AllowSelection;
49-
5048
public BeatmapSelectPanel(MultiplayerPlaylistItem item)
5149
{
5250
Item = item;
@@ -119,7 +117,11 @@ private void load(BeatmapLookupCache lookupCache, OverlayColourProvider colourPr
119117
mainContent.Add(card = new BeatmapCardMatchmaking(beatmap)
120118
{
121119
Depth = float.MaxValue,
122-
Action = () => Action?.Invoke(Item),
120+
Action = () =>
121+
{
122+
if (AllowSelection)
123+
Action?.Invoke(Item);
124+
},
123125
});
124126

125127
foreach (var user in users)
@@ -141,11 +143,15 @@ public void RemoveUser(APIUser user)
141143

142144
protected override bool OnHover(HoverEvent e)
143145
{
144-
lighting.FadeTo(0.2f, 50)
145-
.Then()
146-
.FadeTo(0.1f, 300);
146+
if (AllowSelection)
147+
{
148+
lighting.FadeTo(0.2f, 50)
149+
.Then()
150+
.FadeTo(0.1f, 300);
151+
return true;
152+
}
147153

148-
return true;
154+
return base.OnHover(e);
149155
}
150156

151157
protected override void OnHoverLost(HoverLostEvent e)
@@ -157,11 +163,8 @@ protected override void OnHoverLost(HoverLostEvent e)
157163

158164
protected override bool OnMouseDown(MouseDownEvent e)
159165
{
160-
if (e.Button == MouseButton.Left)
161-
{
166+
if (AllowSelection && e.Button == MouseButton.Left)
162167
scaleContainer.ScaleTo(0.95f, 400, Easing.OutExpo);
163-
return true;
164-
}
165168

166169
return base.OnMouseDown(e);
167170
}
@@ -171,16 +174,17 @@ protected override void OnMouseUp(MouseUpEvent e)
171174
base.OnMouseUp(e);
172175

173176
if (e.Button == MouseButton.Left)
174-
{
175177
scaleContainer.ScaleTo(1f, 500, Easing.OutElasticHalf);
176-
}
177178
}
178179

179180
protected override bool OnClick(ClickEvent e)
180181
{
181-
lighting.FadeTo(0.5f, 50)
182-
.Then()
183-
.FadeTo(0.1f, 400);
182+
if (AllowSelection)
183+
{
184+
lighting.FadeTo(0.5f, 50)
185+
.Then()
186+
.FadeTo(0.1f, 400);
187+
}
184188

185189
// pass through to let the beatmap card handle actual click.
186190
return false;

0 commit comments

Comments
 (0)