Skip to content

Commit a22da9b

Browse files
committed
Add {get; set} to all public properties
1 parent 9bba7b3 commit a22da9b

18 files changed

+142
-167
lines changed

Runtime/Client/EndPointClass.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
1-
using LootLocker;
1+
using System;
2+
using LootLocker;
23
using System.Collections;
34
using System.Collections.Generic;
45
using UnityEngine;
56

67
namespace LootLocker
78
{
8-
[System.Serializable]
9+
[Serializable]
910
public class EndPointClass
1011
{
11-
public string endPoint;
12-
public LootLockerHTTPMethod httpMethod;
12+
public string endPoint { get; set; }
13+
public LootLockerHTTPMethod httpMethod { get; set; }
1314

1415
public EndPointClass() { }
1516

Runtime/Client/GetRequests.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
using System.Collections.Generic;
2+
using LootLocker.ZeroDepJson;
23

34
namespace LootLocker.Requests
45
{
56
public class LootLockerGetRequest
67
{
8+
[Json(IgnoreWhenSerializing = true, IgnoreWhenDeserializing = true)]
79
public List<string> getRequests = new List<string>();
8-
9-
public bool ShouldSerializegetRequests()
10-
{
11-
// don't serialize the getRequests property.
12-
return false;
13-
}
1410
}
1511
}

Runtime/Client/LootLockerBaseServerAPI.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ IEnumerator coroutine()
202202

203203
protected struct ServerError
204204
{
205-
public HttpStatusCode status;
206-
public string text;
205+
public HttpStatusCode status { get; set; }
206+
public string text { get; set; }
207207
}
208208

209209
protected void BroadcastError(ServerError error)
@@ -336,11 +336,11 @@ UnityWebRequest CreateWebRequest(string url, LootLockerServerRequest request)
336336

337337
private struct ObfuscationDetails
338338
{
339-
public string key;
340-
public char replacementChar;
341-
public int visibleCharsFromBeginning;
342-
public int visibleCharsFromEnd;
343-
public bool hideCharactersForShortStrings;
339+
public string key { get; set; }
340+
public char replacementChar { get; set; }
341+
public int visibleCharsFromBeginning { get; set; }
342+
public int visibleCharsFromEnd { get; set; }
343+
public bool hideCharactersForShortStrings { get; set; }
344344

345345
public ObfuscationDetails(string key, char replacementChar = '*', int visibleCharsFromBeginning = 3, int visibleCharsFromEnd = 3, bool hideCharactersForShortStrings = true)
346346
{

Runtime/Client/LootLockerServerRequest.cs

Lines changed: 17 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ namespace LootLocker
1414
public static class LootLockerJsonSettings
1515
{
1616
public static readonly JsonOptions Default = new JsonOptions(JsonSerializationOptions.Default & ~JsonSerializationOptions.SkipGetOnly);
17-
18-
public static readonly JsonOptions Indented = new JsonOptions(JsonSerializationOptions.Default & ~JsonSerializationOptions.SkipGetOnly, "\t");
19-
/*public static readonly JsonSerializerSettings Default = new JsonSerializerSettings
20-
{
21-
ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() },
22-
Formatting = Formatting.None
23-
};
24-
public static readonly JsonSerializerSettings Indented = new JsonSerializerSettings
25-
{
26-
ContractResolver = new DefaultContractResolver { NamingStrategy = new SnakeCaseNamingStrategy() },
27-
Formatting = Formatting.None
28-
};*/
2917
}
3018

3119
public static class LootLockerJson
@@ -39,18 +27,9 @@ public static T DeserializeObject<T>(string json, JsonOptions options = null)
3927
{
4028
return Json.Deserialize<T>(json, options ?? LootLockerJsonSettings.Default);
4129
}
42-
/*public static string SerializeObject(object obj, JsonSerializerSettings settings = null)
43-
{
44-
return JsonConvert.SerializeObject(obj, settings ?? LootLockerJsonSettings.Default);
45-
}
46-
47-
public static T DeserializeObject<T>(string json, JsonSerializerSettings settings = null)
48-
{
49-
return JsonConvert.DeserializeObject<T>(json, settings ?? LootLockerJsonSettings.Default);
50-
}*/
5130
}
5231

53-
[System.Serializable]
32+
[Serializable]
5433
public enum LootLockerHTTPMethod
5534
{
5635
GET = 0,
@@ -68,40 +47,39 @@ public enum LootLockerHTTPMethod
6847
/// <summary>
6948
/// All ServerAPI.SendRequest responses will invoke the callback using an instance of this class for easier handling in client code.
7049
/// </summary>
71-
[System.Serializable]
7250
public class LootLockerResponse
7351
{
7452
/// <summary>
7553
/// TRUE if http error OR server returns an error status
7654
/// </summary>
77-
public bool hasError;
55+
public bool hasError { get; set; }
7856

7957
/// <summary>
8058
/// HTTP Status Code
8159
/// </summary>
82-
public int statusCode;
60+
public int statusCode { get; set; }
8361

8462
/// <summary>
8563
/// Raw text response from the server
8664
/// <para>If hasError = true, this will contain the error message.</para>
8765
/// </summary>
88-
public string text;
66+
public string text { get; set; }
8967

90-
public bool success;
68+
public bool success { get; set; }
9169

9270

93-
public string Error;
71+
public string Error { get; set; }
9472

9573
/// <summary>
9674
/// A texture downloaded in the webrequest, if applicable, otherwise this will be null.
9775
/// </summary>
98-
public Texture2D texture;
76+
public Texture2D texture { get; set; }
9977

10078
/// <summary>
10179
/// inheritdoc added this because unity main thread executing style cut the calling stack and make the event orphan see also calling multiple events
10280
/// of the same type makes use unable to identify each one
10381
/// </summary>
104-
public string EventId;
82+
public string EventId { get; set; }
10583

10684
public static void Deserialize<T>(Action<T> onComplete, LootLockerResponse serverResponse, JsonOptions options = null)
10785
where T : LootLockerResponse, new()
@@ -331,18 +309,18 @@ static void OnEnterPlaymodeInEditor(EnterPlayModeOptions options)
331309
/// <summary>
332310
/// Construct a request to send to the server.
333311
/// </summary>
334-
[System.Serializable]
312+
[Serializable]
335313
public struct LootLockerServerRequest
336314
{
337-
public string endpoint;
338-
public LootLockerHTTPMethod httpMethod;
315+
public string endpoint { get; set; }
316+
public LootLockerHTTPMethod httpMethod { get; set; }
339317
public Dictionary<string, object> payload;
340-
public string jsonPayload;
341-
public byte[] upload;
342-
public string uploadName;
343-
public string uploadType;
318+
public string jsonPayload { get; set; }
319+
public byte[] upload { get; set; }
320+
public string uploadName { get; set; }
321+
public string uploadType { get; set; }
344322
public LootLocker.LootLockerEnums.LootLockerCallerRole adminCall;
345-
public WWWForm form;
323+
public WWWForm form { get; set; }
346324

347325
/// <summary>
348326
/// Leave this null if you don't need custom headers
@@ -355,7 +333,7 @@ public struct LootLockerServerRequest
355333
/// </summary>
356334
public Dictionary<string, string> queryParams;
357335

358-
public int retryCount;
336+
public int retryCount { get; set; }
359337

360338
#region Make ServerRequest and call send (3 functions)
361339

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,9 +4166,9 @@ public static void Ping(Action<LootLockerPingResponse> onComplete)
41664166

41674167
public class ResponseError
41684168
{
4169-
public bool success;
4170-
public string error;
4171-
public string[] messages;
4172-
public string error_id;
4169+
public bool success { get; set; }
4170+
public string error { get; set; }
4171+
public string[] messages { get; set; }
4172+
public string error_id { get; set; }
41734173
}
41744174
}

Runtime/Game/Platforms/PlatformManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ static CurrentPlatform()
6868

6969
public struct PlatformRepresentation
7070
{
71-
public Platforms Platform;
72-
public string PlatformString;
73-
public string PlatformFriendlyString;
71+
public Platforms Platform { get; set; }
72+
public string PlatformString { get; set; }
73+
public string PlatformFriendlyString { get; set; }
7474
}
7575

7676
private static PlatformRepresentation current;

Runtime/Game/Requests/AssetInstanceRequest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace LootLocker.Requests
55
{
66
public class LootLockerGetAllKeyValuePairsResponse : LootLockerResponse
77
{
8-
public int streamedObjectCount = 0;
9-
public LootLockerInstanceStoragePair[] keypairs;
8+
public int streamedObjectCount { get; set; } = 0;
9+
public LootLockerInstanceStoragePair[] keypairs { get; set; }
1010
}
1111

1212
public class LootLockerGetSingleKeyValuePairsResponse : LootLockerResponse
1313
{
14-
public int streamedObjectCount = 0;
15-
public LootLockerInstanceStoragePair keypair;
14+
public int streamedObjectCount { get; set; } = 0;
15+
public LootLockerInstanceStoragePair keypair { get; set; }
1616
}
1717

1818
public class LootLockerInstanceStoragePair

Runtime/Game/Requests/AssetRequest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ public class LootLockerVariation_Info
5656
public object links { get; set; }
5757
}
5858

59-
[System.Serializable]
59+
[Serializable]
6060
public class LootLockerAssetRequest : LootLockerResponse
6161
{
62-
public int count;
62+
public int count { get; set; }
6363
public static int lastId;
6464

6565
public static void ResetAssetCalls()
@@ -109,7 +109,7 @@ public class LootLockerFilter
109109
public string name { get; set; }
110110
}
111111

112-
[System.Serializable]
112+
[Serializable]
113113
public class LootLockerCommonAsset : LootLockerResponse
114114
{
115115
public int id { get; set; }
@@ -146,8 +146,8 @@ public class LootLockerCommonAsset : LootLockerResponse
146146

147147
public class LootLockerAssetCandidate
148148
{
149-
public int created_by_player_id;
150-
public string created_by_player_uid;
149+
public int created_by_player_id { get; set; }
150+
public string created_by_player_uid { get; set; }
151151
}
152152

153153
public class LootLockerFile
@@ -194,12 +194,12 @@ public class LootLockerFavouritesListResponse : LootLockerResponse
194194
[Obsolete("This class is deprecated and will be removed at a later stage. Please use LootLockerActivateRentalAssetResponse instead")]
195195
public class LootLockerActivateARentalAssetResponse : LootLockerResponse
196196
{
197-
public int time_left;
197+
public int time_left { get; set; }
198198
}
199199

200200
public class LootLockerActivateRentalAssetResponse : LootLockerResponse
201201
{
202-
public int time_left;
202+
public int time_left { get; set; }
203203
}
204204
}
205205

@@ -331,11 +331,11 @@ public static void GetAssetById(LootLockerGetRequest data, Action<LootLockerSing
331331
LootLockerAssetResponse realResponse = LootLockerResponse.Deserialize<LootLockerAssetResponse>(serverResponse);
332332
LootLockerSingleAssetResponse newResponse = new LootLockerSingleAssetResponse();
333333

334-
string serializedAsset = LootLockerJson.SerializeObject(realResponse.assets[0], LootLockerJsonSettings.Indented);
334+
string serializedAsset = LootLockerJson.SerializeObject(realResponse.assets[0]);
335335

336336
newResponse.asset = LootLockerJson.DeserializeObject<LootLockerCommonAsset>(serializedAsset);
337337

338-
string singleAssetResponse = LootLockerJson.SerializeObject(newResponse, LootLockerJsonSettings.Indented);
338+
string singleAssetResponse = LootLockerJson.SerializeObject(newResponse);
339339
newResponse.text = singleAssetResponse;
340340
newResponse.SetResponseInfo(serverResponse);
341341

Runtime/Game/Requests/CharacterRequest.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public class LootLockerListCharacterTypesResponse : LootLockerResponse
3131
[Serializable]
3232
public class LootLockerCharacter_Types
3333
{
34-
public int id;
35-
public bool is_default;
36-
public string name;
34+
public int id { get; set; }
35+
public bool is_default { get; set; }
36+
public string name { get; set; }
3737
public LootLockerStorage [] storage;
3838
}
3939

@@ -99,24 +99,24 @@ public LootLockerCharacter[] GetCharacters()
9999

100100
public class EquipAssetToCharacterLoadoutResponse : LootLockerResponse
101101
{
102-
public LootLockerCharacter character;
103-
public LootLockerLoadouts[] loadout;
102+
public LootLockerCharacter character { get; set; }
103+
public LootLockerLoadouts[] loadout { get; set; }
104104
}
105105

106-
[Serializable]
106+
//[Serializable]
107107
public class LootLockerLootLockerLoadout
108108
{
109-
public LootLockerCharacter character;
110-
public LootLockerLoadouts[] loadout;
109+
public LootLockerCharacter character { get; set; }
110+
public LootLockerLoadouts[] loadout { get; set; }
111111
}
112112

113-
[Serializable]
113+
//[Serializable]
114114
public class LootLockerCharacter
115115
{
116-
public int id;
117-
public string type;
118-
public string name;
119-
public bool is_default;
116+
public int id { get; set; }
117+
public string type { get; set; }
118+
public string name { get; set; }
119+
public bool is_default { get; set; }
120120
}
121121

122122
public class LootLockerCharacterAsset

Runtime/Game/Requests/CollectableRequest.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,23 +67,23 @@ public class LootLockerCollectingAnItemResponse : LootLockerResponse
6767
{
6868
public LootLockerCollectable[] collectables { get; set; }
6969

70-
public LootLockerCollectable mainCollectable;
70+
public LootLockerCollectable mainCollectable { get; set; }
7171

72-
public LootLockerGroup mainGroup;
72+
public LootLockerGroup mainGroup { get; set; }
7373

74-
public LootLockerItem mainItem;
74+
public LootLockerItem mainItem { get; set; }
7575

7676
}
7777

7878
public class LootLockerCollectItemResponse : LootLockerResponse
7979
{
8080
public LootLockerCollectable[] collectables { get; set; }
8181

82-
public LootLockerCollectable mainCollectable;
82+
public LootLockerCollectable mainCollectable { get; set; }
8383

84-
public LootLockerGroup mainGroup;
84+
public LootLockerGroup mainGroup { get; set; }
8585

86-
public LootLockerItem mainItem;
86+
public LootLockerItem mainItem { get; set; }
8787
}
8888

8989
#endregion

0 commit comments

Comments
 (0)