1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-25 14:10:48 +08:00

Move quick play chat entirely to screen footer

This commit is contained in:
Dan Balasescu
2025-10-24 18:03:28 +09:00
Unverified
parent 6ac8e59a11
commit e240817087
3 changed files with 93 additions and 18 deletions
@@ -0,0 +1,49 @@
// 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 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);
}
}
}
@@ -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<GlobalAction> e)
{
}
public void Appear()
{
FinishTransforms();
this.MoveToY(150f)
.FadeOut()
.MoveToY(0f, 240, Easing.OutCubic)
.FadeIn(240, Easing.OutCubic);
}
public TransformSequence<MatchmakingChatDisplay> Disappear()
{
FinishTransforms();
return this.FadeOut(240, Easing.InOutCubic)
.MoveToY(150f, 240, Easing.InOutCubic);
}
}
}
@@ -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();
}
/// <summary>
/// Handles changes in the track to keep it looping while active.
/// </summary>