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 IEnumerator OnArenaIntro(TankGame game) { pauseBlocked = true; otherThanBossContainer.SetActive(value: false); arenaContainer.GetComponent <CanvasGroup>().alpha = 0f; float cameraSize = game.ingameCameras[0].orthographicSize; float time = 0.5f; float vel = 0f; float vel2 = 0f; float cameraXVelocity = 0f; float cameraYVelocity = 0f; game.cameraFollowTransform = game.arenaEnemies[0].transform; yield return(null); Vector3 position = game.arenaEnemies[0].transform.position - Vector3.right * 7f; position.z = game.cameraContainer.position.z; game.cameraContainer.transform.position = position; game.backgroundCamera.orthographicSize = cameraSize * 0.9f; game.ingameCameras[0].orthographicSize = cameraSize * 0.9f; yield return(null); yield return(null); yield return(null); string[] allyNames = new string[(PlayerDataManager.SelectedGameMode == GameMode.Arena) ? 1 : 2]; string[] array = new string[(PlayerDataManager.SelectedGameMode == GameMode.Arena) ? 1 : 2]; allyNames[0] = TankPrefs.GetString("challengeName", Social.localUser.userName); if (PlayerDataManager.SelectedGameMode == GameMode.Arena) { array[0] = PlayerDataManager.ArenaMatchData.arenaPayload.name; } else { int num = 1; int num2 = 0; for (int i = 0; i != PlayerDataManager.ArenaMultiMatchData.arenaPayload.Length; i++) { if (i > 0) { array[num2++] = PlayerDataManager.ArenaMultiMatchData.arenaPayload[i].name; } else { allyNames[num++] = PlayerDataManager.ArenaMultiMatchData.arenaPayload[i].name; } } } yield return(AnimateTextRoutine(array, arenaOpponentNames)); if (PlayerDataManager.SelectedGameMode == GameMode.Arena) { arenaPlayerHUDs[0].ratingText.text = PlayerDataManager.GetRating().ToString(); arenaPlayerHUDs[1].ratingText.text = ((PlayerDataManager.ArenaMatchData.arenaPayload.actualRating == 0) ? PlayerDataManager.ArenaMatchData.arenaPayload.rating.ToString() : PlayerDataManager.ArenaMatchData.arenaPayload.actualRating.ToString()); } game.cameraFollowTransform = game.playerTankContainer.transform; for (float t2 = 0f; t2 < time; t2 += Time.unscaledDeltaTime) { game.backgroundCamera.orthographicSize = Mathf.SmoothDamp(game.backgroundCamera.orthographicSize, cameraSize * 1f, ref vel, time, float.PositiveInfinity, Time.unscaledDeltaTime); game.ingameCameras[0].orthographicSize = Mathf.SmoothDamp(game.ingameCameras[0].orthographicSize, cameraSize * 1f, ref vel2, time, float.PositiveInfinity, Time.unscaledDeltaTime); game.cameraContainer.position = new Vector3(Mathf.SmoothDamp(game.cameraContainer.position.x, game.cameraFollowTransform.position.x, ref cameraXVelocity, time, float.PositiveInfinity, Time.unscaledDeltaTime), Mathf.SmoothDamp(game.cameraContainer.position.y, game.cameraFollowTransform.position.y + 2f, ref cameraYVelocity, time, float.PositiveInfinity, Time.unscaledDeltaTime), game.cameraContainer.position.z); yield return(null); } Coroutine allyNameRoutine = StartCoroutine(AnimateTextRoutine(allyNames, arenaAllyNames)); for (float t2 = 0f; t2 < time + 0.5f; t2 += Time.unscaledDeltaTime) { game.backgroundCamera.orthographicSize = Mathf.SmoothDamp(game.backgroundCamera.orthographicSize, cameraSize, ref vel, time, float.PositiveInfinity, Time.unscaledDeltaTime); game.ingameCameras[0].orthographicSize = Mathf.SmoothDamp(game.ingameCameras[0].orthographicSize, cameraSize, ref vel2, time, float.PositiveInfinity, Time.unscaledDeltaTime); game.cameraContainer.position = new Vector3(Mathf.SmoothDamp(game.cameraContainer.position.x, game.cameraFollowTransform.position.x + 3f, ref cameraXVelocity, time, float.PositiveInfinity, Time.unscaledDeltaTime), Mathf.SmoothDamp(game.cameraContainer.position.y, game.cameraFollowTransform.position.y + 2f, ref cameraYVelocity, time, float.PositiveInfinity, Time.unscaledDeltaTime), game.cameraContainer.position.z); yield return(null); } yield return(new WaitForSecondsRealtime(0.6f)); yield return(allyNameRoutine); otherThanBossContainer.SetActive(value: true); arenaContainer.GetComponent <CanvasGroup>().alpha = 1f; }