Skip to content

Commit 41f8ced

Browse files
committed
Add directive to switch to Unity Newtonsoft as well
1 parent cab92f6 commit 41f8ced

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

Runtime/Client/GetRequests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Collections.Generic;
2-
#if USE_LOOTLOCKER_ZERODEPJSON
2+
#if LOOTLOCKER_USE_ZERODEPJSON
33
using LootLocker.ZeroDepJson;
44
#endif
55

@@ -8,7 +8,7 @@ namespace LootLocker.Requests
88
public class LootLockerGetRequest
99
{
1010

11-
#if USE_LOOTLOCKER_ZERODEPJSON
11+
#if LOOTLOCKER_USE_ZERODEPJSON
1212
[Json(IgnoreWhenSerializing = true, IgnoreWhenDeserializing = true)]
1313
public List<string> getRequests = new List<string>();
1414
#else

Runtime/Client/LootLockerBaseServerAPI.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@
55
using System;
66
using System.Text;
77
using System.Net;
8-
#if !USE_LOOTLOCKER_ZERODEPJSON
8+
#if !LOOTLOCKER_USE_ZERODEPJSON && !LOOTLOCKER_USE_NEWTONSOFTJSON
99
using LLlibs.Newtonsoft.Json;
1010
using LLlibs.Newtonsoft.Json.Linq;
11+
#elif LOOTLOCKER_USE_NEWTONSOFTJSON
12+
using Newtonsoft.Json;
13+
using Newtonsoft.Json.Linq;
1114
#endif
1215
using LootLocker.Requests;
1316

@@ -368,7 +371,7 @@ public ObfuscationDetails(string key, char replacementChar = '*', int visibleCha
368371

369372
private static string ObfuscateJsonStringForLogging(string json)
370373
{
371-
#if USE_LOOTLOCKER_ZERODEPJSON
374+
#if LOOTLOCKER_USE_ZERODEPJSON
372375
//TODO: Fix this json usage
373376
return json;
374377
#else

Runtime/Client/LootLockerServerRequest.cs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
using UnityEngine;
33
using System;
44
using LootLocker.LootLockerEnums;
5-
#if USE_LOOTLOCKER_ZERODEPJSON
5+
#if LOOTLOCKER_USE_ZERODEPJSON
66
using LootLocker.ZeroDepJson;
7-
#else //USE_LOOTLOCKER_ZERODEPJSON
7+
#elif LOOTLOCKER_USE_NEWTONSOFTJSON
8+
using Newtonsoft.Json;
9+
using Newtonsoft.Json.Serialization;
10+
#else
811
using LLlibs.Newtonsoft.Json.Serialization;
912
using LLlibs.Newtonsoft.Json;
1013
#endif
@@ -18,9 +21,9 @@ namespace LootLocker
1821

1922
public static class LootLockerJsonSettings
2023
{
21-
#if USE_LOOTLOCKER_ZERODEPJSON
24+
#if LOOTLOCKER_USE_ZERODEPJSON
2225
public static readonly JsonOptions Default = new JsonOptions(JsonSerializationOptions.Default & ~JsonSerializationOptions.SkipGetOnly);
23-
#else //USE_LOOTLOCKER_ZERODEPJSON
26+
#else //LOOTLOCKER_USE_ZERODEPJSON
2427
public static readonly JsonSerializerSettings Default = new JsonSerializerSettings
2528
{
2629
ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() },
@@ -31,7 +34,7 @@ public static class LootLockerJsonSettings
3134

3235
public static class LootLockerJson
3336
{
34-
#if USE_LOOTLOCKER_ZERODEPJSON
37+
#if LOOTLOCKER_USE_ZERODEPJSON
3538
public static string SerializeObject(object obj)
3639
{
3740
return SerializeObject(obj, LootLockerJsonSettings.Default);
@@ -51,7 +54,7 @@ public static T DeserializeObject<T>(string json, JsonOptions options)
5154
{
5255
return Json.Deserialize<T>(json, options ?? LootLockerJsonSettings.Default);
5356
}
54-
#else //USE_LOOTLOCKER_ZERODEPJSON
57+
#else //LOOTLOCKER_USE_ZERODEPJSON
5558
public static string SerializeObject(object obj)
5659
{
5760
return SerializeObject(obj, LootLockerJsonSettings.Default);
@@ -128,9 +131,9 @@ public class LootLockerResponse
128131
public string EventId { get; set; }
129132

130133
public static void Deserialize<T>(Action<T> onComplete, LootLockerResponse serverResponse,
131-
#if USE_LOOTLOCKER_ZERODEPJSON
134+
#if LOOTLOCKER_USE_ZERODEPJSON
132135
JsonOptions options = null
133-
#else //USE_LOOTLOCKER_ZERODEPJSON
136+
#else //LOOTLOCKER_USE_ZERODEPJSON
134137
JsonSerializerSettings options = null
135138
#endif
136139
)
@@ -140,9 +143,9 @@ public static void Deserialize<T>(Action<T> onComplete, LootLockerResponse serve
140143
}
141144

142145
public static T Deserialize<T>(LootLockerResponse serverResponse,
143-
#if USE_LOOTLOCKER_ZERODEPJSON
146+
#if LOOTLOCKER_USE_ZERODEPJSON
144147
JsonOptions options = null
145-
#else //USE_LOOTLOCKER_ZERODEPJSON
148+
#else //LOOTLOCKER_USE_ZERODEPJSON
146149
JsonSerializerSettings options = null
147150
#endif
148151
)

Runtime/Game/Requests/PlayerRequest.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System;
22
using LootLocker.Requests;
3-
#if USE_LOOTLOCKER_ZERODEPJSON
3+
#if LOOTLOCKER_USE_ZERODEPJSON
44
using LootLocker.ZeroDepJson;
5+
#elif LOOTLOCKER_USE_NEWTONSOFTJSON
6+
using Newtonsoft.Json;
57
#else
68
using LLlibs.Newtonsoft.Json;
79
#endif
@@ -208,7 +210,7 @@ public class LootLockerPlayerFile : LootLockerResponse
208210
public int size { get; set; }
209211
public string purpose { get; set; }
210212

211-
#if USE_LOOTLOCKER_ZERODEPJSON
213+
#if LOOTLOCKER_USE_ZERODEPJSON
212214
[Json(Name = "public")]
213215
#else
214216
[JsonProperty("public")]

0 commit comments

Comments
 (0)