void SetDifficulty(Difficulties.Difficulty diff) { if (!newGameMenu.GetComponent <MenuTransitionOn>() && !newGameMenu.GetComponent <MenuTransitionOff>()) { StartCoroutine(Load(diff)); } }
IEnumerator Load(Difficulties.Difficulty diff) { loadingBackground.SetActive(true); if (Application.platform == RuntimePlatform.IPhonePlayer) { Handheld.StartActivityIndicator(); } else { loadingText.SetActive(true); } yield return(new WaitForSeconds(0)); PlayerPrefs.SetInt(PlayerPrefsManager.boardCompleted, 0); PlayerPrefs.SetInt(PlayerPrefsManager.currentHintCount, 0); PlayerPrefs.SetInt(PlayerPrefsManager.hintCount, 1); GetComponent <Appearance>().DestroyAllCircles(); GetComponent <Appearance>().hint.gameObject.GetComponent <UnityAds>().SetHint(1); CheckIfRestartCurrentWinStreak(); GetComponent <BoardCreator>().ClearBoard(); GetComponent <BoardCreator>().NewBoard(diff.boardCount, diff.percentageEmpty, diff.name, diff.width, diff.height, diff.diagonals); GetComponent <NumberScroller>().ClearNumberScroller(); GetComponent <NumberScroller>().SetUpNumberScroller(); GetComponent <NumberScroller>().GoToFirstButton(); GetComponent <Appearance>().RestartButtonSave(); NewGameMenuClose(); if (diff.diagonals) { if (PlayerPrefs.GetInt(PlayerPrefsManager.plusFirstStartUp) == 0) { PlusFirstPlayPopUpOpen(); } } winMenu.SetActive(false); Handheld.StopActivityIndicator(); loadingText.SetActive(false); }