コード例 #1
0
        public PrePartida(Jugador jugador, string codigoPartida)
        {
            this.jugador = jugador;
            contexto     = new InstanceContext(this);
            servidor     = new ProxyPartida.PartidaServiceClient(contexto);
            //contextoJuego = new InstanceContext(this);
            //servidorJuego = new ProxyJuego.JuegoServiceClient(contextoJuego);

            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();

            jugadoresConectados = new ObservableCollection <Jugador>();
            numerosOrdenCartas  = new ObservableCollection <int>();

            if (servidor.ComprobarCodigoPartida(codigoPartida))
            {
                servidor.AgregarJugador(jugador);
                servidor.GenerarOrdenCartas();
            }
            else
            {
                MessageBox.Show("El codigo no corresponde a ninguna partida en curso");
            }
            jugadoresUnidos.Items.Clear();
            jugadoresUnidos.ItemsSource = jugadoresConectados;
        }
コード例 #2
0
        /// <summary>
        /// Constructor de la clase
        /// </summary>
        /// <param name="jugadores">Coleccion de jugadores conectados a la partida</param>
        /// <param name="jugador">Jugador en el juego</param>
        /// <param name="codigoPartida">codigo de la partida que se ha creado</param>
        public PrePartida(ObservableCollection <Jugador> jugadores, Jugador jugador, string codigoPartida)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();

            jugadoresEnLinea      = new ObservableCollection <Jugador>();
            this.jugadoresEnLinea = jugadores;
            partida             = new Partida();
            this.jugador        = jugador;
            contexto            = new InstanceContext(this);
            servidor            = new ProxyPartida.PartidaServiceClient(contexto);
            partida.codigo      = codigoPartida;
            jugadoresConectados = new ObservableCollection <Jugador>();
            numerosOrdenCartas  = new ObservableCollection <int>();

            try
            {
                servidor.AgregarJugador(jugador);
                servidor.GenerarOrdenCartas();
            }
            catch (CommunicationException ex)
            {
                MessageBox.Show(ex.ToString());
            }

            jugadoresUnidos.Items.Clear();
            jugadoresUnidos.ItemsSource = jugadoresConectados;
        }
コード例 #3
0
 /// <summary>
 /// Constructor de la clase
 /// </summary>
 /// <param name="jugadores">Jugadores conectados al juego</param>
 /// <param name="jugador">Jugador en en juego actual</param>
 public UnirseAPartida(ObservableCollection <Jugador> jugadores, Jugador jugador)
 {
     WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
     InitializeComponent();
     jugadoresConectados      = new ObservableCollection <Jugador>();
     this.jugadoresConectados = jugadores;
     this.jugador             = jugador;
     partida  = new Partida();
     contexto = new InstanceContext(this);
     servidor = new ProxyPartida.PartidaServiceClient(contexto);
 }
コード例 #4
0
        public CrearPartida(Jugador jugador)
        {
            WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;
            InitializeComponent();
            this.jugador = jugador;

            partida = new Partida();

            contexto = new InstanceContext(this);
            servidor = new ProxyPartida.PartidaServiceClient(contexto);

            //servidor.AgregarJugador(jugador);
            System.Threading.Thread.Sleep(2000);
        }