// once the user is done with creating the string , it has to press the done button so we can process // its answer this method will process the naswer string and also will validate the // grid if it contains atleast one valid word or not public void OnDOneClick() { string answer = CreateAnswerString(); if (WordBankManager.GetInstance().CheckAnswerString(answer.ToLower())) //chek the validity of word { Debug.Log(" This is the valid string "); right.rectTransform.localScale = new Vector3(1, 1, 1); StartCoroutine(showMsg(1)); char[] removeletter = answer.ToCharArray(); for (int i = 0; i < destructionArry.Count; i++) { remaingLetter.Remove(removeletter[i]); Destroy(destructionArry[i].gameObject); } for (int i = 0; i < currentAnsweGridNo; i++) { answerArray[i] = -1; } noOfLetterClicked = 0; currentAnsweGridNo = 0; destructionArry.Clear(); if (WordBankManager.GetInstance().validateGrid(CreateString(remaingLetter))) // check the validity of grid { Debug.Log("Grid is still valid for further play "); } else { Debug.Log("No valid word in the grid !!!!!!! "); } } else { Debug.Log(" in valid word or mising from bank"); wrong.rectTransform.localScale = new Vector3(1, 1, 1); StartCoroutine(showMsg(2)); char[] removeletter = answer.ToCharArray(); for (int i = 0; i < destructionArry.Count; i++) { remaingLetter.Remove(removeletter[i]); Destroy(destructionArry[i].gameObject); } for (int i = 0; i < currentAnsweGridNo; i++) { answerArray[i] = -1; } if (WordBankManager.GetInstance().validateGrid(CreateString(remaingLetter))) // check the validity of grid { Debug.Log("Grid is still valid for further play "); } else { Debug.Log("No valid word in the grid !!!!!!! "); } noOfLetterClicked = 0; currentAnsweGridNo = 0; destructionArry.Clear(); } }
void Start() { tempQuestionArray = questionString.ToCharArray(); alphabetManager = GetComponent <AlphabetManager> (); alphabetManager.LoadAlphabetSprite(); WordBankManager.GetInstance().LoadDictionaryFromTextFile(); calculateGridDimensionsAndCreateEMptyGrid(currentNoOfRow, currentNoOfCol); destructionArry = new List <Button> (); remaingLetter = new List <char> (); remaingLetter.AddRange(tempQuestionArray); }
void Start() { cameraZoom = FindObjectOfType <ViewSwitch>(); playerHistory = FindObjectOfType <PlayerHistory>(); playerMovement = FindObjectOfType <PlayerMovement>(); wordBank = FindObjectOfType <WordBankManager>(); // textBox = GameObject.Find("DialoguePanel"); listenJsonParser = FindObjectOfType <ListenJsonParser>(); questionJsonParser = FindObjectOfType <QuestionJsonParser>(); playerMovement.frozen = false; canvas = GameObject.Find("UICanvas"); listenJson = listenJsonParser.parseLevelJson("levelOne"); questionJson = questionJsonParser.parseLevelJson("levelOne"); }
static public WordBankManager GetInstance() { if (m_instance == null) { m_instance = Object.FindObjectOfType(typeof(WordBankManager)) as WordBankManager; if (m_instance == null) { GameObject temp = new GameObject("WordBankManager"); DontDestroyOnLoad(temp); m_instance = temp.AddComponent <WordBankManager>(); } return(m_instance); } return(m_instance); }