public SampleQuestionWithWordsProvider() { currentQuestion = 0; description = "Questions description"; for (int i = 0; i < 32; i++) { List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>(); List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>(); LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(); if (newWordData == null) { return; } correctAnswers.Add(newWordData); // At least 4 wrong words while (wrongAnswers.Count < 4) { var word = AppManager.I.Teacher.GetRandomTestWordDataLL(); if (!correctAnswers.Contains(word) && !wrongAnswers.Contains(word)) { wrongAnswers.Add(word); } } var currentPack = new SampleQuestionPack(newWordData, wrongAnswers, correctAnswers); questions.Add(currentPack); } }
public SampleQuestionProvider() { currentQuestion = 0; description = "Questions description"; // 10 QuestionPacks for (int i = 0; i < 32; i++) { List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>(); List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>(); LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(); //LL_WordData newWordData = AppManager.I.Teacher.GetRandomTestWordDataLL(new WordFilters(requireDiacritics: true)); //LL_WordData newWordData = new LL_WordData(AppManager.I.DB.GetWordDataById("welcome")); if (newWordData == null) { return; } foreach (var letterData in ArabicAlphabetHelper.ExtractLetterDataFromArabicWord(newWordData.Data.Arabic)) { correctAnswers.Add(letterData); } correctAnswers = correctAnswers.Distinct().ToList(); // At least 4 wrong letters while (wrongAnswers.Count < 4) { var letter = AppManager.I.Teacher.GetRandomTestLetterLL(); if (!CheckIfContains(correctAnswers, letter) && !CheckIfContains(wrongAnswers, letter)) { wrongAnswers.Add(letter); } } var currentPack = new SampleQuestionPack(newWordData, wrongAnswers, correctAnswers); questions.Add(currentPack); } }
public SunMoonQuestionProvider() { currentQuestion = 0; // 10 QuestionPacks for (int i = 0; i < 32; i++) { List <ILivingLetterData> correctAnswers = new List <ILivingLetterData>(); List <ILivingLetterData> wrongAnswers = new List <ILivingLetterData>(); var data = AppManager.I.Teacher.GetRandomTestLetterLL(); if (data == null) { return; } // sun var sunData = AppManager.I.DB.GetWordDataById("the_sun"); var moonData = AppManager.I.DB.GetWordDataById("the_moon"); ILivingLetterData sunWord = new LL_ImageData(sunData.GetId(), sunData); ILivingLetterData moonWord = new LL_ImageData(moonData.GetId(), moonData); if (data.Data.SunMoon == Db.LetterDataSunMoon.Sun) { correctAnswers.Add(sunWord); wrongAnswers.Add(moonWord); } else if (data.Data.SunMoon == Db.LetterDataSunMoon.Moon) { correctAnswers.Add(moonWord); wrongAnswers.Add(sunWord); } else { continue; } var currentPack = new SampleQuestionPack(data, wrongAnswers, correctAnswers); questions.Add(currentPack); } }