From e240817087c4886de830322fc71d08f2fb2ddb2f Mon Sep 17 00:00:00 2001 From: Dan Balasescu Date: Fri, 24 Oct 2025 18:03:28 +0900 Subject: [PATCH] Move quick play chat entirely to screen footer --- .../TestSceneMatchmakingChatDisplay.cs | 49 +++++++++++++++++++ .../Match/MatchmakingChatDisplay.cs | 20 ++++++++ .../Matchmaking/Match/ScreenMatchmaking.cs | 42 +++++++++------- 3 files changed, 93 insertions(+), 18 deletions(-) create mode 100644 osu.Game.Tests/Visual/Matchmaking/TestSceneMatchmakingChatDisplay.cs diff --git a/osu.Game.Tests/Visual/Matchmaking/TestSceneMatchmakingChatDisplay.cs b/osu.Game.Tests/Visual/Matchmaking/TestSceneMatchmakingChatDisplay.cs new file mode 100644 index 0000000000..d8e42cd946 --- /dev/null +++ b/osu.Game.Tests/Visual/Matchmaking/TestSceneMatchmakingChatDisplay.cs @@ -0,0 +1,49 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Game.Online.Rooms; +using osu.Game.Overlays; +using osu.Game.Screens; +using osu.Game.Screens.OnlinePlay.Matchmaking.Match; +using osuTK; + +namespace osu.Game.Tests.Visual.Matchmaking +{ + public partial class TestSceneMatchmakingChatDisplay : ScreenTestScene + { + private MatchmakingChatDisplay? chat; + + public override void SetUpSteps() + { + base.SetUpSteps(); + + AddStep("add chat", () => + { + chat?.Expire(); + + ScreenFooter.Add(chat = new MatchmakingChatDisplay(new Room()) + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Size = new Vector2(700, 130), + Margin = new MarginPadding { Bottom = 10, Right = WaveOverlayContainer.WIDTH_PADDING - OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, + Alpha = 0 + }); + }); + + AddStep("show footer", () => ScreenFooter.Show()); + } + + [Test] + public void TestAppearDisappear() + { + AddStep("appear", () => chat!.Appear()); + AddWaitStep("wait for animation", 3); + + AddStep("disappear", () => chat!.Disappear()); + AddWaitStep("wait for animation", 3); + } + } +} diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingChatDisplay.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingChatDisplay.cs index 4ff6a3cdf6..6a01642907 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingChatDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/MatchmakingChatDisplay.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Transforms; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Input; @@ -66,5 +68,23 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match public void OnReleased(KeyBindingReleaseEvent e) { } + + public void Appear() + { + FinishTransforms(); + + this.MoveToY(150f) + .FadeOut() + .MoveToY(0f, 240, Easing.OutCubic) + .FadeIn(240, Easing.OutCubic); + } + + public TransformSequence Disappear() + { + FinishTransforms(); + + return this.FadeOut(240, Easing.InOutCubic) + .MoveToY(150f, 240, Easing.InOutCubic); + } } } diff --git a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs index 9292287c3c..56667822d2 100644 --- a/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs +++ b/osu.Game/Screens/OnlinePlay/Matchmaking/Match/ScreenMatchmaking.cs @@ -29,10 +29,10 @@ using osu.Game.Online.Rooms; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; using osu.Game.Rulesets; -using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.OnlinePlay.Matchmaking.Match.Gameplay; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Users; +using osuTK; using osuTK.Input; namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match @@ -87,19 +87,27 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match private MusicController music { get; set; } = null!; private readonly MultiplayerRoom room; + private readonly MatchmakingChatDisplay chat; private Sample? sampleStart; private CancellationTokenSource? downloadCheckCancellation; private int? lastDownloadCheckedBeatmapId; - private MatchChatDisplay chat = null!; - public ScreenMatchmaking(MultiplayerRoom room) { this.room = room; Activity.Value = new UserActivity.InLobby(room); Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING }; + + chat = new MatchmakingChatDisplay(new Room(room)) + { + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Size = new Vector2(700, 130), + Margin = new MarginPadding { Bottom = 10, Right = WaveOverlayContainer.WIDTH_PADDING - HORIZONTAL_OVERFLOW_PADDING }, + Alpha = 0 + }; } [BackgroundDependencyLoader] @@ -156,13 +164,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - Width = 700, - Height = 130, - Padding = new MarginPadding { Bottom = row_padding }, - Child = chat = new MatchmakingChatDisplay(new Room(room)) - { - RelativeSizeAxes = Axes.Both, - } + Size = new Vector2(700, 130), + Margin = new MarginPadding { Bottom = row_padding } } ] } @@ -183,7 +186,7 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match beatmapAvailabilityTracker.Availability.BindValueChanged(onBeatmapAvailabilityChanged, true); - Footer!.Add(chat.CreateProxy()); + Footer?.Add(chat); } private void onRoomUpdated() @@ -326,12 +329,16 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match public override void OnEntering(ScreenTransitionEvent e) { base.OnEntering(e); + + chat.Appear(); beginHandlingTrack(); } public override void OnSuspending(ScreenTransitionEvent e) { - onLeaving(); + chat.Disappear(); + endHandlingTrack(); + base.OnSuspending(e); } @@ -347,7 +354,9 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match return true; } - onLeaving(); + chat.Disappear().Expire(); + endHandlingTrack(); + client.LeaveRoom().FireAndForget(); return false; } @@ -370,6 +379,8 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match public override void OnResuming(ScreenTransitionEvent e) { base.OnResuming(e); + + chat.Appear(); beginHandlingTrack(); if (e.Last is not MultiplayerPlayerLoader playerLoader) @@ -384,11 +395,6 @@ namespace osu.Game.Screens.OnlinePlay.Matchmaking.Match client.ChangeState(MultiplayerUserState.Idle); } - private void onLeaving() - { - endHandlingTrack(); - } - /// /// Handles changes in the track to keep it looping while active. ///