private void Done()
 {
     ++events;
     if (events == 2)
     {
         Debug.Log("Survey was ended by SurveyEnd");
         SceneFlowController.LoadNextScene();
     }
 }
Пример #2
0
 void Start()
 {
     dialogueUI = GameObject.FindGameObjectWithTag("UIController");
     sceneFC    = GameObject.FindGameObjectWithTag("GameController").GetComponent <SceneFlowController>();
     //LoadCards();
     //Time.timeScale = 0.0f;
     //SetDeckState(true);
     //ShiftRemainingCards();
 }
Пример #3
0
 void Awake()
 {
     sceneFC     = GameObject.FindGameObjectWithTag("GameController").GetComponent <SceneFlowController>();
     audioCS     = GameObject.FindGameObjectWithTag("AudioController").GetComponent <AudioControlScript>();
     lDefaultPos = lPortPos = leftPortrait.rectTransform.anchoredPosition;
     rDefaultPos = rPortPos = rightPortrait.rectTransform.anchoredPosition;
     ConstructDicts();
     Reset();
 }
Пример #4
0
        public static void StopMission()
        {
            if (!GcsSocket.Alive)
            {
                Debug.Log("Error: Socket connection could not be established.");
                SceneFlowController.LoadErrorScene();
            }

            GcsSocket.Emit(STOP_MISSION,
                           ParticipantBehavior.Participant.CurrentMission);
        }
Пример #5
0
        public static void StartMission()
        {
            if (!GcsSocket.Alive)
            {
                Debug.Log("Error: Socket connection could not be established.");
                SceneFlowController.LoadErrorScene();
            }

            GcsSocket.Emit(START_MISSION,
                           ParticipantBehavior.Participant.CurrentMission);
            Started = true;
            Lifecycle.EventManager.OnStarted();
        }
        /// <summary>
        /// Attempts to create a participant by sending an HTTP request to server and waiting for the response.
        /// </summary>
        /// <param name="data">
        /// The metadata of the participant such as their group number and proctor name.
        /// </param>
        /// <returns></returns>
        private IEnumerator NewParticipantRequest(ParticipantData data)
        {
            var form = new WWWForm();

            form.AddField("adaptive", data.Adaptive ? "1" : "0");
            form.AddField("transparent", data.Transparent ? "1" : "0");
            form.AddField("group_number", data.Group);
            form.AddField("proctor_name", data.ProctorName);

            var www = UnityWebRequest.Post(ServerURL.INSERT_PARTICIPANT, form);

            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
                SceneFlowController.LoadErrorScene();
            }
            else
            {
                var result = JSON.Parse(www.downloadHandler.text);
                Debug.Log(result);
                if (result["failed"].AsBool)
                {
                    SceneFlowController.LoadErrorScene();
                }
                else
                {
                    data.Id = result["data"].AsInt;
                }


                Participant = new Participant
                {
                    Data           = data,
                    CurrentMission = 1,
                    CurrentSurvey  = 1
                };

                Debug.Log(string.Format(
                              "New Participant Made: Transparency={0} Adaptive={1} Proctor={2}, ID={3}",
                              Participant.Data.Transparent, Participant.Data.Adaptive,
                              Participant.Data.ProctorName,
                              Participant.Data.Id));
                EventManager.OnNewParticipantMade(new NewParticipantEventArgs
                {
                    Data = data
                });
            }
        }
Пример #7
0
        /*
         * private void OnGUI()
         * {
         *  var e = Event.current;
         *  if (e.isKey)
         *      if (e.keyCode == KeyCode.C && hardcodedQueryNumber <= nLoadedQueries)
         *      {
         *          Debug.Log(_queryList.Count);
         *          for (; _questionIndex < _queryList.Count() - 1;)
         *          {
         ++_questionIndex;
         *              UpdateLiveFeed();
         *          }
         *      }
         * }
         */
        private void GoToNextScene()
        {
            Debug.Log("Ending Transparency");
            EventManager.OnEnd();
            SceneFlowController.LoadNextScene();
            //Participant.Instance.CurrentSurvey += 1;


            //SceneManager.getSurveyName();

            // SceneManager.LoadScene(
            //    ParticipantBehavior.Instance.CurrentMission == 6
            //       ? "FinalScene"
            //      : "MissionScene");
            //_nextButton.Disable();
        }
Пример #8
0
        /// <summary>
        /// Starts the initialization process for a mission.
        /// </summary>
        public static void InitializeMission()
        {
            if (!GcsSocket.Alive)
            {
                Debug.Log("Error: Socket connection could not be established.");
                SceneFlowController.LoadErrorScene();
            }
            ;

            var initializeMissionParameters = string.Format("mission{0}-{1}-{2}-{3}",
                                                            ParticipantBehavior.Participant.CurrentMission,
                                                            ParticipantBehavior.Participant.Data.Adaptive ? "true" : "false",
                                                            ParticipantBehavior.Participant.Data.Id,
                                                            ParticipantBehavior.Participant.Data.Transparent ? "true" : "false");

            Debug.Log("Initializing Mission.  Parameters: " + initializeMissionParameters);

            GcsSocket.Emit(INITIALIZE_MISSION, initializeMissionParameters);

            Lifecycle.EventManager.OnInitialize(ParticipantBehavior.Participant.CurrentMission);
        }
Пример #9
0
        public void GatherAnswers(ref List <GameObject> go,
                                  ref List <QuestionDetails> surveyQuestionList, int tempSurveyNumber)
        {
            _surveyNumber = tempSurveyNumber;
            foreach (var g in go)
            {
                var temp = surveyQuestionList[int.Parse(g.name)];

                //Debug.Log(surveyQuestionList[int.Parse(g.name)].QuestionId +
                //" is question id");
                //Debug.Log(surveyQuestionList[int.Parse(g.name)].Type +
                //" is question type");

                switch (temp.QuestionType)
                {
                case "FreeResponse":
                    FreeResponseGetAnswer(g, ref temp);
                    break;

                case "Multiple":
                    MultipleGetAnswer(g, ref temp);
                    break;

                case "Scalar":
                    ScalarGetAnswer(g, ref temp);
                    break;

                case "Numerical":
                    NumericGetAnswer(g, ref temp);
                    break;

                //special cases bellow
                case "Debrief":
                    Debrief(g, ref temp);
                    //Debug.Log("Debrief");
                    StartCoroutine(UploadPreferredLvlOfAutonomy(temp));
                    break;

                case "Intro":
                    continue;

                case "Outro":
                    continue;


                case "IfYesRespond":
                    IfYesRespondGetAnswer(g, ref temp);
                    break;

                case "IfNoRespond":
                    IfNoRespondGetAnswer(g, ref temp);
                    break;

                case "IfScalarLessThan3Respond":
                    IfScalarLessThan3RespondGetAnswer(g, ref temp);
                    break;

                case "TLX":
                    ScaleGetAnswer(g, ref temp);
                    break;

                case "PickAll":
                    PickAllGetAnswer(g, ref temp);
                    break;
                }


                //Debug.Log(surveyQuestionList[int.Parse(g.name)].SelectedAnswer +
                //          " is answer");
                UploadQuery(ref temp);

                //Debug.Log(currentDetails.QuestionString + " is question string");
                //Debug.Assert(false, "Question type does not exist");
            }

            //Debug.Log("End of Survey");
            //Will go back to the QueryScene
            EventManager.OnEnd();
            SceneFlowController.LoadNextScene();
        }