mirror of
https://github.com/ppy/osu
synced 2025-01-22 22:03:12 +00:00
Populate json with enums better
This commit is contained in:
parent
9064f3fe0f
commit
e170372932
@ -1,21 +1,30 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
public class BeatmapChoice
|
||||
{
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public TeamColour Team;
|
||||
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
||||
public ChoiceType Type;
|
||||
|
||||
public int BeatmapID;
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum TeamColour
|
||||
{
|
||||
Red,
|
||||
Blue
|
||||
}
|
||||
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public enum ChoiceType
|
||||
{
|
||||
Pick,
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Tournament
|
||||
new JsonSerializerSettings
|
||||
{
|
||||
NullValueHandling = NullValueHandling.Ignore,
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore
|
||||
DefaultValueHandling = DefaultValueHandling.Ignore,
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user