FittsLaw/Assets/Scripts/Participant.cs

28 lines
840 B
C#
Raw Normal View History

2018-10-14 19:55:46 -04:00
using UnityEngine;
using UnityEditor;
using Newtonsoft.Json.Linq;
public class Participant
{
public string[][] trials;
public string inputMethod;
public int participantId;
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());
}
}