void BuildDefaultAssets() { StartCoroutine(new WWWProxy() { url = _ServerJsonFilePath, feedback = delegate(WWW www) { // Debug.Log("Json File: " + www.text); tempConfigTable = JsonFx.Json.JsonReader.Deserialize <_ConfigTable>(www.text); if (tempConfigTable == null) { // Debug.LogError("DefaultConfigTable is NULL!!!"); //TODO.... return; } tempConfigTable.RemoveAll(x => (x.isDefault | x.decoration_status == 1)); foreach (_SourceMenuData menu in tempConfigTable.data) { DownloadDefaultData(menu); } } }.WaitForFinished()); }
public IEnumerator BuildConfigTable() { IsLoaded = false; defaultConfigTable = _InternalDataCodec.LoadSerializableData <_ConfigTable>(_DefaultConfigTablePath); if (defaultConfigTable == null) { // AppendLog("Android Database UnZip --- begin :"); defaultConfigTable = JsonFx.Json.JsonReader.Deserialize <_ConfigTable>(defaultConfigTxt.text); //#if UNITY_IPHONE // TransferConfigTable(defaultConfigTable, _DefaultRootDirectory, _LocalDatabaseDirectory); //#endif // while(!WWWProxy.IsDone) // yield return new WaitForFixedUpdate(); SaveDefaultConfigTable(); } localConfigTable = _InternalDataCodec.LoadSerializableData <_ConfigTable>(_LocalConfigTablePath); if (localConfigTable == null) { localConfigTable = defaultConfigTable; SaveLocalConfigTable(); } /*Debug.Log ("InternetReachability : " + Application.internetReachability.ToString());*/ if (Application.internetReachability == NetworkReachability.NotReachable) { SaveLocalConfigTable(); IsLoaded = true; yield return(null); } StartCoroutine(new WWWProxy() { url = _ServerJsonFilePath, feedback = www => { serverConfigTable = JsonFx.Json.JsonReader.Deserialize <_ConfigTable>(www.text); //过滤临时表 /// "isDefault":1, 是否预置配饰 为 ‘否’; /// "isDefault":0, 是否预置配饰 为 ‘是’; /// "decoration_status":1, 状态 为 ‘下架’; /// "decoration_status":0, 状态 为 ‘上架’; serverConfigTable.RemoveAll(x => (x.decoration_status == 1));// || !x.isDefault)); } }.WaitForFinished()); while (!WWWProxy.IsDone) { yield return(new WaitForFixedUpdate()); } // Debug.Log ("Server Config Table Transfer --- end\n Server Config Table is null? " + (serverConfigTable == null).ToString()); // AppendLog("Server Config Table Transfer --- end : " +(serverConfigTable == null ? " NULL !!!" : "Exits! ") + Time.frameCount); if (serverConfigTable == null || serverConfigTable.data == null || serverConfigTable.data.Count == 0) { // Debug.Log("Server Config Table is NOT Exist!!! There must be another BIG Mistake!!!"); SaveLocalConfigTable(); IsLoaded = true; yield return(null); } if (localConfigTable.Equals(serverConfigTable)) { // Debug.Log("Nothing is changed!!! Just GO!GO!GO!!!"); IsLoaded = true; yield return(null); } else { // Debug.Log ("Compare server to local --- begin "); if (serverConfigTable != null && serverConfigTable.data != null && localConfigTable != null && localConfigTable.data != null) { CompareMenuData(serverConfigTable.data, localConfigTable.data); } //SaveLocalConfigTable(); // Debug.Log ("Compare server to local --- end "); } while (!WWWProxy.IsDone) { yield return(new WaitForFixedUpdate()); } SaveLocalConfigTable(); IsLoaded = true; yield return(null); }