Add JsonConstructor specs to allow for correct deserialization of readonly fields

This commit is contained in:
Dean Herbert 2020-12-09 15:05:57 +09:00
parent bef52af1da
commit ab00a15555
2 changed files with 4 additions and 0 deletions

View File

@ -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;

View File

@ -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<MultiplayerRoomUser>
public User? User { get; set; }
[JsonConstructor]
public MultiplayerRoomUser(in int userId)
{
UserID = userId;