Split drawing and business logic of ChatOverlay

This commit is contained in:
miterosan
2018-04-08 18:21:48 +02:00
parent 525e50e8dd
commit a70b329155
11 changed files with 431 additions and 388 deletions

View File

@ -23,15 +23,15 @@ namespace osu.Game.Graphics.Containers
public override bool HandleMouseInput => true;
private OsuGame game;
private ChatManager chatManager;
private Action showNotImplementedError;
[BackgroundDependencyLoader(true)]
private void load(OsuGame game, NotificationOverlay notifications)
private void load(OsuGame game, NotificationOverlay notifications, ChatManager chatManager)
{
// will be null in tests
this.game = game;
this.chatManager = chatManager;
showNotImplementedError = () => notifications?.Post(new SimpleNotification
{
Text = @"This link type is not yet supported!",
@ -80,7 +80,9 @@ namespace osu.Game.Graphics.Containers
game?.ShowBeatmapSet(setId);
break;
case LinkAction.OpenChannel:
game?.OpenChannel(linkArgument);
var channel = chatManager.AvailableChannels.FirstOrDefault(c => c.Name == linkArgument);
if (channel != null)
chatManager.CurrentChat.Value = channel;
break;
case LinkAction.OpenEditorTimestamp:
case LinkAction.JoinMultiplayerMatch: