Exemple #1
0
    //var datos;


    public void contarpreguntas()
    {
        string query = "SELECT count(*) from preguntas";

        MySqlCommand cmd = conexion.CreateCommand();

        cmd.CommandText = query;
        cmd.ExecuteNonQuery();
        Adminsql        _adminsql = GameObject.Find("AdminDB").GetComponent <Adminsql>();
        MySqlDataReader Resultado = _adminsql.Select(query);

        Resultado.Read();
        var r = Resultado.GetString(0);

        //randomv =r
        Debug.Log(r);
    }
Exemple #2
0
    public void logearprofe()
    {
        string          _log      = "`profesora` WHERE `id` LIKE '" + id.text + "' AND `contraseña` LIKE '" + contraseña.text + "'";
        Adminsql        _adminsql = GameObject.Find("GameObject").GetComponent <Adminsql>();
        MySqlDataReader Resultado = _adminsql.Select(_log);


        if (Resultado.HasRows)
        {
            Debug.Log("Login correcto");
            Resultado.Close();
            Debug.Log(Resultado);
            SceneManager.LoadScene("escena homeprofe");
        }
        else
        {
            Debug.Log("No hay un usuario con este ID y contraseña");
            Resultado.Close();
        }
    }
Exemple #3
0
    public void logear()
    {
        string          _log      = "`estudiantes` WHERE `id` LIKE '" + id.text + "'";
        Adminsql        _adminsql = GameObject.Find("GameObject").GetComponent <Adminsql>();
        MySqlDataReader Resultado = _adminsql.Select(_log);

        Resultado.Read();


        var ids    = Resultado.GetString(0);
        var nombre = Resultado.GetString(1);
        var grado  = Resultado.GetString(11);

        idsa   = ids;
        Nombre = nombre;
        Grado  = grado;

        //Debug.Log(idsa);
        //Debug.Log(Nombre);
        //Debug.Log(Grado);

        textos.SetActive(true);

        if (Resultado.HasRows)
        {
            Debug.Log("Login correcto");
            Resultado.Close();
            Debug.Log(Resultado);
            SceneManager.LoadScene("escena home");
        }
        else
        {
            Debug.Log("No hay un usuario con este ID");
            Resultado.Close();
        }
    }
Exemple #4
0
    public void preguntaaleatoria()
    {
        numerorandom = Random.Range(1, 5);
        string          _log      = "`preguntamts` WHERE `id` LIKE '" + numerorandom + "' AND `sub_tema_id` LIKE '1'";
        Adminsql        _adminsql = GameObject.Find("AdminDB").GetComponent <Adminsql>();
        MySqlDataReader Resultado = _adminsql.Select(_log);


        Resultado.Read();

        var pregunta = Resultado.GetString(3);
        var opciona  = Resultado.GetString(4);
        var opcionb  = Resultado.GetString(5);
        var opcionc  = Resultado.GetString(6);
        var correcta = Resultado.GetString(7);

        //Debug.Log(pregunta);
        //texto = datos.
        textoP.text       = pregunta;
        textoopciona.text = opciona;
        textoopcionb.text = opcionb;
        textoopcionc.text = opcionc;
        correctaS         = correcta;
        opcionaS          = opciona;
        opcionbS          = opcionb;
        opcioncS          = opcionc;
        //a.Equals(textoopciona);


        botona();
        botonb();
        botonc();



        /*
         * if (opciona == correcta)
         *  {
         *      Debug.Log("es la a");
         *      valorcorrecto = 1;
         *  if (valora == valorcorrecto)
         *  {
         *      Puntaje++;
         *  }
         *
         * }
         *  else if (opcionb == correcta)
         *  {
         *      Debug.Log("es la b");
         *      valorcorrecto = 2;
         *
         *  if (valora == valorcorrecto)
         *  {
         *      Puntaje++;
         *  }
         * }
         *  else if (opcionc == correcta)
         *  {
         *      Debug.Log("es la c");
         *      valorcorrecto = 3;
         *
         *  if (valora == valorcorrecto)
         *  {
         *      Puntaje++;
         *  }
         * }
         *  else {
         *      Debug.Log("Hay un error con la pregunta");
         *          }
         *
         * //botona();
         * //botonb();
         * //botonc();
         */
        if (Resultado.HasRows)
        {
            Resultado.Close();
        }
        else
        {
            Debug.Log("No hay pregunta con este id");
            Resultado.Close();
        }
    }