public void letterAppearance(settingsMouse thisLetter) { for (int i = 0; i <= 25; i++) { int letterId = PlayerPrefs.GetInt("letter" + i); //print ("Curr Letters" + letterId.ToString ()); if (letterId == thisLetter.getId()) { //GetComponent<SpriteRenderer>().sprite = letters[thisLetter.getId ()]; //sprite.color = Color.grey; thisLetter.transform.localScale = new Vector3(1.1f, 1.1f, 1.1f); } } }
public void lettersChosen(settingsMouse letter) { if (!userChoices.Contains(letter.getId())) { userChoices.Add(letter.getId()); isEmpty = false; alreadyChosen = false; } else if (userChoices.Contains(letter.getId())) { alreadyChosen = true; PlayerPrefs.DeleteKey("letter" + letter.getId()); userChoices.Remove(letter.getId()); PlayerPrefs.Save(); } else if (userChoices.Count == 0) { isEmpty = true; // this variable will be passed into the playbutton screen, if it is set to true, do not allow the user to continue to the game screen } }
/* public void letterAppearance(List<settingsMouse> avail) { for (int i = 0; i < avail.Count; i++) { Debug.Log("Avail: " + avail[i].getId() + "Here is my pref " + PlayerPrefs.GetInt("initial_letter" + i)); if (PlayerPrefs.GetInt(playerPrefName + i) != -1) { avail[PlayerPrefs.GetInt(playerPrefName + i)].GetComponent<SpriteRenderer>().color = Color.grey; avail[PlayerPrefs.GetInt(playerPrefName + i)].transform.localScale = new Vector3(1.1f, 1.1f, 1.1f); } } //Debug.Log("These are my player prefs so far" + PlayerPrefs.GetInt("initial_letter" + i)); }*/ public void createLetters() { Vector3 startPos = originalCard.transform.position; // position of the first card, all cards will be offset from here int index = 0; for (int i = 0; i < letters.Length; i++) { if (i == 0) { letter = originalCard; } else { letter = Instantiate(originalCard) as settingsMouse; } //setLetter from the settingsMouse class, using the sprites provides and creating an id based on the i-iteration letter.setLetter(letters[index], i); allChoices.Add(letter); // add all of the letters into a list //print("My Curr Choices: " + theseLetters[i]); float posX = startPos.x + (i % gridCols) * offsetX; float posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card // Center the remaining 4 letters positioning if (letters.Length - i < 5) { posX = startPos.x + (i % gridCols) * offsetX + 4; posY = startPos.y + (int)Mathf.Floor((float)i / gridCols) * -offsetY; } letter.transform.position = new Vector3(posX, posY, startPos.z); // create a new position based on this offset for the newly instatiated card index++; } Debug.Log("I am at the end of the loop about to call method"); letterAppearanceMemory(allChoices); // call the letterAppearance helper method to change how the letter is displayed if a user has already chosen it }
public void lettersChosen(settingsMouse letter) { if (!userChoicesMem.Contains(letter.getId())) { userChoicesMem.Add(letter.getId()); isEmpty = false; alreadyChosen = false; } else if (userChoicesMem.Contains(letter.getId())) { alreadyChosen = true; PlayerPrefs.DeleteKey ("letter" + letter.getId ()); userChoicesMem.Remove(letter.getId()); PlayerPrefs.Save (); } else if (userChoicesMem.Count == 0) { isEmpty = true; // this variable will be passed into the playbutton screen, if it is set to true, do not allow the user to continue to the game screen } }