public IEnumerator LoadData(int type, string url, Action <string> action) { //获取json string baseUrl = DataMgr.tokenUrl; WWW www = new WWW(baseUrl); yield return(www); if (www.isDone) { Debug.LogError(www.text); JsonData jsonData = JsonMapper.ToObject(www.text); DataMgr.access_token = jsonData["data"]["access_token"].ToString(); if (type == 1) { url = DataMgr.GetURL(url); } else { url = DataMgr.GetURLById(url); } WWW www1 = new WWW(url); yield return(www1); if (www1.isDone) { if (action != null) { action(www1.text); action = null; } } else { Debug.LogError("Request failed!"); } } }