Ejemplo n.º 1
0
 // Loads the next scene
 private void LoadNextScene(string def)
 {
     if (ExperimentManager.HasInstance() && ParameterManager.HasInstance())
     {
         ExperimentManager.Instance.LoadNextScene();
     }
     else
     {
         SceneManager.LoadScene(def);
     }
 }
    void Awake()
    {
        if (ParameterManager.HasInstance())
        {
            logOnline  = ParameterManager.Instance.LogOnline;
            logOffline = ParameterManager.Instance.LogOffline;
        }

        if (!ExperimentManager.HasInstance())
        {
            ExperimentManager.Instance.Setup(tutorial, playTutorial, studies, casesPerUsers,
                                             experimentName, survey, playSurvey, logOffline, logOnline, logGame, logStatistics);
        }
    }
    public void SaveTimeNum(float time)
    {
#if !UNITY_EDITOR
        gameDataPos.time = time;
        if (ExperimentManager.HasInstance())
        {
            int  index       = ExperimentManager.Instance.GetCaseIndex();
            Case currentCase = ExperimentManager.Instance.GetCaseList()[index];
            //Debug.Log(currentCase.GetCurrentMap().name);
            gameDataPos.mapName = currentCase.GetCurrentMap().name;
            gameDataMap.mapName.Add(currentCase.GetCurrentMap().name);

            if (!string.IsNullOrEmpty(ExperimentManager.Instance.GetIpAddress()))
            {
                gameDataPos.ip = ExperimentManager.Instance.GetIpAddress();
            }
        }
        gameDataPos.os = SystemInfo.operatingSystem;
        posAsJson      = JsonUtility.ToJson(gameDataPos);
        mapAsJson      = JsonUtility.ToJson(gameDataMap);
#endif
#if UNITY_EDITOR
        gameRobotData.time = time;
        if (ExperimentManager.HasInstance())
        {
            int  index       = ExperimentManager.Instance.GetCaseIndex();
            Case currentCase = ExperimentManager.Instance.GetCaseList()[index];
            //Debug.Log(currentCase.GetCurrentMap().name);
            gameDataMap.mapName.Add(currentCase.GetCurrentMap().name);

            if (!string.IsNullOrEmpty(ExperimentManager.Instance.GetIpAddress()))
            {
                gameRobotData.ip = ExperimentManager.Instance.GetIpAddress();
            }
        }
        gameRobotData.os = SystemInfo.operatingSystem;
        posAsJson        = JsonUtility.ToJson(gameRobotData);
        mapAsJson        = JsonUtility.ToJson(gameDataMap);
        File.WriteAllText(filePathPosResNum, posAsJson);
        File.WriteAllText(filePathMapResNum, mapAsJson);
#endif
    }
    // Saves the values of the survey and quits
    public void Submit()
    {
        ParameterManager.Instance.BackgroundRotation = backgroundScript.GetRotation();

        thanks.SetActive(false);

        //if (ExperimentManager.Instance.MustSaveSurvey()) {
        //    ExperimentManager.Instance.SaveSurvey(jQuestions);
        //}
        //ExperimentManager.Instance.SaveAnswers(jAnswers);
        survey.choices = new List <string>();
        survey.choices = answers.choices;
        if (ExperimentManager.HasInstance())
        {
            survey.mapname = ExperimentManager.Instance.GetCaseList()[2].GetCurrentMap().name;
            survey.ip      = ExperimentManager.Instance.GetIpAddress();
        }

        rSD.SendDataToServer(JsonUtility.ToJson(survey));

        StartCoroutine(FinishingExperiment());
    }
    private void CheckIfImageQuestion()
    {
        if (currentQuestion == 3)
        {
            string name;
            if (ExperimentManager.HasInstance())
            {
                name = ExperimentManager.Instance.GetCaseList()[2].GetCurrentMap().name;

                for (int i = 0; i < mapsForSurvey.Length; i++)
                {
                    if (name == mapsForSurvey[i].name)
                    {
                        setOfMapSelected = i;
                        foreach (GameObject g in mapsSet[i].maps)
                        {
                            g.SetActive(true);
                        }
                    }
                }
            }
        }
    }
 public void LoadLevel()
 {
     if (ExperimentManager.HasInstance())
     {
     }
 }