mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Context menu for duplicating multi rooms
This commit is contained in:
@ -103,38 +103,48 @@ namespace osu.Game.Online.Multiplayer
|
||||
[JsonIgnore]
|
||||
public readonly Bindable<int> Position = new Bindable<int>(-1);
|
||||
|
||||
public void CopyFrom(Room other)
|
||||
/// <summary>
|
||||
/// Copies the properties from another <see cref="Room"/> to this room.
|
||||
/// </summary>
|
||||
/// <param name="other">The room to copy</param>
|
||||
/// <param name="duplicate">Whether the copy should exclude information unique to a specific room (i.e. when duplicating a room)</param>
|
||||
public void CopyFrom(Room other, bool duplicate = false)
|
||||
{
|
||||
RoomID.Value = other.RoomID.Value;
|
||||
if (!duplicate)
|
||||
{
|
||||
RoomID.Value = other.RoomID.Value;
|
||||
|
||||
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;
|
||||
ParticipantCount.Value = other.ParticipantCount.Value;
|
||||
EndDate.Value = other.EndDate.Value;
|
||||
|
||||
if (DateTimeOffset.Now >= EndDate.Value)
|
||||
Status.Value = new RoomStatusEnded();
|
||||
|
||||
if (!RecentParticipants.SequenceEqual(other.RecentParticipants))
|
||||
{
|
||||
RecentParticipants.Clear();
|
||||
RecentParticipants.AddRange(other.RecentParticipants);
|
||||
}
|
||||
|
||||
Position.Value = other.Position.Value;
|
||||
}
|
||||
|
||||
Name.Value = other.Name.Value;
|
||||
|
||||
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;
|
||||
MaxParticipants.Value = other.MaxParticipants.Value;
|
||||
ParticipantCount.Value = other.ParticipantCount.Value;
|
||||
EndDate.Value = other.EndDate.Value;
|
||||
|
||||
if (DateTimeOffset.Now >= EndDate.Value)
|
||||
Status.Value = new RoomStatusEnded();
|
||||
|
||||
if (!Playlist.SequenceEqual(other.Playlist))
|
||||
{
|
||||
Playlist.Clear();
|
||||
Playlist.AddRange(other.Playlist);
|
||||
}
|
||||
|
||||
if (!RecentParticipants.SequenceEqual(other.RecentParticipants))
|
||||
{
|
||||
RecentParticipants.Clear();
|
||||
RecentParticipants.AddRange(other.RecentParticipants);
|
||||
}
|
||||
|
||||
Position.Value = other.Position.Value;
|
||||
}
|
||||
|
||||
public bool ShouldSerializeRoomID() => false;
|
||||
|
Reference in New Issue
Block a user