IEnumerator LoadWordData() { if (allWords != null && allWords.Count != 0) { yield break; } else { string dictionaryPath = System.IO.Path.Combine(Application.streamingAssetsPath, "wordsByFrequency.txt"); string result = null; if (dictionaryPath.Contains("://")) { WWW www = new WWW(dictionaryPath); yield return(www); result = www.text; } else { result = System.IO.File.ReadAllText(dictionaryPath); } var words = result.Split('\n'); //collect words allWords = new List <string> (); commonDictionaryWords = new List <string> (); var index = 0; foreach (var w in words) { if (string.IsNullOrEmpty(w) || w.Length < 3) { continue; } var word = w.TrimEnd(); if (word.IndexOf('#') != -1) { index++; } else { allWords.Add(word); if (index < 5) { commonDictionaryWords.Add(word); } } } BogglingGameEvents.GameLoaded(); } }
private void SubmitWord() { char[] word = new char[selectedTiles.Count]; for (var i = 0; i < selectedTiles.Count; i++) { var tile = selectedTiles [i]; word [i] = tile.TypeChar; } var s = new string (word); Debug.Log("SUBMIT WORD: " + s); BogglingGameEvents.WordSelected(s, selectedTiles); }