void Judge(GameObject[] toggles) { if (Time.time - lastTime < 5) { return; } rightAnswers = ReadFromXml.ReadRightAnswers(id); if (toggles.Length == rightAnswers.Count) { foreach (GameObject toggle in toggles) { if (!rightAnswers.Contains(toggle.GetComponent <Text>().text)) { score.text = "Try again"; return; } } score.text = "That's right!"; Destroy("Toggle"); id++; ShowQuestion.Show(); //show the next question and options rightAnswers = ReadFromXml.ReadRightAnswers(id); //update the right answer Init(); return; } score.text = "Try again"; lastTime = Time.time; updateOn = true; }
void Judge(GameObject button) //judge the button that user have just selected { if (Time.time - lastTime < 5) { return; } rightAnswers = ReadFromXml.ReadRightAnswers(id); if (rightAnswers.Count == 1) { string myAns = button.GetComponentInChildren <Text>().text; if (myAns == rightAnswers[0]) //if the answer is right { score.text = "That's right!"; Destroy("Button"); id++; ShowQuestion.Show(); //show the next question and options rightAnswers = ReadFromXml.ReadRightAnswers(id); //update the right answer Init(); } else { score.text = "Try Again"; //if not right then print try again } lastTime = Time.time; updateOn = true; } }
public void NextQuestion() { GoOut(sq.panel); Debug.Log(stage + " " + maxStage); if (stage == maxStage - 1) { Debug.Log("please point 2"); foreach (string tp in userChoices) { Debug.Log("User choice: " + tp); } Debug.Log("please point 1"); data.Longest(userChoices); // LCS Debug.Log("please point 3"); Cocktail[] result = data.getRecommendation(); // 추천도가 높은 상위 4개 뽑아오기 foreach (Cocktail tp in result) { Debug.Log("Recommadation: " + tp.Name + " " + tp.recommendation + " " + tp.cf); } // 결과창을 띄어줘야함. ShowResult(result); Debug.Log("please point end"); } else { sq = new ShowQuestion(questArr[++stage], Origin); } }
public void rightAnswer(ObservableCollection <Question> lqs) { Score += 5; lqs.Remove(currQuestion); this.LQuestion = lqs; GetRandomQuestion(); ShowQ = setShowAnswer(); NumbQuestPas = 50 - LQuestion.Count + 1; }
public async void WrongAnswer(ObservableCollection <Question> lqs) { if (LuotNgu == 1) { await Application.Current.MainPage.Navigation.PushAsync(new GameOver(this.Score)); } LuotNgu--; lqs.Remove(currQuestion); this.LQuestion = lqs; GetRandomQuestion(); ShowQ = setShowAnswer(); NumbQuestPas = 50 - LQuestion.Count + 1; }
public void OnSelectionChanged(Object obj) { if (obj is AmericanQuestion) { AmericanQuestion chosenQuestion = (AmericanQuestion)obj; Page questionPage = new ShowQuestion(); ShowQuestionViewModel qContext = new ShowQuestionViewModel { QText = chosenQuestion.QText, QAnswer = chosenQuestion.CorrectAnswer, QNotAnswers = chosenQuestion.OtherAnswers }; questionPage.BindingContext = qContext; if (NavigateToPageEvent != null) { NavigateToPageEvent(questionPage); } } }
public ShowQuestion setShowAnswer() { List <string> result = new List <string>(4); List <string> listAnswer = new List <string>(4); listAnswer.Add(currQuestion.rightAnswer); listAnswer.Add(currQuestion.wrongAnswer1); listAnswer.Add(currQuestion.wrongAnswer2); listAnswer.Add(currQuestion.wrongAnswer3); Random random = new Random(); while (listAnswer.Count > 0) { string next = listAnswer[random.Next(listAnswer.Count)]; listAnswer.Remove(next); result.Add(next); } ShowQ = new ShowQuestion(result); ShowQ.title = currQuestion.nameQuestion; return(ShowQ); }
//============================================================================================= public void StartQuestion() { stage = 0; sq = new ShowQuestion(questArr[stage], Origin); }
private void showQuestionToolStripMenuItem_Click(object sender, EventArgs e) { player.Stop(); ShowQuestion?.Invoke(this, EventArgs.Empty); }