public void SetSentenceResultPanel() { int corretCnt = 0; foreach (var item in Sentence_DataLoader.GetRecord()) { int id = item.Key; bool isCoreect = item.Value; //var d = Sentence_DataLoader.sentenceList[index]; var d = Sentence_DataLoader.GetSentenceListDataById(id); var r = Instantiate(PrefabManager.Instance.sentenceResultItem); { string sentence = UIStaticManager.ReplaceUnderline(d.Value[0]); r.GetComponent <ResultItem>().SetVocabDesc(sentence, "", isCoreect); if (isCoreect) { corretCnt++; } SetPreSentence(r.transform, id); r.GetComponent <ResultItem>().SetEmptyStar(); if (UserDataManager.Instance.IsSentenceDataExist(id)) { r.GetComponent <ResultItem>().SetStar(); } } } // write data int totalQuestionSize = GameModeManager.GetQuestionSize(); float finalscore = ((float)((float)corretCnt / (float)totalQuestionSize) * 100f); UserDataManager.Instance.SetUserSentenceFinalScore(finalscore); int dayid = GameModeManager.GetCurrentDay(); UserDataManager.Instance.SetUserSentenceDayResult(dayid, finalscore); UserDataManager.Instance.SetSentenceNextDayUnlock(dayid); string filename = FileReadWrite.Instance.GetSentenceFileName(); FileReadWrite.Instance.WriteUserData(filename); }
public void SetOXResultPanel() { int corretCnt = 0; foreach (var item in OX_DataLoader.records) { string vocab = item.Key; bool isCoreect = item.Value; var word = OX_DataLoader.GetVocab(vocab); var r = Instantiate(PrefabManager.Instance.oxresultItem); r.GetComponent <ResultItem>().SetVocabDesc(vocab, "", isCoreect); SetPreVocab(vocab, r.transform); if (isCoreect) { corretCnt++; } r.GetComponent <ResultItem>().SetEmptyStar(); if (UserDataManager.Instance.IsVocabExist(vocab)) { r.GetComponent <ResultItem>().SetStar(); } } // write data int totalQuestionSize = GameModeManager.GetQuestionSize(); float finalscore = ((float)((float)corretCnt / (float)totalQuestionSize) * 100f); UserDataManager.Instance.SetUserOXFinalScore(finalscore); int dayid = GameModeManager.GetCurrentDay(); UserDataManager.Instance.SetUserOXDayResult(dayid, finalscore); UserDataManager.Instance.SetOXNextDayUnlock(dayid); string filename = FileReadWrite.Instance.GetOXFileName(); FileReadWrite.Instance.WriteUserData(filename); }