mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Make chat tests work again, clear old messages
This commit is contained in:
parent
d09b674fb3
commit
c1e3c4d435
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
|
using osu.Game.Tournament.IPC;
|
||||||
using osu.Game.Tournament.Screens.Ladder.Components;
|
using osu.Game.Tournament.Screens.Ladder.Components;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -39,6 +40,9 @@ namespace osu.Game.Tournament.Tests
|
|||||||
[Cached]
|
[Cached]
|
||||||
private LadderInfo ladderInfo = new LadderInfo();
|
private LadderInfo ladderInfo = new LadderInfo();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private MatchIPCInfo matchInfo = new MatchIPCInfo(); // hide parent
|
||||||
|
|
||||||
public TestCaseMatchChatDisplay()
|
public TestCaseMatchChatDisplay()
|
||||||
{
|
{
|
||||||
MatchChatDisplay chatDisplay;
|
MatchChatDisplay chatDisplay;
|
||||||
|
@ -61,10 +61,6 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
if (ipc != null)
|
if (ipc != null)
|
||||||
{
|
{
|
||||||
AddInternal(manager = new ChannelManager());
|
|
||||||
|
|
||||||
Channel.BindTo(manager.CurrentChannel);
|
|
||||||
|
|
||||||
chatChannel.BindTo(ipc.ChatChannel);
|
chatChannel.BindTo(ipc.ChatChannel);
|
||||||
chatChannel.BindValueChanged(channelString =>
|
chatChannel.BindValueChanged(channelString =>
|
||||||
{
|
{
|
||||||
@ -73,7 +69,18 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
int id = int.Parse(channelString);
|
int id = int.Parse(channelString);
|
||||||
|
|
||||||
var channel = manager.JoinedChannels.FirstOrDefault(ch => ch.Id == id) ?? new Channel
|
if (id <= 0) return;
|
||||||
|
|
||||||
|
if (manager == null)
|
||||||
|
{
|
||||||
|
AddInternal(manager = new ChannelManager());
|
||||||
|
Channel.BindTo(manager.CurrentChannel);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var ch in manager.JoinedChannels.ToList())
|
||||||
|
manager.LeaveChannel(ch);
|
||||||
|
|
||||||
|
var channel = new Channel
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
Type = ChannelType.Public
|
Type = ChannelType.Public
|
||||||
@ -81,7 +88,6 @@ namespace osu.Game.Tournament.Components
|
|||||||
|
|
||||||
manager.JoinChannel(channel);
|
manager.JoinChannel(channel);
|
||||||
manager.CurrentChannel.Value = channel;
|
manager.CurrentChannel.Value = channel;
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -92,6 +98,10 @@ namespace osu.Game.Tournament.Components
|
|||||||
lastChannel.NewMessagesArrived -= newMessages;
|
lastChannel.NewMessagesArrived -= newMessages;
|
||||||
|
|
||||||
lastChannel = channel;
|
lastChannel = channel;
|
||||||
|
messagesFlow.Clear();
|
||||||
|
|
||||||
|
if (channel == null) return;
|
||||||
|
|
||||||
channel.NewMessagesArrived += newMessages;
|
channel.NewMessagesArrived += newMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user