void CheckForNewHighscore() { if (currentTime > PlayerPrefsConstants.GetHighscoreTime()) { PlayerPrefsConstants.SetHighscoreTime(currentTime); } }
void OnSubmitHighscore() { string name = nameInput.text.Trim(); if (name.Length < 3) { return; } int score = scoreManager.GetHighscoreTimeInSeconds(); PlayerPrefsConstants.SetHighscorePlayerName(name); StartCoroutine(TryPostHighscore(name, score)); }
void SaveSettings() { float sfxVal = sfxSlider.value / 100; float musicVal = musicSlider.value / 100; float announcerVal = announcerSlider.value / 100; PlayerPrefsConstants.SetSFXVolume(sfxVal); PlayerPrefsConstants.SetMusicVolume(musicVal); PlayerPrefsConstants.SetAnnouncerVolume(announcerVal); if (FindObjectOfType <SoundSource>()) { SoundSource[] allSoundSources = FindObjectsOfType <SoundSource>(); foreach (SoundSource s in allSoundSources) { s.SetupSound(); } } }
public void SetupSound() { float currentVol = originVol; if (soundType == SoundType.SFX) { float pref = PlayerPrefsConstants.GetSFXVolume(); audioSource.volume = currentVol / 100 * (pref * 100); } else if (soundType == SoundType.Music) { float pref = PlayerPrefsConstants.GetMusicVolume(); audioSource.volume = currentVol / 100 * (pref * 100); } else if (soundType == SoundType.Announcer) { float pref = PlayerPrefsConstants.GetAnnouncerVolume(); audioSource.volume = currentVol / 100 * (pref * 100); } }
public void ShowGameOverPanel() { musicAudioSource.clip = gameOverTheme; musicAudioSource.Play(); scoreManager.GameOver(); if (scoreManager.GetScoreString() == scoreManager.GetHighscoreString()) { gameOverTimeText.SetText(string.Format(LocalizationManager.instance.GetLocalizedValue("gameover_new_highscore"), scoreManager.GetHighscoreString())); gameOverHighscoreText.gameObject.SetActive(false); nameInputPanel.gameObject.SetActive(true); nameInput.onValueChanged.AddListener(OnHighscoreNameInputChange); if (PlayerPrefsConstants.GetHighscorePlayerName() != string.Empty && PlayerPrefsConstants.GetHighscorePlayerName().Length >= 3) { nameInput.text = PlayerPrefsConstants.GetHighscorePlayerName(); submitHighscoreButton.interactable = true; } submitHighscoreButton.onClick.AddListener(OnSubmitHighscore); } else { nameInputPanel.gameObject.SetActive(false); gameOverHighscoreText.gameObject.SetActive(true); gameOverTimeText.SetText(string.Format( LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("gameover_score") : "Du hast {0} durchgehalten!", scoreManager.GetScoreString() )); gameOverHighscoreText.SetText(string.Format( LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("gameover_highscore_score") : "Dein Highscore: {0}", scoreManager.GetHighscoreString() )); } gameOverPanelAnimator.SetBool("isActive", true); }
void SetupSettings() { sfxSlider.value = PlayerPrefsConstants.GetSFXVolume() * 100; musicSlider.value = PlayerPrefsConstants.GetMusicVolume() * 100; announcerSlider.value = PlayerPrefsConstants.GetAnnouncerVolume() * 100; }
public int GetHighscoreTimeInSeconds() { return(Mathf.RoundToInt(PlayerPrefsConstants.GetHighscoreTime())); }
public string GetHighscoreString() { return(PlayerPrefsConstants.GetHighscoreTimeString()); }