From ab00a15555a31394e23b9dd6277fc02aa25f9239 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 9 Dec 2020 15:05:57 +0900 Subject: [PATCH] Add JsonConstructor specs to allow for correct deserialization of readonly fields --- osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs | 2 ++ osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs b/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs index 1ba8d0c487..5704ddd675 100644 --- a/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs +++ b/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoom.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using Newtonsoft.Json; namespace osu.Game.Online.RealtimeMultiplayer { @@ -41,6 +42,7 @@ public class MultiplayerRoom private object writeLock = new object(); + [JsonConstructor] public MultiplayerRoom(in long roomId) { RoomID = roomId; diff --git a/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs b/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs index 60f1c9e42e..caf1a70197 100644 --- a/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs +++ b/osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs @@ -4,6 +4,7 @@ #nullable enable using System; +using Newtonsoft.Json; using osu.Game.Users; namespace osu.Game.Online.RealtimeMultiplayer @@ -17,6 +18,7 @@ public class MultiplayerRoomUser : IEquatable public User? User { get; set; } + [JsonConstructor] public MultiplayerRoomUser(in int userId) { UserID = userId;