From 94d5c2ca62e47d02622a346dc407f13321d9559c Mon Sep 17 00:00:00 2001 From: lumanskiy Date: Mon, 8 Jan 2024 23:47:18 -0800 Subject: [PATCH] Minor fix - changing json formatting to snake_case for the server_info object --- source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj | 2 +- .../Runtime/LiteNet/LiteNetProtocolConnectionData.cs | 6 +++++- source/UnityPackage/Assets/Runtime/Network/ProtocolInfo.cs | 5 ++++- source/UnityPackage/Assets/Runtime/Network/ServerInfo.cs | 7 ++++++- source/UnityPackage/Assets/package.json | 2 +- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj b/source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj index 33fec64..94a4ff0 100644 --- a/source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj +++ b/source/Fenrir.Multiplayer/Fenrir.Multiplayer.csproj @@ -5,7 +5,7 @@ true true Fenrir Multiplayer Library - 1.0.17 + 1.0.18 README.md diff --git a/source/UnityPackage/Assets/Runtime/LiteNet/LiteNetProtocolConnectionData.cs b/source/UnityPackage/Assets/Runtime/LiteNet/LiteNetProtocolConnectionData.cs index dfd3243..57fa265 100644 --- a/source/UnityPackage/Assets/Runtime/LiteNet/LiteNetProtocolConnectionData.cs +++ b/source/UnityPackage/Assets/Runtime/LiteNet/LiteNetProtocolConnectionData.cs @@ -1,4 +1,6 @@ -namespace Fenrir.Multiplayer.LiteNet +using Newtonsoft.Json; + +namespace Fenrir.Multiplayer.LiteNet { /// /// Identifies data require to connect @@ -9,11 +11,13 @@ class LiteNetProtocolConnectionData : IProtocolConnectionData /// /// Public port that client is supposed to use /// + [JsonProperty("port")] public ushort Port { get; set; } /// /// IPv6 Mode /// + [JsonProperty("ipv6_enabled")] public bool IPv6Enabled { get; set; } /// diff --git a/source/UnityPackage/Assets/Runtime/Network/ProtocolInfo.cs b/source/UnityPackage/Assets/Runtime/Network/ProtocolInfo.cs index aecfa0c..3fe9be6 100644 --- a/source/UnityPackage/Assets/Runtime/Network/ProtocolInfo.cs +++ b/source/UnityPackage/Assets/Runtime/Network/ProtocolInfo.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Converters; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; using System; @@ -13,11 +14,13 @@ public class ProtocolInfo /// /// Type of the supported protocol /// + [JsonProperty("protocol_type")] public ProtocolType ProtocolType { get; set; } /// /// Protocol-specific connection data /// + [JsonProperty("connection_data")] public JObject ConnectionData { get; set; } /// diff --git a/source/UnityPackage/Assets/Runtime/Network/ServerInfo.cs b/source/UnityPackage/Assets/Runtime/Network/ServerInfo.cs index 7debf88..273ee42 100644 --- a/source/UnityPackage/Assets/Runtime/Network/ServerInfo.cs +++ b/source/UnityPackage/Assets/Runtime/Network/ServerInfo.cs @@ -1,4 +1,6 @@ -namespace Fenrir.Multiplayer +using Newtonsoft.Json; + +namespace Fenrir.Multiplayer { /// /// Payload object that is being delivered via server info endpoint, @@ -9,16 +11,19 @@ public class ServerInfo /// /// Public hostname of the server /// + [JsonProperty("hostname")] public string Hostname { get; set; } /// /// Unique ID of the server /// + [JsonProperty("server_id")] public string ServerId { get; set; } /// /// List of protocols supported by this server /// + [JsonProperty("protocols")] public ProtocolInfo[] Protocols { get; set; } } } diff --git a/source/UnityPackage/Assets/package.json b/source/UnityPackage/Assets/package.json index b31571a..dd04f15 100644 --- a/source/UnityPackage/Assets/package.json +++ b/source/UnityPackage/Assets/package.json @@ -3,7 +3,7 @@ "displayName": "Fenrir Multiplayer", "description": "Library for building multiplayer games with using Fenrir Multiplayer Platform", "license": "MIT", - "version": "1.0.17", + "version": "1.0.18", "author": { "name": "Fenrir", "email": "info@fenrirserver.com",