FittsLaw/Assets/Scripts/Participant.cs
2020-05-27 02:10:41 -04:00

28 lines
869 B
C#

using UnityEngine;
using UnityEditor;
using Newtonsoft.Json.Linq;
public class Participant
{
public string[][] trials;
public string inputMethod;
public int participantId;
//Parse data from server.
public Participant(string json)
{
JObject jObject = JObject.Parse(json);
JArray jTrials = (JArray)jObject["trials"];
this.trials = new string[jTrials.Count][];
for (int i = 0;i<jTrials.Count;i++)
{
JArray ja = (JArray)jTrials[i];
this.trials[i] = new string[ja.Count];
for(int j = 0; j < ja.Count;j++)
{
this.trials[i][j] = ja[j].ToString();
}
}
this.inputMethod = jObject["inputMethod"].ToString();
this.participantId = int.Parse(jObject["participantId"].ToString());
}
}