/// <summary>
        /// 更新数据库中的单词数据
        /// </summary>
        /// <param name="wordType">Word type.</param>
        private void UpdateWordsDataBase(MySQLiteHelper sql, int wordType, List <HLHWord> wordsList)
        {
            string query = string.Empty;

            for (int i = 0; i < wordsList.Count; i++)
            {
                HLHWord word = wordsList[i];

                int wordId = word.wordId;

                switch (wordType)
                {
                case 0:
                    query = string.Format("UPDATE {0} SET learnedTimes={1},ungraspTimes={2},isFamiliar={3} WHERE spell='{4}'",
                                          CommonData.simpleWordsTable, word.learnedTimes, word.ungraspTimes, word.isFamiliar?1:0, word.spell);
                    break;

                case 1:
                    query = string.Format("UPDATE {0} SET learnedTimes={1},ungraspTimes={2},isFamiliar={3} WHERE spell='{4}'",
                                          CommonData.mediumWordsTabel, word.learnedTimes, word.ungraspTimes, word.isFamiliar ? 1 : 0, word.spell);
                    break;

                case 2:
                    query = string.Format("UPDATE {0} SET learnedTimes={1},ungraspTimes={2},isFamiliar={3} WHERE spell='{4}'",
                                          CommonData.masterWordsTabel, word.learnedTimes, word.ungraspTimes, word.isFamiliar ? 1 : 0, word.spell);
                    break;
                }

                sql.ExecuteQuery(query);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 从reader中读取单词数据,生成单词对象
        /// </summary>
        /// <returns>The word from reader.</returns>
        /// <param name="reader">Reader.</param>
        public static HLHWord GetWordFromReader(IDataReader reader)
        {
            int wordId = reader.GetInt32(0);

            string spell = reader.GetString(1);

            string phoneticSymble = reader.GetString(2);

            string explaination = reader.GetString(3);

            string sentenceEN = reader.GetString(4);

            string sentenceCH = reader.GetString(5);

            string pronounciationURL = reader.GetString(6);

            int wordLength = reader.GetInt16(7);

            int learnedTimes = reader.GetInt16(8);

            int ungraspTimes = reader.GetInt16(9);

            bool isFamiliar = reader.GetInt16(10) == 1;

            string backupPronouncitaionURL = reader.GetString(11);

            HLHWord word = new HLHWord(wordId, spell, phoneticSymble, explaination, sentenceEN, sentenceCH, pronounciationURL,
                                       wordLength, learnedTimes, ungraspTimes, isFamiliar, backupPronouncitaionURL);

            return(word);
        }
        /// <summary>
        /// 更新数据库中变更单词掌握状态的单词信息
        /// </summary>
        private void UpdateChangeStatusWords()
        {
            MySQLiteHelper sql = MySQLiteHelper.Instance;

            sql.GetConnectionWith(CommonData.dataBaseName);

            string currentWordsTableName = LearningInfo.Instance.GetCurrentLearningWordsTabelName();

            string[] colFields = { "isFamiliar" };

            HLHWord word = null;

            // 更新数据库中的单词数据
            // 更新所有待转移到熟悉列表的单词
            for (int i = 0; i < changeToFamiliarWords.Count; i++)
            {
                word = changeToFamiliarWords[i];
                word.learnedTimes++;
                string[] conditions = { "wordId=" + word.wordId };
                string[] values     = { "1" };
                sql.UpdateValues(currentWordsTableName, colFields, values, conditions, true);
            }
            // 更新所有待转移到不熟悉列表的单词
            for (int i = 0; i < changeToUnfamiliarWords.Count; i++)
            {
                word = changeToUnfamiliarWords[i];
                word.learnedTimes++;
                word.ungraspTimes++;
                string[] conditions = { "wordId=" + word.wordId };
                string[] values     = { "0" };
                sql.UpdateValues(currentWordsTableName, colFields, values, conditions, true);
            }

            sql.CloseConnection(CommonData.dataBaseName);
        }
Beispiel #4
0
        public void UpdateWordRecords(List <HLHWord> words)
        {
            for (int i = 0; i < words.Count; i++)
            {
                HLHWord word = words[i];

                if (word == null)
                {
                    continue;
                }

                //bool update = true;
                for (int j = 0; j < wordRecords.Count; j++)
                {
                    if (wordRecords[j].wordId == word.wordId)
                    {
                        //update = false;
                        wordRecords.RemoveAt(j);
                        break;
                    }
                }
                //if (update)
                //{
                wordRecords.Add(words[i]);
                //}
            }
            if (words.Count > 0 && words[words.Count - 1] != null)
            {
                wordRecordText.text = words[words.Count - 1].spell;
            }
        }
Beispiel #5
0
        public void SetUpWordDetailHUD(bool controlMoveWhenQuit, CallBack quitCallBack)
        {
            if (wordRecords.Count > 0)
            {
                ExploreManager.Instance.MapWalkableEventsStopAction();
                HLHWord word = wordRecords[wordRecords.Count - 1];
                wordDetailHUD.SetUpWordDetailHUD(wordRecords, delegate
                {
                    rejectNewUI = false;

                    if (quitCallBack != null)
                    {
                        quitCallBack();
                    }
                    if (!controlMoveWhenQuit)
                    {
                        ExploreManager.Instance.MapWalkableEventsStartAction();
                    }
                });
            }
            else
            {
                rejectNewUI = false;
                ExploreManager.Instance.MapWalkableEventsStartAction();
            }
        }
Beispiel #6
0
        public void SetUpKeyDoorOperatorView(List <SpecialItem> keys, HLHWord keyDoorWord, CallBackWithWord unlockSuccessCallBack, CallBack unlockFailCallBack)
        {
            this.unlockSuccessCallBack = unlockSuccessCallBack;

            this.unlockFailCallBack = unlockFailCallBack;

            this.keyDoorWord = keyDoorWord;

            SetUpKeysSelect(keys);

            lockIcon.sprite = lockOnSprite;


            this.gameObject.SetActive(true);

            toolSelectPlane.gameObject.SetActive(true);

            unlockOperationPlane.gameObject.SetActive(false);

            keyDoorOperationMask.gameObject.SetActive(false);

            queryQuitHUD.gameObject.SetActive(false);

            SetUpCharacterButtons(keyDoorWord);

            SetUpKeyDoorCharacterFill(keyDoorWord);

            ExploreManager.Instance.MapWalkableEventsStopAction();
        }
        /// <summary>
        /// 更新指定页面的已学习单词
        /// </summary>
        public void UpdateWordsOfCurrentPage(List <HLHWord> words, int currentPageIndex, int totalPage)
        {
            wordPool.AddChildInstancesToPool(wordContainer);

            int minWordIndexOfCurrentPage = currentPageIndex * CommonData.singleWordsRecordsPageVolume;
            int maxWordIndexOfCurrentPage = (currentPageIndex + 1) * CommonData.singleWordsRecordsPageVolume - 1;

            maxWordIndexOfCurrentPage = maxWordIndexOfCurrentPage > words.Count ? words.Count : maxWordIndexOfCurrentPage;

            for (int i = 0; i < words.Count; i++)
            {
                HLHWord word = words[i];

                WordItemView wordItem = wordPool.GetInstance <WordItemView>(wordModel.gameObject, wordContainer);

                int indexInCurrentPage = i;

                wordItem.InitWordItemView(ShowChangeWordStatusQueruHUD, delegate {
                    ShowWordDetail(word, minWordIndexOfCurrentPage + indexInCurrentPage);
                }, wordPool);
                wordItem.SetUpCellDetailView(word);
            }

            generalInfoPlane.gameObject.SetActive(false);
            wordsPlane.gameObject.SetActive(true);

            wordPageText.text = string.Format("{0}/{1}", currentPageIndex + 1, totalPage);

            GetComponent <Canvas>().enabled = true;
        }
        /// <summary>
        /// 在单词详细页里点击上一个单词按钮的回调
        /// </summary>
        /// <param name="wordIndexInList">Word index in list.</param>
        public void OnLastWordButtonClick(int wordIndexInList)
        {
            List <HLHWord> wordList = null;

            switch (currentTabIndex)
            {
            case 1:
                wordList = allFamiliarWords;
                break;

            case 2:
                wordList = allUnfamiliarWords;
                break;
            }

            if (wordIndexInList <= 0)
            {
                return;
            }

            wordIndexInList--;

            HLHWord word = wordList[wordIndexInList];

            recordView.wordDetail.UpdateWordDetailHUD(word, wordIndexInList);
        }
        /// <summary>
        /// 下载单词发音【主要用于在创建地图时进行发音缓存】
        /// </summary>
        /// <param name="word">Word.</param>
        public void DownloadPronounceCache(HLHWord word)
        {
            wordToPronounce = word;
            // 从发音缓存查询是否有该单词的缓存
            Pronunciation pro = GetPronunciationFromCache(word);

            // 如果没有,则重新下载
            if (pro == null)
            {
                string pronounceUrl = string.Empty;

                // 检查该单词是否有过下载错误
                PronounceErrorRecord errorRecord = CheckPronounceErrorExist(word);

                // 如果没有错误,使用默认下载链接
                if (errorRecord.wordId == -1)
                {
                    pronounceUrl = word.pronounciationURL;
                }
                // 如果出现过错误
                else if (errorRecord.wordId >= 0)
                {
                    switch (errorRecord.errorCode)
                    {
                    // 如果默认发音地址出现过错误,则使用备用发音地址
                    case PronounceErrorCode.ErrorWithURL_1:
                        pronounceUrl = word.backupProuounciationURL;
                        break;

                    // 如果备用发音地址出现过错误,则使用默认发音地址
                    case PronounceErrorCode.ErrorWithURL_2:
                        pronounceUrl = word.pronounciationURL;
                        break;

                    case PronounceErrorCode.Unknown:
                        break;
                    }
                }

                // 有可用发音链接
                if (pronounceUrl != string.Empty)
                {
                    try
                    {
                        if (string.Equals(pronounceUrl, currentConnectingUrl))
                        {
                            return;
                        }

                        // 开启新的下载协程
                        IEnumerator downloadCoroutine = CachePronouciationFinishDownloading(pronounceUrl, word);
                        StartCoroutine(downloadCoroutine);
                    }
                    catch (System.Exception e)
                    {
                        Debug.Log(e);
                    }
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// 获取所有不熟悉的单词
        /// </summary>
        /// <returns>The all unfamiliar word.</returns>
        public List <HLHWord> GetAllUnfamiliarWord()
        {
            List <HLHWord> unfamiliarWords = new List <HLHWord>();

            string tableName = GetCurrentLearningWordsTabelName();

            MySQLiteHelper sql = MySQLiteHelper.Instance;

            sql.GetConnectionWith(CommonData.dataBaseName);

            string[] graspedCondition = { "learnedTimes>0", "isFamiliar=0" };

            IDataReader reader = sql.ReadSpecificRowsOfTable(tableName, null, graspedCondition, true);

            while (reader.Read())
            {
                if (reader == null)
                {
                    sql.CloseConnection(CommonData.dataBaseName);
                    return(null);
                }

                HLHWord word = HLHWord.GetWordFromReader(reader);

                unfamiliarWords.Add(word);
            }


            sql.CloseAllConnections();

            return(unfamiliarWords);
        }
Beispiel #11
0
        /// <summary>
        /// 获取所有已学习过的单词
        /// </summary>
        /// <returns>The all learned words.</returns>
        public List <HLHWord> GetAllLearnedWords()
        {
            List <HLHWord> learnedWords = new List <HLHWord>();

            string tableName = GetCurrentLearningWordsTabelName();

            MySQLiteHelper sql = MySQLiteHelper.Instance;

            // 连接数据库
            sql.GetConnectionWith(CommonData.dataBaseName);

            string[] ungraspedCondition = { "learnedTimes>0" };

            // 读取器
            IDataReader reader = sql.ReadSpecificRowsOfTable(tableName, null, ungraspedCondition, true);

            // 从表中读取数据
            while (reader.Read())
            {
                if (reader == null)
                {
                    sql.CloseAllConnections();
                    return(null);
                }

                HLHWord word = HLHWord.GetWordFromReader(reader);

                learnedWords.Add(word);
            }

            sql.CloseAllConnections();

            return(learnedWords);
        }
        /// <summary>
        /// 更新当前页面的单词显示
        /// </summary>
        private void UpdateWordsOfCurrentPage()
        {
            int totalPage = 0;
            // 计算本页最小单词序号和最大单词序号
            int minWordIndexOfCurrentPage = currentWordPageIndex * CommonData.singleWordsRecordsPageVolume;
            int maxWordIndexOfCurrentPage = (currentWordPageIndex + 1) * CommonData.singleWordsRecordsPageVolume - 1;

            switch (currentTabIndex)
            {
            // 显示熟悉单词列表
            case 1:
                // 如果本页最小单词的序号已经超过了所有熟悉单词数据的数量,并且不是第1页
                if (minWordIndexOfCurrentPage >= allFamiliarWords.Count && currentWordPageIndex > 0)
                {
                    // 向前翻一页
                    currentWordPageIndex--;
                    UpdateWordsOfCurrentPage();
                }
                else
                {
                    totalPage = (allFamiliarWords.Count - 1) / CommonData.singleWordsRecordsPageVolume + 1;

                    List <HLHWord> graspedWords = new List <HLHWord>();

                    maxWordIndexOfCurrentPage = maxWordIndexOfCurrentPage <= allFamiliarWords.Count - 1 ? maxWordIndexOfCurrentPage : allFamiliarWords.Count - 1;

                    for (int i = minWordIndexOfCurrentPage; i <= maxWordIndexOfCurrentPage; i++)
                    {
                        HLHWord word = allFamiliarWords[i];
                        graspedWords.Add(word);
                    }
                    recordView.UpdateWordsOfCurrentPage(graspedWords, currentWordPageIndex, totalPage);
                }
                break;

            case 2:
                if (minWordIndexOfCurrentPage >= allUnfamiliarWords.Count && currentWordPageIndex > 0)
                {
                    currentWordPageIndex--;
                    UpdateWordsOfCurrentPage();
                }
                else
                {
                    totalPage = (allUnfamiliarWords.Count - 1) / CommonData.singleWordsRecordsPageVolume + 1;

                    List <HLHWord> ungraspedWords = new List <HLHWord>();

                    maxWordIndexOfCurrentPage = maxWordIndexOfCurrentPage <= allUnfamiliarWords.Count - 1 ? maxWordIndexOfCurrentPage : allUnfamiliarWords.Count - 1;

                    for (int i = minWordIndexOfCurrentPage; i <= maxWordIndexOfCurrentPage; i++)
                    {
                        HLHWord word = allUnfamiliarWords[i];
                        ungraspedWords.Add(word);
                    }
                    recordView.UpdateWordsOfCurrentPage(ungraspedWords, currentWordPageIndex, totalPage);
                }
                break;
            }
        }
        /// <summary>
        /// 从缓存中读取单词发音
        /// </summary>
        /// <returns>The pronunciation from cache.</returns>
        /// <param name="word">Word.</param>
        private Pronunciation GetPronunciationFromCache(HLHWord word)
        {
            Pronunciation pro = pronunciationCache.Find(delegate(Pronunciation obj)
            {
                return(obj.word.wordId == word.wordId);
            });

            return(pro);
        }
Beispiel #14
0
 public void OnBackgroundClicked()
 {
     if (quitWhenClickBackground && canQuitWhenClickBackground)
     {
         ExploreManager.Instance.battlePlayerCtr.isInEvent = false;
         questionWord = null;
         QuitWordHUD();
     }
 }
Beispiel #15
0
        public override void SetUpCellDetailView(object data)
        {
            this.word = data as HLHWord;

            spellText.text = word.spell;

            explainationText.text = word.explaination;

            phoneticSymbolText.text = word.phoneticSymbol;
        }
        /// <summary>
        /// 获取数据库中的单词数据[0:simple 1:middle 2:master]
        /// </summary>
        /// <returns>The word records in data base.</returns>
        /// <param name="wordType">Word type.</param>
        private List <HLHWord> GetWordRecordsInDataBase(MySQLiteHelper sql, int wordType)
        {
            List <HLHWord> wordsList = new List <HLHWord>();

            string query = string.Empty;

            switch (wordType)
            {
            case 0:
                query = string.Format("SELECT * FROM {0} WHERE learnedTimes>0", CommonData.simpleWordsTable);
                break;

            case 1:
                query = string.Format("SELECT * FROM {0} WHERE learnedTimes>0", CommonData.mediumWordsTabel);;
                break;

            case 2:
                query = string.Format("SELECT * FROM {0} WHERE learnedTimes>0", CommonData.masterWordsTabel);
                break;
            }


            IDataReader reader = sql.ExecuteQuery(query);

            while (reader.Read())
            {
                int wordId = reader.GetInt32(0);

                string spell = reader.GetString(1);

                string phoneticSymble = reader.GetString(2);

                string explaination = reader.GetString(3);

                string sentenceEN = reader.GetString(4);

                string sentenceCH = reader.GetString(5);

                string pronounciationURL = reader.GetString(6);

                int wordLength = reader.GetInt16(7);

                int learnedTimes = reader.GetInt16(8);

                int ungraspTimes = reader.GetInt16(9);

                bool isFamiliar = reader.GetInt16(10) == 1;

                HLHWord word = new HLHWord(wordId, spell, phoneticSymble, explaination, sentenceEN, sentenceCH, pronounciationURL,
                                           wordLength, learnedTimes, ungraspTimes, isFamiliar, "");

                wordsList.Add(word);
            }
            return(wordsList);
        }
Beispiel #17
0
        public void SetUpWordHUDAndShow(HLHWord word)
        {
            this.questionWord = word;

            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                pronounceNotAvalableHintTextInFill.enabled = true;
            }
            else
            {
                pronounceNotAvalableHintTextInFill.enabled = false;
            }

            pronounceNotAvalableHintTextInExplain.enabled = false;

            gameObject.SetActive(true);

            EnableClick();

            canQuitWhenClickBackground = true;

            explainationSelectPlane.gameObject.SetActive(false);
            characterFillPlane.gameObject.SetActive(true);

            realCharacters   = word.spell.ToCharArray();
            answerCharacters = GenerateCharacterFillArray(word.spell);

            questionForCharacterFill.text       = word.explaination;
            phoneticSymbolForCharacterFill.text = word.phoneticSymbol;

            lockStatusIcon.sprite = lockSprite;

            fillAndCodeCells.Clear();

            for (int i = 0; i < realCharacters.Length; i++)
            {
                char charInQuestion = answerCharacters [i];

                char realChar = realCharacters [i];

                FillAndCodeCell cell = characterToFillCellPool.GetInstance <FillAndCodeCell> (fillAndCodeModel.gameObject, characterToFillCellContainer);

                cell.gameObject.SetActive(true);

                answerCharacters [i] = cell.SetUpFillAndCodeCell(i, charInQuestion, realChar, CharacterChange, CharacterClick);

                fillAndCodeCells.Add(cell);
            }

            //if(GameManager.Instance.gameDataCenter.gameSettings.isAutoPronounce){
            //	OnPronunceButtonClick();
            //}
        }
        private void SetUpWordDetailHUD(HLHWord word)
        {
            spellText.text          = word.spell;
            phoneticSymbolText.text = word.phoneticSymbol;
            explainationText.text   = word.explaination;
            sentenceEN.text         = word.sentenceEN;
            sentenceCH.text         = word.sentenceCH;

            if (GameManager.Instance.gameDataCenter.gameSettings.isAutoPronounce)
            {
                OnPronunceButtonClick();
            }
        }
Beispiel #19
0
        public void OnPronounceButtonClick()
        {
            switch (currentQuizType)
            {
            case QuizType.EnToCh:
                HLHWord questionWord = sourceWords[currentWordIndex];
                GameManager.Instance.pronounceManager.PronounceWord(questionWord);
                break;

            case QuizType.ChToEn:
                GameManager.Instance.soundManager.PlayAudioClip(CommonData.wrongTintAudioName);
                break;
            }
        }
Beispiel #20
0
 public void SetUpUnlockDoorView(List <SpecialItem> keys, HLHWord keyDoorWord, CallBack unlockSuccessCallBack, CallBack unlockFailCallBack)
 {
     ExploreManager.Instance.MapWalkableEventsStopAction();
     keyDoorOperatorView.SetUpKeyDoorOperatorView(keys, keyDoorWord, delegate(HLHWord word){
         UpdateWordRecords(new List <HLHWord> {
             word
         });
         unlockSuccessCallBack();
         if (word != null)
         {
             SetUpWordDetailHUD(true, null);
         }
     }, unlockFailCallBack);
 }
Beispiel #21
0
        /// <summary>
        /// 更新单词数据库
        /// </summary>
        public void UpdateWordDataBase()
        {
            // 连接到数据库
            MySQLiteHelper sql = MySQLiteHelper.Instance;

            sql.GetConnectionWith(CommonData.dataBaseName);

            // 开启事务
            sql.BeginTransaction();

            // 获取当前单词的表单
            string currentWordsTableName = LearningInfo.Instance.GetCurrentLearningWordsTabelName();

            // 更新项
            string[] colFields = { "learnedTimes", "ungraspTimes", "isFamiliar" };

            HLHWord word = null;

            // 正确单词列表中所有单词数据更新进数据库
            for (int i = 0; i < correctWordList.Count; i++)
            {
                word = correctWordList[i];

                string familiarStr = word.isFamiliar ? "1" : "0";

                string[] conditions = { "wordId=" + word.wordId };
                string[] values     = { word.learnedTimes.ToString(), word.ungraspTimes.ToString(), familiarStr };
                sql.UpdateValues(currentWordsTableName, colFields, values, conditions, true);
            }

            // 错误单词列表中所有单词数据更新进数据库
            for (int i = 0; i < wrongWordList.Count; i++)
            {
                word = wrongWordList[i];

                string   familiarStr = word.isFamiliar ? "1" : "0";
                string[] conditions  = { "wordId=" + word.wordId };
                string[] values      = { word.learnedTimes.ToString(), word.ungraspTimes.ToString(), familiarStr };
                sql.UpdateValues(currentWordsTableName, colFields, values, conditions, true);
            }

            // 清理工作
            correctWordList.Clear();
            wrongWordList.Clear();

            sql.EndTransaction();

            sql.CloseConnection(CommonData.dataBaseName);
        }
Beispiel #22
0
        public override void InitializeWithAttachedInfo(int mapIndex, MapAttachedInfoTile attachedInfo)
        {
            this.mapIndex = mapIndex;

            transform.position = attachedInfo.position;

            isWordTrigger = false;
            isOpen        = false;

            direction = int.Parse(KVPair.GetPropertyStringWithKey("direction", attachedInfo.properties));

            unlockDifficulty = int.Parse(KVPair.GetPropertyStringWithKey("type", attachedInfo.properties));

            string pairDoorPosString = KVPair.GetPropertyStringWithKey("pairDoorPos", attachedInfo.properties);

            string[] posXY = pairDoorPosString.Split(new char[] { '_' }, System.StringSplitOptions.RemoveEmptyEntries);

            int posX = int.Parse(posXY[0]);
            int posY = mapHeight - int.Parse(posXY[1]) - 1;

            pairDoorPos = new Vector3(posX, posY, transform.position.z);


            if (MapEventsRecord.IsMapEventTriggered(mapIndex, attachedInfo.position))
            {
                mapItemRenderer.sprite = null;
                isOpen = true;
                //ExploreManager.Instance.newMapGenerator.ChangeMapEventStatusAtPosition(pairDoorPos);
            }

            if (!isOpen)
            {
                mapItemRenderer.enabled = true;
                mapItemRenderer.sprite  = doorCloseSprites[direction];
            }
            else
            {
                mapItemRenderer.sprite  = null;
                mapItemRenderer.enabled = false;
            }


            bc2d.enabled = true;
            SetSortingOrder(-(int)transform.position.y);

            int wordLength = unlockDifficulty + 3;

            keyDoorWord = GetWordOfLength(wordLength);
        }
        public void OnNextWordButtonClick()
        {
            if (wordIndex >= wordRecords.Count - 1)
            {
                return;
            }

            wordIndex++;

            indexTint.text = string.Format("{0}/{1}", wordIndex + 1, wordRecords.Count);

            currentWord = wordRecords[wordIndex];

            SetUpWordDetailHUD(currentWord);
        }
Beispiel #24
0
        public void QuitWordHUD()
        {
            if (quitCallBack != null)
            {
                quitCallBack(questionWord);
            }

            characterToFillCellPool.AddChildInstancesToPool(characterToFillCellContainer);

            questionWord = null;

            recordList.Clear();

            gameObject.SetActive(false);
        }
Beispiel #25
0
        private void SetUpKeyDoorCharacterFill(HLHWord word)
        {
            keyDoorCharacterFillList.Clear();

            char[] characters = word.spell.ToCharArray();

            for (int i = 0; i < word.wordLength; i++)
            {
                KeyDoorCharacterFill keyDoorCharacter = keyDoorCharacterPool.GetInstance <KeyDoorCharacterFill>(keyDoorCharacterModel.gameObject, keyDoorCharacterContainer);

                keyDoorCharacter.Reset();

                keyDoorCharacterFillList.Add(keyDoorCharacter);
            }
        }
Beispiel #26
0
        /// <summary>
        /// 显示事件单词
        /// </summary>
        protected virtual void CheckIsWordTriggeredAndShow()
        {
            if (isWordTriggered && tmPro != null)
            {
                HLHWord targetWord = wordsArray [0];

                tmPro.text = targetWord.spell;

                tmPro.enabled = true;
            }
            else
            {
                tmPro.enabled = false;
            }
        }
Beispiel #27
0
        /// <summary>
        /// 检查单词是否在错误单词列表中
        /// </summary>
        /// <returns><c>true</c>, if word exist in wrong record list was checked, <c>false</c> otherwise.</returns>
        /// <param name="word">Word.</param>
        public bool CheckWordExistInWrongRecordList(HLHWord word)
        {
            bool exist = false;

            for (int i = 0; i < wrongWordList.Count; i++)
            {
                HLHWord wordRecord = wrongWordList[i];
                if (word.wordId == wordRecord.wordId)
                {
                    exist = true;
                    break;
                }
            }
            return(exist);
        }
Beispiel #28
0
        private HLHWord GetAValidWord()
        {
            MySQLiteHelper mySql = MySQLiteHelper.Instance;

            mySql.GetConnectionWith(CommonData.dataBaseName);

            string currentWordsTableName = LearningInfo.Instance.GetCurrentLearningWordsTabelName();

            string[] condition = new string[] { "wordLength <= 7 ORDER BY RANDOM() LIMIT 1" };

            IDataReader reader = mySql.ReadSpecificRowsOfTable(currentWordsTableName, null, condition, true);

            reader.Read();

            return(HLHWord.GetWordFromReader(reader));
        }
        public void SetUpChangeWordStatusQueryHUD(HLHWord word, CallBackWithWord changeWordStatusCallBack)
        {
            this.word = word;

            this.changeWordStatusCallBack = changeWordStatusCallBack;

            bool hasGrasped = word.isFamiliar;

            string wordListName = hasGrasped ? "不熟悉" : "熟悉";

            string query = string.Format("是否将单词\n\n<color=orange><size=70>{0}</size></color>\n\n移至<color=orange>{1}</color>单词列表?", word.spell, wordListName);

            queryText.text = query;

            this.gameObject.SetActive(true);
        }
Beispiel #30
0
        private void SetUpQuiz(HLHWord[] words, int quizWordIndex)
        {
            //int quizTypeInt = Random.Range(0, 2);

            currentQuizType = QuizType.ChToEn;

            HLHWord questionWord = words[quizWordIndex];

            switch (currentQuizType)
            {
            case QuizType.EnToCh:
                pronounceButton.gameObject.SetActive(true);
                spellQuesiton.text                  = questionWord.spell;
                explainationQuestion.text           = string.Empty;
                phoneticSymbolForExplainSelect.text = questionWord.phoneticSymbol;
                exampleSentenceText.text            = questionWord.sentenceEN;
                for (int i = 0; i < words.Length; i++)
                {
                    if (i < choiceTexts.Length)
                    {
                        Text choiceText = choiceTexts[i];
                        choiceText.text  = words[i].explaination;
                        choiceText.color = CommonData.darkYellowTextColor;
                    }
                }
                break;

            case QuizType.ChToEn:
                pronounceButton.gameObject.SetActive(false);
                spellQuesiton.text                  = string.Empty;
                explainationQuestion.text           = questionWord.explaination;
                phoneticSymbolForExplainSelect.text = string.Empty;
                exampleSentenceText.text            = string.Empty;
                for (int i = 0; i < words.Length; i++)
                {
                    if (i < choiceTexts.Length)
                    {
                        Text choiceText = choiceTexts[i];
                        choiceText.text  = words[i].spell;
                        choiceText.color = CommonData.darkYellowTextColor;
                    }
                }
                break;
            }

            interactiveMask.enabled = false;
        }