/// <summary> /// Returns the ExperimentData displayed in the design ui. /// </summary> /// <returns>an ExperimentData struct containing the displayed UI.</returns> public ExperimentController.ExperimentSave GetExperimentData() { int questionId = 1; ExperimentController.ExperimentSave experimentData = new ExperimentController.ExperimentSave(); ExperimentController.TrialSave [] experimentTrials = new ExperimentController.TrialSave [TrialDisplayGroup.transform.childCount]; for (int i = 0; i < experimentTrials.Length; i++) { TrialDesignUI designUI = TrialDisplayGroup.transform.GetChild(i).GetComponent <TrialDesignUI> (); experimentTrials [i] = new ExperimentController.TrialSave { TrialType = designUI.TrialType, TrialData = designUI.GetTrialData() }; experimentTrials [i].TrialData.ConditionNumber = i; for (int j = 0; j < experimentTrials [i].TrialData.Questionnaire.Length; j++) { experimentTrials [i].TrialData.Questionnaire [j].QuestionId = questionId; questionId++; } } experimentData.ExperimentTrials = experimentTrials; return(experimentData); }
/// <summary> /// Sets the current experiment. /// </summary> /// <param name="experiment">The experiment.</param> /// <param name="experimentName">The name of the experiment.</param> public void SetExperiment(ExperimentController.ExperimentSave experiment) { OldExperimentState = experiment; foreach (ExperimentController.TrialSave trial in OldExperimentState.ExperimentTrials) { AddTrialUI(trial.TrialType, trial.TrialData); } }