public void POSTToDataBase() { JsonObject newUser = new JsonObject(); newUser.Add("email", emailInputField.text); newUser.Add("password", passwordInputField.text); _Rester.PostJSON(url + "register", newUser, (err, result) => { Debug.LogWarning("Error: " + err); Debug.LogWarning("Result: " + result); }); }
private void ExportRecordedDataToJSON() { JsonObject recordedData = new JsonObject(); JsonArray posRotArray = new JsonArray(); for (int i = 0; i < recordedPositions.Count; i++) { // Get reference to current position/rotation in our recorded data Vector3 currentPos = recordedPositions[i]; float currentYRot = recordedYRotations[i]; // Build out position and rotation objects JsonObject posV = new JsonObject(); posV.Add("x", currentPos.x); posV.Add("y", currentPos.y); posV.Add("z", currentPos.z); // JsonObject rotQ = new JsonObject(); // rotQ.Add( "w", currentYRot.w ); // rotQ.Add( "x", currentYRot.x ); // rotQ.Add( "y", currentYRot.y ); // rotQ.Add( "z", currentYRot.z ); // Create and populate object that will encapsulate position and rotation at this index JsonObject posRotPair = new JsonObject(); posRotPair.Add("posV", posV); posRotPair.Add("yRot", currentYRot); // Add new object to array of positions posRotArray.Add(posRotPair); } // Add array of positions to recorded data recordedData.Add("frames", posRotArray); _Rester.PostJSON("asaghostmatch.herokuapp.com/data", recordedData, (string err, JsonObject retJO) => { Debug.Log(err); }); Debug.LogWarning("Exporting complete."); }