Merge pull request #11234 from smoogipoo/fix-category-serialisation

Fix room category being serialised as int
This commit is contained in:
Dean Herbert
2020-12-21 18:03:10 +09:00
committed by GitHub
2 changed files with 27 additions and 1 deletions

View File

@ -6,6 +6,7 @@ using System.Linq;
using Newtonsoft.Json;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.IO.Serialization.Converters;
using osu.Game.Online.Multiplayer.GameTypes;
using osu.Game.Online.Multiplayer.RoomStatuses;
using osu.Game.Users;
@ -35,9 +36,18 @@ namespace osu.Game.Online.Multiplayer
public readonly Bindable<int> ChannelId = new Bindable<int>();
[Cached]
[JsonProperty("category")]
[JsonIgnore]
public readonly Bindable<RoomCategory> Category = new Bindable<RoomCategory>();
// Todo: osu-framework bug (https://github.com/ppy/osu-framework/issues/4106)
[JsonProperty("category")]
[JsonConverter(typeof(SnakeCaseStringEnumConverter))]
private RoomCategory category
{
get => Category.Value;
set => Category.Value = value;
}
[Cached]
[JsonIgnore]
public readonly Bindable<TimeSpan?> Duration = new Bindable<TimeSpan?>();