1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-10 21:40:34 +08:00

Merge pull request #32219 from peppy/lounge-minor-redesign

Adjust scale and display of rooms in multiplayer lounge
This commit is contained in:
Dan Balasescu 2025-03-04 17:19:58 +09:00 committed by GitHub
commit e0e7d92e79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 90 additions and 39 deletions

View File

@ -45,14 +45,20 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
private readonly ScrollContainer<Drawable> scroll;
private readonly FillFlowContainer<DrawableLoungeRoom> roomFlow;
private const float display_scale = 0.8f;
// handle deselection
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public RoomListing()
{
InternalChild = scroll = new OsuScrollContainer
InternalChild = scroll = new Scroll
{
Masking = false,
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Width = display_scale,
ScrollbarOverlapsContent = false,
Padding = new MarginPadding { Right = 5 },
Child = new OsuContextMenuContainer
@ -64,12 +70,18 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(10),
Spacing = new Vector2(5),
Margin = new MarginPadding { Vertical = 10 },
}
}
};
}
private partial class Scroll : OsuScrollContainer
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
}
protected override void LoadComplete()
{
SelectedRoom.BindValueChanged(onSelectedRoomChanged, true);
@ -171,7 +183,14 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
{
foreach (var room in rooms)
{
var drawableRoom = new DrawableLoungeRoom(room) { SelectedRoom = selectedRoom };
var drawableRoom = new DrawableLoungeRoom(room)
{
SelectedRoom = selectedRoom,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(display_scale),
Width = 1 / display_scale,
};
roomFlow.Add(drawableRoom);

View File

@ -8,9 +8,12 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Logging;
@ -27,6 +30,7 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
using osu.Game.Screens.OnlinePlay.Match;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.OnlinePlay.Lounge
{
@ -85,11 +89,15 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
[BackgroundDependencyLoader(true)]
private void load()
{
Masking = true;
const float controls_area_height = 25f;
if (idleTracker != null)
isIdle.BindTo(idleTracker.IsIdle);
Color4 bg = Color4Extensions.FromHex("#070405");
InternalChildren = new Drawable[]
{
listingPoller = new LoungeListingPoller
@ -113,56 +121,80 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
}
},
loadingLayer = new LoadingLayer(true),
new FillFlowContainer
new Container
{
Name = @"Header area flow",
Name = "Header area",
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new Container
new Box
{
RelativeSizeAxes = Axes.X,
Height = Header.HEIGHT,
Child = searchTextBox = new BasicSearchTextBox
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.X,
Width = 0.6f,
},
Colour = ColourInfo.GradientVertical(bg, bg.Opacity(0.75f)),
RelativeSizeAxes = Axes.Both,
Height = 0.8f,
},
new Container
new Box
{
Colour = ColourInfo.GradientVertical(bg.Opacity(0.75f), bg.Opacity(0)),
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Y = 0.8f,
// Intentionally taller than the header for a more gradual fade
Height = 0.5f,
},
new FillFlowContainer
{
Name = @"Header area flow",
RelativeSizeAxes = Axes.X,
Height = controls_area_height,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = WaveOverlayContainer.WIDTH_PADDING },
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
Buttons.WithChild(CreateNewRoomButton().With(d =>
new Container
{
d.Anchor = Anchor.BottomLeft;
d.Origin = Anchor.BottomLeft;
d.Size = new Vector2(150, 37.5f);
d.Action = () => Open();
})),
new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10),
ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
RelativeSizeAxes = Axes.X,
Height = Header.HEIGHT,
Child = searchTextBox = new BasicSearchTextBox
{
d.Anchor = Anchor.TopRight;
d.Origin = Anchor.TopRight;
}))
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.X,
Width = 0.6f,
},
},
new Container
{
RelativeSizeAxes = Axes.X,
Height = controls_area_height,
Children = new Drawable[]
{
Buttons.WithChild(CreateNewRoomButton().With(d =>
{
d.Anchor = Anchor.BottomLeft;
d.Origin = Anchor.BottomLeft;
d.Size = new Vector2(150, 37.5f);
d.Action = () => Open();
})),
new FillFlowContainer
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10),
ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
{
d.Anchor = Anchor.TopRight;
d.Origin = Anchor.TopRight;
}))
}
}
}
}
}
},
},
},
}
},
};
}