mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 22:20:48 +08:00
Add history footer button to quick play rooms
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Screens.Footer;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match
|
||||
{
|
||||
public partial class ScreenMatchmaking
|
||||
{
|
||||
private partial class HistoryFooterButton : ScreenFooterButton
|
||||
{
|
||||
[Resolved]
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
private readonly MultiplayerRoom room;
|
||||
|
||||
public HistoryFooterButton(MultiplayerRoom room)
|
||||
{
|
||||
this.room = room;
|
||||
|
||||
Action = openRoomHistory;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Text = "History";
|
||||
Icon = FontAwesome.Solid.Globe;
|
||||
AccentColour = colours.Lime1;
|
||||
}
|
||||
|
||||
private void openRoomHistory()
|
||||
=> game?.OpenUrlExternally($@"/multiplayer/rooms/{room.RoomID}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
@@ -29,6 +30,7 @@ using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.OnlinePlay.Matchmaking.Match.Gameplay;
|
||||
using osu.Game.Screens.OnlinePlay.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
@@ -164,7 +166,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Size = new Vector2(700, 130),
|
||||
Size = new Vector2(600, 130),
|
||||
Margin = new MarginPadding { Bottom = row_padding }
|
||||
}
|
||||
]
|
||||
@@ -326,6 +328,11 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match
|
||||
return false;
|
||||
}
|
||||
|
||||
public override IReadOnlyList<ScreenFooterButton> CreateFooterButtons() =>
|
||||
[
|
||||
new HistoryFooterButton(room)
|
||||
];
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
base.OnEntering(e);
|
||||
@@ -463,7 +470,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match
|
||||
|
||||
// This component is added to the screen footer which is only about 50px high.
|
||||
// Therefore, it's given a large absolute size to give the context menu enough space to display correctly.
|
||||
Size = new Vector2(700);
|
||||
Size = new Vector2(600);
|
||||
|
||||
InternalChild = new OsuContextMenuContainer
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user