예제 #1
0
    //------------------------------------------------------------------------------------------------------------------

    public void partidaAleatoria()
    {
        tiempoAux = tiempoEspera;
        //Mostrar ventana de espera
        ventanaEmergente.GetComponent <VentanaEspera>().mostrar("Buscando partida aleatoria...");
        //Indicar que estamos en solicitado batalla para no permitir solicitudes
        infoPersistente.setEnBatalla(true);
        //Marcar como buscando
        buscando = true;
        //Guardar nombre oponente
        infoPersistente.setNombreOponente("Aleatorio");
        //Acceder a la sala aleatoria
        gestionPartidas.accederSalaAleatoria();
    }
예제 #2
0
    //--------------------------------------------------------------------------------------------------------------

    /*
     * METODO PARA MOSTRAR MENSAJE DE SOLICITUD DE BATALLA
     */
    public async System.Threading.Tasks.Task crearBatalla()
    {
        string nombre = "";

        await refBD.getBaseDatos().GetReference("jugadores")
        .GetValueAsync().ContinueWith(task => {
            if (task.IsFaulted)
            {
            }
            else if (task.IsCompleted)
            {
                DataSnapshot snapshot = task.Result;
                IEnumerable <DataSnapshot> posLeida = snapshot.Children;

                //Recorrer los resultado leidos del usuario
                foreach (var linea in posLeida)
                {
                    //Buscar el nombre del jugador con el id de batalla
                    if (linea.Key.ToString().Equals(infoPersistente.getPeticionBatalla()))
                    {
                        nombre = linea.Value.ToString();
                    }
                }
            }
        });

        //Indicar que estamos en batalla
        infoPersistente.setEnBatalla(true);

        //Guardar nombre oponente
        infoPersistente.setNombreOponente(nombre);

        //Mostrar el mensaje emergente de batalla
        ventanaBatalla.GetComponent <Batalla>().crear(nombre, infoPersistente.getPeticionBatalla());
        //A partir de la creacion del mensaje contar tiempo
        contarTiempo = true;
    }
예제 #3
0
    //------------------------------------------------------------------------------------------------------------------

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////
    //                        METODOS PARA EL BOTON DE RETAR A UNA BATALLA A UN AMIGO                        //
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////

    /*
     * METODO QUE SE EJECUTA AL PULSAR EL BOTON DE BATALLA PARA RETAR A UNA BATALLA A UN AMIGO
     */
    public void botonBatalla()
    {
        solicitarBatalla.solicitar(uid);
        //Guardar nombre oponente para mostrarlo mas adelante
        infoPersistente.setNombreOponente(nombre.text);
    }