public override void LoadUI(Dictionary <string, string> propertyList = null) { base.LoadUI(propertyList); mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); m_gameLogic = active.GameLogic; Button[] componentsInChildren = base.gameObject.GetComponentsInChildren <Button>(); Button[] array = componentsInChildren; foreach (Button button in array) { if (button.gameObject.name == "mg_jr_TapToPlayArea") { m_tapToPlayButton = button; } else if (button.gameObject.name == "mg_jr_GoalsButton") { m_goalButton = button; } } m_SpeechContainer = base.transform.Find("mg_jr_pf_StartScreen/mg_jr_SpeechBubble").gameObject; Assert.NotNull(m_SpeechContainer, "speech container not found"); m_garySpeechText = m_SpeechContainer.GetComponentsInChildren <Text>(includeInactive: true)[0]; Assert.NotNull(m_garySpeechText, "Speech label not found"); m_gary = m_gameLogic.IntroGary; m_tapToPlayButton.onClick.AddListener(OnTapToPlayClicked); m_goalButton.onClick.AddListener(OnGoalClicked); if (m_gary != null) { m_gary.OnDialogChanged += OnGaryDialogChange; } }
private IEnumerator Start() { mg_JetpackReboot minigame = MinigameManager.GetActive <mg_JetpackReboot>(); m_goalManager = minigame.GoalManager; m_goalBars.AddRange(from x in GetComponentsInChildren <mg_jr_UIGoalBar>() orderby x.transform.position.y select x); IList <mg_jr_Goal> goals = m_goalManager.ActiveGoals; Assert.AreEqual(m_goalBars.Count, goals.Count, "Active goal count does not equal available goal bars"); m_flyByPenguins.AddRange(from x in GetComponentsInChildren <mg_jr_FlyByPenguin>(includeInactive: true) orderby x.transform.position.y select x); Assert.AreEqual(m_flyByPenguins.Count, m_goalBars.Count, "Active flyby penguin count does not equal available goal bars"); foreach (mg_jr_FlyByPenguin flyByPenguin in m_flyByPenguins) { flyByPenguin.FlyByCompleted += ReplaceCompletedGoal; } for (int i = 0; i < goals.Count; i++) { Assert.NotNull(goals[i], "Null goal in goal list"); m_goalBars[i].GoalToDisplay = goals[i]; if (goals[i].IsCurrentLevelComplete) { minigame.GameLogic.Player.AwardBonusCoins(goals[i].RewardForCurrentLevel); m_completedGoalIndexes.AddLast(i); } } minigame.MusicManager.SelectTrack(mg_jr_Sound.MENU_MUSIC_AMBIENT.ClipName()); m_goalManager.ReplaceCompletedGoals(); yield return(new WaitForSeconds(1f)); ReplaceCompletedGoal(); }
public override void LoadUI(Dictionary <string, string> propertyList = null) { mg_jr_CountDisplay[] componentsInChildren = GetComponentsInChildren <mg_jr_CountDisplay>(); mg_jr_CountDisplay[] array = componentsInChildren; foreach (mg_jr_CountDisplay mg_jr_CountDisplay in array) { if (mg_jr_CountDisplay.gameObject.name == "mg_jr_Coins") { m_coinCountDisplay = mg_jr_CountDisplay; } else if (mg_jr_CountDisplay.gameObject.name == "mg_jr_Distance") { m_distanceCountDisplay = mg_jr_CountDisplay; } } m_turboBar = GetComponentInChildren <mg_jr_TurboBar>(); Assert.NotNull(m_turboBar, "Turbobar not found"); m_coinCollectAnimator = GetComponentInChildren <Animator>(); Assert.IsTrue(m_coinCollectAnimator.gameObject.name.Equals("mg_jr_CoinIcon"), "More animators added? additional logic required?"); m_notification = GetComponentInChildren <mg_jr_UINotification>(); mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); active.GameLogic.Player.CoinCountChanged += m_coinCountDisplay.OnCountChange; active.GameLogic.Odometer.DistanceChanged += m_distanceCountDisplay.OnCountChange; m_coinCountDisplay.CurrentCount = active.GameLogic.Player.CoinsCollected; m_distanceCountDisplay.CurrentCount = (int)active.GameLogic.Odometer.DistanceTravelledThisRun; active.GoalManager.OnGoalCompleted += OnGoalCompleted; active.GameLogic.Player.CoinCountChanged += OnCoinCollected; m_turboBar.LoadUIElement(); m_turboBar.SetDisplayedDevice(active.GameLogic.Player.TurboDevice); base.LoadUI(propertyList); }
private void Start() { mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); m_gameLogic = active.GameLogic; Button[] componentsInChildren = base.gameObject.GetComponentsInChildren <Button>(); Button[] array = componentsInChildren; foreach (Button button in array) { if (button.gameObject.name == "mg_jr_RetryButton") { m_retryButton = button; } else if (button.gameObject.name == "mg_jr_QuitButton") { m_quitButton = button; } else if (button.gameObject.name == "mg_jr_ResumeButton") { m_resumeButton = button; } } Toggle[] componentsInChildren2 = base.gameObject.GetComponentsInChildren <Toggle>(); Toggle[] array2 = componentsInChildren2; foreach (Toggle toggle in array2) { if (toggle.gameObject.name == "mg_jr_SfxButton") { m_sfxButton = toggle; m_sfxButton.isOn = m_gameLogic.MiniGame.AreSFXEnabled; } else if (toggle.gameObject.name == "mg_jr_MusicButton") { m_musicButton = toggle; m_musicButton.isOn = m_gameLogic.MiniGame.MusicManager.IsMusicEnabled; } } m_goalBars.AddRange(from x in base.gameObject.GetComponentsInChildren <mg_jr_UIGoalBar>() orderby x.transform.position.y select x); IList <mg_jr_Goal> activeGoals = active.GoalManager.ActiveGoals; Assert.AreEqual(m_goalBars.Count, activeGoals.Count, "Active goal count does not equal available goal bars"); for (int j = 0; j < activeGoals.Count; j++) { Assert.NotNull(activeGoals[j], "Null goal in goal list"); m_goalBars[j].GoalToDisplay = activeGoals[j]; } m_retryButton.onClick.AddListener(OnRetryClicked); m_quitButton.onClick.AddListener(OnQuitClicked); m_resumeButton.onClick.AddListener(OnResumeClicked); m_musicButton.onValueChanged.AddListener(OnMusicClicked); m_sfxButton.onValueChanged.AddListener(OnSfxClicked); active.MusicManager.IsPaused = true; }
private void OnRetryClicked() { UIManager.Instance.PopScreen(); mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); active.PlaySFX(mg_jr_Sound.UI_SELECT.ClipName()); active.SaveState(); bool startWithBonusRobot = (float)m_gameLogic.Player.CoinsCollected >= m_gameLogic.GameBalance.CoinsForBonusRobot; active.GameLogic.LoadInitialState(); active.GameLogic.StartGame(startWithBonusRobot); }
public override void UnloadUI() { base.UnloadUI(); m_turboBar.UnloadUIElement(); m_turboBar.SetDisplayedDevice(null); mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); active.GameLogic.Player.CoinCountChanged -= m_coinCountDisplay.OnCountChange; active.GameLogic.Odometer.DistanceChanged -= m_distanceCountDisplay.OnCountChange; active.GameLogic.Player.CoinCountChanged -= OnCoinCollected; active.GoalManager.OnGoalCompleted -= OnGoalCompleted; }
private void Start() { mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); m_gameLogic = active.GameLogic; Button[] componentsInChildren = base.gameObject.GetComponentsInChildren <Button>(); Button[] array = componentsInChildren; foreach (Button button in array) { if (button.gameObject.name == "mg_jr_RetryButton") { m_retryButton = button; } else if (button.gameObject.name == "mg_jr_QuitButton") { m_quitButton = button; } } m_retryButton.onClick.AddListener(OnRetryClicked); m_quitButton.onClick.AddListener(OnQuitClicked); ClassicMiniGames.PushBackButtonHandler(OnQuitClicked); Text[] componentsInChildren2 = base.gameObject.GetComponentsInChildren <Text>(includeInactive: true); Text[] array2 = componentsInChildren2; foreach (Text text in array2) { if (text.gameObject.name == "mg_jr_TotalCoinCount") { m_coinsCollectedSession = text; m_coinsCollectedSession.text = string.Concat(m_gameLogic.Player.CoinsCollectedSession - m_gameLogic.Player.CoinsCollected); } else if (text.gameObject.name == "mg_jr_RunCoinCount") { text.text = string.Concat(m_gameLogic.Player.CoinsCollected); } else if (text.gameObject.name == "mg_jr_RunCoinsLabel") { m_runCoinbarLabel = text; if (localizer != null) { m_runCoinbarLabel.text = localizer.GetTokenTranslation("Activity.MiniGames.CollectedCoins"); } else { m_runCoinbarLabel.text = "Collected Coins"; } } } Transform[] componentsInChildren3 = base.gameObject.GetComponentsInChildren <Transform>(includeInactive: true); Transform[] array3 = componentsInChildren3; foreach (Transform transform in array3) { if (transform.gameObject.name == "mg_jr_ResultDistanceContainer") { m_resultdistanceContainer = transform.gameObject; } else if (transform.gameObject.name == "mg_jr_DistanceSparkle") { m_DistanceSparkleContainer = transform.gameObject; } else if (transform.gameObject.name == "mg_jr_RunCoinBar") { m_runCoinBar = transform.gameObject; m_runCoinBarAnimator = m_runCoinBar.GetComponent <Animator>(); } else if (transform.gameObject.name == "mg_jr_CoinTransfer") { m_coinTransfer = transform.GetComponent <Animator>(); } else if (transform.gameObject.name == "mg_jr_BigBonusRobot") { m_bonusRobotBig = transform.gameObject; } else if (transform.gameObject.name == "mg_jr_LittleBonusRobot") { m_bonusRobotSmall = transform.gameObject; } } mg_jr_ResultCounter[] componentsInChildren4 = GetComponentsInChildren <mg_jr_ResultCounter>(includeInactive: true); mg_jr_ResultCounter[] array4 = componentsInChildren4; foreach (mg_jr_ResultCounter mg_jr_ResultCounter in array4) { if (mg_jr_ResultCounter.gameObject.name == "mg_jr_ResultDistance") { m_distanceCounter = mg_jr_ResultCounter; Assert.NotNull(m_distanceCounter, "distance conuter needed"); m_distanceCounter.SfxLoopName = mg_jr_Sound.UI_POINTS_COUNTER_LOOP.ClipName(); m_distanceCounter.PostFix = "m"; } else if (mg_jr_ResultCounter.gameObject.name == "mg_jr_TotalCoinCount") { m_coinCounter = mg_jr_ResultCounter; Assert.NotNull(m_coinCounter, "coin conuter needed"); m_coinCounter.SfxLoopName = mg_jr_Sound.COIN_COLLECT_LOOP.ClipName(); } } m_flybyPenguin = GetComponentsInChildren <mg_jr_FlyByPenguin>(includeInactive: true)[0]; Assert.NotNull(m_flybyPenguin, "fly by penguin needed"); m_flybyPenguin.PassingMiddleOfScreen += OnFlyByPenguinPassingMiddle; m_gary = GetComponentInChildren <mg_jr_ResultGary>(); Assert.NotNull(m_gary, "Gary is needed"); active.MusicManager.SelectTrack(mg_jr_Sound.MENU_MUSIC_AMBIENT.ClipName()); m_currentState = ResultScreenState.PENGUIN_FLYBY_START; }
public override void DestroyThisGameObject() { mg_JetpackReboot active = MinigameManager.GetActive <mg_JetpackReboot>(); active.Resources.ReturnPooledResource(base.gameObject); }