1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Remove participants, add match chat

This commit is contained in:
smoogipoo 2018-12-21 14:01:06 +09:00
parent 14879acd83
commit fa2bc16140
3 changed files with 35 additions and 14 deletions

View File

@ -24,6 +24,9 @@ namespace osu.Game.Online.Multiplayer
[JsonProperty("playlist")]
public BindableCollection<PlaylistItem> Playlist { get; set; } = new BindableCollection<PlaylistItem>();
[JsonProperty("channel_id")]
public Bindable<int> ChannelId { get; private set; } = new Bindable<int>();
[JsonIgnore]
public Bindable<TimeSpan> Duration { get; private set; } = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));

View File

@ -0,0 +1,30 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
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;
[Resolved]
private ChannelManager channelManager { get; set; }
public MatchChatDisplay(Room room)
: base(true)
{
this.room = room;
}
protected override void LoadComplete()
{
base.LoadComplete();
Channel.Value = channelManager.JoinChannel(new Channel { Id = room.ChannelId, Type = ChannelType.Multiplayer, Name = $"#mp_{room.RoomID}" });
}
}
}

View File

@ -21,8 +21,6 @@ namespace osu.Game.Screens.Multi.Match
{
public class MatchScreen : MultiplayerScreen
{
private readonly Participants participants;
private readonly Bindable<string> nameBind = new Bindable<string>();
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
private readonly Bindable<RoomAvailability> availabilityBind = new Bindable<RoomAvailability>();
@ -34,8 +32,6 @@ namespace osu.Game.Screens.Multi.Match
public override bool AllowBeatmapRulesetChange => false;
protected override Drawable TransitionContent => participants;
public override string Title => room.Name.Value;
public override string ShortTitle => "room";
@ -90,15 +86,10 @@ namespace osu.Game.Screens.Multi.Match
{
new Drawable[]
{
participants = new Participants { RelativeSizeAxes = Axes.Both },
leaderboard = new MatchLeaderboard(room) { RelativeSizeAxes = Axes.Both }
leaderboard = new MatchLeaderboard(room) { RelativeSizeAxes = Axes.Both },
new MatchChatDisplay(room) { RelativeSizeAxes = Axes.Both }
},
},
ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Distributed),
new Dimension(GridSizeMode.Relative, 0.5f),
}
}
},
},
@ -138,9 +129,6 @@ namespace osu.Game.Screens.Multi.Match
header.Type.BindTo(typeBind);
participants.Users.BindTo(participantsBind);
participants.MaxParticipants.BindTo(maxParticipantsBind);
playlistBind.ItemsAdded += _ => setFromPlaylist();
playlistBind.ItemsRemoved += _ => setFromPlaylist();
}