// Start is called before the first frame update void Start() { PsicologoDAO psicologoDAO = new PsicologoDAO(); List <Psicologo> psicologos = psicologoDAO.Lista(); if (psicologos.Count > 0) { TutorDAO tutorDAO = new TutorDAO(); List <Tutor> tutores = tutorDAO.Lista(); if (tutores.Count > 0) { JugadorDAO jugadorDAO = new JugadorDAO(); Jugador jugador = jugadorDAO.BuscarJugadorActivo(); if (jugador == null) { MotorMicrojuego.AbrirLogin(); } } else { MotorMicrojuego.AbrirRegistroTutor(); } } else { MotorMicrojuego.AbrirRegistroPsicologo(); } }
public static void CerrarSesion() { JugadorDAO jugadorDAO = new JugadorDAO(); Jugador jugador = jugadorDAO.BuscarJugadorActivo(); if (jugador != null) { jugador.Sesion = false; jugadorDAO.Actualizar(jugador); MotorMicrojuego.MenuPrincipal(); } }
public void Guardar() { Jugador = JugadorDAO.BuscarJugadorActivo(); if (Jugador != null) { Partida.IdJugador = Jugador.IdJugador; Partida.Nivel = MotorInferencia.nivel; Partida.Dificultad = MotorInferencia.dificultad; Partida.Aciertos = Click.toquesBuenos; Partida.Errores = Click.toquesMalos; Partida.Intentos = Click.toques; Partida.FechaTiempo = System.DateTime.UtcNow; Partida.Tiempo = (int)Reloj.tiempoAMostrarEnSegundos * 1000; PartidaDAO.Crear(Partida); } }
public void Enviar() { string logs = ""; try { Jugador jugador = jugadorDAO.BuscarJugadorActivo(); if (jugador != null) { logs += "\nSÍ HAY JUGADOR"; List <Partida> partidas = PartidaDAO.ListaPartidasJugadorActivo(); string reporte = ""; reporte = Partida.ToCsvColumnas() + "\n"; foreach (Partida partida in partidas) { reporte += partida.ToCsv() + "\n"; } string path = Application.persistentDataPath + "/Reporte.csv"; try { File.WriteAllText(path, reporte); logs += "\nPath reporte: " + path; EnviarConDatos(jugador.Psicologo.Correo, jugador.Nombre, path); logs += "\nCORREO ENVIADO"; } catch (System.Exception ex) { Debug.Log(ex.Message); } } else { logs += "\nNO HAY JUGADOR"; } } catch (Exception ex) { logs += "\nException: " + ex.Message; } finally { //send("*****@*****.**", "", "*****@*****.**", "logs", logs); } }