private void ShowQuestion() { RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.setUp(questionData.answers[i]); } }
public void showQuestion() { RemoveAnswerButtons(); QuestionData questiondata = questionPool [questionIndex]; questionText.text = questiondata.QuestionText; for (int i = 0; i < questiondata.answers.Length; i++) { GameObject answerBtn = answerbtnObjPool.GetObject(); answerObjList.Add(answerBtn); answerBtn.transform.SetParent(answerbtnParent); AnswerButton answerbutton = answerBtn.GetComponent <AnswerButton> (); answerbutton.Setup(questiondata.answers [i]); } }
private void ShowQuestion() //clear out any existing answer button and show questions { RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionDisplayText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject();//get me another button which is not currently used answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); //pass to the answer } }
public void QuestionButtonClicked(string tileText, int mappedQuestionButtonIndex) { Debug.Log("Question button clicked = " + mappedQuestionButtonIndex); foreach (GameObject ansBtn in answerButtonGameObjects) { AnswerButton answerButton = ansBtn.GetComponent <AnswerButton> (); if (answerButton.answerText.text == "") { answerButton.Setup(tileText); answerButton.SetMappedQuestionButtonIndex(mappedQuestionButtonIndex); checkIfAnswerIsComplete(); break; } } }
public void AnswerQuestion(AnswerButton button, int indexQuestion) { button.MarkAsSuccess(indexQuestion == correctAnswerIndex); if (indexQuestion == correctAnswerIndex) { answerSource.clip = resultSuccess.audio; resultText.text = resultSuccess.text; } else { answerSource.clip = resultFailure.audio; resultText.text = resultFailure.text; } resultCanvas.SetActive(true); againButtonText.text = again.text; answerSource.Play(); }
private void repeatQuestion() { removeAnswerButtons(); perguntaRespondida = false; QuestionData questionData = questionPool[perguntaAtual]; textoPergunta.text = questionData.textoPergunta; for (int i = 0; i < questionData.respostas.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.setup(questionData.respostas[i]); } }
private void ShowInstruction() { RemoteAnswerButtons(); InstructionData instructionData = instructionPool [instructionIndex]; instructionDisplayText.text = instructionData.instructionText; for (int i = 0; i < instructionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton> (); answerButton.Setup(instructionData.answers[i]); } }
private void ShowQuestion() { RemoveAnswerButton(); QuestionData questionData = questionPool[questionIndex]; questionText.text = questionData.questionText; //for showing the button for (int i = 0; i < questionData.answers.Length; i++) { GameObject asbGO = answerButtonPool.GetObject(); asbGO.transform.SetParent(parentsPanel); answerButtonGO.Add(asbGO); AnswerButton answerButton = asbGO.GetComponent <AnswerButton>(); answerButton.SetUp(questionData.answers[i]); } }
private void ShowQuestion() { // for each question, player has 10s to answer timeRemaining = 15; RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionDisplayText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonGameObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.SetUp(questionData.answers[i]); } }
} //end RemoveAnswerButtons private void ShowQuestion() { RemoveAnswerButtons(); QuestionData questionData = questionPool [questionIndex]; //reach in pool, get question and display in UI questionDisplayText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton> (); answerButton.Setup(questionData.answers [i]); } //end for } //end ShowQuestion
void ReleaseDesignerOutlets() { if (AnswerButton != null) { AnswerButton.Dispose(); AnswerButton = null; } if (PictureButton != null) { PictureButton.Dispose(); PictureButton = null; } if (QuestionLable != null) { QuestionLable.Dispose(); QuestionLable = null; } if (QuestionTextView != null) { QuestionTextView.Dispose(); QuestionTextView = null; } if (ResetButton != null) { ResetButton.Dispose(); ResetButton = null; } if (RoundLabel != null) { RoundLabel.Dispose(); RoundLabel = null; } if (ScoreLabel != null) { ScoreLabel.Dispose(); ScoreLabel = null; } }
private void ShowQuestion() { // First remove old answer buttons RemoveAnswerButtons(); // Get question from pool questionData = questionPool [nextQuestionIndex]; questionText.text = questionData.QuestionText; timeRemaining = questionData.TimeLimit; // Create N answer buttons for (int i = 0; i < questionData.Answers.Count; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent, false); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton> (); answerButton.Setup(questionData.Answers [i]); } }
private void ShowQuestion() { //Remove old answers get current question and display the text RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionDisplayText.text = questionData.questionText; //Get all answers for the question, create new buttons for each and add them to the answerButtonParent object(AnswerPanel) for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); //we get a reference to the answer button then use its attatched script to set the answer AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); //Give the gameobject an answer button component answerButton.Setup(questionData.answers[i]); } }
private void showQuestion() { removeAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionText.text = questionData.questionText; //part that puts answers in answer panel for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonHolder); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.SetUp(questionData.answers[i]); } }
void ShowQuestion() { RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; // Get the QuestionData for the current question questionText.text = questionData.questionText; // Update questionText with the correct text for (int i = 0; i < questionData.answers.Length; i++) // For every AnswerData in the current QuestionData... { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); // Spawn an AnswerButton from the object pool answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObject.transform.localScale = Vector3.one; AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.SetUp(questionData.answers[i]); // Pass the AnswerData to the AnswerButton so the AnswerButton knows what text to display and whether it is the correct answer } }
private void ShowQuestion() { RemoveAnswerButtons(); QuestionData questionData = new QuestionData(); questionData = questionPool[questionIndex]; questionDisplayText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { Debug.Log("Button wird erstellt"); GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } }
private void ShowQuestion() { print(questionsList.Count); timeRemaining = 40f; RemoveAnswerButtons(); QuestionData questionData = questionsList[questionIndex]; questionDisplayText.text = questionData.questionText.Replace("NEWLINE", "\n"); List <AnswerData> wrongAnswersForSpecificQuestion = new List <AnswerData>(); for (int i = 0; i < 4; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); GameObject child = answerButtonGameObject.transform.GetChild(0).transform.GetChild(0).gameObject; if (child.GetComponent <Text>().text.Equals("-")) { child.GetComponent <Text>().text = abcd[i]; } answerButtonGameObject.transform.SetParent(answerButoonParent); answerButtonGameObject.transform.localScale = new Vector3(1f, 1f, 1f); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); if (i == 0) { answerButton.Setup(questionData.answers[0]); wrongAnswersForSpecificQuestion.Add(questionData.answers[0]); } else { int incorrectIndex = Random.Range(0, currentWrongData.Count); while (wrongAnswersForSpecificQuestion.Exists(x => x.answerText[0] == currentWrongData[incorrectIndex].answerText[0])) { incorrectIndex = Random.Range(0, currentWrongData.Count); } answerButton.Setup(currentWrongData[incorrectIndex]); wrongAnswersForSpecificQuestion.Add(currentWrongData[incorrectIndex]); } } }
// Grabs the proper Question Pool depending on the artist and displays their questions private void ShowQuestion() { // Remove all answer buttons being used RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionText.text = questionData.questionText; // Add the optional answers to the GameObject and set them up for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.SetUp(questionData.answers[i]); } }
private void ShowQuestions() { RemoveAnswerButtons(); QuestionData currentQuestion = question [questionIndex]; questionDisplay.text = currentQuestion.questionText; //GameObject buttonObject = null; foreach (AnswerData answer in currentQuestion.answers) { GameObject buttonObject = answerButtonPool.GetObject(); buttonObject.transform.SetParent(answerButtonParentTransform); AnswerButton answerButton = buttonObject.GetComponent <AnswerButton> (); answerButton.Setup(answer); answerButtonObject.Add(buttonObject); } }
private void ShowQuestion() { RemoveAnswerButtons(); AudioData questionData = audioPool [questionIndex]; audioSource = audioButton.GetComponent <AudioSource>(); audioSource.clip = questionData.questionAudio; audioSource.Play(); for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.transform.localScale.Set(1, 1, 1); answerButton.Setup(questionData.answers[i]); } }
public void ShowQuestion() { isRoundActive = true; UIPanel.SetActive(true); RemoveAnswerButtons(); QuestionData questionData = questionPool [questionIndex]; questionText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } }
private void ShowQuestion() { RemoveAnswerButtons(); QuestionData questionData = questionPool[questionIndex]; questionText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { print(questionData.answers[i].answerText); GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtonGameObject); print(answerButtonGameObjects.Count); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); print(answerButton); answerButton.answerText.text = questionData.answers[i].answerText; //"answerButton", "questionData", "answers[i]". One of these does not exist } }
public void ShowQuestion(QuestionData question) { RemoveAnswerButtons(); QuestionData questionData = question; questionDisplayText.text = questionData.questionText; for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } triviaBoardImage.color = normalColor; triviaAnimator.SetBool("isOpen", true); }
IEnumerator Co_ShowAndHideHint() { AnswerButton btn = GetNextAnswerButton(); //아이템 갯수 갱신 if (btn != null) { GameObject obj = btn.hintAnimObject; obj.SetActive(true); yield return(new WaitForSeconds(2f)); obj.SetActive(false); isShowingHint = false; } yield return(null); }
private void ShowQuestion() { RemoveAnswerButton(); QuestionData questionData = questionPool[questionIndex]; // display text question questionText.text = questionData.questionText; // init answer button for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); // add button to array answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } }
private void checkIfAnswerIsComplete() { numberOfTilesPopulated = 0; string enteredAnswer = ""; foreach (GameObject ansBtn in answerButtonGameObjects) { AnswerButton answerButton = ansBtn.GetComponent <AnswerButton> (); if (answerButton.answerText.text != "") { numberOfTilesPopulated++; enteredAnswer += answerButton.answerText.text; if (numberOfTilesPopulated == answerWord.Length) { CheckCorrectnessOfAnswer(enteredAnswer); } } } }
private void ShowQuestion() { RemoveAnswerButton(); //questionPool position index store it into question data QuestionData questionData = questionPool[questionIndex]; //get question from that question & get string of actual question and display that with questionTest UI elem questionTest.text = questionData.questionText; // loop over all the answer and add buttons as needed for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); //get reference of AnswerButton & pass set it up in given pos i AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } }
public void Serialize(AnswerButton control, DataStore data) { if (control != null) { SerializeDefault(control); brush.Serialize(control, control.Background, data); brushSelect.SerializeWithKey(control.SelectedBrush, data, control.SelectedBrushKey); ID = control.ID; content = control.contentCreator; NormalOp = control.NormalOp; HoverOp = control.HoverOp; ClickOp = control.ClickOp; horizontalAlignment = control.AnswerPanel.HorizontalAlignment; verticalAlignment = control.AnswerPanel.VerticalAlignment; Good = control.Good; ShowGoodAnswer = control.ShowGood; } }
private void ShowQuestion() { // 이전 답변 버튼 다지우기 RemoveAnswerButtons(); // questionIndex 순서대로 질문 생성 QuestionData questionData = questionPool[questionIndex]; questionDisplayText.text = questionData.questionText; // 답변의 갯수만큼 AnswerButton 버튼 생성 for (int i = 0; i < questionData.answers.Length; i++) { GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObjects.Add(answerButtonGameObject); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObject.transform.localScale = Vector3.one; AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } }
private void ShowQuestion(QuestionData questionData, int number) { questionDisplayText.text = questionData.questionText; DestroyExtraObject(); RemoveAnswerButtons(); gameView.AnimationWorkers(); for (int i = 0; i < questionData.answers.Length; i++) { numberQuestionText.text = number.ToString() + " вопрос"; GameObject answerButtonGameObject = answerButtonObjectPool.GetObject(); answerButtonGameObject.transform.SetParent(answerButtonParent); answerButtonGameObjects.Add(answerButtonGameObject); AnswerButton answerButton = answerButtonGameObject.GetComponent <AnswerButton>(); answerButton.Setup(questionData.answers[i]); } for (int i = 0; i < questionData.extraObjects.Length; i++) { Instantiate(questionData.extraObjects[i], questionParentDestroyExtraObject.transform.position, questionParentDestroyExtraObject.transform.rotation, questionParentDestroyExtraObject); } }