1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-24 13:22:55 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneStandAloneChatDisplay.cs

105 lines
3.1 KiB
C#
Raw Normal View History

// 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.
2018-12-20 15:50:38 +08:00
2018-12-20 17:21:37 +08:00
using osu.Framework.Allocation;
2018-12-20 15:50:38 +08:00
using osu.Framework.Graphics;
using osu.Game.Online.Chat;
using osu.Game.Users;
using osuTK;
2019-03-25 00:02:36 +08:00
namespace osu.Game.Tests.Visual.Online
2018-12-20 15:50:38 +08:00
{
public class TestSceneStandAloneChatDisplay : OsuTestScene
2018-12-20 15:50:38 +08:00
{
private readonly Channel testChannel = new Channel();
private readonly User admin = new User
{
Username = "HappyStick",
Id = 2,
Colour = "f2ca34"
};
private readonly User redUser = new User
{
Username = "BanchoBot",
Id = 3,
};
private readonly User blueUser = new User
{
Username = "Zallius",
Id = 4,
};
2018-12-20 17:21:37 +08:00
[Cached]
private ChannelManager channelManager = new ChannelManager();
private readonly StandAloneChatDisplay chatDisplay;
private readonly StandAloneChatDisplay chatDisplay2;
public TestSceneStandAloneChatDisplay()
2018-12-20 15:50:38 +08:00
{
2018-12-20 17:21:37 +08:00
Add(channelManager);
2018-12-20 15:50:38 +08:00
Add(chatDisplay = new StandAloneChatDisplay
{
2018-12-20 17:21:37 +08:00
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding(20),
2018-12-20 15:50:38 +08:00
Size = new Vector2(400, 80)
});
2018-12-20 17:21:37 +08:00
Add(chatDisplay2 = new StandAloneChatDisplay(true)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding(20),
Size = new Vector2(400, 150)
});
2018-12-20 15:50:38 +08:00
}
protected override void LoadComplete()
{
base.LoadComplete();
2018-12-20 17:21:37 +08:00
channelManager.CurrentChannel.Value = testChannel;
chatDisplay.Channel.Value = testChannel;
chatDisplay2.Channel.Value = testChannel;
int sequence = 0;
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
2018-12-20 15:50:38 +08:00
{
Sender = admin,
Content = "I am a wang!"
}));
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
2018-12-20 15:50:38 +08:00
{
Sender = redUser,
Content = "I am team red."
}));
AddStep("message from team red", () => testChannel.AddNewMessages(new Message(sequence++)
2018-12-20 15:50:38 +08:00
{
Sender = redUser,
Content = "I plan to win!"
}));
AddStep("message from team blue", () => testChannel.AddNewMessages(new Message(sequence++)
2018-12-20 15:50:38 +08:00
{
Sender = blueUser,
Content = "Not on my watch. Prepare to eat saaaaaaaaaand. Lots and lots of saaaaaaand."
}));
AddStep("message from admin", () => testChannel.AddNewMessages(new Message(sequence++)
2018-12-20 15:50:38 +08:00
{
Sender = admin,
Content = "Okay okay, calm down guys. Let's do this!"
}));
}
}
}