private void SetSelectedBooster(string id) { selectedBoosterId = id; if (PlayerDataManager.SetSelectedBooster(Variables.instance.GetTank(PlayerDataManager.GetSelectedTank()), id)) { boosterBackButtonIcon.sprite = checkmarkIcon; boosterBackButtonIcon.SetNativeSize(); } Booster booster = PlayerDataManager.GetBooster(id); boosterPopupBoosterName.text = $"{ScriptLocalization.Get(booster.tankName)} {ScriptLocalization.Get(booster.type.ToString())}"; boosterUpgradeCoinsText.text = Variables.instance.GetBoosterLevelUpPriceForNextLevel(booster.Level).ToString(); boosterPopupBoosterIcon.sprite = booster.bigCard; for (int i = 0; i < boosterItems.Length; i++) { bool flag = boosterItems[i].id.Equals(id); boosterItems[i].selected.enabled = flag; if (flag) { SetBoosterUIData(boosterItems[i], booster); PlayerDataManager.SetBoosterSeen(booster.id, val: true); } } MenuController.GetMenu <GarageMenu>().SetTankBooster(); TankPrefs.Save(); PlayerDataManager.SaveToCloudOnNextInterval = true; }
private void OnEnable() { if (PlayerDataManager.IsSubscribed()) { offerContent.SetActive(value: false); subscribedContent.SetActive(value: true); } TankPrefs.SetInt("subOfferSeen", 1); TankPrefs.Save(); }
private void BuyBoosterCoins() { if (PlayerDataManager.BuyBooster(selectedBoosterId)) { AudioMap.PlayClipAt("upgradeBooster", Vector3.zero, AudioMap.instance.uiMixerGroup); AudioMap.PlayClipAt("purchase", Vector3.zero, AudioMap.instance.uiMixerGroup); currentBoosters = PlayerDataManager.GetTankBoosters(Variables.instance.GetTank(PlayerDataManager.GetSelectedTank())); SetSelectedBooster(selectedBoosterId); TankPrefs.Save(); TankPrefs.CloudSyncComplete = true; PlayerDataManager.SaveToCloudOnNextInterval = true; } else { MenuController.ShowMenu <OutOfCurrencyPopup>().SetCurrency(CurrencyType.Coins); } }
private void Start() { TankPrefs.SetInt("facebookAsked", 1); TankPrefs.Save(); button.SetToggled(BackendManager.ConnectedWithFacebook); button.SetOnClick(ButtonState.Default, delegate { button.SetDisabled(); BackendManager.ConnectWithFacebook(delegate { button.SetToggled(toggled: true); }, delegate { button.SetToggled(toggled: false); }); }); proceedButton.onClick.AddListener(delegate { MenuController.HideMenu <FacebookPopup>(); }); }
private void OnEnable() { string @string = TankPrefs.GetString("challengeName", Social.localUser.userName); if (@string != "") { nameChangePlaceholder.text = @string; nameChangeField.text = @string; } nameChangeOkButton.onClick.RemoveAllListeners(); nameChangeOkButton.onClick.AddListener(delegate { string text = Utilities.SanitizeInput(nameChangeField.text); if (text != "" && text.Length >= nameChangeLengthMin && text.Length <= nameChangeLengthMax) { TankPrefs.SetString("challengeName", text); } MenuController.HideMenu <NameChangePopup>(); TankPrefs.Save(); PlayerDataManager.SaveToCloudOnNextInterval = true; }); }
private void Start() { gameOverBackToMainButton.onClick.AddListener(delegate { if (scoreRollRoutine != null) { StopCoroutine(MenuBase <GameEndMenu> .instance.scoreRollRoutine); FinishScoreRoll(); scoreRollRoutine = null; } else { if (highscoreRoutine != null) { StopCoroutine(MenuBase <GameEndMenu> .instance.highscoreRoutine); scoreRollRoutine = null; } bool num = gameOverAdventureContainer.activeInHierarchy && ranks.DidLevelUp; bool flag = (gameOverArenaContainer.activeInHierarchy || gameOverArena2v2Container.activeInHierarchy) && didArenaLevelUp; if (num | flag) { InitPromotion(); } else { PlayerDataManager.GamesThisSession++; PlayerDataManager.SelectedGameMode = GameMode.Adventure; TankPrefs.Save(); LoadingScreen.ReloadGame(delegate { TankPrefs.CheckAndCreateLongtermBackup(); MenuController.HideMenu <GameEndMenu>(); //AdsManager.ShowInterstitial(); }); } } }); //shareButton.onClick.AddListener(Share); }
private void OnDisable() { AnimatedCurrencyController.AnimateCoins(Variables.instance.easterEggCoins, MenuController.UICamera.WorldToViewportPoint(base.transform.position), MenuController.TotalCoinsPositionViewport, 5); PlayerDataManager.CollectEasterEgg(); TankPrefs.Save(); }
private IEnumerator StartRoutine() { float startTime = Time.time; GameMode selectedGameMode = PlayerDataManager.SelectedGameMode; IsLoading = true; instance.loadingText.gameObject.SetActive(selectedGameMode == GameMode.Adventure); instance.waitingForOpponentText.gameObject.SetActive(selectedGameMode == GameMode.Arena); instance.waitingForPlayersText.gameObject.SetActive(selectedGameMode == GameMode.Arena2v2); for (int i = 0; i < logos.Length; i++) { logos[i].enabled = (selectedGameMode == GameMode.Adventure); } for (int j = 0; j < gameLogoParts.Length; j++) { gameLogoParts[j].SetNativeSize(); } cancelWaitingForOpponentButton.gameObject.SetActive(PlayerDataManager.IsSelectedGameModePvP); if (PlayerDataManager.IsSelectedGameModePvP) { cancelWaitingForOpponentButton.onClick.RemoveAllListeners(); cancelWaitingForOpponentButton.onClick.AddListener(delegate { StopCoroutine(loadingRoutine); IsLoading = false; TankGame.Running = false; PlayerDataManager.SelectedGameMode = GameMode.Adventure; ReloadGame(delegate { PlayerDataManager.SelectedGameMode = selectedGameMode; MenuController.HideMenu <GarageMenu>(); MenuController.ShowMenu <MainMenu>(); }); }); } canvasGroup.gameObject.SetActive(value: true); canvasGroup.alpha = 1f; while (!PlayerDataManager.IsInitialized) { yield return(null); } yield return(null); StartCoroutine(AddProgress(0.1f)); if (TankPrefs.IsInitialized) { TankPrefs.Save(); } while (selectedGameMode == GameMode.Arena && PlayerDataManager.ArenaMatchData == null) { if (!BackendManager.IsRequestingChallenge) { BackendManager.GetChallenge(PlayerDataManager.GetRating()); } yield return(null); } while (selectedGameMode == GameMode.Arena2v2 && PlayerDataManager.ArenaMultiMatchData == null) { if (!BackendManager.IsRequestingChallenge) { BackendManager.GetChallenges(PlayerDataManager.GetRating(selectedGameMode), PlayerDataManager.ArenaMultiplayerAICount); } yield return(null); } StartCoroutine(AddProgress(0.1f)); cancelWaitingForOpponentButton.onClick.RemoveAllListeners(); cancelWaitingForOpponentButton.gameObject.SetActive(value: false); if (SceneManager.GetSceneByName("Game").isLoaded) { AsyncOperation unload2 = SceneManager.UnloadSceneAsync("Game"); while (!unload2.isDone) { yield return(null); } } StartCoroutine(AddProgress(0.1f)); if (TankGame.Running) { AsyncOperation unload2 = SceneManager.LoadSceneAsync("Game", LoadSceneMode.Additive); while (!unload2.isDone) { yield return(null); } StartCoroutine(AddProgress(0.2f)); } Action newReloadAction = null; if (OnFinish != null) { OnFinish(); } else if (PlayerDataManager.AppJustStarted && !PlayerDataManager.BeenInAppBefore) { PlayerDataManager.AppJustStarted = false; PlayerDataManager.SelectedGameMode = GameMode.Adventure; TankGame.Running = true; newReloadAction = delegate { MenuController.HideMenu <MainMenu>(); //MenuController.ShowMenu<PrivacyPolicyPopup>(); }; } if (Time.time - startTime < 1f) { yield return(new WaitForSecondsRealtime(1f - (Time.time - startTime))); } Time.timeScale = 1f; StartCoroutine(AddProgress(1f)); while (loadingProgressImage.fillAmount < 0.99f) { yield return(null); } IsLoading = false; if (newReloadAction != null) { ReloadGame(delegate { newReloadAction(); }); } else { StartCoroutine(FadeOut()); } }