updated code

This commit is contained in:
Chris Midkiff 2020-06-22 13:30:08 -04:00
parent d727f902aa
commit 5c9a0f8137
2 changed files with 14 additions and 3 deletions

View File

@ -42,7 +42,8 @@ namespace Assets.Scripts
client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string ud = "userStudyId=" + name + "&userStudyData=" + data;
client.UploadStringAsync(new Uri(endpoint), ud);
string r = client.UploadString(new Uri(endpoint),"POST", ud);
UnityEngine.Debug.Log(r);
}
}

14
Assets/Scripts/ExperimentController.cs Normal file → Executable file
View File

@ -31,13 +31,14 @@ public class ExperimentController : MonoBehaviour {
#if UNITY_STANDALONE_WIN
platform = "oculus";
#endif
platform = "mouse";
UnityEngine.Debug.Log(platform);
string response = "";
UnityEngine.Debug.Log(Application.persistentDataPath);
//Load Trial data from server
using (WebClient client = new WebClient())
{
string endpoint = "http://<URL OF SERVER INSTANCE>" + platform;
string endpoint = "http://<SERVER INSTANCE URL>/" + platform;
response = client.DownloadString(endpoint);
UnityEngine.Debug.Log("Received Response: " + response);
}
@ -172,7 +173,16 @@ public class ExperimentController : MonoBehaviour {
else if(nextDot.name.Contains("Long")){
sample.Distance = 1500;
}
else
if (nextDot.name.Contains("Up")){
sample.Angle = 90;
}
else if (nextDot.name.Contains("Right"))
{
sample.Angle = 0;
}else if (nextDot.name.Contains("Left"))
{
sample.Angle = 180;
}
sample.Time = time;
sample.Direction = direction;
sample.DotName = nextDot.name;