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"; client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
string ud = "userStudyId=" + name + "&userStudyData=" + data; 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 #if UNITY_STANDALONE_WIN
platform = "oculus"; platform = "oculus";
#endif #endif
platform = "mouse";
UnityEngine.Debug.Log(platform); UnityEngine.Debug.Log(platform);
string response = ""; string response = "";
UnityEngine.Debug.Log(Application.persistentDataPath); UnityEngine.Debug.Log(Application.persistentDataPath);
//Load Trial data from server //Load Trial data from server
using (WebClient client = new WebClient()) using (WebClient client = new WebClient())
{ {
string endpoint = "http://<URL OF SERVER INSTANCE>" + platform; string endpoint = "http://<SERVER INSTANCE URL>/" + platform;
response = client.DownloadString(endpoint); response = client.DownloadString(endpoint);
UnityEngine.Debug.Log("Received Response: " + response); UnityEngine.Debug.Log("Received Response: " + response);
} }
@ -172,7 +173,16 @@ public class ExperimentController : MonoBehaviour {
else if(nextDot.name.Contains("Long")){ else if(nextDot.name.Contains("Long")){
sample.Distance = 1500; 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.Time = time;
sample.Direction = direction; sample.Direction = direction;
sample.DotName = nextDot.name; sample.DotName = nextDot.name;