Exemplo n.º 1
0
        /// <summary>
        /// este metodo guarda el progreso
        /// </summary>
        private void guardarProgreso()
        {
            if (this.listadoPalabrasPorPrueba.Count == 0)
            {
                calcularTiempoJugador();

                ClsPruebaJugador         prog = new ClsPruebaJugador(new ClsManejadoraJugadorBL().ObtenerIdJugadorPorNickDAL(this.nick), this.pruebaActual.IdPrueba, this.tiempoMaximo);
                ClsManejadoraProgresosBL m    = new ClsManejadoraProgresosBL();

                m.InsertarProgresoBL(prog);
            }
        }
Exemplo n.º 2
0
        private string borderBrushPalabraEscrita;//para poner el textbox de la palabra que escribe el jugador en rojo si se equivoca
        #endregion


        #region constructores
        public ClsJuegoVM(string nick)
        {
            try
            {
                this.borderBrushPalabraEscrita = "Black";
                this.nick = nick;

                int id = new ClsManejadoraProgresosBL().ObtenerUltimoProgresoBL(this.nick);

                this.imagenCamello = "ms-appx:///Assets/Imagenes/camellos.gif";

                if (id == 0)//es la primera vez que juega
                {
                    this.pruebaActual = new ClsManejadoraPruebaBL().ObtenerPrimeraPruebaBL();
                }
                else
                {
                    this.pruebaActual = new ClsManejadoraPruebaBL().ObtenerSiguentePruebaBL(id);
                }

                if (this.pruebaActual != null)//si tengo timepo pondré que pueda volver a jugar
                {
                    this.listadoPalabrasPorPrueba = new ClsListadoPalabrasBL().ObtenerPalabrasPorIdPruebaBL(this.pruebaActual.IdPrueba);
                    if (this.listadoPalabrasPorPrueba != null)//por si hay pruebas que todavia no tienen palabras
                    {
                        obtenerTotalDificultades();
                        //calcularTamañoPantalla();
                        this.moverCamello = 0.0;
                        barjarPalabras();

                        primeraPalabra();

                        this.tiempoMaximo = this.pruebaActual.TiempoMaximo;
                        this.minutos      = Convert.ToInt32(this.tiempoMaximo.Substring(3, 2));
                        this.segundos     = Convert.ToInt32(this.tiempoMaximo.Substring(6, 2));

                        this.tiempo = new DispatcherTimer();

                        this.tiempo.Interval = new TimeSpan(0, 0, 1);

                        this.tiempo.Tick += Timer_Tik;
                    }
                    else
                    {
                        irAlMenu();
                        var dlg = new MessageDialog("Esta prueba aún no tiene palabras,Pronto podrás jugar. Gracias ");
                        var res = dlg.ShowAsync();
                    }
                }
                else
                {
                    irAlMenu();
                    var dlg = new MessageDialog("Has superado  todas la pruebas");
                    var res = dlg.ShowAsync();
                    //nivelesSuperados();
                }
            }
            catch (Exception)
            {
                var dlg = new MessageDialog("Problemas de conexión. Inténtalo más tarde por favor");
                var res = dlg.ShowAsync();
            }
        }