Ejemplo n.º 1
0
 void ListenForInterrupt()
 {
     foreach (KeyCode interruptKey in InterruptKeys)
     {
         if (Input.GetKeyDown(interruptKey))
         {
             ExperimentEvents.InterruptTrial();
         }
     }
 }
Ejemplo n.º 2
0
 void ListenForGoToNextTrial()
 {
     foreach (KeyCode nextKey in NextKeys)
     {
         if (Input.GetKeyDown(nextKey))
         {
             ExperimentEvents.SkipToNextTrial();
         }
     }
 }
Ejemplo n.º 3
0
 void ListenForGoBackTrial()
 {
     foreach (KeyCode backKey in BackKeys)
     {
         if (Input.GetKeyDown(backKey))
         {
             ExperimentEvents.GoBackOneTrial();
         }
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Starts the Runner. The Runner does not start automatically, because it waits for an event to start it.
        /// </summary>
        /// <param name="currentSession"></param>
        void StartExperiment(Session currentSession)
        {
            if (!FinishedInitialization)
            {
                throw new NullReferenceException("Experiment started before FinishedInitialization");
            }

            Running       = true;
            outputManager = new OutputManager(currentSession.OutputFullPath);



            Debug.Log("Starting Runner");
            ExperimentEvents.ExperimentStarted();

            StartCoroutine(ConfigFile.ControlSettings.Run());
            ExperimentEvents.StartPart(experiment);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Display the Runner controls
        /// </summary>
        void ShowExperimentControls()
        {
            EditorGUILayout.Space();
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.LabelField("Runner Controls:", EditorStyles.boldLabel);
            EditorGUI.indentLevel++;

            if (!runner.Running && !runner.Ended)
            {
                if (GUILayout.Button("Start Runner"))
                {
                    ExperimentEvents.StartExperiment(session);
                }
            }
            else
            {
                EditorGUILayout.BeginHorizontal();
                string runningText = runner.Running ? "Running" : "Not Running";
                EditorGUILayout.LabelField($"Runner {runningText}.");
                int currentTrial = runner.Design.BlockCount * currentBlockIndex + currentTrialIndex + 1;
                if (currentTrial > runner.Design.TotalTrials)
                {
                    currentTrial = runner.Design.TotalTrials;
                }
                EditorGUILayout.LabelField("Running Trial: " +
                                           $"{currentTrial}" +
                                           "/" +
                                           $"{runner.Design.TotalTrials} ");
                EditorGUILayout.EndHorizontal();
            }

            string endedText = !runner.Ended ? "Not Finished" : "Ended";

            EditorGUILayout.LabelField($"Runner is {endedText}.");

            EditorGUILayout.Space();
            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Updates the Runner's output
 /// </summary>
 void OutputUpdated()
 {
     ExperimentEvents.OutputUpdated(this);
 }
Ejemplo n.º 7
0
 protected override void InternalPostMethod()
 {
     ExperimentEvents.BlockCompleted(this);
 }
Ejemplo n.º 8
0
 void StartRunningExperiment(Session session)
 {
     ExperimentEvents.StartRunningExperiment(session);
     ExperimentStartPanel.gameObject.SetActive(false);
     ExperimentRunnerPanel.ShowPanel();
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Displays tables of all trials
        /// </summary>
        void ShowTrialTables()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("NumberOfTrials:", EditorStyles.boldLabel);

            foreach (Block block in runner.Design.Blocks)
            {
                int blockIndex = runner.Design.Blocks.IndexOf(block);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);


                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", IndentWidth);
                EditorGUILayout.TextArea($"Block Values: {block.Identity}", BlockIdentityWidth);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("", IndentWidth);
                EditorGUILayout.LabelField("", RunningTrialIndicatorWidth);
                EditorGUILayout.LabelField("", JumpToButtonWidth);
                EditorGUILayout.LabelField("", CompleteIndicatorWidth);
                EditorGUILayout.TextArea(block.TrialTable.HeaderAsString());
                EditorGUILayout.EndHorizontal();


                for (int indexOfRow = 0; indexOfRow < block.TrialTable.Rows.Count; indexOfRow++)
                {
                    DataRow trialRow = block.TrialTable.Rows[indexOfRow];

                    EditorGUILayout.BeginHorizontal();

                    EditorGUILayout.LabelField("", IndentWidth);

                    if (currentTrialIndex == indexOfRow && currentBlockIndex == blockIndex)
                    {
                        EditorGUILayout.LabelField("Running", RunningTrialIndicatorWidth);
                    }
                    else
                    {
                        EditorGUILayout.LabelField("", RunningTrialIndicatorWidth);
                    }

                    if (blockIndex == currentBlockIndex)
                    {
                        // can't jump between blocks, only allow jumping with block.
                        if (GUILayout.Button("Go", JumpToButtonWidth))
                        {
                            ExperimentEvents.JumpToTrial(indexOfRow);
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField("", JumpToButtonWidth);
                    }

                    Trial trial = block.Trials[indexOfRow];

                    Color color = trial.CompletedSuccessfully ? Color.green : Color.red;
                    color = trial.Skipped ? Color.yellow : color;
                    EditorGUILayout.ColorField(GUIContent.none, color, false, false, false, CompleteIndicatorWidth);

                    EditorGUILayout.TextArea(trialRow.AsString());

                    EditorGUILayout.EndHorizontal();
                }

                EditorGUILayout.EndVertical();
            }

            EditorGUI.indentLevel--;
            EditorGUILayout.EndVertical();
        }
Ejemplo n.º 10
0
 void TrialUpdated(List <Trial> trials, int index)
 {
     ExperimentEvents.UpdateOutput(this);
 }