Пример #1
0
        public void CargarInicio()
        {
            if (PlayerPrefs.HasKey("idioma") == false)
            {
                if (Application.systemLanguage == SystemLanguage.Spanish)
                {
                    idioma.CargarIdioma(idioma.ficheroIdiomas, "Spanish");
                    PlayerPrefs.SetString("idioma", "Spanish");
                }
                else
                {
                    idioma.CargarIdioma(idioma.ficheroIdiomas, "English");
                    PlayerPrefs.SetString("idioma", "English");
                }
            }
            else
            {
                idioma.CargarIdioma(idioma.ficheroIdiomas, PlayerPrefs.GetString("idioma"));
            }

            //-----------------------------------------------------------

            if (PlayerPrefs.HasKey("volumenEfectos") == false)
            {
                PlayerPrefs.SetFloat("volumenEfectos", 0.7f);
            }

            sliderVolumenEfectos.value = PlayerPrefs.GetFloat("volumenEfectos");

            if (PlayerPrefs.HasKey("volumenMusica") == false)
            {
                PlayerPrefs.SetFloat("volumenMusica", 0);
            }

            sliderVolumenMusica.value = PlayerPrefs.GetFloat("volumenMusica");

            //-----------------------------------------------------------

            idioma.TraduccionesDpPantalla();

            if (PlayerPrefs.HasKey("pantalla") == false)
            {
                PlayerPrefs.SetInt("pantalla", 1);
            }

            dpPantalla.value = PlayerPrefs.GetInt("pantalla");

            //-----------------------------------------------------------

            Resolution[] resoluciones = Screen.resolutions;

            foreach (Resolution resolucion in resoluciones)
            {
                dpResoluciones.options.Add(new Dropdown.OptionData()
                {
                    text = string.Format("{0}x{1}", resolucion.width, resolucion.height)
                });
            }

            if (PlayerPrefs.HasKey("resolucion") == false)
            {
                PlayerPrefs.SetInt("resolucion", dpResoluciones.options.Count - 1);
            }

            dpResoluciones.value = PlayerPrefs.GetInt("resolucion");
        }
Пример #2
0
        public void CargarInicio()
        {
            if (PlayerPrefs.HasKey("idioma") == false)
            {
                idioma.CargarIdioma(idioma.ficheroIdiomas, "English");
                PlayerPrefs.SetString("idioma", "English");
            }
            else
            {
                idioma.CargarIdioma(idioma.ficheroIdiomas, PlayerPrefs.GetString("idioma"));
            }

            //-----------------------------------------------------------

            if (PlayerPrefs.HasKey("sonido") == false)
            {
                PlayerPrefs.SetString("sonido", "true");
                sonidoParar = false;
            }
            else
            {
                if (PlayerPrefs.GetString("sonido") == "true")
                {
                    sonidoParar = false;
                }
                else
                {
                    sonidoParar = true;
                }
            }

            //-----------------------------------------------------------

            if (PlayerPrefs.HasKey("volumen") == false)
            {
                PlayerPrefs.SetFloat("volumen", 0.7f);
            }

            sliderVolumen.value = PlayerPrefs.GetFloat("volumen");

            //-----------------------------------------------------------

            if (PlayerPrefs.HasKey("ayuda") == false)
            {
                PlayerPrefs.SetString("ayuda", "true");
                toggleAyuda.isOn = true;
            }
            else
            {
                if (PlayerPrefs.GetString("ayuda") == "true")
                {
                    toggleAyuda.isOn = true;
                }
                else
                {
                    toggleAyuda.isOn = false;
                }
            }

            //-----------------------------------------------------------

            if (PlayerPrefs.HasKey("modoFacil") == false)
            {
                PlayerPrefs.SetString("modoFacil", "false");
                toggleModoFacil.isOn = false;
            }
            else
            {
                if (PlayerPrefs.GetString("modoFacil") == "true")
                {
                    toggleModoFacil.isOn = true;
                }
                else
                {
                    toggleModoFacil.isOn = false;
                }
            }

            //-----------------------------------------------------------

            idioma.TraduccionesDpPantalla();

            if (PlayerPrefs.HasKey("pantalla") == false)
            {
                PlayerPrefs.SetInt("pantalla", 1);
            }

            dpPantalla.value = PlayerPrefs.GetInt("pantalla");

            //-----------------------------------------------------------

            Resolution[] resoluciones = Screen.resolutions;

            foreach (Resolution resolucion in resoluciones)
            {
                dpResoluciones.options.Add(new Dropdown.OptionData()
                {
                    text = string.Format("{0}x{1}", resolucion.width, resolucion.height)
                });
            }

            if (PlayerPrefs.HasKey("resolucion") == false)
            {
                PlayerPrefs.SetInt("resolucion", dpResoluciones.options.Count - 1);
            }

            dpResoluciones.value = PlayerPrefs.GetInt("resolucion");
        }