mirror of
https://github.com/ppy/osu.git
synced 2026-06-01 22:21:00 +08:00
fc817627e5
In discussions, we've come to the conclusion to attempt to use a chat-bubble system to minimise the effective area of the chat. In particular, the results screen doesn't give us enough space to display the full chat box without overlapping the main screen content. This PR both adds the chat to the results screen, and reworks it to use such a bubble system (not sure what to call it, IM style?). https://github.com/user-attachments/assets/a8a88c51-8a9d-4a03-92b6-621112a15a41 - New messages are previewed for 3 seconds. - When focusing and unfocusing the textbox, the history moves into expanded state (show the most recent 10 messages) or collapsed state (fade messages out ASAP). This is a bit of an initial implementation to get a feel of how it behaves, and there's more that can be done such as adding colours, improving the transforms, perhaps adding it to the intro screen (post-animation) but the structure's a bit weird atm. --------- Co-authored-by: Dean Herbert <pe@ppy.sh>
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// 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.API.Requests.Responses;
|
|
using osu.Game.Screens.OnlinePlay.Matchmaking.RankedPlay.Components;
|
|
|
|
namespace osu.Game.Tests.Visual.RankedPlay
|
|
{
|
|
public partial class TestSceneBubbleChatHistory : OsuTestScene
|
|
{
|
|
private RankedPlayChatDisplay.BubbleChatHistory history = null!;
|
|
|
|
[SetUp]
|
|
public void Setup() => Schedule(() =>
|
|
{
|
|
Child = history = new RankedPlayChatDisplay.BubbleChatHistory
|
|
{
|
|
Anchor = Anchor.Centre,
|
|
Origin = Anchor.BottomCentre,
|
|
Width = 300
|
|
};
|
|
});
|
|
|
|
[Test]
|
|
public void TestPostMessages()
|
|
{
|
|
int messageId = 1;
|
|
AddRepeatStep("post message", () => history.PostMessage(new APIUser { Id = 2 }, $"message {messageId++}"), 20);
|
|
}
|
|
|
|
[Test]
|
|
public void TestCollapse()
|
|
{
|
|
AddStep("set expanded", () => history.Expand());
|
|
|
|
AddStep("post some messages", () =>
|
|
{
|
|
for (int i = 0; i < 10; i++)
|
|
history.PostMessage(new APIUser { Id = 2 }, $"message {i}");
|
|
});
|
|
|
|
AddWaitStep("wait a bit", 10);
|
|
AddStep("set collapsed", () => history.Collapse());
|
|
AddWaitStep("wait a bit", 10);
|
|
AddStep("set expanded", () => history.Expand());
|
|
AddWaitStep("wait a bit", 10);
|
|
AddStep("set collapsed", () => history.Collapse());
|
|
}
|
|
}
|
|
}
|