private void UpdatePanel() { nextLesson.interactable = true; prevLesson.interactable = true; if (GameMng.selectedLessonIndex == 1) { prevLesson.interactable = false; } if (GameMng.selectedLessonIndex == GameMng.GetLastOpenLesson(GameMng.selectedCategory)) { nextLesson.interactable = false; } lessonNumber.text = 3 + " / " + GameMng.selectedLessonIndex.ToString(); lessonScore.text = GameMng.GetLessonBestScore(GameMng.selectedCategory, GameMng.selectedLessonIndex) + "/" + 30; List <ScoreHistory> scoreList = Setting.GetHistory(GameMng.selectedCategory.ToString(), GameMng.selectedLessonIndex); List <int> valueList = new List <int>(); valueList.Add(0); foreach (var item in scoreList) { valueList.Add(item.score); } graph.ShowGraph(valueList, GraphVisualType.LineGraph); }
private void SaveScore() { if (currentQType == QType.Practice) { int lastScore = GameMng.GetLessonBestScore(GameMng.selectedCategory, GameMng.selectedLessonIndex); if (currentScore > lastScore) { GameMng.SetLessonBestScore(GameMng.selectedCategory, GameMng.selectedLessonIndex, currentScore); } } else { int lastScore = GameMng.GetExamBestScore(GameMng.selectedExam.examTitle); if (currentScore > lastScore) { GameMng.SetExamBestScore(GameMng.selectedExam.examTitle, currentScore); } } }
private void EndQuestions() { verifyButton.interactable = false; skipButton.interactable = false; hintButton.gameObject.SetActive(false); timerPanel.OnTimerDoneEvent -= TimerPanel_OnTimerDoneEvent; ResultType result = GetResultType(); SaveScore(); string curentScoreString = currentScore + "/" + maxScore.ToString(); string bestScoreString = GameMng.GetLessonBestScore(GameMng.selectedCategory, GameMng.selectedLessonIndex) + "/" + maxScore.ToString(); if (currentQType == QType.Practice) { GameMng.Instance.SendLessonScore(GameMng.selectedCategory.ToString(), GameMng.selectedLessonIndex, currentScore, QuestionList); } else { GameMng.Instance.SendLessonScore("Exam", GameMng.selectedExam.examDegree, currentScore, null); } if (result >= ResultType.NotBad && currentQType == QType.Practice) { CheckOpenNextLesson(); CheckOpenNextCategory(); GameMng.Instance.CheckAchivmentLessonDone(); } else if (result >= ResultType.NotBad && currentQType == QType.Exam) { GameMng.Instance.CheckAchivment(timerPanel.GetElepsedTime()); } bool canRestart = true; if (currentQType == QType.Exam) { canRestart = false; } ResultsPanel.Show(curentScoreString, bestScoreString, result, canRestart); }