/// <summary>
/// Reconstructs the <see cref="CloudConfig"/> from a <see cref="JSONObject"/>.
/// </summary>
/// <param name="jsonObject"><see cref="JSONObject"/> containing the <see cref="CloudConfig"/>.</param>
private void FromJSONObject(JSONObject jsonObject)
{
if (!jsonObject.HasFields(achievementIDsName, leaderboardIDsName, cloudVariablesName, appleSupportedName, googleSupportedName,
amazonSupportedName, androidPlatformName, googleAppIDName, googleSetupRunName, debugModeEnabledName, versionName))
{
throw new SerializationException("JSONObject missing fields, cannot deserialize to " + typeof(CloudConfig).Name);
}
AchievementIDs = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[achievementIDsName]);
LeaderboardIDs = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[leaderboardIDsName]);
CloudVariables = EditorJsonHelper.Convert <List <CloudVariableData> >(jsonObject[cloudVariablesName]);
AppleSupported = jsonObject[appleSupportedName].B;
GoogleSupported = jsonObject[googleSupportedName].B;
AmazonSupported = jsonObject[amazonSupportedName].B;
AndroidPlatform = (AndroidBuildPlatform)Enum.Parse(typeof(AndroidBuildPlatform), jsonObject[androidPlatformName].String);
GoogleAppID = jsonObject[googleAppIDName].String;
GoogleSetupRun = jsonObject[googleSetupRunName].B;
DebugModeEnabled = jsonObject[debugModeEnabledName].B;
Version = jsonObject[versionName].String;
if (jsonObject.HasFields(apiKeyName))
{
ApiKey = jsonObject[apiKeyName].String;
}
if (jsonObject.HasFields(settingsLocationName))
{
SettingsLocation = (SettingsLocation)Enum.Parse(typeof(SettingsLocation), jsonObject[settingsLocationName].String);
}
}