Пример #1
0
        private async void ComprobarActivos_Clicked(object sender, EventArgs e)
        {
            if (!contenedor.IsBusy)
            {
                contenedor.IsBusy = true;
                if (manejadorJuego.ComprobarActivos())
                {
                    if (contenedor.AumentarPuntuacion()) //si ya se pasa de nivel
                    {
                        if (contenedor.Nivel < 7)
                        {
                            await DisplayAlert("Siguiente nivel",
                                               "Enhorabuena, avanzas al siguiente nivel.",
                                               "Aceptar");

                            contenedor.GuardarProgreso();
                            manejadorJuego.Reiniciar();
                            contenedor.IniciarTemporizador();
                        }//if (nivel < 6)
                        else
                        {
                            await DisplayAlert("Fin de juego", "Gracias por jugar! " +
                                               ((!contenedor.Temporizador) ? "" : "Total de tiempo: " + contenedor.Tiempo + " segundos."), "Aceptar");

                            contenedor.EliminarProgreso();
                            await Navigation.PopAsync();
                        } //sale del juego
                    }     //if
                }         //if
                contenedor.IsBusy = false;
            }             //if !IsBusy
        }
Пример #2
0
        private async void VolverMenu_Clicked(object sender, EventArgs e)
        {
            if (!contenedor.IsBusy)
            {
                contenedor.IsBusy = true;
                bool b = await DisplayAlert("¿Desea volver?", "Si vuelve se perderá el progreso"
                                            + ((contenedor.Nivel == 1) ? "." : " hecho en el nivel."), "Aceptar", "Cancelar");

                if (b)
                {
                    contenedor.GuardarProgreso();
                    ManejadorJuego.Instance.Limpiar();
                    contenedor.ReiniciarTemporizador();
                    await Navigation.PopToRootAsync();
                }
                contenedor.IsBusy = false;
            }
        }