IEnumerator UpdateFloorLoop(Floor f, UpdateFloorCallback callback) { WWWForm form = new WWWForm(); form.AddField("request", "update_floor"); form.AddField("floor", f.ToJSON().ToString()); form.AddField("token", token); // Create a download object WWW request = new WWW(apiUrl, form); // Wait until the download is done yield return(request); if (!string.IsNullOrEmpty(request.error)) { Debug.Log("Unable to update floor: " + request.error); callback(false, false); } else { Debug.Log(request.text); JSONNode root = JSON.Parse(request.text); if (root["success"] != null && root["success"].AsBool) { callback(true, true); } else { callback(true, false); } } updateFloorCoroutine = null; }
public string ExportFloor() { JSONNode node = floor.ToJSON(); return(node.ToString()); }