private void OnExampleMenuItem(AppController.EMenu id) { VWord word = m_VocabularyData[m_SelectedCategory].WordSet.GetWordById(m_SelectedWordID); switch (id) { case AppController.EMenu.NEXT: // Set next sentence m_SelectedExampleID++; m_SelectedExampleID %= word.SentencesExamples.Sentence.Count; SetExample(m_SelectedExampleID); break; case AppController.EMenu.KANJI: m_ExamplesUI.Sentence = word.SentencesExamples.Sentence[m_SelectedExampleID]; break; case AppController.EMenu.KANA: m_ExamplesUI.Sentence = word.SentencesExamples.Kana[m_SelectedExampleID]; break; case AppController.EMenu.ROMAJI: m_ExamplesUI.Sentence = word.SentencesExamples.Romaji[m_SelectedExampleID]; break; } }
public void OnItemButtonPress(int id, int x, int y) { Debug.Log("Item: " + id + " (" + x + "," + y + ") m_ListButtonText[id].TextButton" + m_ListButtonText[id].TextButton); Debug.Log("H:" + m_ABCSet.SymbolChar[x, y] + ", R: " + m_ABCSet.RomanjiChar[x, y]); if (m_ABCSet == null) { Debug.Log("<color=cyan> SetExample, m_CurrentHiragana null </color>"); return; } // X has the current hiragana (ROW in the json) if ((x >= m_ABCSet.Data.Count) || (x < 0)) { Debug.Log("<color=cyan> SetExample, Index out of boundaries </color>"); return; } m_SelectedABC = m_ABCSet.Data[x]; /*if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) * { * EasyTTSUtil.SpeechFlush(m_ABCSet.RomanjiChar[x, y]); * }*/ //SetExample(0); //m_ABCCharUI.ExampleUI.Show(); }
private void SetExample(int index) { if ((index < 0) || (index >= m_VocabularyData.Count)) { Debug.LogError("[VocabularyControl.SetExample] index " + index + " Out of range"); return; } // Set sentence VWord word = m_VocabularyData[m_SelectedCategory].WordSet.GetWordById(m_SelectedWordID); m_ExamplesUI.Sentence = word.SentencesExamples.GetSentence(index); m_ExamplesUI.English = word.SentencesExamples.GetEnglish(index); m_ExamplesUI.Kanjis = word.SentencesExamples.GetKanjis(index); }
private void SetWord() { // Out of bondaries if ((m_SelectedCategory < 0) || (m_SelectedCategory >= m_VocabularyData.Count)) { Debug.LogError("[VocabularyControl.SetWord] SelectedCategory " + m_SelectedCategory + " Out of range"); return; } if ((m_SelectedWordID < 0) || (m_SelectedWordID >= m_VocabularyData[m_SelectedCategory].WordSet.Data.Count)) { Debug.LogError("[VocabularyControl.SetWord] m_SelectedWordID " + m_SelectedWordID + " Out of range"); return; } // Check number of words for this category if (m_Menu == EMenu.WordDay) { m_VocabularyUI.NextWordBtn.Enable(false, m_DisableBtnColor); } else { if (m_VocabularyData[m_SelectedCategory].WordSet.Data.Count > 0) { m_VocabularyUI.NextWordBtn.Enable(true, m_EnableBtnColor); } else { m_VocabularyUI.NextWordBtn.Enable(false, m_DisableBtnColor); } } VWord word = m_VocabularyData[m_SelectedCategory].WordSet.GetWordById(m_SelectedWordID); if (word != null) { // Set word m_VocabularyUI.Word = word.Word; m_VocabularyUI.English = word.Meaning; m_VocabularyUI.Kana = word.Kana + " : " + word.Romaji; // Set sprite m_VocabularyUI.SpriteBtn.Enable(false, m_DisableBtnColor); if (word.SpriteObj != null) { m_VocabularyUI.Sprite.SpriteObject = word.SpriteObj; m_VocabularyUI.SpriteBtn.Enable(true, m_EnableBtnColor); } m_VocabularyUI.Sprite.Hide(); // Set sentence if ((word.SentencesExamples != null) && (word.SentencesExamples.Sentence.Count > 0)) { if (word.SentencesExamples.Sentence.Count > 1) { m_ExamplesUI.NextBtn.Enable(true, m_EnableBtnColor); } else { m_ExamplesUI.NextBtn.Enable(false, m_DisableBtnColor); } m_VocabularyUI.ExampleBtn.Enable(true, m_EnableBtnColor); // Set sentence m_SelectedExampleID = 0; SetExample(m_SelectedExampleID); } else { m_ExamplesUI.NextBtn.Enable(false, m_DisableBtnColor); m_VocabularyUI.ExampleBtn.Enable(false, m_DisableBtnColor); } } else { Debug.Log("<color=cyan> No Current Word </color>"); } }