2using Newtonsoft.Json.Linq;
4using System.Collections.Generic;
5using System.Runtime.CompilerServices;
8using UnityEngine.UIElements;
33 bool hasErrored =
false;
36 if (hasErrorSetup ==
false)
40 if (
Error.Equals(
"true", StringComparison.CurrentCultureIgnoreCase))
46 hasErrored = !
string.IsNullOrEmpty(
Error);
56 public class JoinSessionResponse : FailureResponse
63 IEnumerable<JProperty> dataPropertyEnumerator =
Data.Properties();
64 foreach (JProperty property
in dataPropertyEnumerator)
66 if (property.Name.Equals(
"SessionId", StringComparison.OrdinalIgnoreCase))
68 SessionId = JsonConvert.DeserializeObject<
int>(
property.Value.ToString());
84 return (
Error.Equals(
"true", StringComparison.CurrentCultureIgnoreCase));
90 IEnumerable<JProperty> dataPropertyEnumerator =
Data.Properties();
92 foreach (JProperty currentProperty
in dataPropertyEnumerator)
96 currentUser.UserId = currentProperty.Name;
97 currentUser.AvailableModules = JsonConvert.DeserializeObject<List<int>>(currentProperty.Value.ToString());
119 [JsonProperty(PropertyName =
"userIds")]
120 public List<int>
UserIds =
new List<int>();
124 public class LoginData
155 public class UserLoginResponseContent : IPlatformErrorable
157 public LoginResponseContent
User;
199 return (
Email ==
null);
214 public class AssistedLoginCode
232 public SessionData(
float score,
float scaled,
float min,
float max,
int duration,
bool completed,
bool success)
244#if UNITY_6000_0_OR_NEWER
251 public string Name =
"";
275#if UNITY_6000_0_OR_NEWER
281 public List<OrgModuleDownload>
Downloads =
new List<OrgModuleDownload>();
287#if UNITY_6000_0_OR_NEWER
288 public event EventHandler<BindablePropertyChangedEventArgs> propertyChanged;
293 Downloads =
new List<OrgModuleDownload>();
298 Downloads =
new List<OrgModuleDownload>();
304 ID = token.Value<
int>(
"ID");
305 Name = token.Value<
string>(
"Name");
312 Categories = token.Value<
string>(
"Categories");
313 externalId = token.Value<
string>(
"externalId");
316 var PlayerToken = token.Value<JObject>(
"player");
318 if (PlayerToken !=
null)
323 var DownloadTokens = token.Value<JArray>(
"Downloads");
325 if (DownloadTokens !=
null)
327 foreach (JToken DownloadToken
in DownloadTokens)
335 var availableLanguages = GetValue<JArray>(token,
"availableLanguages");
337 if (availableLanguages !=
null)
339 var availableLanguagesList =
new List<string>();
341 foreach (JToken languageToken
in availableLanguages)
343 string displayName = GetValue<string>(languageToken,
"displayName");
344 if (!
string.IsNullOrEmpty(displayName))
346 availableLanguagesList.Add(displayName);
353 var industry = GetValue<string>(token,
"Industry");
354 if (!
string.IsNullOrEmpty(industry) && industry.Length > 0)
356 Industry =
char.ToUpper(industry[0]) + (industry.Length > 1 ? industry[1..] :
string.Empty);
360 var distributor = GetValue<JToken>(token,
"distributor");
361 if (distributor !=
null)
367 private T
GetValue<T>(JToken token,
string propertyName, T defaultValue =
default)
369 return token[propertyName] !=
null ? token.Value<T>(propertyName) : defaultValue;
373#if UNITY_6000_0_OR_NEWER
374 void Notify([CallerMemberName]
string property =
"")
376 propertyChanged?.Invoke(
this,
new BindablePropertyChangedEventArgs(property));
400 public void Parse(JToken token)
402 ID = token.Value<
int>(
"ID");
403 VersionID = token.Value<
int>(
"VersionID");
405 externalId = token.Value<
string>(
"externalId");
407 Version = token.Value<
string>(
"Version");
408 Platform = token.Value<
string>(
"Platform");
409 ApkName = token.Value<
string>(
"ApkName");
410 URL = token.Value<
string>(
"URL");
411 Status = token.Value<
string>(
"Status");
423 public List<PlatformPlayerDownload>
versions =
new List<PlatformPlayerDownload>();
427 id = tokenObject.Value<
int>(
"id");
429 name = tokenObject.Value<
string>(
"name");
430 description = tokenObject.Value<
string>(
"description");
433 var versionTokens = tokenObject.Value<JArray>(
"versions");
434 if (versionTokens ==
null)
436 versionTokens =
new JArray();
439 foreach (JToken Version
in versionTokens)
441 versions.Add(
new PlatformPlayerDownload(Version));
459 id = token.Value<
int>(
"id");
461 version = token.Value<
string>(
"version");
462 status = token.Value<
string>(
"status");
463 URL = token.Value<
string>(
"URL");
464 ApkName = token.Value<
string>(
"ApkName");
465 platform = token.Value<
string>(
"platform");
AssistedLoginCode AssistedLogin
List< UserModulesData > ParsedData
LoginData(string username, string password)
OrgModuleDownload(JToken token)
string AvailableLanguages
List< OrgModuleDownload > Downloads
T GetValue< T >(JToken token, string propertyName, T defaultValue=default)
SessionData(float score, float scaled, float min, float max, int duration, bool completed, bool success)
LoginResponseContent User
List< int > AvailableModules