//---------------------------------------------------------------------- IEnumerator IGetData() { // 从网络拉取 if (true) { WWW www = new WWW(NetConfig.s_qiniuDownloadUrl + "code.json"); yield return(www);//等待Web服务器的反应 // 错误 if (www.error != null) { Debug.Log(www.error); yield return(null); } SceneLogScript.setLog("0"); //Debug.Log(www.text); SceneLogScript.setLog(www.text); Entity_code.getInstance().init(www.text); } // 从本地拉取 else { yield return(null); StreamReader sr = new StreamReader("Assets\\Resources\\Files\\code.json", System.Text.Encoding.GetEncoding("utf-8")); string jsonData = sr.ReadToEnd().ToString(); sr.Close(); //Debug.Log(jsonData); Entity_code.getInstance().init(jsonData); } }
public static Entity_code getInstance() { if (s_entity_code == null) { s_entity_code = new Entity_code(); } return(s_entity_code); }