/** * this method handles displaying all the mastery report rows from the playerData */ private void DisplayUserData() { GameObject currentStageTitle = GameObject.Find("CurrentStageTitle"); currentStageTitle.GetComponent <TextMeshProUGUI>().text = "Current Stage: " + playerData.curStage; GameObject totalNumAttemptTitle = GameObject.Find("TotalNumberAttemptTitle"); totalNumAttemptTitle.GetComponent <TextMeshProUGUI>().text = "Total Number of Attempts: " + playerData.totalNoAttempted.ToString(); GameObject totalNumCorrectTitle = GameObject.Find("TotalNumberCorTitle"); totalNumCorrectTitle.GetComponent <TextMeshProUGUI>().text = "Total Number Correct: " + playerData.totalNoCorrect.ToString(); GameObject numberPokemonTitle = GameObject.Find("NumberPokemonTitle"); numberPokemonTitle.GetComponent <TextMeshProUGUI>().text = "Total Number Pokemons Held: " + playerData.pokemonHeld.Count.ToString(); int numExploreStage = playerData.exploreAnsweredQns.Length; // for exploration stages for (int i = 0; i < numExploreStage; i++) { // displaying the rows on the mastery report table GameObject newEntry = Instantiate(entryTemplate, entryContainer); TextMeshProUGUI[] texts = newEntry.GetComponentsInChildren <TextMeshProUGUI>(); AnsweredQns answeredQns = playerData.exploreAnsweredQns[i]; string stageName = answeredQns.stageName + " exploration"; // stage texts[0].text = stageName; int correct = answeredQns.qnsCorrect.Count; int total = correct + answeredQns.qnsWrong.Count; // total score texts[1].text = correct.ToString() + "/" + total.ToString(); newEntry.name = stageName; newEntry.GetComponent <ViewQuestionBreakdwon>().playerJson = playerJson; } int numQuizStage = playerData.quizAnsweredQns.Length; // for quiz stages for (int i = 0; i < numQuizStage; i++) { GameObject newEntry = Instantiate(entryTemplate, entryContainer); TextMeshProUGUI[] texts = newEntry.GetComponentsInChildren <TextMeshProUGUI>(); AnsweredQns answeredQns = playerData.quizAnsweredQns[i]; string stageName = answeredQns.stageName + " quiz"; texts[0].text = stageName; int correct = answeredQns.qnsCorrect.Count; int total = correct + answeredQns.qnsWrong.Count; texts[1].text = correct.ToString() + "/" + total.ToString(); newEntry.name = stageName; newEntry.GetComponent <ViewQuestionBreakdwon>().playerJson = playerJson; } }
public PlayerInfo(string name, string curmap, string nextmap, string curstage, string quizcat, int nopokemon, int totalcorrect, int totalattempt) { playerName = name; curMap = curmap; nextMap = nextmap; curStage = curstage; quizCat = quizcat; noPokemon = nopokemon; pokemonHeld = new List <string>(new string[] { "Cely" }); AnsweredQns temp = new AnsweredQns("1_easy"); exploreAnsweredQns = new AnsweredQns[] { temp }; quizAnsweredQns = new AnsweredQns[] { temp }; totalNoCorrect = totalcorrect; totalNoAttempted = totalattempt; }