From 6d65b68100c9f07d5329f7b4dd7db1f63be997fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 25 Apr 2025 10:41:27 +0200 Subject: [PATCH] Fix some weirdness around forced multiplayer elements - Naming wasn't adjusted - When the chat collapsed, the team score display broke due to zero width Partial revert of https://github.com/ppy/osu/commit/da1fc1013e07b8dafb0c409354f9d1cef971e449. --- .../Multiplayer/GameplayChatDisplay.cs | 2 +- .../Multiplayer/MultiplayerPlayer.cs | 24 ++++++++++++++----- osu.Game/Screens/Play/HUDOverlay.cs | 23 +++++++++--------- 3 files changed, 30 insertions(+), 19 deletions(-) diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs index c7b65856e6..7e263b06ad 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/GameplayChatDisplay.cs @@ -38,8 +38,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer public GameplayChatDisplay(Room room) : base(room, leaveChannelOnDispose: false) { + RelativeSizeAxes = Axes.X; Background.Alpha = 0.2f; - Width = width; } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs index d089a8e909..386276720e 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs @@ -8,6 +8,8 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Extensions.ObjectExtensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; @@ -18,6 +20,7 @@ using osu.Game.Screens.Play; using osu.Game.Screens.Ranking; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; +using osuTK; namespace osu.Game.Screens.OnlinePlay.Multiplayer { @@ -70,13 +73,22 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer ScoreProcessor.ApplyNewJudgementsWhenFailed = true; - LoadComponentAsync(chat = new GameplayChatDisplay(Room), HUDOverlay.LeaderboardFlow.Add); - - LoadComponentAsync(teamScoreDisplay = new GameplayMatchScoreDisplay + LoadComponentAsync(new FillFlowContainer { - Expanded = { BindTarget = HUDOverlay.ShowHud }, - Alpha = 0, - }, scoreDisplay => HUDOverlay.LeaderboardFlow.Insert(1, scoreDisplay)); + Width = 260, + Direction = FillDirection.Vertical, + Spacing = new Vector2(5), + Children = new Drawable[] + { + chat = new GameplayChatDisplay(Room), + teamScoreDisplay = new GameplayMatchScoreDisplay + { + Expanded = { BindTarget = HUDOverlay.ShowHud }, + Alpha = 0, + } + } + }, HUDOverlay.TopLeftElements.Add); + LoadComponentAsync(leaderboardProvider, loaded => { AddInternal(loaded); diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index dd6e443249..d108d82a6b 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -86,9 +86,14 @@ namespace osu.Game.Screens.Play private readonly BindableBool replayLoaded = new BindableBool(); private static bool hasShownNotificationOnce; - private readonly FillFlowContainer bottomRightElements; + // The following flows are used to attach fixed non-skinnable elements in particular implementations of the player + // (e.g. replay or multiplayer-specific controls). + // They will make a best-effort attempt to get out of the way of any other skinnable components. + + public readonly FillFlowContainer TopLeftElements; internal readonly FillFlowContainer TopRightElements; + private readonly FillFlowContainer bottomRightElements; internal readonly IBindable IsPlaying = new Bindable(); @@ -101,12 +106,6 @@ namespace osu.Game.Screens.Play [CanBeNull] private readonly SkinnableContainer rulesetComponents; - /// - /// A flow which sits at the left side of the screen to house leaderboard (and related) components. - /// Will automatically be positioned to avoid colliding with top scoring elements. - /// - public readonly FillFlowContainer LeaderboardFlow; - private readonly List hideTargets; /// @@ -177,7 +176,7 @@ namespace osu.Game.Screens.Play PlayerSettingsOverlay = new PlayerSettingsOverlay(), } }, - LeaderboardFlow = new FillFlowContainer + TopLeftElements = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, @@ -191,7 +190,7 @@ namespace osu.Game.Screens.Play if (rulesetComponents != null) hideTargets.Add(rulesetComponents); - hideTargets.Add(LeaderboardFlow); + hideTargets.Add(TopLeftElements); } [BackgroundDependencyLoader(true)] @@ -285,10 +284,10 @@ namespace osu.Game.Screens.Play else TopRightElements.Y = 0; - if (lowestTopScreenSpaceLeft.HasValue && DrawHeight - LeaderboardFlow.DrawHeight > 0) - LeaderboardFlow.Y = Math.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceLeft.Value)).Y, 0, DrawHeight - LeaderboardFlow.DrawHeight); + if (lowestTopScreenSpaceLeft.HasValue && DrawHeight - TopLeftElements.DrawHeight > 0) + TopLeftElements.Y = Math.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceLeft.Value)).Y, 0, DrawHeight - TopLeftElements.DrawHeight); else - LeaderboardFlow.Y = 0; + TopLeftElements.Y = 0; if (highestBottomScreenSpace.HasValue && DrawHeight - bottomRightElements.DrawHeight > 0) bottomRightElements.Y = BottomScoringElementsHeight = -Math.Clamp(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y, 0, DrawHeight - bottomRightElements.DrawHeight);