1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 05:22:54 +08:00

Fix room category being serialised as ints

This commit is contained in:
smoogipoo 2020-12-21 16:42:21 +09:00
parent 0c9b1c3a73
commit a021aaf546

View File

@ -35,9 +35,22 @@ 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")]
private string categoryString
{
get => Category.Value.ToString().ToLower();
set
{
if (!Enum.TryParse<RoomCategory>(value, true, out var enumValue))
enumValue = RoomCategory.Normal;
Category.Value = enumValue;
}
}
[Cached]
[JsonIgnore]
public readonly Bindable<TimeSpan> Duration = new Bindable<TimeSpan>(TimeSpan.FromMinutes(30));