protected void RequestForUserImageFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler RequestForUserImageFinished(_dataDict); }
private void AddValue() { if (m_plist == null) { m_result = "Please load the plist before calling its API's"; return; } if (string.IsNullOrEmpty(m_input)) { m_result = "Failed to add value"; return; } object _JSONObject = JSONUtility.FromJSON(m_input); if (_JSONObject != null) { m_plist.AddValue(m_keyPath, _JSONObject); m_result = "Plist=" + JSONUtility.ToJSON(m_plist); } else { m_plist.AddValue(m_keyPath, m_input); m_result = "Plist=" + JSONUtility.ToJSON(m_plist); } }
public void Initialise() { string _localNotificationJSONStr = EditorPrefs.GetString(kDidStartWithLocalNotification, string.Empty); string _remoteNotificationJSONStr = EditorPrefs.GetString(kDidStartWithRemoteNotification, string.Empty); // Get launch local notification if (!string.IsNullOrEmpty(_localNotificationJSONStr)) { IDictionary _notificationDict = JSONUtility.FromJSON(_localNotificationJSONStr) as IDictionary; CrossPlatformNotification _launchNotification = new CrossPlatformNotification(_notificationDict); // Send notification SendLocalNotification(_launchNotification); } // Get launch remote notification if (!string.IsNullOrEmpty(_remoteNotificationJSONStr)) { IDictionary _notificationDict = JSONUtility.FromJSON(_remoteNotificationJSONStr) as IDictionary; CrossPlatformNotification _launchNotification = new CrossPlatformNotification(_notificationDict); // Send notification SendRemoteNotification(_launchNotification); } // Remove cached values EditorPrefs.DeleteKey(kDidStartWithLocalNotification); EditorPrefs.DeleteKey(kDidStartWithRemoteNotification); }
protected void ReportScoreFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler ReportScoreFinished(_dataDict); }
public IDictionary GetAchievementData(string _id) { string _dataStr = Plugin.Call <string>(AndroidNativeInfo.Methods.GET_ACHIEVEMENT_DATA, _id); IDictionary _achievementsDict = JSONUtility.FromJSON(_dataStr) as IDictionary; return(_achievementsDict); }
protected override void ParseAppLaunchInfo(string _launchData, out CrossPlatformNotification _launchLocalNotification, out CrossPlatformNotification _launchRemoteNotification) { Dictionary <string, object> _payloadDict = JSONUtility.FromJSON(_launchData) as Dictionary <string, object>; object _isRemoteNotification = "false"; if (_payloadDict != null) { _payloadDict.TryGetValue(AndroidNotificationPayload.kIsRemoteNotification, out _isRemoteNotification); Debug.LogError("Launch Notification is Remote Notification ? " + _isRemoteNotification); // Launched with local notification if (_isRemoteNotification.Equals("false")) { _launchLocalNotification = new AndroidNotificationPayload((IDictionary)_payloadDict); _launchRemoteNotification = null; } // Launched with remote notification else { _launchLocalNotification = null; _launchRemoteNotification = new AndroidNotificationPayload((IDictionary)_payloadDict); } } // Normal launch else { _launchLocalNotification = null; _launchRemoteNotification = null; } }
private void OnReceivingScores(string _loadedScoresJsonStr, Leaderboard.LoadScoreCompletion _callback) { IList _scoresJsonList = JSONUtility.FromJSON(_loadedScoresJsonStr) as IList; Score[] _scores = null; Score _localUserScore = null; if (_scoresJsonList != null) { int _count = _scoresJsonList.Count; if (_count > 0) { _localUserScore = AndroidScore.ConvertScore(_scoresJsonList[_count - 1] as IDictionary); //Now remove the last element. As we stored user score in the last entry. _scoresJsonList.RemoveAt(_count - 1); _scores = AndroidScore.ConvertScoreList(_scoresJsonList); if (_localUserScore.User == null) //Empty entry { _localUserScore = null; } } } // Send callback if (_callback != null) { _callback(_scores, _localUserScore); } }
protected override void ParseReceivedNotificationData(string _dataStr, out CrossPlatformNotification _receivedNotification, out bool _isLaunchNotification) { IDictionary _dataDict = JSONUtility.FromJSON(_dataStr) as IDictionary; // Extract properties IDictionary _payloadDict = _dataDict.GetIfAvailable <IDictionary>(kPayloadKey); _receivedNotification = new iOSNotificationPayload(_payloadDict); _isLaunchNotification = _dataDict.GetIfAvailable <bool>(kIsLaunchNotificationKey); if (_receivedNotification.UserInfo != null) { #if USES_ONE_SIGNAL // Our system should ignore raising events sent from One Signal const string _kOneSignalIdentifierKeyPath = "custom/i"; if (_receivedNotification.UserInfo.ContainsKeyPath(_kOneSignalIdentifierKeyPath)) { _receivedNotification = null; return; } #endif } }
protected void LoadAchievementDescriptionsFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler LoadAchievementDescriptionsFinished(_dataDict); }
protected override void DidReceiveBillingProducts(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); string _error = _dataDict.GetIfAvailable <string>(kErrorKey); if (_error != null) { DidReceiveBillingProducts(null, _error); return; } else { IList _regProductsJSONList = _dataDict.GetIfAvailable <IList>(kProductsKey); BillingProduct[] _regProductsList = null; if (_regProductsJSONList != null) { _regProductsList = new BillingProductAndroid[_regProductsJSONList.Count]; int _iter = 0; foreach (IDictionary _productInfoDict in _regProductsJSONList) { _regProductsList[_iter++] = new BillingProductAndroid(_productInfoDict); } } DidReceiveBillingProducts(_regProductsList, null); return; } }
private void AuthenticationFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler AuthenticationFinished(_dataDict); }
protected override void DidFinishBillingTransaction(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); string _error = _dataDict.GetIfAvailable <string>(kErrorKey); if (_error != null) { DidFinishBillingTransaction(null, _error); return; } else { IList _transactionsJSONList = _dataDict.GetIfAvailable <IList>(kTransactionsKey); BillingTransaction[] _transactionsList = null; if (_transactionsJSONList != null) { _transactionsList = new iOSBillingTransaction[_transactionsJSONList.Count]; int _iter = 0; foreach (IDictionary _transactionInfoDict in _transactionsJSONList) { _transactionsList[_iter++] = new iOSBillingTransaction(_transactionInfoDict); } } DidFinishBillingTransaction(_transactionsList, null); return; } }
private void DidReceiveNewCloudData(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); string _encodedData = _dataDict.GetIfAvailable <string>(kKeyForNewCloudData); string _cloudAccountName = _dataDict.GetIfAvailable <string>(kKeyForCloudAccount); // Decode the data with Base64 and convert to Json IDict. if (!string.IsNullOrEmpty(_encodedData)) { string _decodedData = _encodedData.FromBase64(); Console.Log(Constants.kDebugTag, "[CloudServices] Received from Cloud : " + _decodedData); IDictionary _newCloudData = (IDictionary)JSONUtility.FromJSON(_decodedData); // Here compare the data with the one on local disk and trigger the ExternallyChagedEvent. CheckChangedKeyValueStoreDataAndRefresh(_newCloudData, _cloudAccountName); } if (IsLocalDirty()) { SetLocalDirty(false); //We are setting to false and on failed commit to cloud we set it to true. If we don't set here, there could be chances for missing the flagstatus if set to false in callback on sucess of save. string _jsonString = m_dataStore.ToJSON(); Console.Log(Constants.kDebugTag, "[CloudServices] Save To Cloud : " + _jsonString); Plugin.Call(Native.Methods.SAVE_CLOUD_DATA, _jsonString.ToBase64()); } else { FinishedSync(true); } }
private void LoadFriendsFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler LoadFriendsFinished(_dataDict); }
protected void LoadUsersFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); // Invoke handler LoadUsersFinished(_dataDict); }
protected override void ParseReceivedNotificationData(string _dataStr, out CrossPlatformNotification _receivedNotification, out bool _isLaunchNotification) { IDictionary _dataDict = JSONUtility.FromJSON(_dataStr) as IDictionary; _receivedNotification = new AndroidNotificationPayload(_dataDict); _isLaunchNotification = _dataDict.GetIfAvailable <bool>(kIsLaunchNotificationKey); }
protected override void ExtractTransactionResponseData(string _dataStr, out BillingTransaction[] _transactions, out string _error) { // Set default values _transactions = null; _error = null; // Parse and fetch properties from JSON object IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); _error = _dataDict.GetIfAvailable <string>(kErrorKey); if (_error == null) { IList _transactionsJSONList = _dataDict.GetIfAvailable <IList>(kTransactionsKey); if (_transactionsJSONList != null) { int _count = _transactionsJSONList.Count; _transactions = new BillingTransactionAndroid[_count]; for (int _iter = 0; _iter < _count; _iter++) { _transactions[_iter] = new BillingTransactionAndroid((IDictionary)_transactionsJSONList[_iter]); } } } }
private void DrawUpdateNews() { string newJson = EditorPrefs.GetString(Constants.kVBNewsKey, "[]"); IList news = (IList)JSONUtility.FromJSON(newJson); if (news.Count > 0) { GUILayout.FlexibleSpace(); EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); EditorGUI.indentLevel++; m_recentUpdatesFoldout = EditorGUILayout.Foldout(m_recentUpdatesFoldout, "Recent Updates", true); if (m_recentUpdatesFoldout) { m_recentUpdatesScrollPosition = GUILayout.BeginScrollView(m_recentUpdatesScrollPosition, GUILayout.MinHeight(150f)); GUILayout.BeginVertical(EditorStyles.helpBox); foreach (IDictionary eachEntry in news) { GUILayout.BeginVertical(EditorStyles.helpBox); foreach (string key in eachEntry.Keys) { object value = eachEntry[key]; if ((value as IDictionary) != null) { IDictionary info = value as IDictionary; string link = info.GetIfAvailable <string>("link"); string description = info.GetIfAvailable <string>("description"); GUILayout.BeginHorizontal(); if (GUILayout.Button(key)) { Application.OpenURL(link); } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); EditorGUI.indentLevel++; GUILayout.Label(description, EditorStyles.wordWrappedLabel); EditorGUI.indentLevel--; } else { GUILayout.Label(key, EditorStyles.boldLabel); EditorGUI.indentLevel++; GUILayout.Label(value.ToString(), EditorStyles.wordWrappedLabel); EditorGUI.indentLevel--; } } GUILayout.Space(6); GUILayout.EndVertical(); } GUILayout.EndVertical(); GUILayout.EndScrollView(); } EditorGUI.indentLevel--; } }
protected void LoadExternalAuthenticationCredentialsFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); Debug.Log("LoadExternalAuthenticationCredentialsFinished" + _dataStr); // Invoke handler LoadExternalAuthenticationCredentialsFinished(_dataDict); }
protected override void ABRequestAccessFinished(string _dataStr) { IDictionary _dataDict = (IDictionary)JSONUtility.FromJSON(_dataStr); string _error = _dataDict.GetIfAvailable <string>(kErrorKey); eABAuthorizationStatus _authStatus = ConvertFromNativeAuthorizationStatus(_dataDict.GetIfAvailable <iOSABAuthorizationStatus>(kAuthStatusKey)); // Invoke handler ABRequestAccessFinished(_authStatus, _error); }
private void OnReceivingLocalUsersFriendsList(string _friendsJsonStr) { IList _friendsJsonList = JSONUtility.FromJSON(_friendsJsonStr) as IList; // Send callback if (OnLoadLocalUserFriendsFinished != null) { OnLoadLocalUserFriendsFinished(AndroidUser.ConvertToUserList(_friendsJsonList)); } }
private void OnReceivingAchievements(string _achievementsJsonStr) { IList _achievementsJsonList = JSONUtility.FromJSON(_achievementsJsonStr) as IList; // Send callback if (OnLoadAchievementsFinished != null) { OnLoadAchievementsFinished(AndroidAchievement.ConvertAchievementList(_achievementsJsonList)); } }
private void OnReceivingUserProfilesList(string _loadedUsersJsonStr) { IList _usersJsonList = JSONUtility.FromJSON(_loadedUsersJsonStr) as IList; // Send callback if (OnLoadUsersFinished != null) { OnLoadUsersFinished(AndroidUser.ConvertToUserList(_usersJsonList)); } }
private void Awake() { var textAsset = Resources.Load <TextAsset>(resourceFile); var voText = JSONUtility.FromJSON <VoiceOverText>(textAsset.text); foreach (var t in voText.lines) { lines[t.key] = t.line; } }
public override TwitterAuthSession GetSessionWithUserID(string _userID = null) { string _sessionJSONString = Plugin.Call <string>(Native.Methods.GET_AUTH_SESSION, _userID); if (string.IsNullOrEmpty(_sessionJSONString)) { return(null); } return(new AndroidTwitterSession((IDictionary)JSONUtility.FromJSON(_sessionJSONString))); }
public override TwitterAuthSession GetSessionWithUserID(string _userID) { string _sessionJSONString = cpnpTwitterGetSessionDictionaryWithUserID(_userID); if (_sessionJSONString == null) { return(null); } return(new iOSTwitterAuthSession((IDictionary)JSONUtility.FromJSON(_sessionJSONString))); }
private IDictionary GetLocalStoreDiskData() { string _encodedLocalData = PlayerPrefs.GetString(kKeyForCloudServicesLocalStore, null); if (_encodedLocalData != null) { string _decodedLocalData = _encodedLocalData.FromBase64(); return((IDictionary)JSONUtility.FromJSON(_decodedLocalData)); } return(null); }
protected void WebViewDidReceiveMessage(string _dataJsonStr) { IDictionary _dataDict = JSONUtility.FromJSON(_dataJsonStr) as IDictionary; string _tag; WebViewMessage _message; // Parse received data ParseMessageData(_dataDict, out _tag, out _message); // Get webview instance and call event handler WebViewDidReceiveMessage(GetWebViewWithTag(_tag), _message); }
protected void WebViewDidFinishEvaluatingJS(string _resultJsonStr) { IDictionary _resultJsonDict = JSONUtility.FromJSON(_resultJsonStr) as IDictionary; string _tag; string _result; // Parse received data ParseEvalJSData(_resultJsonDict, out _tag, out _result); // Get webview instance and call event handler WebViewDidFinishEvaluatingJS(GetWebViewWithTag(_tag), _result); }
protected void WebViewDidFailLoadWithError(string _errorJsonStr) { IDictionary _errorJsonDict = JSONUtility.FromJSON(_errorJsonStr) as IDictionary; string _tag; string _error; // Parse received data ParseLoadErrorData(_errorJsonDict, out _tag, out _error); // Get webview instance and call event handler WebViewDidFailLoadWithError(GetWebViewWithTag(_tag), _error); }