override public void Init() { LanguageManager.Instance.RegisterLanguage("Dutch", new LanguageDutch()); LanguageManager.Instance.RegisterLanguage("English", new LanguageEnglish()); LanguageManager.Instance.RegisterLanguage("Spanish", new LanguageSpanish()); LanguageManager.Instance.RegisterLanguage("Chinese", new LanguageChinese()); LanguageManager.Instance.DetermineAndSetInitialLanguage(); if (PlayerPrefs.HasKey("PreferedLanguage")) { LanguageManager.Instance.SetCurrentLanguage(PlayerPrefs.GetString("PreferedLanguage"), true); } else { LanguageManager.Instance.SetCurrentLanguage(LanguageManager.Instance.currentLanguageName, true); PlayerPrefs.SetString("PreferedLanguage", LanguageManager.Instance.currentLanguageName); } _menu = canvas.Find("MenuView").GetComponent <Menu>(); _menu.Init(); _ballGame = canvas.Find("GameView").GetComponent <BallGame>(); _ballGame.Init(); _timerForTimeGameMode = _ballGame.transform.Find("GameTimer").GetComponent <TimerForTimeGameMode>(); }
public void Init() { _rect = transform.GetComponent <RectTransform>(); _textAnimations = transform.Find("FeedbackText").GetComponent <TextAnimations>(); _multiplierText = transform.Find("ScoreHolder/MultiplierText").GetComponent <Text>(); _ballsize = transform.GetComponent <RectTransform>().sizeDelta.x / _MAX_AMOUNT_OF_BALLS_HORIZONTAL; _ballSpawnLocation = 540 / _ASPECT_RATIO / 2; _retryButton = transform.Find("RetryButton").gameObject; _homeButton = transform.Find("HomeButton").gameObject; _showAchievementButton = transform.Find("ShowAchievementEnd").gameObject; _showLeaderboardButton = transform.Find("ShowLeaderBoardEnd").gameObject; _gameOverOverlay = transform.Find("GameOverOverlay").gameObject; _pauseMenu = transform.Find("PauseMenu").gameObject; _pauseButton = transform.Find("PauseButton").gameObject; _pausePlayButton = transform.Find("PauseMenu/UnpauseButton").gameObject; _pauseSoundButton = transform.Find("PauseMenu/SoundButton").gameObject; _pauseGyroscopeButton = transform.Find("PauseMenu/GyroscopeButton").gameObject; _pauseScreenshakeButton = transform.Find("PauseMenu/ScreenshakeButton").gameObject; _pauseHomeButton = transform.Find("PauseMenu/PauseHomeButton").gameObject; _counter = transform.GetComponent <Counter>(); _powerUpsManager = transform.GetComponent <PowerUps>(); _powerUpsManager.Init(); _supportsAccelerometer = SystemInfo.supportsAccelerometer; _supportsGyroscope = SystemInfo.supportsGyroscope; _gravityDirection = _START_GRAVITY_DIRECTION; _ballSpawnArea = transform.Find("BallsHolder/SpawnArea"); _ballsHolder = transform.Find("BallsHolder"); _buttonHolder = transform.Find("ButtonHolder"); _canvasGroup = transform.GetComponent <CanvasGroup>(); _feedbackText = transform.Find("FeedbackText").GetComponent <Text>(); _countDownText = transform.Find("CountdownText").GetComponent <Text>(); _playerScoreText = transform.Find("ScoreHolder/Score").GetComponent <Text>(); _phaseFeedbackText = transform.Find("PhaseFeedbackText").GetComponent <Text>(); _gameOverText = transform.Find("GameOverText").GetComponent <Text>(); _positiveFeedbackStrings = new List <string>(); _negativeFeedbackStrings = new List <string>(); RefreshLanguage(); PhasesManager.Instance.OnPhaseChange += _HandlePhaseChange; _phases = new List <bool>(); _phases = PhasesManager.Instance.phases; _textAnimations = transform.Find("FeedbackText").GetComponent <TextAnimations>(); _textAnimations.Init(); _buttonShake = _buttonHolder.GetComponent <ButtonShake>(); _buttonShake.Init(); _timerBar = transform.Find("TimerBar").GetComponent <TimerBar>(); _timerForTimeGameMode = transform.Find("GameTimer").GetComponent <TimerForTimeGameMode>(); _timerCountdown = transform.Find("GameTimer").gameObject; _buttonHolderCanvasGroup = transform.Find("ButtonHolder").GetComponent <CanvasGroup>(); _tutorialText = transform.Find("Tutorial").gameObject; _tutorialHint = transform.Find("TutorialHint").gameObject.GetComponent <FadeTutorialImage>(); _tutorialHint.Init(); clickableObjects = new List <Button> (); clickableObjects.Add(_pauseButton.GetComponent <Button>()); clickableObjects.Add(_timerBar.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(0).GetChild(0).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(0).GetChild(1).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(1).GetChild(0).gameObject.GetComponent <Button> ()); clickableObjects.Add(_buttonHolder.transform.GetChild(1).GetChild(1).gameObject.GetComponent <Button> ()); _highestCountofBalls = 0; _secondHighestCountOfBalls = 0; _popupMenu = transform.Find("PopupMenu").gameObject; AchievementsManager.Instance.SetPopupMenu(transform.Find("PopupMenu").gameObject); }