public void AuthorizeUser(Action <JSONObject> onComplete) { if (_token == null) { _token = GetToken(); } if (_token == "") { String response = "{\"error\": \"no token found\"}"; JSONObject jsonResponse = new JSONObject(response); jsonResponse.Bake(); onComplete(jsonResponse); return; } if (_userId == null) { _userId = GetUserid(); } if (_userId == "") { String response = "{\"error\": \"no userid found\"}"; JSONObject jsonResponse = new JSONObject(response); jsonResponse.Bake(); onComplete(jsonResponse); return; } POST("user/authorize", new Dictionary <string, string> { { "token", _token }, { "uuid", _userId } }, onComplete); }
private StringResources() { TextAsset strings = Resources.Load(Key) as TextAsset; if (strings != null) { _stringsJsonObject = new JSONObject(strings.text); _stringsJsonObject.Bake(); } else { _stringsJsonObject = new JSONObject(); } }
public static JSONObject GetConfig() { if (_config == null) { TextAsset config = Resources.Load("config") as TextAsset; if (config != null) { _config = new JSONObject(config.text); _config.Bake(); } else { _config = new JSONObject(); } } return(_config); }
private IEnumerator WaitForRequest(WWW www, System.Action <JSONObject> onComplete) { yield return(www); // check for errors if (www.error == null) { JSONObject result = new JSONObject(www.text); result.Bake(); onComplete(result); } else { Debug.Log(www.error); JSONObject result = new JSONObject(); result.AddField("error", www.error); result.Bake(); onComplete(result); } www.Dispose(); }
public static JSONObject GetConfig() { if (_config == null) { if (IsLocalConfigAvailable()) { _config = new JSONObject(PlayerPrefs.GetString(ConfigKey)); } else { TextAsset config = Resources.Load("config") as TextAsset; if (config != null) { _config = new JSONObject(config.text); _config.Bake(); } else { _config = new JSONObject(); } } } return _config; }
public void AuthorizeUser(Action<JSONObject> onComplete) { if(_token == null) { _token = GetToken (); } if(_token == "") { String response = "{\"error\": \"no token found\"}"; JSONObject jsonResponse = new JSONObject (response); jsonResponse.Bake (); onComplete (jsonResponse); return; } if (_userId == null) { _userId = GetUserid (); } if(_userId == "") { String response = "{\"error\": \"no userid found\"}"; JSONObject jsonResponse = new JSONObject (response); jsonResponse.Bake (); onComplete (jsonResponse); return; } POST ("user/authorize", new Dictionary<string, string> { { "token", _token }, { "uuid", _userId } }, onComplete); }
public static JSONObject GetConfig() { if (_config == null) { if (IsLocalConfigAvailable()) { _config = new JSONObject(PlayerPrefs.GetString(ConfigKey)); } else { TextAsset config = Resources.Load("config") as TextAsset; if (config != null) { _config = new JSONObject(config.text); _config.Bake(); } else { _config = new JSONObject(); } } } return(_config); }
private IEnumerator WaitForRequest(WWW www, System.Action<JSONObject> onComplete) { yield return www; // check for errors if (www.error == null) { JSONObject result = new JSONObject(www.text); result.Bake(); onComplete(result); } else { Debug.Log(www.error); JSONObject result = new JSONObject(); result.AddField("error", www.error); result.Bake(); onComplete(result); } www.Dispose (); }