public ExitPollSet Begin() { var exitpollset = new ExitPollSet(); exitpollset.BeginExitPoll(this); return(exitpollset); }
public static ExitPollSet NewExitPoll(string hookName) { if (CurrentExitPollSet != null) { CurrentExitPollSet.EndQuestionSet(); } CurrentExitPollSet = new ExitPollSet(); CurrentExitPollSet.RequestQuestionHookName = hookName; return(CurrentExitPollSet); }
public void SetExitPollQuestionSet(ExitPollSet questionSet) { this.questionSet = questionSet; }
/// <summary> /// Instantiate and position the exit poll at an arbitrary point /// </summary> /// <param name="closeAction">called when the player answers or the question is skipped/timed out</param> /// <param name="position">where to instantiate the exitpoll window</param> /// <param name="exitpollType">what kind of window to instantiate. microphone will automatically appear last</param> public void Initialize(Dictionary <string, string> properties, int panelId, ExitPollSet questionset) { QuestionSet = questionset; PanelId = panelId; NextResponseTime = ResponseDelayTime + Time.time; if (questionset.UseTimeout) { _remainingTime = questionset.Timeout; UpdateTimeoutBar(); } //display question from properties if (Title != null) { string title = "Title"; properties.TryGetValue("title", out title); Title.text = title; } if (Question != null) { string question = "Question"; properties.TryGetValue("question", out question); Question.text = question; } if (properties["type"] == "MULTIPLE") { string[] split = properties["csvanswers"].Split('|'); List <GameObject> AnswerButtons = new List <GameObject>(); AnswerButtons.Add(AnswerButton); for (int i = 1; i < split.Length; i++) { AnswerButtons.Add((GameObject)Instantiate(AnswerButton, ContentRoot)); } for (int i = 0; i < split.Length; i++) { SetMutltipleChoiceButton(split[i], i, AnswerButtons[i]); } var c = GetComponent <BoxCollider>(); if (c != null) { c.size = new Vector3(2, 0.75f + split.Length * 0.3f, 0.1f); } } else if (properties["type"] == "SCALE") { int resultbegin = 0; int.TryParse(properties["start"], out resultbegin); int resultend = 0; int.TryParse(properties["end"], out resultend); if (resultend == 0) { CognitiveVR.Util.logDebug("ExitPoll Panel number of integer buttons to display == 0. skip this question"); QuestionSet.OnPanelClosed(PanelId, "Answer" + PanelId, short.MinValue); Destroy(gameObject); return; } //labels if (MinLabel != null) { if (properties.ContainsKey("minLabel")) { MinLabel.enabled = true; MinLabel.text = properties["minLabel"]; } else { MinLabel.enabled = false; } } if (MaxLabel != null) { if (properties.ContainsKey("maxLabel")) { MaxLabel.enabled = true; MaxLabel.text = properties["maxLabel"]; } else { MaxLabel.enabled = false; } } SetIntegerCount(resultbegin, resultend); } else if (properties["type"] == "VOICE") { int result = 0; int.TryParse(properties["maxResponseLength"], out result); GetComponentInChildren <MicrophoneButton>().RecordTime = result; } _isclosing = false; _allowTimeout = true; StartCoroutine(_SetVisible(true)); }
/// <summary> /// Instantiate and position the exit poll at an arbitrary point /// </summary> /// <param name="closeAction">called when the player answers or the question is skipped/timed out</param> /// <param name="position">where to instantiate the exitpoll window</param> /// <param name="exitpollType">what kind of window to instantiate. microphone will automatically appear last</param> public void Initialize(Dictionary <string, string> properties, int panelId, ExitPollSet questionset) { QuestionSet = questionset; PanelId = panelId; NextResponseTime = ResponseDelayTime + Time.time; if (questionset.myparameters.UseTimeout) { _remainingTime = questionset.myparameters.Timeout; UpdateTimeoutBar(); } //display question from properties if (Title != null) { string title = "Title"; properties.TryGetValue("title", out title); Title.text = title; } if (Question != null) { string question = "Question"; properties.TryGetValue("question", out question); Question.text = question; } if (properties["type"] == "MULTIPLE") { string[] split = properties["csvanswers"].Split('|'); for (int i = 0; i < split.Length; i++) { AnswerButtons[i].GetComponentInChildren <Text>().text = split[i]; } for (int i = split.Length; i < AnswerButtons.Length; i++) { if (AnswerButtons[i] == null) { continue; } AnswerButtons[i].SetActive(false); } } else if (properties["type"] == "SCALE") { int resultbegin = 0; int.TryParse(properties["start"], out resultbegin); int resultend = 0; int.TryParse(properties["end"], out resultend); if (resultend == 0) { CognitiveVR.Util.logDebug("ExitPoll Panel number of integer buttons to display == 0. skip this question"); QuestionSet.OnPanelClosed(PanelId, "Answer" + PanelId, short.MinValue); Destroy(gameObject); return; } //labels if (MinLabel != null) { if (properties.ContainsKey("minLabel")) { MinLabel.enabled = true; MinLabel.text = properties["minLabel"]; } else { MinLabel.enabled = false; } } if (MaxLabel != null) { if (properties.ContainsKey("maxLabel")) { MaxLabel.enabled = true; MaxLabel.text = properties["maxLabel"]; } else { MaxLabel.enabled = false; } } SetIntegerCount(resultbegin, resultend); } else if (properties["type"] == "VOICE") { int result = 0; int.TryParse(properties["maxResponseLength"], out result); var mic = GetComponentInChildren <MicrophoneButton>(); mic.RecordTime = result; mic.SetExitPollQuestionSet(questionset); } _isclosing = false; _allowTimeout = true; StartCoroutine(_SetVisible(true)); }