Fix chat channel ids not being updated on room creation

This commit is contained in:
Jamie Taylor 2019-03-07 15:35:57 +09:00
parent 00cdb3a44a
commit ee076bbbe3
No known key found for this signature in database
GPG Key ID: 2ACFA8B6370B8C8C
2 changed files with 6 additions and 3 deletions

View File

@ -124,6 +124,7 @@ public void CopyFrom(Room other)
if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id)
Host.Value = other.Host.Value;
ChannelId.Value = other.ChannelId.Value;
Status.Value = other.Status.Value;
Availability.Value = other.Availability.Value;
Type.Value = other.Type.Value;

View File

@ -28,13 +28,15 @@ protected override void LoadComplete()
{
base.LoadComplete();
roomId.BindValueChanged(_ => updateChannel(), true);
channelId.BindValueChanged(_ => updateChannel(), true);
}
private void updateChannel()
{
if (roomId.Value != null)
Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId.Value, Type = ChannelType.Multiplayer, Name = $"#mp_{roomId.Value}" });
if (roomId.Value == null || channelId.Value == 0)
return;
Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId.Value, Type = ChannelType.Multiplayer, Name = $"#lazermp_{roomId.Value}" });
}
}
}