private IQuestion GenerateMissingLetterQuestion(ILivingLetterData data, ILivingLetterData letterToRemove) { var imageData = new LL_ImageData(data.Id); LL_WordData word = (LL_WordData)data; LL_LetterData letter = (LL_LetterData)letterToRemove; cacheCompleteWord = word.TextForLivingLetter; var partsToRemove = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).FindLetter(AppManager.I.DB, word.Data, letter.Data, LetterEqualityStrictness.Letter); partsToRemove.Shuffle(); //pick a random letter string text = LanguageSwitcher.I.GetHelper(LanguageUse.Learning).GetWordWithMissingLetterText( word.Data, partsToRemove[0], removedLetterColor: "#000000"); //Spawn word, then replace text with text with missing letter var wordGO = ItemFactory.Instance.SpawnQuestion(word); wordGO.InstaShrink(); wordGO.Label.text = text; cacheCompleteWordLL = wordGO; wordGO.SetExtendedBoxCollider(); return(new ImageQuestion(wordGO, imageData, audioManager)); }
private IEnumerator ImageShowAnimation(StillLetterBox letter) { letter.Poof(); audioManager.PlayPoofSound(); letter.Magnify(); yield return(Wait.For(0.9f)); }
protected void WrapQuestionInABox(IQuestion q) { var ll = q.gameObject.GetComponent <StillLetterBox>(); int placeholdersCount = 0; foreach (var p in q.GetPlaceholders()) { placeholdersCount++; } StillLetterBox[] boxes = new StillLetterBox[placeholdersCount + 1]; placeholdersCount = 0; foreach (var p in q.GetPlaceholders()) { boxes[placeholdersCount++] = p.GetComponent <StillLetterBox>(); } boxes[boxes.Length - 1] = ll; var box = ItemFactory.Instance.SpawnQuestionBox(boxes); box.Show(); audioManager.PlayPoofSound(); boxesList.Add(box); }
IEnumerator FadeOutImage(StillLetterBox image) { audioManager.PlayPoofSound(); image.Poof(); image.transform.DOScale(0, 0.4f).OnComplete(() => GameObject.Destroy(image.gameObject)); yield return(Wait.For(0.1f)); }
public DefaultQuestion(StillLetterBox letter, int placeholders, AssessmentAudioManager dialogues) { view = letter; placeholdersCount = placeholders; placeholdersSet = new List <GameObject>(); var question = letter.gameObject.AddComponent <QuestionBehaviour>(); question.SetQuestion(this, dialogues); }
public ImageQuestion(StillLetterBox wordGO, ILivingLetterData image, AssessmentAudioManager dialogues) { imageData = image; view = wordGO; placeholdersSet = new List <GameObject>(); var question = wordGO.gameObject.AddComponent <QuestionBehaviour>(); question.SetQuestion(this, dialogues); }
private IQuestion GenerateQuestion(ILivingLetterData data) { cacheFullWordData = new LL_WordData(data.Id); if (AssessmentOptions.Instance.ShowQuestionAsImage) { data = new LL_ImageData(data.Id); } cacheFullWordDataLL = ItemFactory.Instance.SpawnQuestion(data); return(new DefaultQuestion(cacheFullWordDataLL, 0, audioManager)); }
protected void PlaceImage(IQuestion q, Vector3 imagePos) { var ll = ItemFactory.Instance.SpawnQuestion(q.Image()); cacheImage = ll; images.Add(ll); ll.transform.position = imagePos; ll.InstaShrink(); AnimationsQueue.Add(ImageShowAnimation(ll)); }
private void RemovePlaceholder(StillLetterBox box) { box.transform.DOScale(0, 0.3f).OnComplete(() => GameObject.Destroy(box)); }
private void AddCompleteWordEvent(string completeText, StillLetterBox target) { cacheWordsToComplete.Add(target); cacheCompleteWords.Add(completeText); }
private IEnumerator PlaceholderShowAnimation(StillLetterBox box) { audioManager.PlayPlaceSlot(); box.Magnify(); yield return(Wait.For(0.2f)); }