// Use this for initialization void Start() { dontdestroy = GameObject.Find("DONTDESTROY").GetComponent <dontDestroyScript>(); Screen.orientation = ScreenOrientation.Portrait; correctText.text = "Correct Words: " + dontdestroy.correctCount; skipText.text = "Skip Words: " + dontdestroy.skipCount; }
// Use this for initialization void Start() { dontdestroyInstance = GameObject.Find("DONTDESTROY").GetComponent <dontDestroyScript>(); //LOAD DECKS if (!PlayerPrefs.HasKey("customDeckCount")) { PlayerPrefs.SetInt("customDeckCount", 0); } print(PlayerPrefs.GetInt("customDeckCount")); //load titles for custom decks for (int i = 0; i < PlayerPrefs.GetInt("customDeckCount"); i++) { if (PlayerPrefs.HasKey("CUSTOM " + i)) { string[] s = new string[2]; s = PlayerPrefs.GetString("CUSTOM " + i).Split(new string[] { "[title]" }, System.StringSplitOptions.None); dontdestroyInstance.deckTitles.Add(s[0]); } else { print("CUSTOM DECK MISSING"); } } //SPAWN SELECTION BUTTONS FOR STANDARD DECKS for (int i = 0; i < STANDARD_DECK_COUNT; i++) { GameObject instance = Instantiate(deckPrefab, GameObject.Find("GridWithOurElements").transform); Text deckText = instance.GetComponentInChildren <Text>(); deckText.text = dontdestroyInstance.deckTitles[i]; Image image = instance.GetComponentInChildren <Image>(); image.color = Color.white; instance.GetComponent <deckButtonScript>().thisDeckID = "STANDARD " + i; } // SPAWN SELECTION DECKS FOR CUSTOM DECKS for (int i = STANDARD_DECK_COUNT; i < PlayerPrefs.GetInt("customDeckCount") + STANDARD_DECK_COUNT; i++) { GameObject instance = Instantiate(deckPrefab, GameObject.Find("GridWithOurElements").transform); Text deckText = instance.GetComponentInChildren <Text>(); deckText.text = dontdestroyInstance.deckTitles[i]; Image image = instance.GetComponentInChildren <Image>(); image.color = Color.gray; instance.GetComponent <deckButtonScript>().thisDeckID = "CUSTOM " + (i - STANDARD_DECK_COUNT); } }
void Start() { wordDisplayText.gameObject.SetActive(false); lockInput = true; dontdestroy = GameObject.Find("DONTDESTROY").GetComponent <dontDestroyScript>(); Screen.orientation = ScreenOrientation.LandscapeLeft; timeLeft = timeLimit + beginningBufferTime; if (dontdestroy.isStandard) { words = dontdestroy.deckContents[dontdestroy.deckIDNumber].Split(new string[] { "[word]" }, System.StringSplitOptions.None).ToList(); } else { string[] s = PlayerPrefs.GetString("CUSTOM " + dontdestroy.deckIDNumber).Split(new string[] { "[title]" }, System.StringSplitOptions.None); words = s[1].Split(new string[] { "[word]" }, System.StringSplitOptions.None).ToList(); } for (int i = 0; i < words.Count; i++) { print(words[i]); } //SHUFFLE DECK for (int i = 0; i < words.Count; i++) { string temp = words[i]; int randomIndex = Random.Range(i, words.Count); words[i] = words[randomIndex]; words[randomIndex] = temp; } print("AFTER"); for (int i = 0; i < words.Count; i++) { print(words[i]); } currentWord = words[currentWordIndex]; wordDisplayText.text = currentWord; }