From e170372932a14153ab2b41973af592038982d638 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Nov 2018 17:54:05 +0900 Subject: [PATCH] Populate json with enums better --- .../Screens/Ladder/Components/BeatmapChoice.cs | 9 +++++++++ osu.Game.Tournament/TournamentGameBase.cs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs index d0b2556603..5b38e539c6 100644 --- a/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs +++ b/osu.Game.Tournament/Screens/Ladder/Components/BeatmapChoice.cs @@ -1,21 +1,30 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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, diff --git a/osu.Game.Tournament/TournamentGameBase.cs b/osu.Game.Tournament/TournamentGameBase.cs index 28136a6394..70868d398e 100644 --- a/osu.Game.Tournament/TournamentGameBase.cs +++ b/osu.Game.Tournament/TournamentGameBase.cs @@ -186,7 +186,7 @@ namespace osu.Game.Tournament new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, - DefaultValueHandling = DefaultValueHandling.Ignore + DefaultValueHandling = DefaultValueHandling.Ignore, })); } }