move JsonConverter attribute to enum instead of on fields

This commit is contained in:
JohnCorby 2022-05-24 14:58:42 -07:00
parent 627b0484e6
commit bcfb54a586
5 changed files with 9 additions and 10 deletions

View File

@ -8,6 +8,7 @@ using Newtonsoft.Json.Converters;
namespace NewHorizons.External.Modules
{
[JsonConverter(typeof(StringEnumConverter))]
public enum CloudFluidType
{
[EnumMember(Value = @"none")] None = 0,
@ -94,7 +95,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// Fluid type for sounds/effects when colliding with this cloud.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public CloudFluidType fluidType = CloudFluidType.Cloud;
/// <summary>
@ -160,7 +160,6 @@ namespace NewHorizons.External.Modules
public string cloudRamp;
[Obsolete("CloudFluidType is deprecated, please use CloudInfo instead")]
[JsonConverter(typeof(StringEnumConverter))]
public CloudFluidType fluidType;
[Obsolete("UseBasicCloudShader is deprecated, please use CloudInfo instead")]

View File

@ -7,6 +7,7 @@ using Newtonsoft.Json.Converters;
namespace NewHorizons.External.Modules
{
[JsonConverter(typeof(StringEnumConverter))]
public enum GravityFallOff
{
[EnumMember(Value = @"linear")] Linear = 0,
@ -43,7 +44,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public GravityFallOff gravityFallOff = GravityFallOff.Linear;
/// <summary>

View File

@ -185,6 +185,7 @@ namespace NewHorizons.External.Modules
[JsonObject]
public class TornadoInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum TornadoType
{
[EnumMember(Value = @"downwards")] Downwards = 0,
@ -222,7 +223,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public TornadoType type = TornadoType.Downwards;
/// <summary>
@ -337,6 +337,7 @@ namespace NewHorizons.External.Modules
[JsonObject]
public class RevealInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum RevealVolumeType
{
[EnumMember(Value = @"enter")] Enter = 0,
@ -369,7 +370,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// What needs to be done to the volume to unlock the facts
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public RevealVolumeType revealOn = RevealVolumeType.Enter;
/// <summary>
@ -400,6 +400,7 @@ namespace NewHorizons.External.Modules
[JsonObject]
public class NomaiTextInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum NomaiTextType
{
[EnumMember(Value = @"wall")] Wall = 0,
@ -442,7 +443,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// The type of object this is.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public NomaiTextType type = NomaiTextType.Wall;
/// <summary>
@ -454,6 +454,7 @@ namespace NewHorizons.External.Modules
[JsonObject]
public class NomaiTextArcInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum NomaiTextArcType
{
[EnumMember(Value = @"adult")] Adult = 0,
@ -471,7 +472,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// The type of text to display.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public NomaiTextArcType type = NomaiTextArcType.Adult;
/// <summary>
@ -483,6 +483,7 @@ namespace NewHorizons.External.Modules
[JsonObject]
public class ProjectionInfo
{
[JsonConverter(typeof(StringEnumConverter))]
public enum SlideShowType
{
[EnumMember(Value = @"slideReel")] SlideReel = 0,
@ -513,7 +514,6 @@ namespace NewHorizons.External.Modules
/// <summary>
/// The type of object this is.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public SlideShowType type = SlideShowType.SlideReel;
}

View File

@ -5,6 +5,7 @@ using Newtonsoft.Json.Converters;
namespace NewHorizons.External.Modules.VariableSize
{
[JsonConverter(typeof(StringEnumConverter))]
public enum FunnelType
{
[EnumMember(Value = @"sand")] Sand = 0,
@ -32,7 +33,6 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary>
/// Type of fluid the funnel transfers
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public FunnelType type = FunnelType.Sand;
}
}

View File

@ -10,6 +10,7 @@ namespace NewHorizons.External.Modules.VariableSize
[JsonObject]
public class SingularityModule : VariableSizeModule
{
[JsonConverter(typeof(StringEnumConverter))]
public enum SingularityType
{
[EnumMember(Value = @"blackHole")] BlackHole = 0,
@ -47,7 +48,6 @@ namespace NewHorizons.External.Modules.VariableSize
/// <summary>
/// Type of singularity (white hole or black hole)
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public SingularityType type;
}
}