Esempio n. 1
0
 public bool manoCompleta(be.Mano mano, be.Partida partida)
 {
     bll.Truco trucoServices = new bll.Truco();
     if (mano.Jugadores.Count == 2)
     {
         trucoServices.CompararMano(mano, partida);
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        public void IniciarPartidaDeTruco()
        {
            bll.Truco trucoServices = new bll.Truco();

            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            partida = trucoServices.IniciarJuego(jugadores);

            Assert.IsInstanceOfType(partida, typeof(be.Partida));
        }
Esempio n. 3
0
 public void alternarTurno(be.Turno turno, be.Partida partida)
 {
     if (turno.Jugador == partida.Jugadores[0])
     {
         turno.Jugador = partida.Jugadores[1];
     }
     else
     {
         turno.Jugador = partida.Jugadores[0];
     }
 }
Esempio n. 4
0
 public uMesa(be.Partida Partida)
 {
     InitializeComponent();
     partida          = Partida;
     pictureBox1.Size = new Size(0, 0);
     pictureBox2.Size = new Size(0, 0);
     pictureBox3.Size = new Size(0, 0);
     pictureBox4.Size = new Size(0, 0);
     pictureBox5.Size = new Size(0, 0);
     pictureBox6.Size = new Size(0, 0);
 }
Esempio n. 5
0
        public void CrearRonda()
        {
            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            Assert.IsInstanceOfType(ronda, typeof(be.Ronda));
        }
Esempio n. 6
0
        public be.Partida IniciarJuego(List <be.Jugador> jugadores, bll.Ronda rondaServices)
        {
            be.Truco   truco   = new be.Truco();
            be.Partida partida = new be.Partida(jugadores);
            be.Turno   turno   = new be.Turno();
            turno.Jugador = jugadores[0];
            partida.Turno = turno;

            rondaServices.AsignarPartida(partida);
            rondaServices.CrearRonda();
            rondaServices.RepartirCartas(jugadores);

            return(partida);
        }
Esempio n. 7
0
        public void CompararMano(be.Mano mano, be.Partida partida)
        {
            if (mano.Jugadores[0].CartaJugada.Valor < mano.Jugadores[1].CartaJugada.Valor)
            {
                AsignarPuntos(mano.Jugadores[0]);
                partida.Turno.Jugador = mano.Jugadores[0];
            }
            else
            {
                AsignarPuntos(mano.Jugadores[1]);
                partida.Turno.Jugador = mano.Jugadores[1];
            }

            partida.Rondas[partida.Rondas.Count() - 1].UltimaManoJugada++;
        }
Esempio n. 8
0
        public void TirarCarta(be.Jugador jugador, be.Carta carta, bll.Ronda rondaServices)
        {
            be.Partida partida = rondaServices.getPartida();
            int        index   = rondaServices.RondaActual;

            be.Mano mano = partida.Rondas[index].Manos[partida.Rondas[index].UltimaManoJugada];
            jugador.CartaJugada = carta;
            rondaServices.alternarTurno();

            int indice = jugador.Cartas.IndexOf(carta);

            jugador.Cartas[indice] = null;
            mano.Jugadores.Add(jugador);

            bll.Mano manoServices = new bll.Mano();
            manoServices.manoCompleta(mano, partida);
        }
Esempio n. 9
0
        public void RepartirCartasTest()
        {
            List <be.Jugador> jugadores = new List <be.Jugador>();

            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            rondaServices.RepartirCartas(jugadores);

            Assert.IsInstanceOfType(jugadores[0].Cartas[0], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[0].Cartas[1], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[0].Cartas[2], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[0], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[1], typeof(be.Carta));
            Assert.IsInstanceOfType(jugadores[1].Cartas[2], typeof(be.Carta));
        }
Esempio n. 10
0
        public void TirarCarta()
        {
            List <be.Jugador> jugadores = new List <be.Jugador>();

            jugadores.Add(new be.Jugador("Pedro"));
            jugadores.Add(new be.Jugador("Juan"));

            be.Partida partida       = new be.Partida(jugadores);
            bll.Ronda  rondaServices = new bll.Ronda();
            bll.Turno  turnoServices = new bll.Turno();
            rondaServices.AsignarPartida(partida);
            ronda = rondaServices.CrearRonda();

            be.Turno turno = turnoServices.cambiarTurno(new be.Turno(), jugadores[0]);
            rondaServices.RepartirCartas(jugadores);


            bll.Jugador jugadorServices = new bll.Jugador(jugadores);
            jugadorServices.TirarCarta(jugadores[0], jugadores[0].Cartas[1], ronda.Manos[0]);
            turnoServices.alternarTurno(turno, partida);

            Assert.IsInstanceOfType(ronda.Manos[0].Jugadores[0].CartaJugada, typeof(be.Carta));
        }
Esempio n. 11
0
        private void button3_Click(object sender, EventArgs e)
        {
            crearJugadores();

            if (jugadores.Count >= 2)
            {
                partida     = trucoServices.IniciarJuego(jugadores, rondaServices);
                label1.Text = jugadores[0].Nombre;
                label2.Text = jugadores[1].Nombre;
            }

            this.trucoUserControlNuevaRonda();

            this.EnlazarEventoUCartas();

            trucoUserController2.bloquearCartas();

            crearUserControllMesa();

            ToggleBotones(true);

            MessageBox.Show("Partida iniciada: " + partida.Jugadores[0].Nombre + " vs " + partida.Jugadores[1].Nombre + " @ Turno de: " + partida.Turno.Jugador.Nombre);
        }