mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:35:35 +08:00
Allow scores to open beatmap overlay
Reshuffles depth of beatmap and profile overlays for now.
This commit is contained in:
parent
7550b461e3
commit
15373c71b6
@ -188,8 +188,8 @@ namespace osu.Game
|
||||
GetToolbarHeight = () => ToolbarOffset,
|
||||
Depth = -1
|
||||
}, overlayContent.Add);
|
||||
LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -2 }, mainContent.Add);
|
||||
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -3 }, mainContent.Add);
|
||||
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add);
|
||||
LoadComponentAsync(beatmapSetOverlay = new BeatmapSetOverlay { Depth = -3 }, mainContent.Add);
|
||||
LoadComponentAsync(musicController = new MusicController
|
||||
{
|
||||
Depth = -4,
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -11,7 +12,10 @@ using osu.Framework.Input;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -23,6 +27,9 @@ namespace osu.Game.Overlays
|
||||
private readonly Header header;
|
||||
private readonly Info info;
|
||||
|
||||
private APIAccess api;
|
||||
private RulesetStore rulesets;
|
||||
|
||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
@ -75,6 +82,13 @@ namespace osu.Game.Overlays
|
||||
header.Picker.Beatmap.ValueChanged += b => info.Beatmap = b;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(APIAccess api, RulesetStore rulesets)
|
||||
{
|
||||
this.api = api;
|
||||
this.rulesets = rulesets;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
@ -93,6 +107,14 @@ namespace osu.Game.Overlays
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ShowBeatmapSet(int beatmapSetId)
|
||||
{
|
||||
// todo: display the overlay while we are loading here. we need to support setting BeatmapSet to null for this to work.
|
||||
var req = new GetBeatmapSetRequest(beatmapSetId);
|
||||
req.Success += res => ShowBeatmapSet(res.ToBeatmapSet(rulesets));
|
||||
api.Queue(req);
|
||||
}
|
||||
|
||||
public void ShowBeatmapSet(BeatmapSetInfo set)
|
||||
{
|
||||
header.BeatmapSet = info.BeatmapSet = set;
|
||||
|
@ -12,7 +12,6 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Select.Leaderboards;
|
||||
using System.Linq;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Localisation;
|
||||
using System.Globalization;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -78,7 +77,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour, LocalisationEngine locale)
|
||||
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
|
||||
{
|
||||
stats.Add(new OsuSpriteText
|
||||
{
|
||||
@ -115,7 +114,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
metadata.Add(new OsuHoverContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Action = () => Process.Start($"https://osu.ppy.sh/beatmaps/{score.Beatmap.OnlineBeatmapID}"),
|
||||
Action = () =>
|
||||
{
|
||||
if (score.Beatmap.OnlineBeatmapSetID.HasValue) beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value);
|
||||
},
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
Loading…
Reference in New Issue
Block a user