1
- using UnityEngine ;
1
+ using UnityEngine ;
2
2
using UnityEngine . Networking ;
3
3
using System ;
4
4
using System . Text ;
5
5
using System . Collections ;
6
6
using System . Collections . Generic ;
7
7
8
- [ System . Serializable ]
9
- public class GlobalstatsIO_StatisticValues
8
+ namespace GlobalstatsIO
10
9
{
11
- public string key = null ;
12
- public string value = "0" ;
13
- public string sorting = null ;
14
- public string rank = "0" ;
15
- public string value_change = "0" ;
16
- public string rank_change = "0" ;
17
- }
18
-
19
- [ System . Serializable ]
20
- public class GlobalstatsIO_LinkData
21
- {
22
- public string url = null ;
23
- public string pin = null ;
24
- }
25
-
26
- [ System . Serializable ]
27
- public class GlobalstatsIO_LeaderboardValue
28
- {
29
- public string name = null ;
30
- public string user_profile = null ;
31
- public string user_icon = null ;
32
- public string rank = "0" ;
33
- public string value = "0" ;
34
- }
35
-
36
- [ System . Serializable ]
37
- public class GlobalstatsIO_Leaderboard {
38
-
39
- public GlobalstatsIO_LeaderboardValue [ ] data ;
40
- }
41
-
42
- public class GlobalstatsIO
43
- {
44
- [ System . Serializable ]
45
- private class GlobalstatsIO_AccessToken
46
- {
47
- public string access_token = null ;
48
- public string token_type = null ;
49
- public string expires_in = null ;
50
- public Int32 created_at = ( Int32 ) ( DateTime . UtcNow . Subtract ( new DateTime ( 1970 , 1 , 1 ) ) ) . TotalSeconds ;
51
-
52
- public bool isValid ( )
53
- {
54
- //Check if still valid, allow a 2 minute grace period
55
- return ( created_at + int . Parse ( expires_in ) - 120 ) > ( Int32 ) ( DateTime . UtcNow . Subtract ( new DateTime ( 1970 , 1 , 1 ) ) ) . TotalSeconds ;
56
- }
57
- }
58
-
59
- [ System . Serializable ]
60
- private class GlobalstatsIO_StatisticResponse
61
- {
62
- public string name = null ;
63
- public string _id = null ;
64
- [ SerializeField ]
65
- public List < GlobalstatsIO_StatisticValues > values = null ;
66
- }
67
-
68
- public static string api_id = "" ;
69
- public static string api_secret = "" ;
70
-
71
- private static GlobalstatsIO_AccessToken api_access_token = null ;
72
-
73
- private static List < GlobalstatsIO_StatisticValues > statistic_values = new List < GlobalstatsIO_StatisticValues > ( ) ;
74
- public static string statistic_id = "" ;
75
- public static string user_name = "" ;
76
- public static GlobalstatsIO_LinkData link_data = null ;
77
-
78
- private bool getAccessToken ( )
79
- {
80
- string url = "https://api.globalstats.io/oauth/access_token" ;
81
-
82
- WWWForm form = new WWWForm ( ) ;
83
- form . AddField ( "grant_type" , "client_credentials" ) ;
84
- form . AddField ( "scope" , "endpoint_client" ) ;
85
- form . AddField ( "client_id" , api_id ) ;
86
- form . AddField ( "client_secret" , api_secret ) ;
87
-
88
- WWW www = new WWW ( url , form ) ;
89
-
90
- while ( ! www . isDone ) {
91
- System . Threading . Thread . Sleep ( 100 ) ;
92
- }
93
-
94
- // check for errors
95
- if ( www . error == null ) {
96
- UnityEngine . Debug . Log ( "WWW getAccessToken Ok!: " ) ;
97
- } else {
98
- UnityEngine . Debug . Log ( "WWW getAccessToken Error: " + www . error ) ;
99
- UnityEngine . Debug . Log ( "WWW Content: " + www . text ) ;
100
- return false ;
101
- }
102
-
103
- api_access_token = JsonUtility . FromJson < GlobalstatsIO_AccessToken > ( www . text ) ;
104
-
105
- return true ;
106
- }
107
-
108
- public bool share ( string id = "" , string name = "" , Dictionary < string , string > values = null )
109
- {
110
- if ( api_access_token == null || ! api_access_token . isValid ( ) ) {
111
- if ( ! getAccessToken ( ) ) {
112
- return false ;
113
- }
114
- }
115
-
116
- // If no id is supplied but we have one stored, reuse it.
117
- if ( id == "" && statistic_id != "" )
118
- id = statistic_id ;
119
-
120
- string url = "https://api.globalstats.io/v1/statistics" ;
121
- if ( id != "" ) {
122
- url = "https://api.globalstats.io/v1/statistics/" + id ;
123
- } else {
124
- if ( name == "" )
125
- name = "anonymous" ;
126
- }
127
-
128
- string json_payload = "{\" name\" :\" " + name + "\" ,\" values\" :{" ;
129
-
130
- bool semicolon = false ;
131
- foreach ( KeyValuePair < string , string > value in values ) {
132
- if ( semicolon )
133
- json_payload += "," ;
134
- json_payload += "\" " + value . Key + "\" :\" " + value . Value + "\" " ;
135
- semicolon = true ;
136
- }
137
- json_payload += "}}" ;
138
-
139
- byte [ ] pData = Encoding . ASCII . GetBytes ( json_payload . ToCharArray ( ) ) ;
140
-
141
- GlobalstatsIO_StatisticResponse statistic = null ;
142
-
143
- if ( id == "" ) {
144
- Dictionary < string , string > headers = new Dictionary < string , string > ( ) ;
145
- headers . Add ( "Authorization" , "Bearer " + api_access_token . access_token ) ;
146
- headers . Add ( "Content-Type" , "application/json" ) ;
147
-
148
- WWW www = new WWW ( url , pData , headers ) ;
149
-
150
- while ( ! www . isDone ) {
151
- System . Threading . Thread . Sleep ( 100 ) ;
152
- }
153
-
154
- // check for errors
155
- if ( www . error == null ) {
156
- //UnityEngine.Debug.Log ("WWW POST Ok!");
157
- } else {
158
- UnityEngine . Debug . Log ( "WWW POST Error: " + www . error ) ;
159
- UnityEngine . Debug . Log ( "WWW POST Content: " + www . text ) ;
160
- return false ;
161
- }
162
-
163
- statistic = JsonUtility . FromJson < GlobalstatsIO_StatisticResponse > ( www . text ) ;
164
- } else {
165
- UnityEngine . Networking . UnityWebRequest www = UnityEngine . Networking . UnityWebRequest . Put ( url , pData ) ;
166
- www . SetRequestHeader ( "Authorization" , "Bearer " + api_access_token . access_token ) ;
167
- www . SetRequestHeader ( "Content-Type" , "application/json" ) ;
168
-
169
- UnityEngine . Networking . UploadHandler uploader = new UnityEngine . Networking . UploadHandlerRaw ( pData ) ;
170
- www . uploadHandler = uploader ;
171
-
172
- www . Send ( ) ;
173
-
174
- while ( ! www . isDone ) {
175
- System . Threading . Thread . Sleep ( 100 ) ;
176
- }
177
-
178
- // check for errors
179
- if ( www . error == null ) {
180
- //UnityEngine.Debug.Log ("WWW PUT Ok!");
181
- } else {
182
- UnityEngine . Debug . Log ( "WWW PUT Error: " + www . error ) ;
183
- UnityEngine . Debug . Log ( "WWW PUT Content: " + Encoding . ASCII . GetString ( www . downloadHandler . data ) ) ;
184
- return false ;
185
- }
186
-
187
- statistic = JsonUtility . FromJson < GlobalstatsIO_StatisticResponse > ( Encoding . ASCII . GetString ( www . downloadHandler . data ) ) ;
188
- }
189
-
190
- // ID is available only on create, not on update, so do not overwrite it
191
- if ( statistic . _id != null && statistic . _id != "" )
192
- statistic_id = statistic . _id ;
193
-
194
- user_name = statistic . name ;
195
-
196
- //Store the returned data statically
197
- foreach ( GlobalstatsIO_StatisticValues value in statistic . values ) {
198
- bool updated_existing = false ;
199
- for ( int i = 0 ; i < statistic_values . Count ; i ++ ) {
200
- if ( statistic_values [ i ] . key == value . key ) {
201
- statistic_values [ i ] = value ;
202
- updated_existing = true ;
203
- break ;
204
- }
205
- }
206
- if ( ! updated_existing ) {
207
- statistic_values . Add ( value ) ;
208
- }
209
- }
210
-
211
- return true ;
212
- }
213
-
214
- public GlobalstatsIO_StatisticValues getStatistic ( string key )
215
- {
216
- for ( int i = 0 ; i < statistic_values . Count ; i ++ ) {
217
- if ( statistic_values [ i ] . key == key ) {
218
- return statistic_values [ i ] ;
219
- }
220
- }
221
- return null ;
222
- }
223
-
224
- public bool linkStatistic ( string id = "" )
225
- {
226
- if ( api_access_token == null || ! api_access_token . isValid ( ) ) {
227
- if ( ! getAccessToken ( ) ) {
228
- return false ;
229
- }
230
- }
231
-
232
- // If no id is supplied but we have one stored, reuse it.
233
- if ( id == "" && statistic_id != "" )
234
- id = statistic_id ;
235
-
236
- string url = "https://api.globalstats.io/v1/statisticlinks/" + id + "/request" ;
237
-
238
- string json_payload = "{}" ;
239
- byte [ ] pData = Encoding . ASCII . GetBytes ( json_payload . ToCharArray ( ) ) ;
240
-
241
- Dictionary < string , string > headers = new Dictionary < string , string > ( ) ;
242
- headers . Add ( "Authorization" , "Bearer " + api_access_token . access_token ) ;
243
- headers . Add ( "Content-Type" , "application/json" ) ;
244
- headers . Add ( "Content-Length" , json_payload . Length . ToString ( ) ) ;
245
-
246
- WWW www = new WWW ( url , pData , headers ) ;
247
-
248
- while ( ! www . isDone ) {
249
- System . Threading . Thread . Sleep ( 100 ) ;
250
- }
251
-
252
- // check for errors
253
- if ( www . error == null ) {
254
- //UnityEngine.Debug.Log ("WWW POST Ok!");
255
- } else {
256
- UnityEngine . Debug . Log ( "WWW POST Error: " + www . error ) ;
257
- UnityEngine . Debug . Log ( "WWW POST Content: " + www . text ) ;
258
- return false ;
259
- }
260
-
261
- link_data = JsonUtility . FromJson < GlobalstatsIO_LinkData > ( www . text ) ;
262
- return true ;
263
- }
264
-
265
- // numberOfPlayer can be 100 at max.
266
- public GlobalstatsIO_Leaderboard getLeaderboard ( string gtd , int numberOfPlayers ) {
267
-
268
-
269
- if ( numberOfPlayers < 0 ) {
270
- return new GlobalstatsIO_Leaderboard ( ) ;
271
- } else if ( numberOfPlayers > 100 ) { // Number has to be between 0 and 100
272
- numberOfPlayers = 100 ;
273
- }
274
-
275
- if ( api_access_token == null || ! api_access_token . isValid ( ) )
276
- {
277
- if ( ! getAccessToken ( ) )
278
- {
279
- return new GlobalstatsIO_Leaderboard ( ) ;
280
- }
281
- }
282
-
283
-
284
- string url = "https://api.globalstats.io/v1/gtdleaderboard/" + gtd ;
285
-
286
- string json_payload = "{\" limit\" :" + numberOfPlayers + "\n }" ;
287
-
288
- Dictionary < string , string > headers = new Dictionary < string , string > ( ) ;
289
- headers . Add ( "Authorization" , "Bearer " + api_access_token . access_token ) ;
290
- headers . Add ( "Content-Type" , "application/json" ) ;
291
- headers . Add ( "Cache-Control" , "no-cache" ) ;
292
- headers . Add ( "Content-Length" , json_payload . Length . ToString ( ) ) ;
293
-
294
- byte [ ] pData = Encoding . ASCII . GetBytes ( json_payload . ToCharArray ( ) ) ;
295
-
296
-
297
- WWW www = new WWW ( url , pData , headers ) ;
298
-
299
-
300
- while ( ! www . isDone )
301
- {
302
- System . Threading . Thread . Sleep ( 100 ) ;
303
- }
304
-
305
- // check for errors
306
- if ( www . error == null )
307
- {
308
- //UnityEngine.Debug.Log ("WWW POST Ok!");
309
- }
310
- else
311
- {
312
- UnityEngine . Debug . Log ( "WWW POST Error: " + www . error ) ;
313
- UnityEngine . Debug . Log ( "WWW POST Content: " + www . text ) ;
314
- return new GlobalstatsIO_Leaderboard ( ) ;
315
- }
316
-
317
- GlobalstatsIO_Leaderboard leaderboard = JsonUtility . FromJson < GlobalstatsIO_Leaderboard > ( www . text ) ;
318
-
319
- return leaderboard ;
320
- }
321
-
322
- }
10
+ [ Serializable ]
11
+ public class StatisticValues
12
+ {
13
+ public string key = null ;
14
+ public string value = "0" ;
15
+ public string sorting = null ;
16
+ public string rank = "0" ;
17
+ public string value_change = "0" ;
18
+ public string rank_change = "0" ;
19
+ }
20
+
21
+ [ Serializable ]
22
+ public class LinkData
23
+ {
24
+ public string url = null ;
25
+ public string pin = null ;
26
+ }
27
+
28
+ [ Serializable ]
29
+ public class LeaderboardValue
30
+ {
31
+ public string name = null ;
32
+ public string user_profile = null ;
33
+ public string user_icon = null ;
34
+ public string rank = "0" ;
35
+ public string value = "0" ;
36
+ }
37
+
38
+ [ Serializable ]
39
+ public class Leaderboard
40
+ {
41
+ public LeaderboardValue [ ] data ;
42
+ }
43
+
44
+ public class GlobalstatsIOClient
45
+ {
46
+ private readonly string _apiId ;
47
+ private readonly string _apiSecret ;
48
+ private AccessToken _apiAccessToken ;
49
+ private List < StatisticValues > _statisticValues = new List < StatisticValues > ( ) ;
50
+
51
+ [ HideInInspector ]
52
+ public string StatisticId = "" ;
53
+
54
+ [ HideInInspector ]
55
+ public string UserName = "" ;
56
+
57
+ [ HideInInspector ]
58
+ public LinkData LinkData = null ;
59
+
60
+ [ Serializable ]
61
+ private class AccessToken
62
+ {
63
+ public string access_token = null ;
64
+ public string token_type = null ;
65
+ public string expires_in = null ;
66
+ public int created_at = ( int ) DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ;
67
+
68
+ //Check if still valid, allow a 2 minute grace period
69
+ public bool IsValid ( ) =>
70
+ ( this . created_at + int . Parse ( this . expires_in ) - 120 ) > ( int ) DateTimeOffset . UtcNow . ToUnixTimeSeconds ( ) ;
71
+ }
72
+
73
+ [ Serializable ]
74
+ private class StatisticResponse
75
+ {
76
+ public string name = null ;
77
+ public string _id = null ;
78
+
79
+ [ SerializeField ]
80
+ public List < StatisticValues > values = null ;
81
+ }
82
+
83
+ public GlobalstatsIOClient ( string apiKey , string apiSecret )
84
+ {
85
+ this . _apiId = apiKey ;
86
+ this . _apiSecret = apiSecret ;
87
+ }
88
+
89
+ private IEnumerator GetAccessToken ( )
90
+ {
91
+ string url = "https://api.globalstats.io/oauth/access_token" ;
92
+
93
+ WWWForm form = new WWWForm ( ) ;
94
+ form . AddField ( "grant_type" , "client_credentials" ) ;
95
+ form . AddField ( "scope" , "endpoint_client" ) ;
96
+ form . AddField ( "client_id" , this . _apiId ) ;
97
+ form . AddField ( "client_secret" , this . _apiSecret ) ;
98
+
99
+ using ( UnityWebRequest www = UnityWebRequest . Post ( url , form ) )
100
+ {
101
+ www . downloadHandler = new DownloadHandlerBuffer ( ) ;
102
+ yield return www . SendWebRequest ( ) ;
103
+
104
+ string responseBody = www . downloadHandler . text ;
105
+
106
+ if ( www . isNetworkError || www . isHttpError )
107
+ {
108
+ Debug . LogWarning ( "Error retrieving access token: " + www . error ) ;
109
+ Debug . Log ( "GlobalstatsIO API Response: " + responseBody ) ;
110
+ yield break ;
111
+ }
112
+ else
113
+ {
114
+ this . _apiAccessToken = JsonUtility . FromJson < AccessToken > ( responseBody ) ;
115
+ }
116
+ }
117
+ }
118
+
119
+ public IEnumerator Share ( Dictionary < string , string > values , string id = "" , string name = "" , Action < bool > callback = null )
120
+ {
121
+ bool update = false ;
122
+
123
+ if ( this . _apiAccessToken == null || ! this . _apiAccessToken . IsValid ( ) )
124
+ {
125
+ yield return this . GetAccessToken ( ) ;
126
+ }
127
+
128
+ // If no id is supplied but we have one stored, reuse it.
129
+ if ( id == "" && this . StatisticId != "" )
130
+ {
131
+ id = this . StatisticId ;
132
+ }
133
+
134
+ string url = "https://api.globalstats.io/v1/statistics" ;
135
+ if ( id != "" )
136
+ {
137
+ url = "https://api.globalstats.io/v1/statistics/" + id ;
138
+ update = true ;
139
+ }
140
+ else
141
+ {
142
+ if ( name == "" )
143
+ {
144
+ name = "anonymous" ;
145
+ }
146
+ }
147
+
148
+ string jsonPayload ;
149
+
150
+ if ( update == false )
151
+ {
152
+ jsonPayload = "{\" name\" :\" " + name + "\" , \" values\" :{" ;
153
+ }
154
+ else
155
+ {
156
+ jsonPayload = "{\" values\" :{" ;
157
+ }
158
+
159
+ bool semicolon = false ;
160
+ foreach ( KeyValuePair < string , string > value in values )
161
+ {
162
+ if ( semicolon )
163
+ {
164
+ jsonPayload += "," ;
165
+ }
166
+
167
+ jsonPayload += "\" " + value . Key + "\" :\" " + value . Value + "\" " ;
168
+ semicolon = true ;
169
+ }
170
+ jsonPayload += "}}" ;
171
+
172
+ byte [ ] pData = Encoding . UTF8 . GetBytes ( jsonPayload ) ;
173
+ StatisticResponse statistic = null ;
174
+
175
+ using ( UnityWebRequest www = new UnityWebRequest ( url ) )
176
+ {
177
+ if ( update == false )
178
+ {
179
+ www . method = "POST" ;
180
+ }
181
+ else
182
+ {
183
+ www . method = "PUT" ;
184
+ }
185
+
186
+ www . uploadHandler = new UploadHandlerRaw ( pData ) ;
187
+ www . downloadHandler = new DownloadHandlerBuffer ( ) ;
188
+ www . SetRequestHeader ( "Authorization" , "Bearer " + this . _apiAccessToken . access_token ) ;
189
+ www . SetRequestHeader ( "Content-Type" , "application/json" ) ;
190
+ yield return www . SendWebRequest ( ) ;
191
+
192
+ string responseBody = www . downloadHandler . text ;
193
+
194
+ if ( www . isNetworkError || www . isHttpError )
195
+ {
196
+ Debug . LogWarning ( "Error submitting statistic: " + www . error ) ;
197
+ Debug . Log ( "GlobalstatsIO API Response: " + responseBody ) ;
198
+ callback ? . Invoke ( false ) ;
199
+ }
200
+ else
201
+ {
202
+ statistic = JsonUtility . FromJson < StatisticResponse > ( responseBody ) ;
203
+ }
204
+ } ;
205
+
206
+ // ID is available only on create, not on update, so do not overwrite it
207
+ if ( statistic . _id != null && statistic . _id != "" )
208
+ {
209
+ this . StatisticId = statistic . _id ;
210
+ }
211
+
212
+ this . UserName = statistic . name ;
213
+
214
+ //Store the returned data statically
215
+ foreach ( StatisticValues value in statistic . values )
216
+ {
217
+ bool updatedExisting = false ;
218
+ for ( int i = 0 ; i < this . _statisticValues . Count ; i ++ )
219
+ {
220
+ if ( this . _statisticValues [ i ] . key == value . key )
221
+ {
222
+ this . _statisticValues [ i ] = value ;
223
+ updatedExisting = true ;
224
+ break ;
225
+ }
226
+ }
227
+ if ( ! updatedExisting )
228
+ {
229
+ this . _statisticValues . Add ( value ) ;
230
+ }
231
+ }
232
+
233
+ callback ? . Invoke ( true ) ;
234
+ }
235
+
236
+ public StatisticValues GetStatistic ( string key )
237
+ {
238
+ for ( int i = 0 ; i < this . _statisticValues . Count ; i ++ )
239
+ {
240
+ if ( this . _statisticValues [ i ] . key == key )
241
+ {
242
+ return this . _statisticValues [ i ] ;
243
+ }
244
+ }
245
+ return null ;
246
+ }
247
+
248
+ public IEnumerator LinkStatistic ( string id = "" , Action < bool > callback = null )
249
+ {
250
+ if ( this . _apiAccessToken == null || ! this . _apiAccessToken . IsValid ( ) )
251
+ {
252
+ yield return this . GetAccessToken ( ) ;
253
+ }
254
+
255
+ // If no id is supplied but we have one stored, reuse it.
256
+ if ( id == "" && this . StatisticId != "" )
257
+ {
258
+ id = this . StatisticId ;
259
+ }
260
+
261
+ string url = "https://api.globalstats.io/v1/statisticlinks/" + id + "/request" ;
262
+
263
+ string jsonPayload = "{}" ;
264
+ byte [ ] pData = Encoding . UTF8 . GetBytes ( jsonPayload ) ;
265
+
266
+ using ( UnityWebRequest www = new UnityWebRequest ( url , "POST" )
267
+ {
268
+ uploadHandler = new UploadHandlerRaw ( pData ) ,
269
+ downloadHandler = new DownloadHandlerBuffer ( )
270
+ } )
271
+ {
272
+ www . SetRequestHeader ( "Authorization" , "Bearer " + this . _apiAccessToken . access_token ) ;
273
+ www . SetRequestHeader ( "Content-Type" , "application/json" ) ;
274
+ yield return www . SendWebRequest ( ) ;
275
+
276
+ string responseBody = www . downloadHandler . text ;
277
+
278
+ if ( www . isNetworkError || www . isHttpError )
279
+ {
280
+ Debug . LogWarning ( "Error linking statistic: " + www . error ) ;
281
+ Debug . Log ( "GlobalstatsIO API Response: " + responseBody ) ;
282
+ callback ? . Invoke ( false ) ;
283
+ }
284
+
285
+ this . LinkData = JsonUtility . FromJson < LinkData > ( responseBody ) ;
286
+ } ;
287
+
288
+ callback ? . Invoke ( true ) ;
289
+ }
290
+
291
+ public IEnumerator GetLeaderboard ( string gtd , int numberOfPlayers , Action < Leaderboard > callback )
292
+ {
293
+ numberOfPlayers = Mathf . Clamp ( numberOfPlayers , 0 , 100 ) ; // make sure numberOfPlayers is between 0 and 100
294
+
295
+ if ( this . _apiAccessToken == null || ! this . _apiAccessToken . IsValid ( ) )
296
+ {
297
+ yield return this . GetAccessToken ( ) ;
298
+ }
299
+
300
+ string url = "https://api.globalstats.io/v1/gtdleaderboard/" + gtd ;
301
+
302
+ string json_payload = "{\" limit\" :" + numberOfPlayers + "\n }" ;
303
+ Leaderboard leaderboard ;
304
+ byte [ ] pData = Encoding . UTF8 . GetBytes ( json_payload ) ;
305
+
306
+ using ( UnityWebRequest www = new UnityWebRequest ( url , "POST" )
307
+ {
308
+ uploadHandler = new UploadHandlerRaw ( pData ) ,
309
+ downloadHandler = new DownloadHandlerBuffer ( )
310
+ } )
311
+ {
312
+ www . SetRequestHeader ( "Authorization" , "Bearer " + this . _apiAccessToken . access_token ) ;
313
+ www . SetRequestHeader ( "Content-Type" , "application/json" ) ;
314
+ yield return www . SendWebRequest ( ) ;
315
+
316
+ string responseBody = www . downloadHandler . text ;
317
+
318
+ if ( www . isNetworkError || www . isHttpError )
319
+ {
320
+ Debug . LogWarning ( "Error getting leaderboard: " + www . error ) ;
321
+ Debug . Log ( "GlobalstatsIO API Response: " + responseBody ) ;
322
+ callback ? . Invoke ( null ) ;
323
+ }
324
+
325
+ leaderboard = JsonUtility . FromJson < Leaderboard > ( responseBody ) ;
326
+ } ;
327
+
328
+ callback ? . Invoke ( leaderboard ) ;
329
+ }
330
+ }
331
+ }
0 commit comments