/// <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); } }
/// <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(c_keyAchievementIDs, c_keyLeaderboardIDs, c_keyCloudVariables, c_keyAppleSupported, c_keyGoogleSupported, c_keyAmazonSupported, c_keyAndroidPlatform, c_keyGoogleAppID, c_keyGoogleSetupRun, c_keyDebugModeEnabled, c_keyVersion)) { throw new SerializationException("JSONObject missing fields, cannot deserialize to " + typeof(CloudConfig).Name); } AchievementIDs = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[c_keyAchievementIDs]); LeaderboardIDs = EditorJsonHelper.Convert <List <PlatformIdData> >(jsonObject[c_keyLeaderboardIDs]); CloudVariables = EditorJsonHelper.Convert <List <CloudVariableData> >(jsonObject[c_keyCloudVariables]); AppleSupported = jsonObject[c_keyAppleSupported].B; GoogleSupported = jsonObject[c_keyGoogleSupported].B; AmazonSupported = jsonObject[c_keyAmazonSupported].B; AndroidPlatform = (AndroidBuildPlatform)Enum.Parse(typeof(AndroidBuildPlatform), jsonObject[c_keyAndroidPlatform].String); GoogleAppID = jsonObject[c_keyGoogleAppID].String; GoogleSetupRun = jsonObject[c_keyGoogleSetupRun].B; DebugModeEnabled = jsonObject[c_keyDebugModeEnabled].B; Version = jsonObject[c_keyVersion].String; if (jsonObject.HasFields(c_apiKey)) { ApiKey = jsonObject[c_apiKey].String; } }