// called on btn press public void NextImg() { if (pos >= data.Count) { pos = 0; } GameData.QuestionAnswer d = data[pos]; GameUtil.LoadImage(d.question, question); answer.text = d.answer; pos++; }
public void nextQandA() { if (pos >= data.Count) { pos = 0; } GameData.QuestionAnswer d = data[pos]; GameUtil.LoadImage(d.question, img); backCardText.text = d.answer; pos++; isFrontCard = true; frontCard.SetActive(true); backCard.SetActive(false); }
private bool doCardsMatch(int indexOfCard1, int indexOfCard2) { bool tORf = false; //if (enabledList[0].GetComponent<Text>().text.Equals(enabledList[1].GetComponent<Text>().text) == true) //{ // Debug.Log(enabledList[0].GetComponent<Text>().text); // Debug.Log(enabledList[1].GetComponent<Text>().text); // tORf = false; // return false; //} //if (enabledList[0].GetComponent<Text>().text.Length > 0 && enabledList[1].GetComponent<Text>().text.Length > 0) //{ // Debug.Log(enabledList[0].GetComponent<Text>().text); // Debug.Log(enabledList[1].GetComponent<Text>().text); // tORf = false; // return false; //} //foreach(string question in questionList){ // Debug.Log(question); //} //foreach(string answer in answerList){ // Debug.Log(answer); //} //Debug.Log(indexOfCard1); //Debug.Log(indexOfCard2); for (int i = 0; i < originalData.Count; i++) { GameData.QuestionAnswer a = originalData[i]; if (questionList[indexOfCard1].Equals(a.question)) { if (answerList[indexOfCard2].Equals(a.answer)) { //Debug.Log(questionList[indexOfCard1]); //Debug.Log(a.question); //Debug.Log(answerList[indexOfCard2]); //Debug.Log(a.answer); tORf = true; i = originalData.Count; //SHOULD BREAK LOOP } else { tORf = false; } } //else if(questionList[indexOfCard2].Equals(a.question)){ // if (answerList[indexOfCard1].Equals(a.answer)) // { // //Debug.Log(questionList[indexOfCard2]); // //Debug.Log(a.question); // //Debug.Log(answerList[indexOfCard1]); // //Debug.Log(a.answer); // tORf = true; // i = originalData.Count; //SHOULD BREAK LOOP // } // else // { // tORf = false; // } //} } //Debug.Log(tORf); //if(tORf == true){ // Debug.Log(questionList[indexOfCard1]); // Debug.Log(questionList[indexOfCard2]); // Debug.Log(answerList[indexOfCard2]); // Debug.Log(answerList[indexOfCard1]); //} return(tORf); }