2019-01-24 16:43:03 +08:00
|
|
|
// 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-21 13:01:06 +08:00
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Game.Online.Chat;
|
|
|
|
using osu.Game.Online.Multiplayer;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
|
|
|
{
|
|
|
|
public class MatchChatDisplay : StandAloneChatDisplay
|
|
|
|
{
|
|
|
|
private readonly Room room;
|
|
|
|
|
2018-12-22 13:38:46 +08:00
|
|
|
[Resolved(CanBeNull = true)]
|
2018-12-21 13:01:06 +08:00
|
|
|
private ChannelManager channelManager { get; set; }
|
|
|
|
|
|
|
|
public MatchChatDisplay(Room room)
|
|
|
|
: base(true)
|
|
|
|
{
|
|
|
|
this.room = room;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
2018-12-21 13:37:05 +08:00
|
|
|
room.RoomID.BindValueChanged(v => updateChannel(), true);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void updateChannel()
|
|
|
|
{
|
|
|
|
if (room.RoomID.Value != null)
|
2018-12-22 13:38:46 +08:00
|
|
|
Channel.Value = channelManager?.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" });
|
2018-12-21 13:01:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|