Ejemplo n.º 1
0
 //call if study is over
 public static void CloseIfOpen()
 {
     if (_instance != null)
     {
         _instance._sw.Close();
         Debug.Log("Finished Record_Questionnaire");
         _instance = null;
     }
 }
Ejemplo n.º 2
0
    public IEnumerator CreatePreQuestionnaire()
    {
        //Wait for 60 seconds or break with Keypress
        TableText.text = "";
        print("Vorfragebogen");
        float elapsedTime = 45.0f;

        while (elapsedTime > 0.0f)
        {
            elapsedTime   -= Time.deltaTime;
            TableText.text = "Make yourself familiar with your new hands \n  " + Mathf.Round(elapsedTime);
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                elapsedTime = 0.0f;
            }
            else
            {
                yield return(null);
            }
        }

        TableText.text = "";
        _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(true, _objects.PreFrage);
        _objects.PreFrage.GetComponent <CreateQuestionnaire>().CreateQuestions();
        while (Variables.IsConfirmPREPressed == false)
        {
            yield return(null);
        }

        if (Variables.IsConfirmPREPressed)
        {
            SaveQuestionnaire.SaveCollecter(SaveQuestionnaire.QuestionnaireType.Pre);
            // _objects.TableTop.GetComponent<Questionnaire>().SaveQuestionnaire();
            _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(false, _objects.PreFrage);
            Variables.isTrialActive = true;

            Variables.IsConfirmPREPressed = false;
        }
    }
Ejemplo n.º 3
0
    private static void Save(int questionID, int r)
    {
        if (_instance == null)
        {
            _instance = new SaveQuestionnaire();
        }

        string output = "";

        var subjectId             = Variables.UserId;
        var time                  = Variables.GetCurrentUnixTimestampMillis();
        var questionId            = questionID;
        var rating                = r;
        var currentHandGameObject =
            _instance._objects.HandController.GetComponent <GetHandMovement>().GetCurrentHand().name;
        var displacement = currentHandGameObject.Split('_')[3];
        var texture      = currentHandGameObject.Split('_')[4];

        output += subjectId + CsvSeparator + time + CsvSeparator + questionId + CsvSeparator + rating + CsvSeparator + displacement + CsvSeparator + texture + CsvSeparator + currentHandGameObject;
        _instance._sw.Write(output + "\r\n");
        _instance._sw.Flush();
    }
Ejemplo n.º 4
0
    private IEnumerator Delay()
    {
        yield return(new WaitForSeconds(0.1f));

        foreach (var g in Variables.ButtonNames)
        {
            Destroy(g);
        }

        Variables.LastRoundFailed = false;
        Variables.Count           = 1;
        Variables.NextIndex       = 0;
        Variables.Times.Clear();
        Variables.Round = (Variables.Round + 1) % (Variables.AmountOfRounds);
        if (Variables.Round == 0)
        {
            //Close last HandData save
            SaveHandPosition.closeIfOpen();
            Variables.isTrialActive = false;
            //Wait after last trial and show timer
            float elapsedTime = 5.0f;
            while (elapsedTime > 0.0f)
            {
                elapsedTime   -= Time.deltaTime;
                TableText.text = "End of Task \n " + Mathf.Round(elapsedTime);
                if (Input.GetKeyDown(KeyCode.Escape))
                {
                    elapsedTime = 0.0f;
                }
                else
                {
                    yield return(null);
                }
            }
            TableText.text = "";
            _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(true, _objects.Fragebogen);
            _objects.Fragebogen.GetComponent <CreateQuestionnaire>().CreateQuestions();
            while (Variables.IsConfirmPressed == false)
            {
                yield return(null);
            }

            if (Variables.IsConfirmPressed)
            {
                SaveQuestionnaire.SaveCollecter(SaveQuestionnaire.QuestionnaireType.Post);
                _objects.TableTop.GetComponent <Questionnaire>().SetActiveQ(false, _objects.Fragebogen);
                Variables.IsConfirmPressed = false;
                print("Trial: " + Variables.Trial + " von " + Variables.AmountOfTrials);
                if (Variables.Trial == Variables.AmountOfTrials - 1)
                {
                    float endTime = 120.0f;
                    while (endTime > 0.0f)
                    {
                        endTime       -= Time.deltaTime;
                        TableText.text = "End of Study \n Thanks for participating!";
                        if (Input.GetKeyDown(KeyCode.Escape))
                        {
                            endTime = 0.0f;
                        }
                        else
                        {
                            yield return(null);
                        }
                    }
                    TableText.text = "";
                }
                Variables.Trial++;
                SaveClickData._repetitionDict.Clear();
                _objects.Buttons.GetComponent <Setup>().ShuffleList(Variables.UserId, Variables.Trial);
                _objects.HandController.GetComponent <GetHandMovement>().NextHand();
                yield return(StartCoroutine(CreatePreQuestionnaire()));
            }
        }

        Debug.Log("Round: " + Variables.Round + " von " + Variables.AmountOfRounds);
        yield return(new WaitForSeconds(1));

        Setup.SetupInstance.CreateButtons();
    }
Ejemplo n.º 5
0
 public void OnApplicationQuit()
 {
     SaveClickData.closeIfOpen();
     SaveQuestionnaire.CloseIfOpen();
     SaveHandPosition.closeIfOpen();
 }