Ejemplo n.º 1
0
 protected void btnConfirmar_Click(object sender, EventArgs e)
 {
     try
     {
         cargarWCF();
         unJugador = new Jugador();
         unJugador.CI = Convert.ToInt32(txtCi.Text.Trim());
         unJugador.NOM_PUBLICO = txtUsuario.Text.Trim();
         unJugador.USUARIO = txtUsuario.Text.Trim();
         unJugador.PASS = txtPass.Text.Trim();
         unJugador.NOM_COMPLETO = txtNombre.Text.Trim();
         trivias.AltaUsuario((Usuarios)unJugador);
         trivias.Close();
         Response.Write("<div id=\"exito\" class=\"alert alert-success\">EXITO</div>"
         + "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
         //Limpiar();
         if (unJugador != null)
         {
             Session["Usuario"] = unJugador;
             Response.Redirect("descargar.aspx");
         }
     }
     catch(Exception ex)
     {
         Response.Write("<div id=\"error\" class=\"alert alert-danger\">"+ex.Message+"</div>"
             + "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
     }
 }
Ejemplo n.º 2
0
 public Game()
 {
     InitializeComponent();
     TheGame = new Tablero();
     J1 = new Jugador();
     J2 = new Jugador();
 }
Ejemplo n.º 3
0
    public static List<Jugador> getJugadores(Plantel plantel)
    {
        OdbcConnection con = ConexionBD.ObtenerConexion();
        OdbcCommand cmd = null;
        List<Jugador> jugadores = new List<Jugador>();
        try
        {
            cmd = new OdbcCommand("SELECT j.id, j.nombreApellido, j.posicion, j.idPlantel " +
                "FROM jugador j WHERE j.idPlantel = "+plantel.IdPlantel, con);

            cmd.CommandType = CommandType.Text;
            OdbcDataReader dr = cmd.ExecuteReader();
            while (dr.Read())
            {
                Jugador jugador = new Jugador();
                jugador.IdJugador = dr.GetInt32(0);
                jugador.NombreApellido = dr.GetString(1);
                jugador.Posicion = dr.GetString(2);
                jugador.Foto = ImagenDAL.getImagenJugador(con, dr.GetInt32(0));
                jugadores.Add(jugador);
            }
        }
        catch (Exception e)
        {
            throw new SportingException("Ocurrio un error al intentar obtener los jugadores del plantel. " + e.Message);
        }
        finally
        {
            cmd.Connection.Close();
        }
        return jugadores ;
    }
Ejemplo n.º 4
0
 protected void btnBuscar_Click(object sender, EventArgs e)
 {
     Usuarios unJugador = null;
     try
     {
         cargarWCF();
         unJugador = trivias.BuscarUsuario(Convert.ToInt32(txtCi.Text.Trim()));
         trivias.Close();
         if (unJugador != null)
         {
             txtCi.Text = "";
             Response.Write("<div id=\"error\" class=\"alert alert-warning\">Ya esta registrado: " + txtCi.Text.Trim() + "</div>"
             + "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
         }
         else
         {
             //txtCi.Enabled = false;
             txtNombre.Enabled = true;
             txtPass.Enabled = true;
             txtNombrePublico.Enabled = true;
             txtUsuario.Enabled = true;
             btnConfirmar.Enabled = true;
         }
     }
     catch (Exception ex)
     {
         Response.Write("<div id=\"error\" class=\"alert alert-danger\">" + ex.Message + "</div>" +
         "<script type=\"text/javascript\">window.onload=function(){alertBootstrap();};</script>");
     }
 }
Ejemplo n.º 5
0
    public static Jugador getJugador_plantelActual(int id)
    {
        OdbcConnection conexion = null;
        OdbcCommand cmd = null;
        Jugador jugador = new Jugador();
        try
        {
            conexion = ConexionBD.ObtenerConexion();
            String getJugador = "select j.id, j.nombreApellido, j.posicion, j.idPlantel " +
                                "from jugador j where j.idPlantel = 1 and j.id = " + id;

            cmd = new OdbcCommand(getJugador, conexion);

            OdbcDataAdapter da = new OdbcDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);

            jugador.IdJugador = Convert.ToInt32(dt.Rows[0]["id"].ToString());
            jugador.NombreApellido = dt.Rows[0]["nombreApellido"].ToString();
            jugador.Posicion = dt.Rows[0]["posicion"].ToString();
            jugador.Foto = ImagenDAL.getImagenJugador(conexion, id);
        }
        catch (Exception e)
        {
            throw new SportingException("Ocurrio un error al intentar obtener los datos de un jugador. " + e.Message);
        }
        finally
        {
            cmd.Connection.Close();
        }
        return jugador;
    }
Ejemplo n.º 6
0
	public static void guardar()
    {
        jugador = Jugador.jugador;
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/guardado.sav");
        bf.Serialize(file, jugador);
        file.Close();
    }
Ejemplo n.º 7
0
 public static void cargar()
 {
     if (File.Exists(Application.persistentDataPath+"/guardado.sav"))
     {
         BinaryFormatter bf = new BinaryFormatter();
         FileStream file = File.Open(Application.persistentDataPath + "/guardado.sav", FileMode.Open);
         jugador = (Jugador)bf.Deserialize(file);
         file.Close();
     }
 }
Ejemplo n.º 8
0
 public void InsertOrUpdate(Jugador jugador)
 {
     if (jugador.ID == default(int)) {
         // New entity
         context.Jugadors.Add(jugador);
     } else {
         // Existing entity
         context.Entry(jugador).State = EntityState.Modified;
     }
 }
Ejemplo n.º 9
0
 public void addJugador(int id)
 {
     if (!Jugadores.ContainsKey(id)) {
         Jugador jugador = new Jugador(new Dimensiones(0.3, 0.10, 0.6));
         jugador.Draw3D(Viewport3D);
         Point3D posicionInicial = new Point3D(0.0, 0.4, 2.0);
         jugador.UpdatePositionManoDerecha(posicionInicial);
         jugador.UpdatePositionManoIzquierda(posicionInicial);
         Jugadores.Add(id, jugador);
     }
 }
        public static void Draw(Jugador jugador, Viewport3D viewport3D, Dimensiones dimMano)
        {
            //mano izq
            ModelVisual3D modelManoIzq = DrawMano(jugador, dimMano, Brushes.Blue);
            viewport3D.Children.Add(modelManoIzq);
            jugador.ManoIzquierda = (Model3DGroup)modelManoIzq.Content;

            //mano der
            ModelVisual3D modelManoDer = DrawMano(jugador, dimMano, Brushes.Green);
            viewport3D.Children.Add(modelManoDer);
            jugador.ManoDerecha = (Model3DGroup)modelManoDer.Content;
        }
Ejemplo n.º 11
0
 public frmHistorico(Jugador pJugador)
 {
     InitializeComponent();
     _JugadorLogueado = pJugador;
     try
     {
         cargarWCF();
         _documento.LoadXml(trivias.XMLlistarJuegosXjugador(_JugadorLogueado).ToString());
        //_documento.LoadXml(FabricaLogica.GetLogicaJuego().XMLlistarJuegosXjugador(_JugadorLogueado).ToString());
         trivias.Close();
     }
     catch (Exception ex)
     {
         lblError.Text = ex.Message;
     }
 }
Ejemplo n.º 12
0
 public static void Combatir(Jugador jug1, Jugador jug2)
 {
     float num = Random.Range (0f, 10f);
     Debug.Log (num);
     if (num <= 5)
     {
         //eliminar_jugador(jug1);
     }
     else
     {
         eliminar_jugador(jug2);
         jug1.enemigo_detectado = null;
         jug1.enemigo_combatiendo = null;
         jug2.enemigo_detectado = null;
         jug2.enemigo_combatiendo = null;
     }
 }
Ejemplo n.º 13
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox2.Text != "" && textBox3.Text == "")
            {
                Jugador j = new Jugador();
                j.Nombre = personaNombre;
                j.FechaNacimiento = DateTime.Parse(dateTimePicker1.Text);
                j.Mail = textBox2.Text + comboBox1.Text;

                db.Jugadors.InsertOnSubmit(j);
                db.SubmitChanges();

                Partido partido = (from x in db.Partidos
                                    where x.ID == partidoID
                                    select x).First();

                Inscripcion ins = new Inscripcion()
                {
                    JugadorID = j.ID,
                    PartidoID = partidoID,
                    Fecha = System.DateTime.Now,
                    Prioridad = comboBox2.SelectedIndex +1
                };

                //db.Inscripcions.InsertOnSubmit(ins);
                //db.SubmitChanges();
                partido.inscribir(ins);

                InscripcionPendiente ip = (from x in db.InscripcionPendientes
                                           where x.PersonaNombre == personaNombre && x.PartidoID == partidoID
                                           select x).First();

                db.InscripcionPendientes.DeleteOnSubmit(ip);
                db.SubmitChanges();

                MessageBox.Show("Se ha confirmado el jugador.");
                this.Close();
            }
            else
            {
                MessageBox.Show("Ingrese todos los datos.");
            }
        }
Ejemplo n.º 14
0
        public XmasForm()
        {
            InitializeComponent();

            keysPressed = new Dictionary<Keys, bool>();
            keysPressed[Keys.W] = false;
            keysPressed[Keys.A] = false;
            keysPressed[Keys.S] = false;
            keysPressed[Keys.D] = false;
            keysPressed[Keys.I] = false;
            keysPressed[Keys.J] = false;
            keysPressed[Keys.K] = false;
            keysPressed[Keys.L] = false;

            // Creamos el mundo
            mundo = new Mundo(Resources.mundo);

            jugador1 = new Jugador();
            jugador2 = new Jugador();

            jugador1.X = 58;
            jugador1.Y = 1;
            jugador1.MiBitmap = Resources.mj;
            jugador1.MiMundo = mundo;
            jugador1.MiVisor = visorControl1;

            jugador2.X = 62;
            jugador2.Y = 1;
            jugador2.MiBitmap = Resources.mj;
            jugador2.MiMundo = mundo;
            jugador2.MiVisor = visorControl2;

            mundo.Jugadores.Add(jugador1);
            mundo.Jugadores.Add(jugador2);

            visorControl1.MiJugador = jugador1;
            visorControl1.OtroJugador = jugador2;
            visorControl1.MiMundo = mundo;

            visorControl2.MiJugador = jugador2;
            visorControl2.OtroJugador = jugador1;
            visorControl2.MiMundo = mundo;
        }
Ejemplo n.º 15
0
 public static void registrarJugador_plantelActual(Jugador jugador)
 {
     try
     {
         PlantelDAL.insertarJugador_plantelActual(jugador);
     }
     catch (SportingException spEx)
     {
         throw spEx;
     }
     catch (PathImgEmptyException imgEx)
     {
         throw imgEx;
     }
     catch (Exception e)
     {
         throw new SportingException("Error al registrar un nuevo jugador."+ e.Message);
     }
 }
Ejemplo n.º 16
0
        public MW(int a, string nickName, string PathAvatar, int maxConectados, string ip)
        {
            ultimoDisparo      = DateTime.Now;
            delay              = 2;//000; // tiempo en milisegundos a esperar
            this.maxConectados = maxConectados;
            this.nickName      = nickName;
            pathAvatar         = PathAvatar;

            if (a == 1)
            {
                InitializeComponent();

                pathAvatares = new List <string>();
                imagenes     = new List <BitmapImage>();



                servidor = new Server(maxConectados);
                tablero  = new Tablero(servidor, null);
                Canvas.SetLeft(tablero, this.Width / 2 - this.Height / 2);
                Canvas.SetTop(tablero, 0);
                canvas.Children.Add(tablero);
                Agranda += tablero.Agrandar;

                canonConBarra = new CanonConBarra();
                Canvas.SetLeft(canonConBarra, this.Width / 2 - this.Height / 2);
                Canvas.SetTop(canonConBarra, tablero.Height);
                canvas.Children.Add(canonConBarra);
                Agranda += canonConBarra.Agrandar;

                pathAvatares.Add(pathAvatar); //

                BitmapImage bi3 = new BitmapImage();
                bi3.BeginInit();
                bi3.UriSource = new Uri(pathAvatar, UriKind.Relative);
                bi3.EndInit();

                imagenes.Add(bi3);
                //

                chat = new Chat(pathAvatar);
                Canvas.SetRight(chat, this.Width / 2 + this.Height / 2);
                Canvas.SetTop(chat, 0);
                canvas.Children.Add(chat);
                Agranda += chat.Agrandar;

                instrucciones = new Instrucciones(maxConectados);
                Canvas.SetLeft(instrucciones, this.Width);
                Canvas.SetTop(instrucciones, 0);
                canvas.Children.Add(instrucciones);
                Agranda += instrucciones.Agrandar;



                escucha1 = new Thread(new ParameterizedThreadStart(oir1));
                escucha2 = new Thread(new ParameterizedThreadStart(oir2));
                escucha3 = new Thread(new ParameterizedThreadStart(oir3));
                habla    = new Thread(new ParameterizedThreadStart(hablar));

                escucha1.Start();
                escucha2.Start();
                escucha3.Start();
                habla.Start();
            }
            else if (a == 2)
            {
                Thread.Sleep(4000);
                jugador = new Jugador(ip);
                InitializeComponent();

                ventana.Title = nickName;


                tablero = new Tablero(null, jugador);
                Canvas.SetLeft(tablero, this.Width / 2 - this.Height / 2);
                Canvas.SetTop(tablero, 0);
                canvas.Children.Add(tablero);
                Agranda += tablero.Agrandar;

                canonConBarra = new CanonConBarra();
                Canvas.SetLeft(canonConBarra, this.Width / 2 - this.Height / 2);
                Canvas.SetTop(canonConBarra, tablero.Height);
                canvas.Children.Add(canonConBarra);
                Agranda += canonConBarra.Agrandar;

                chat = new Chat(pathAvatar);
                Canvas.SetLeft(chat, this.Width / 2 + this.Height / 2);
                Canvas.SetTop(chat, 0);
                canvas.Children.Add(chat);
                Agranda += chat.Agrandar;

                instrucciones = new Instrucciones(jugador.numeroJugadores);
                Canvas.SetLeft(instrucciones, this.Width);
                Canvas.SetTop(instrucciones, 0);
                canvas.Children.Add(instrucciones);
                Agranda += instrucciones.Agrandar;



                escucha1 = new Thread(new ParameterizedThreadStart(oir0));
                habla    = new Thread(new ParameterizedThreadStart(hablar2));

                escucha1.Start();
                habla.Start();

                //BitmapImage bi3 = new BitmapImage();
                //bi3.BeginInit();
                //bi3.UriSource = new Uri(pathAvatar, UriKind.Relative);
                //bi3.EndInit();

                //Jugador.Enviar(jugador.cliente, bi3);
            }
            timer          = new System.Windows.Threading.DispatcherTimer();
            timer.Tick    += new EventHandler(timer_Tick);
            timer.Interval = new TimeSpan(0, 0, 0, 1);
            timer.Start();
            canonConBarra.progressBar1.Minimum = 0;
            canonConBarra.progressBar1.Maximum = delay;
        }
Ejemplo n.º 17
0
 string IWCFsem.XMLlistarJuegosXjugador(Jugador un_jug)
 {
     try
     {
         return (FabricaLogica.GetLogicaJuego().XMLlistarJuegosXjugador(un_jug));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 18
0
	//private Quaternion rot;
    void Awake()
    {
        energiaactual = energiajugador.GetComponent<Slider>().value;
        GuardarJuego.cargar();
        player = Jugador.jugador;
    }
Ejemplo n.º 19
0
    public static void insertarJugador_plantelActual(Jugador jugador)
    {
        OdbcConnection conexion = null;
        OdbcCommand cmd = null;
        try
        {
            if (jugador == null)
            {
                throw new SportingException("Error al registrar nuevo jugador. Jugador sin información.");
            }
            if (jugador.Foto == null || jugador.Foto.PathSmall == "")
            {
                throw new PathImgEmptyException("Error al registrar nuevo jugador. El jugador no posee foto.");
            }
            conexion = ConexionBD.ObtenerConexion();

            //Guardo los datos del jugador
            String insertarJugador;
            insertarJugador = " insert into jugador (nombreApellido, posicion, idPlantel)" +
                              " values ('" + jugador.NombreApellido + "', '" + jugador.Posicion + "', " +
                              1 + ")";
            cmd = new OdbcCommand(insertarJugador, conexion);
            cmd.ExecuteNonQuery();

            //Obtengo el id del jugador que acabo de insertar
            String lastIdJugador = "Select  LAST_INSERT_ID()";
            cmd = new OdbcCommand(lastIdJugador, conexion);
            int idJugador = Convert.ToInt32(cmd.ExecuteScalar());

            //Guardo los datos de la foto del jugador
            String insertarImagen = " insert into imagen (pathBig, pathSmall, pathMedium, portada, idJugador)" +
                           " values ('" + jugador.Foto.PathBig + "', '" + jugador.Foto.PathSmall + "','" +
                            jugador.Foto.PathMedium + "'," + jugador.Foto.Portada + ", " + idJugador + ")";
            cmd = new OdbcCommand(insertarImagen, conexion);
            cmd.ExecuteNonQuery();
            conexion.Close();
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            cmd.Connection.Close();
        }
    }
Ejemplo n.º 20
0
 Juegos IWCFsem.Continuar_Juego(Jugador UnJug)
 {
     try
     {
         return (FabricaLogica.GetLogicaJuego().Continuar_Juego(UnJug));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    [SerializeField] string nombreTriggerAnimacionAtaque; //Trigger que activa la animacion de ataque del animator

    private void Awake()
    {
        animator = gameObject.GetComponent <Animator>();
        player   = GameObject.Find("Player");
        sPlayer  = player.GetComponent <Jugador>();
    }
Ejemplo n.º 22
0
 private void Awake()
 {
     player = GameObject.Find("Player").GetComponent <Jugador>();
 }
Ejemplo n.º 23
0
 public bool ActualizarJugador(Jugador jugador)
 {
     _bd.Jugador.Update(jugador);
     return(Guardar());
 }
Ejemplo n.º 24
0
 // Use this for initialization
 void Start()
 {
     def_distancia = 18;
     distancia = def_distancia;
     jugador = transform.parent.GetComponent<Jugador> ();
 }
        /// <summary>
        /// Event handler for Kinect sensor's SkeletonFrameReady event
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void SensorSkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            Skeleton[] skeletons = new Skeleton[0];

            using (SkeletonFrame skeletonFrame = e.OpenSkeletonFrame())
            {
                if (skeletonFrame != null)
                {
                    skeletons = new Skeleton[skeletonFrame.SkeletonArrayLength];
                    skeletonFrame.CopySkeletonDataTo(skeletons);
                    frame_act = skeletonFrame.FrameNumber; // Capturamos el número de frame en el que estamos
                }
            }

            using (DrawingContext dc = this.drawingGroup.Open())
            {
                dc.DrawRectangle(Brushes.White, null, new Rect(0, 0, RenderWidth, RenderHeight));

                if (skeletons.Length != 0)
                {
                    foreach (Skeleton skel in skeletons)
                    {
                        //RenderClippedEdges(skel, dc);

                        if (skel.TrackingState == SkeletonTrackingState.Tracked)
                        {

                            /****************************** IMPLEMENTACION DEL JUEGO *********************/
                            Point manoDer = new Point();
                            manoDer = SkeletonPointToScreen(skel.Joints[JointType.HandRight].Position);

                            if (etapa == 0)
                            {

                                menu.Visibility = System.Windows.Visibility.Visible;
                                Inicial1_1.Visibility = System.Windows.Visibility.Visible;
                                Inicial1_2.Visibility = System.Windows.Visibility.Visible;
                                Inicial2_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_3.Visibility = System.Windows.Visibility.Hidden;
                                anterior.Visibility = System.Windows.Visibility.Hidden;
                                siguiente.Visibility = System.Windows.Visibility.Visible;
                                ayuda.Visibility = System.Windows.Visibility.Hidden;
                                siguiente.Content = "SIGUIENTE";
                                puntuacionDos.Content = "0";
                                puntuacionUno.Content = "0";
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(375, 295, 150, 40));

                                // Boton Siguiente

                                if (tocaBoton(manoDer, bot_siguiente, new Point(150, 40))) // Toca el boton 'siguiente'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(375, 295, 150, 40));
                                    if (contando_sig == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_sig = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {

                                        if ((frame_ini + 45) <= (frame_act)) // Hemos presionado el boton 'siguiente'
                                        {
                                            etapa += 1;
                                            contando_sig = false;
                                            id_jug_bot = -1;
                                        }
                                    }
                                }

                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_sig) contando_sig = true;
                                    else
                                    {
                                        contando_sig = false;
                                        id_jug_bot = -1;
                                    }
                                }
                            }

                            if (etapa == 1)
                            {

                                Inicial1_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial1_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_1.Visibility = System.Windows.Visibility.Visible;
                                Inicial2_2.Visibility = System.Windows.Visibility.Visible;
                                Inicial3_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_3.Visibility = System.Windows.Visibility.Hidden;
                                anterior.Visibility = System.Windows.Visibility.Visible;
                                siguiente.Visibility = System.Windows.Visibility.Visible;
                                siguiente.Content = "SIGUIENTE";
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(115, 295, 150, 40));
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(375, 295, 150, 40));

                                // Boton Siguiente

                                if (tocaBoton(manoDer, bot_siguiente, new Point(150, 40))) // Toca el boton 'siguiente'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(375, 295, 150, 40));
                                    if (contando_sig == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_sig = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 45) <= (frame_act)) // Hemos presionado el boton 'siguiente'
                                        {
                                            id_jug_bot = -1;
                                            etapa += 1;
                                            contando_sig = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_sig) contando_sig = true;
                                    else
                                    {
                                        contando_sig = false;
                                        id_jug_bot = -1;
                                    }
                                }

                                // Boton Anterior

                                if (tocaBoton(manoDer, bot_anterior, new Point(150, 40))) // Toca el boton 'siguiente'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(115, 295, 150, 40));
                                    if (contando_ant == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_ant = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 45) <= (frame_act)) // Hemos presionado el boton 'anterior'
                                        {
                                            id_jug_bot = -1;
                                            etapa -= 1;
                                            contando_ant = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_ant) contando_sig = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_ant = false;
                                    }
                                }
                            }

                            if (etapa == 2)
                            {

                                Inicial1_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial1_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_1.Visibility = System.Windows.Visibility.Visible;
                                Inicial3_2.Visibility = System.Windows.Visibility.Visible;
                                Inicial3_3.Visibility = System.Windows.Visibility.Visible;
                                anterior.Visibility = System.Windows.Visibility.Visible;
                                siguiente.Visibility = System.Windows.Visibility.Visible;
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(115, 295, 150, 40));
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(375, 295, 150, 40));
                                siguiente.Content = "EMPEZAR";

                                // Boton Siguiente

                                if (tocaBoton(manoDer, bot_siguiente, new Point(150, 40))) // Toca el boton 'siguiente'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(375, 295, 150, 40));
                                    if (contando_sig == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_sig = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 45) <= (frame_act)) // Hemos presionado el boton 'siguiente'
                                        {
                                            id_jug_bot = -1;
                                            etapa += 1;
                                            contando_sig = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_sig) contando_sig = true;
                                    else
                                    {
                                        contando_sig = false;
                                        id_jug_bot = -1;
                                    }
                                }

                                // Boton Anterior

                                if (tocaBoton(manoDer, bot_anterior, new Point(150, 40))) // Toca el boton 'siguiente'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(115, 295, 150, 40));
                                    if (contando_ant == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_ant = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 45) <= (frame_act)) // Hemos presionado el boton 'anterior'
                                        {
                                            id_jug_bot = -1;
                                            etapa -= 1;
                                            contando_ant = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_ant) contando_sig = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_ant = false;
                                    }
                                }
                            }
                            if (etapa == 3)
                            {

                                menu.Visibility = System.Windows.Visibility.Hidden;
                                Inicial1_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial1_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial2_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_1.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_2.Visibility = System.Windows.Visibility.Hidden;
                                Inicial3_3.Visibility = System.Windows.Visibility.Hidden;
                                anterior.Visibility = System.Windows.Visibility.Hidden;
                                siguiente.Visibility = System.Windows.Visibility.Hidden;
                                puntuacionUno.Visibility = System.Windows.Visibility.Visible;
                                puntuacionDos.Visibility = System.Windows.Visibility.Visible;

                                pausa1.Visibility = System.Windows.Visibility.Visible;
                                pausa2.Visibility = System.Windows.Visibility.Visible;
                                reiniciar.Visibility = System.Windows.Visibility.Visible;
                                ayuda.Visibility = System.Windows.Visibility.Visible;

                                // Dibujar el fondo negro
                                dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, RenderWidth, RenderHeight));
                                // Fondo blanco fuera de la zona de juego
                                dc.DrawRectangle(Brushes.White, null, new Rect(0.0, 0.0, RenderWidth, RenderHeight / 6.0));
                                dc.DrawRectangle(Brushes.White, null, new Rect(0.0, RenderHeight - RenderHeight / 6.0, RenderWidth, RenderHeight / 6.0));

                                // Dibujamos un marco para diferenciar la pantalla
                                dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, RenderWidth, 2));
                                dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, 0.0, 2, RenderHeight));
                                dc.DrawRectangle(Brushes.Black, null, new Rect(0.0, RenderHeight - 2, RenderWidth, 2));
                                dc.DrawRectangle(Brushes.Black, null, new Rect(RenderWidth - 2, 0.0, 2, RenderHeight));

                                // Linea discontinua central
                                float ini = RenderHeight / 6, tam_ = 4;
                                while ((ini + tam_) <= RenderHeight - (RenderHeight / 6))
                                {
                                    dc.DrawRectangle(Brushes.White, null, new Rect((RenderWidth / 2) - (tam_ / 2), ini, tam_, tam_));
                                    ini += 2 * tam_;
                                }

                                // Pausa jugador 1
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(bot_pausa1.X, bot_pausa1.Y, 90, 30));
                                // Pausa jugador 2
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(bot_pausa2.X, bot_pausa2.Y, 90, 30));
                                // Reiniciar
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(bot_reiniciar.X, bot_reiniciar.Y, 110, 30));

                                // Ayuda
                                dc.DrawRectangle(Brushes.LightGreen, null, new Rect(bot_ayuda.X, bot_ayuda.Y, 40, 30));

                                // Identificacion del Skeleton
                                // El jugador que se encuentre en la mitad derecha controla esa pala y viceversa

                                if (SkeletonPointToScreen(skel.Joints[JointType.Head].Position).X < (RenderWidth / 2))
                                    skeleton_id = 1;
                                else
                                    skeleton_id = 2;

                                if (skeleton_id == 1) // Actualizamos la posicion del jugador 1
                                    pala1.CambiarPos(SkeletonPointToScreen(skel.Joints[JointType.HandRight].Position).Y);

                                if (skeleton_id == 2) // Actualizamos la posicion del jugador 2
                                    pala2.CambiarPos(SkeletonPointToScreen(skel.Joints[JointType.HandRight].Position).Y);

                                // Comprobamos si choca arriba o abajo
                                ChoquePared(ball);

                                // Comprobamos si choca con alguna de las palas de juego
                                ColisionPelota(ball, pala1, pala2);

                                // Comprobamos si algun jugador ha marcado
                                int marcado = PuntoMarcado(ball, pala1, pala2);

                                if (marcado > 0)
                                {
                                    // Actualizamos la puntuacion
                                    if (marcado == 1)
                                    {
                                        jugador1.Marcar();
                                        puntuacionUno.Content = jugador1.GetPuntuacion().ToString();
                                    }

                                    if (marcado == 2)
                                    {
                                        jugador2.Marcar();
                                        puntuacionDos.Content = jugador2.GetPuntuacion().ToString();
                                    }

                                    ball = new Pelota(new Point(RenderHeight / 2, RenderWidth / 2), ball.GetTam());
                                }

                                // Dibujamos las palas de juego
                                pala1.Dibujar(dc);
                                pala2.Dibujar(dc);

                                // Actualizamos la posicion de la pelota
                                ball.ActualizarPos();
                                ball.Dibujar(dc); // La dibujamos

                                // Funcionalidad de los botones
                                // Boton de pausa del jugador 1
                                if (tocaBoton(manoDer, bot_pausa1, new Point(90, 30))) // Toca el boton 'Pausar'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(bot_pausa1.X, bot_pausa1.Y, 90, 30));
                                    if (contando_pau1 == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_pau1 = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 40) <= (frame_act)) // Hemos presionado el boton 'Pausar'
                                        {
                                            id_jug_bot = -1;
                                            if (pausa==true)
                                            {
                                                ball.ActualizarVel(velx, vely);
                                                pausa = false;
                                            }
                                            else
                                            {
                                                ball.ActualizarVel(0.0, 0.0);
                                                velx = ball.GetVel().X;
                                                vely = ball.GetVel().Y;
                                                pausa = true;
                                            }
                                            contando_pau1 = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_pau1) contando_pau1 = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_pau1 = false;
                                    }
                                }

                                // Boton de pausa del jugador 2
                                if (tocaBoton(manoDer, bot_pausa2, new Point(90, 30))) // Toca el boton 'Pausar'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(bot_pausa2.X, bot_pausa2.Y, 90, 30));
                                    if (contando_pau2 == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_pau2 = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 40) <= (frame_act)) // Hemos presionado el boton 'Pausar'
                                        {
                                            id_jug_bot = -1;
                                            if (pausa==true)
                                            {
                                                ball.ActualizarVel(velx, velx);
                                                pausa = false;
                                            }
                                            else
                                            {
                                                ball.ActualizarVel(0.0, 0.0);
                                                velx = ball.GetVel().X;
                                                vely = ball.GetVel().Y;
                                                pausa = true;
                                            }
                                            contando_pau2 = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_pau2) contando_pau2 = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_pau2 = false;
                                    }
                                }

                                // Boton de reinicio
                                if (tocaBoton(manoDer, bot_reiniciar, new Point(110, 30))) // Toca el boton 'Reiniciar'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(bot_reiniciar.X, bot_reiniciar.Y, 110, 30));
                                    if (contando_rei == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_rei = true;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 60) <= (frame_act)) // Hemos presionado el boton 'Reiniciar'
                                        {
                                            id_jug_bot = -1;
                                            jugador1 = new Jugador();
                                            jugador2 = new Jugador();
                                            puntuacionUno.Content = jugador1.GetPuntuacion().ToString();
                                            puntuacionDos.Content = jugador2.GetPuntuacion().ToString();
                                            ball = new Pelota(new Point(RenderHeight/2, RenderWidth/2), ball.GetTam());
                                            contando_rei = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_rei) contando_rei = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_rei = false;
                                    }
                                }

                                // Boton de ayuda
                                if (tocaBoton(manoDer, bot_ayuda, new Point(40, 30))) // Toca el boton 'Ayuda'
                                {
                                    dc.DrawRectangle(Brushes.Green, null, new Rect(bot_ayuda.X, bot_ayuda.Y, 40, 30));
                                    if (contando_ayu == false)
                                    {
                                        id_jug_bot = skel.TrackingId;
                                        contando_ayu = true;
                                        volver.Visibility = System.Windows.Visibility.Visible;
                                        frame_ini = frame_act;
                                    }
                                    else
                                    {
                                        if ((frame_ini + 30) <= (frame_act)) // Hemos presionado el boton 'Ayuda'
                                        {
                                            id_jug_bot = -1;
                                            jugador1 = new Jugador();
                                            jugador2 = new Jugador();
                                            puntuacionUno.Content = jugador1.GetPuntuacion().ToString();
                                            puntuacionDos.Content = jugador2.GetPuntuacion().ToString();
                                            ball = new Pelota(new Point(RenderWidth / 2, RenderHeight / 2), ball.GetTam());
                                            volver.Visibility = System.Windows.Visibility.Hidden;
                                            etapa = 0;
                                            contando_ayu = false;

                                        }
                                    }
                                }
                                else
                                {
                                    if ((id_jug_bot != skel.TrackingId) && contando_ayu) contando_ayu = true;
                                    else
                                    {
                                        id_jug_bot = -1;
                                        contando_ayu = false;
                                        volver.Visibility = System.Windows.Visibility.Hidden;
                                    }
                                }

                            }

                            // Dibujamos la mano por encima de todo lo demas
                            dc.DrawEllipse(Brushes.Black, null, SkeletonPointToScreen(skel.Joints[JointType.HandRight].Position), 10, 10);

                        }
                        else if (skel.TrackingState == SkeletonTrackingState.PositionOnly)
                        {
                            dc.DrawEllipse(Brushes.Black, null, SkeletonPointToScreen(skel.Joints[JointType.HandRight].Position), 10, 10);
                        }
                    }
                }

                // prevent drawing outside of our render area
                this.drawingGroup.ClipGeometry = new RectangleGeometry(new Rect(0.0, 0.0, RenderWidth, RenderHeight));
            }
        }
Ejemplo n.º 26
0
 public static void updateJugador_plantelActual(Jugador jugador)
 {
     try
     {
         PlantelDAL.updateJugador_plantelActual(jugador);
     }
     catch (SportingException spEx)
     {
         throw spEx;
     }
     catch (PathImgEmptyException imgEx)
     {
         throw imgEx;
     }
     catch (Exception e)
     {
         throw new SportingException("Error al modificar un jugador." + e.Message);
     }
 }
Ejemplo n.º 27
0
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                Jugador jugador = new Jugador();
                try
                {
                    jugador.NombreApellido = txtNomApe.Text;
                    jugador.Posicion = txtPosicion.Text;
                    imageToSaveInDB = (Imagen)Session[sessionVar_imageToSaveInDB];
                    jugador.Foto = imageToSaveInDB;

                    if (txtId.Text.CompareTo("") != 0)
                    {
                        //Modifico un jugador existente
                        jugador.IdJugador = Convert.ToInt32(txtId.Text);
                        GestorPlantel.updateJugador_plantelActual(jugador);
                        setSuccessColorOutput(true);
                        lblOutput.Text = "Jugador actualizado con éxito!";
                    }
                    else
                    {
                        //Guardo el nuevo jugador
                        GestorPlantel.registrarJugador_plantelActual(jugador);
                        setSuccessColorOutput(true);
                        lblOutput.Text = "Jugador registrado con éxito!";
                    }
                    /* No limpio los paths de las imagenes en el limpiarCampos() porque el limpiarCampos()
                     * se ejecuta en el load y la variable session no se tiene que limpiar ahi.*/
                    Session[sessionVar_imageToSaveInDB] = new Imagen();
                    cargarJugadores();
                    limpiarCampos();
                    grillaJugadores.SelectedIndex = -1;
                }
                catch (PathImgEmptyException imgEx)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = imgEx.Message;
                }
                catch (SportingException spEx)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = spEx.Message;
                }
                catch (Exception ex)
                {
                    setSuccessColorOutput(false);
                    lblOutput.Text = ex.Message;
                }
            }
            else
            {
                lblOutput.Text = "Error al registrar el jugador.";
            }
        }
Ejemplo n.º 28
0
 public CalificacionPendiente(Partido unPartido, Jugador unJugador)
 {
     partido = unPartido;
     jugador = unJugador;
 }
Ejemplo n.º 29
0
    public void TryShotResult(ShotResult shotResult)
    {
        bool playingGoalkeeper = GameplayService.IsGoalkeeper();

        if (playingGoalkeeper)
        {
            Habilidades.EndRound(shotResult.Result == Result.Goal);
        }

        if (!GameplayService.networked)
        {
            if (!playingGoalkeeper)
            {
                if (shotResult.Result == Result.Goal || shotResult.Result == Result.Target)
                {
                    if (shotResult.Perfect && attempts < maxAttempts)
                    {
                        GeneralSounds.instance.vidaExtra();
                        kickEffects.instance.ExtraLife(shotResult.Point);
                        this.attempts++;
                        if (Habilidades.IsActiveSkill(Habilidades.Skills.VIP) && (attempts < maxAttempts))
                        {
                            this.attempts++;
                            kickEffects.instance.ExtraLife(shotResult.Point + (Vector3.up * -1f));
                        }
                    }

                    /*if (this.attempts >= maxAttempts && shotResult.Perfect)
                     * {
                     * if (perfects > 1 || Habilidades.IsActiveSkill(Habilidades.Skills.VIP))
                     * {
                     *    if (this.attempts != 3)
                     *    {
                     *      GeneralSounds.instance.vidaExtra();
                     *      kickEffects.instance.ExtraLife(shotResult.Point);
                     *      this.attempts = 3;
                     *    }
                     * }
                     * }
                     * if(this.attempts < maxAttempts) this.attempts = maxAttempts;*/
                }
                else
                {
                    ShotFailed();
                }
            }
            else
            {
                if (shotResult.Result == Result.Goal)
                {
                    ShotFailed();
                }
                else
                {
                    if (shotResult.Perfect && attempts < maxAttempts)
                    {
                        GeneralSounds.instance.vidaExtra();
                        kickEffects.instance.ExtraLife(shotResult.Point);
                        this.attempts++;
                        if (Habilidades.IsActiveSkill(Habilidades.Skills.VIP) && (attempts < maxAttempts))
                        {
                            this.attempts++;
                            kickEffects.instance.ExtraLife(shotResult.Point + (Vector3.up * -0.5f));
                        }
                    }
                    //else if (this.attempts < maxAttempts && shotResult.Result != Result.OutOfBounds) this.attempts = maxAttempts;
                }
            }

            SumarDineroPorPrimas();
        }
        else if (GameplayService.networked)
        {
            bool isPlayer1 = GameplayService.initialGameMode != GameMode.Shooter;

            if (playingGoalkeeper)
            {
                cntPastillaMultiplayer.marcadorRemoto.Lanzamientos++;
            }
            else
            {
                cntPastillaMultiplayer.marcadorLocal.Lanzamientos++;
            }

            if (newState)
            {
                Debug.Log("APPLYING");
                cntPastillaMultiplayer.marcadorLocal.SetEstado(GetSimpleState(serverState, isPlayer1));
                cntPastillaMultiplayer.marcadorRemoto.SetEstado(GetSimpleState(serverState, !isPlayer1));
                newState = false;
            }
            else
            {
                Debug.Log("CALCULATING");
                MatchState tempstate = serverState;
                if ((isPlayer1 == playingGoalkeeper))
                {
                    tempstate.rounds++;
                }
                if (playingGoalkeeper)
                {
                    MatchStateSimple state = cntPastillaMultiplayer.marcadorRemoto.AddResult(shotResult.Result == Result.Goal);
                    if (isPlayer1)
                    {
                        tempstate.marker_2 = state.marker;
                        tempstate.score_2  = state.score;
                    }
                    else
                    {
                        tempstate.marker_1 = state.marker;
                        tempstate.score_1  = state.score;
                    }
                }
                else
                {
                    MatchStateSimple stateF = cntPastillaMultiplayer.marcadorLocal.AddResult(shotResult.Result == Result.Goal);
                    if (isPlayer1)
                    {
                        tempstate.marker_1 = stateF.marker;
                        tempstate.score_1  = stateF.score;
                    }
                    else
                    {
                        tempstate.marker_2 = stateF.marker;
                        tempstate.score_2  = stateF.score;
                    }
                }
                serverState = tempstate;

                if (!playingGoalkeeper)
                {
                    Debug.Log("SENDING");
                    MsgSendState msg = Shark.instance.mensaje <MsgSendState>();
                    msg.state   = tempstate;
                    msg.defense = MsgDefend.ToDefenseInfoNet(Vector3.zero, shotResult.DefenseResult);
                    msg.send();
                }
                newState = false;
            }

            if (isPlayer1 == playingGoalkeeper)                                           //fin de ronda
            {
                if (serverState.rounds > 4 && serverState.score_1 != serverState.score_2) //fin de partida
                {
                    gameOver = true;

                    bool winner  = isPlayer1 ? (serverState.score_1 > serverState.score_2) : (serverState.score_2 > serverState.score_1);
                    bool perfect = isPlayer1 ? (serverState.score_2 == 0) : (serverState.score_1 == 0);
                    perfect = perfect && (isPlayer1 ? (serverState.score_1 >= 5) : (serverState.score_2 >= 5));

                    if (winner)
                    {
                        Interfaz.MonedasSoft += recompensaMultijugadorWin;
                    }
                    else
                    {
                        Interfaz.MonedasSoft += recompensaMultijugadorFail;
                    }

                    PersistenciaManager.instance.GuardarPartidaMultiPlayer(winner, perfect);
                }
            }
        }

        int points = shotResult.ScorePoints + shotResult.EffectBonusPoints;

        // actualizar la informacion de cada ronda
        RoundInfoManager.instance.AcumularRonda(shotResult.Result, points, shotResult.Perfect);//, GameplayService.IsGoalkeeper() ? (shotResult.DefenseResult == GKResult.Perfect) : (shotResult.Perfect));

        // acumular la recompensa
        // DINERO! MONEDAS!
        int monedas = Mathf.FloorToInt((float)points * DifficultyService.GetRatioRecompensa());

        Interfaz.recompensaAcumulada += monedas;
        Interfaz.MonedasSoft         += monedas;


        if (gameOver && !GameplayService.networked)
        {
            //ifcGameOver.instance.resultTime = FieldControl.instance.seconds;
            Mission mission = MissionManager.instance.GetMission();
            if (attempts > 0)
            {
                // persistir la mision que se acaba de superar
                PersistenciaManager.instance.ActualizarUltimoNivelDesbloqueado(mission.indexMision + 1);


                // comprobar si la en mision que se acaba de superar desbloquea algun jugador
                Jugador jugadorDesbloqueado = InfoJugadores.instance.GetJugadorDesbloqueableEnFase(mission.indexMision);
                if (jugadorDesbloqueado != null)
                {
                    // registrar el dialogo para mostrar el aviso de que se ha obtenido un nuevo jugador y actualizar su estado
                    jugadorDesbloqueado.estado = Jugador.Estado.DISPONIBLE;
                    DialogManager.instance.RegistrarDialogo(new DialogDefinition(DialogDefinition.TipoDialogo.JUGADOR_DESBLOQUEADO, jugadorDesbloqueado));
                }

                // comprobar si en la mision que se acaba de superar se desbloquea alguna equipacion
                Equipacion equipacionDesbloqueada = EquipacionManager.instance.GetEquipacionDesbloqueableEnFase(mission.indexMision);
                if (equipacionDesbloqueada != null)
                {
                    // registrar el dialogo para mostrar el aviso de que se ha obtenido una nueva equipacion y actualizar su estado
                    equipacionDesbloqueada.estado = Equipacion.Estado.DISPONIBLE;
                    DialogManager.instance.RegistrarDialogo(new DialogDefinition(DialogDefinition.TipoDialogo.EQUIPACION_DESBLOQUEADA, equipacionDesbloqueada));
                }

                // comprobar si en la mision que se acaba de superar se ha desbloqueado algun escudo
                Debug.Log(">>> Compruebo escudo => fase ");
                Escudo escudoDesbloqueado = EscudosManager.instance.GetEscudoDesbloqueableEnFase(mission.indexMision);
                if (escudoDesbloqueado != null)
                {
                    // registrar el dialogo para mostrar el aviso de que se ha obtenido un nuevo escudo y desbloquearlo
                    escudoDesbloqueado.bloqueado = false;
                    DialogManager.instance.RegistrarDialogo(new DialogDefinition(DialogDefinition.TipoDialogo.ESCUDO_DESBLOQUEADO, escudoDesbloqueado));
                }
            }
        }

        if (firstShot)
        {
            firstShot = false;
        }
        UpdateEvent();
    }
Ejemplo n.º 30
0
 public bool BorrarJugador(Jugador jugador)
 {
     _bd.Jugador.Remove(jugador);
     return(Guardar());
 }
        private static ModelVisual3D DrawMano(Jugador jugador, Dimensiones dimMano, Brush brush)
        {
            Point3D p0 = new Point3D(0, 0, 0);
            Point3D p1 = new Point3D(dimMano.Ancho, 0, 0);
            Point3D p2 = new Point3D(dimMano.Ancho, 0, dimMano.Profundidad);
            Point3D p3 = new Point3D(0, 0, dimMano.Profundidad);
            Point3D p4 = new Point3D(0, dimMano.Alto, 0);
            Point3D p5 = new Point3D(dimMano.Ancho, dimMano.Alto, 0);
            Point3D p6 = new Point3D(dimMano.Ancho, dimMano.Alto, dimMano.Profundidad);
            Point3D p7 = new Point3D(0, dimMano.Alto, dimMano.Profundidad);
            /*
            //Modelo
            List<Point3D> puntosModelo = new List<Point3D>();
            puntosModelo.Add(p0);
            puntosModelo.Add(p1);
            puntosModelo.Add(p2);
            puntosModelo.Add(p3);
            puntosModelo.Add(p4);
            puntosModelo.Add(p5);
            puntosModelo.Add(p6);
            puntosModelo.Add(p7);

            Model3DGroup manoModel3D = new Model3DGroup();
            manoModel3D.Children.Add(DrawCubeModel(0, puntosModelo, brush));

            ModelVisual3D modelVisual3D = new ModelVisual3D();
            modelVisual3D.Content = manoModel3D;
            return modelVisual3D;
            */

             Model3DGroup cube = new Model3DGroup();
            //front side triangles
            cube.Children.Add(CreateTriangleModel(p3, p2, p6, brush));
            cube.Children.Add(CreateTriangleModel(p3, p6, p7, brush));
            //right side triangles
            cube.Children.Add(CreateTriangleModel(p2, p1, p5, brush));
            cube.Children.Add(CreateTriangleModel(p2, p5, p6, brush));
            //back side triangles
            cube.Children.Add(CreateTriangleModel(p1, p0, p4, brush));
            cube.Children.Add(CreateTriangleModel(p1, p4, p5, brush));
            //left side triangles
            cube.Children.Add(CreateTriangleModel(p0, p3, p7, brush));
            cube.Children.Add(CreateTriangleModel(p0, p7, p4, brush));
            //top side triangles
            cube.Children.Add(CreateTriangleModel(p7, p6, p5, brush));
            cube.Children.Add(CreateTriangleModel(p7, p5, p4, brush));
            //bottom side triangles
            cube.Children.Add(CreateTriangleModel(p2, p3, p0, brush));
            cube.Children.Add(CreateTriangleModel(p2, p0, p1, brush));

            ModelVisual3D model = new ModelVisual3D();
            model.Content = cube;
            return model;

            /*
            Model3DGroup cube = new Model3DGroup();
            cube.Children.Add(CreateTriangleModel(p2, p1, p0, brush));
            cube.Children.Add(CreateTriangleModel(p2, p0, p3, brush));

            ModelVisual3D model = new ModelVisual3D();
            model.Content = cube;
            return model;*/
        }
Ejemplo n.º 32
0
 public bool CrearJugador(Jugador jugador)
 {
     _bd.Jugador.Add(jugador);
     return(Guardar());
 }
Ejemplo n.º 33
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Jugador auxJugador = new Jugador(this.txtNombre.Text, this.txtApellido.Text, ((Jugador.EPuesto) this.cboPuesto.SelectedItem)); /*Se castea el tercer parametro ya que lo que se toma del ComboBox es un string.*/

            #region "Manejo de archivos con StreamWriter y Stream Writter

            /*StreamWriter tambien cuenta con varios constructores...
             * StreamWriter auxGuardado = new StreamWriter(@"D:\jugadores.txt"); //En este constructor solo recibe la ruta del archivo
             *
             * StreamWriter auxGuardado = new StreamWriter(@"D:\jugadores.txt", true); el boolean es para el modo append, permitiendo añadir contenido en lugar de sobreescribirlo, en este caso requeiria estructura repetitiva
             *
             * Para las rutas de archivo hay ciertos aspectos importantes...
             * "\" dará error porque es un caracter de escape, se puede arreglar con "\\"(no recomendado), "/"(no recomendado) o anteponiendo el "@" previo a la comilla de apertura (recomendado).
             *
             * auxGuardado.WriteLine(auxJugador.ToString()); //Se escribe la linea dentro del archivo (tambien hay .Write()).
             * auxGuardado.Close(); //Siempre se cierra el archivo al terminar de escribir Ó leer, para evitar errores.
             *
             * StreamReader, tiene varios constructores...
             *
             * StreamReader auxLectura = new StreamReader(@"D:\jugadores.txt"); //En este constructor solo recibe la ruta del archivo
             * MessageBox.Show("Jugador Abierto\n" + auxLectura.ReadToEnd()); //Mostrar el contenido de la linea.
             *
             * while ((linea = auxLectura.ReadLine()) != null) //Si el metodo de Leer una linea y asignarla a la variable fue diferente de Null (lo cual da error)...
             * { MessageBox.Show("Jugador Abierto\n" + linea); } //Mostrar el contenido de la linea.
             *
             * auxLectura.Close(); //Siempre se cierra el archivo al terminar de escribir Ó leer, para evitar errores. */
            #endregion

            #region "Metodo estatico con rutas hardcodeadas"

            /* Una forma de escribir y leer archivo es hardcodear una ruta especifica
             * Usar cualquiera de estas funciona, pero provoca fallos ya que nunca se sabe si la pc que ejecutará el programa cuenta con un disco D, por ejemplo, o si el nombre de usuario es "alumno".
             *
             * Esto escribirá un texto en la ruta especificada, ademas de decir si se añadira a lo escrito anterior mente o se sobreescribirá por completo.
             * AdministradorDeArchivos.Escribir(@"D:\jugadores.txt", auxJugador.ToString(), true);
             * Admin istradorDeArchivos.Escribir(@"C:\Users\alumno\Desktop\jugador.txt", auxJugador.ToString(), true);
             *
             * Esto leera la el archivo de principio a fin y lo almacenará en la variable auxLinea
             * string auxLinea = "";
             * AdministradorDeArchivos.Leer(@"D:\jugadores.txt", out auxLinea); */
            #endregion

            if (this.saveFileDialog1.ShowDialog() == DialogResult.OK) //Sí el usuario seleccionó un archivo y opimió "abrir" dentro de la instancia de SaveFileDialog...
            {
                try
                {
                    string path = "";

                    #region "Carpeta Generica"

                    /*Otra forma es hardcodear una carpeta especifica dentro de las carpetas genericas de windows
                     * path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\jugador.txt"; //Enviroment.SpecialFolder obtiene la ruta del la carpeta elegida en el enumerado, luego se le agrega el nombre del archivo*/
                    #endregion

                    /*Pero la mejor, regularmente, es permitir al propio usuario elegir un archivo cualquiera del directorio que prefiera, utilizando el SaveDialogFile y su atributo de FileNames[0] o FileName. */
                    path = this.saveFileDialog1.FileNames[0];
                    if (AdministradorDeArchivos.Escribir(path, auxJugador.ToString(), true) == true) //Si se pudo escribir en el archivo correctamente...
                    {
                        try                                                                          //Intentar...
                        {
                            string linea = "";                                                       //Auxiliar que se usará como "out" del AdministradorDeArchivos.Leer(), si funciona correctamente, se almacenará todo lo leido del archivo de principio a fin.

                            if (AdministradorDeArchivos.Leer(path, out linea))                       /*Si se pudo leer el archivo correctamente (tomará el true o false que devuelve el metodo)...*/
                            {
                                MessageBox.Show("Jugador Abierto\n" + linea);                        /*Muestra el contenido de la variable dentro de un MessageBox*/
                            }
                        }
                        catch (Exception exception) /*Si capta una excepción de cualquier tipo...*/
                        { throw exception; } /* La vuelve a lanzar ya que no será tratada aquí */
                    }
                }
                catch (Exception exception) /*Si capta una excepción de cualquier tipo...*/
                { MessageBox.Show("Se ha producido un error\n" + exception.Message); /*Avisa que se ha producido un error y da detalles del mismo */ }
            }
            else
            {
                MessageBox.Show("Se ha producido un error al seleccionar archivo. Intente de nuevo");
            }
        }
Ejemplo n.º 34
0
        private bool VerificarExiste(Jugador jugador)
        {
            bool existe = _juego.JugadoresRegistrados.Exists(j => j.Usuario.ToLower() == jugador.Usuario.ToLower());

            return(existe);
        }
Ejemplo n.º 35
0
 public ActionResult Put([FromBody] Jugador jugador)
 {
     return(Ok(jugadorService.Update(jugador)));
 }
 public ActionResult Modificar(Jugador j)
 {
     Jugadores.Modificar(j);
     return(RedirectToAction("Lista"));
 }
Ejemplo n.º 37
0
 public void AgregarJugador(Jugador j)
 {
     repositorio.Agregar(j);
 }
Ejemplo n.º 38
0
        public bool cargarDatos(string url)
        {
            try
            {
                XmlTextReader reader    = new XmlTextReader(url);
                string        anterior  = "";
                long          id_equipo = 0;
                long          id_torneo = 0;
                while (reader.Read())
                {
                    switch (reader.NodeType)
                    {
                    case XmlNodeType.Element:     // The node is an element.
                        switch (reader.Name)
                        {
                        case "campeonato":
                            anterior = "campeonato";
                            break;

                        case "nombre":
                            anterior = "nombre";
                            break;

                        case "equipo":
                            anterior = "equipo";
                            break;

                        case "nombreEquipo":
                            anterior = "nombreEquipo";
                            break;

                        case "jugador":
                            anterior = "jugador";
                            break;
                        }
                        break;

                    case XmlNodeType.Text:     //Display the text in each element.
                        switch (anterior)
                        {
                        case "campeonato":
                            break;

                        case "nombre":
                            Torneo newTorneo = new Torneo
                            {
                                nombre     = reader.Value,
                                id_ganador = ""
                            };
                            db.Torneo.Add(newTorneo);
                            db.SaveChanges();
                            id_torneo       = newTorneo.id_torneo;
                            TorneoModificar = newTorneo;
                            break;

                        case "equipo":
                            break;

                        case "nombreEquipo":
                            Equipo newEquipo = new Equipo {
                                nombre = reader.Value
                            };
                            db.Equipo.Add(newEquipo);
                            db.SaveChanges();
                            id_equipo = newEquipo.id_equipo;
                            Equipo_Torneo newEquipTorneo = new Equipo_Torneo {
                                id_equipo = id_equipo,
                                id_torneo = id_torneo,
                                Torneo    = db.Torneo.FirstOrDefault(e => e.id_torneo == id_torneo),
                                Equipo    = db.Equipo.FirstOrDefault(e => e.id_equipo == id_equipo)
                            };
                            db.Equipo_Torneo.Add(newEquipTorneo);
                            db.SaveChanges();
                            TorneoModificar.Equipo_Torneo.Add(newEquipTorneo);
                            newEquipo.Equipo_Torneo.Add(newEquipTorneo);
                            db.Entry(TorneoModificar).State = EntityState.Modified;
                            db.Entry(newEquipo).State       = EntityState.Modified;
                            db.SaveChanges();
                            break;

                        case "jugador":
                            Equipo_Jugador newObject = new Equipo_Jugador {
                                puntos     = 0,
                                id_equipo  = id_equipo,
                                id_usuario = reader.Value,
                                Jugador    = db.Jugador.FirstOrDefault(e => e.id_usuario == reader.Value),
                                Equipo     = db.Equipo.FirstOrDefault(e => e.id_equipo == id_equipo)
                            };
                            db.Equipo_Jugador.Add(newObject);
                            db.SaveChanges();
                            Jugador jug = db.Jugador.FirstOrDefault(e => e.id_usuario == reader.Value);
                            jug.Equipo_Jugador.Add(newObject);
                            Equipo equipo = db.Equipo.FirstOrDefault(e => e.id_equipo == id_equipo);
                            equipo.Equipo_Jugador.Add(newObject);
                            db.Entry(jug).State    = EntityState.Modified;
                            db.Entry(equipo).State = EntityState.Modified;
                            db.SaveChanges();
                            break;
                        }
                        break;

                    case XmlNodeType.EndElement:     //Display the end of the element.
                        switch (reader.Name)
                        {
                        case "campeonato":
                            break;

                        case "nombre":
                            break;

                        case "equipo":
                            break;

                        case "nombreEquipo":
                            break;

                        case "jugador":
                            break;
                        }
                        break;
                    }
                }
                crearPartidas(TorneoModificar.id_torneo);
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Ejemplo n.º 39
0
    public static void updateJugador_plantelActual(Jugador jugador)
    {
        OdbcConnection conexion = null;
        OdbcCommand cmd = null;
        try
        {
            if (jugador == null)
            {
                throw new SportingException("Error al modificar jugador. Jugador sin información.");
            }
            if (jugador.Foto == null || jugador.Foto.PathSmall == "")
            {
                throw new PathImgEmptyException("Error al modificar jugador. El jugador no posee foto.");
            }
            conexion = ConexionBD.ObtenerConexion();

            //Actualizo los datos del jugador
            String updateJugador = "UPDATE jugador set nombreApellido='" + jugador.NombreApellido +
                                    "', posicion = '" + jugador.Posicion + "' WHERE id = " +
                                    jugador.IdJugador.ToString();
            cmd = new OdbcCommand(updateJugador, conexion);
            cmd.ExecuteNonQuery();

            //Actualizo los datos de la foto del jugador
            Imagen foto = jugador.Foto;
            String updateFoto = "UPDATE imagen set pathBig='" + foto.PathBig +
                                "', pathSmall='" + foto.PathSmall + "' WHERE idJugador = " +
                                jugador.IdJugador.ToString();
            cmd = new OdbcCommand(updateFoto, conexion);
            cmd.ExecuteNonQuery();

            conexion.Close();
        }
        catch (Exception e)
        {
            throw e;
        }
        finally
        {
            cmd.Connection.Close();
        }
    }
Ejemplo n.º 40
0
        //ESTADO INICIAL JUGADOR

        public void inicializarJugador(Jugador j)
        {
            var    mapas = builder.getMapaNodeHandler().getAllMapas();
            Random rnd   = new Random();

            int[]   nivel   = { -1, -1, -1, -1, -1 };
            int     i       = 0;
            string  coord   = "";
            string  c       = "/";
            Boolean hayMapa = true;

            do
            {
                i     = 0;
                coord = "";
                c     = "/";
                foreach (var m in mapas)
                {
                    nivel[i] = rnd.Next(1, m.cantidad + 1);
                    coord   += c;
                    c        = nivel[i] + "/";
                    i++;
                }
                hayMapa = builder.getRelJugadorMapaHandler().existeColonia(nivel[0], nivel[1], nivel[2], nivel[3], nivel[4]);
            } while (hayMapa == true);

            var reljm = new RelJugadorMapa(1, nivel[0], nivel[1], nivel[2], nivel[3], nivel[4], coord, j);

            builder.getRelJugadorMapaHandler().createRelJugadorMapa(reljm);

            List <RelJugadorMapa> colonias = builder.getRelJugadorMapaHandler().getMapasByJugador(j.id);
            var colonia = colonias.First();

            var ahora = DateTime.Now;

            List <Recurso> recursos = builder.getRecursoHandler().getAllRecursos();

            foreach (var rec in recursos)
            {
                var rel = new RelJugadorRecurso(1, rec, colonia, rec.capacidadInicial, rec.cantInicial, rec.produccionXTiempo, ahora);
                builder.getRelJugadorRecursoHandler().createRelJugadorRecurso(rel);
            }

            List <Edificio> edificios = builder.getUnidadHandler().getAllEdificios();

            foreach (var ed in edificios)
            {
                var rel = new RelJugadorEdificio(1, colonia, ed, 0, ahora);
                builder.getRelJugadorEdificioHandler().createRelJugadorEdificio(rel);
            }

            List <Destacamento> destacamentos = builder.getUnidadHandler().getAllDestacamentos();

            foreach (var des in destacamentos)
            {
                var rel = new RelJugadorDestacamento(1, colonia, des, 0, ahora);
                builder.getRelJugadorDestacamentoHandler().createRelJugadorDestacamento(rel);
            }

            List <Investigacion> investigaciones = builder.getInvestigacionHandler().getAllInvestigaciones();

            foreach (var inv in investigaciones)
            {
                var rel = new RelJugadorInvestigacion(1, colonia, inv, 0, ahora);
                builder.getRelJugadorInvestigacionHandler().createRelJugadorInvestigacion(rel);
            }
        }
Ejemplo n.º 41
0
        public bool IntentoMoverme(Jugador j, int x, int y)
        {
            foreach (Jugador jug in jugadores)
            {
                if (jug.X == x && jug.Y == y)
                {
                    return false;
                }
            }

            if (celdas[x][y] == TypeCelda.Pasillo)
            {
                return true;
            }
            else if (celdas[x][y] == TypeCelda.Muro)
            {
                return false;
            }
            else if (celdas[x][y] == TypeCelda.Puerta)
            {
                Puerta p = puertas[new Point(x, y)];
                if (p.Opener == j)
                {
                    return true;
                }
                return false;
            }
            return false;
        }
Ejemplo n.º 42
0
 List<Juegos> IWCFsem.ListarJuegosXJugador(Jugador unJug)
 {
     try
     {
         return (FabricaLogica.GetLogicaJuego().ListarJuegosXJugador(unJug));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 43
0
    public static void LoadData()
    {
        BinaryFormatter formatter = new BinaryFormatter();

        if (Directory.Exists(pathEquipos))
        {
            #region Equipo
            //CARGAR EQUIPOS
            string[] equiposDirectories = Directory.GetDirectories(pathEquipos);

            for (int i = 0; i < equiposDirectories.Length; i++)
            {
                //PATH DE UN EQUIPO
                string pathEquipo = equiposDirectories[i];

                FileStream     equipoStream = new FileStream(pathEquipo + "/equipo.txt", FileMode.Open);
                SaveDataEquipo dataEquipo   = (SaveDataEquipo)formatter.Deserialize(equipoStream);

                //CREAR EL EQUIPO
                Equipo equipo = new Equipo(dataEquipo);

                equipoStream.Close();

                #region Jugadores
                //CARGAR JUGADORES
                string pathJugadores = pathEquipo + "/jugadores";

                if (Directory.Exists(pathJugadores))
                {
                    string[] jugadoresDirectories = Directory.GetDirectories(pathJugadores);

                    foreach (var jugadorDir in jugadoresDirectories)
                    {
                        FileStream      streamJugador = new FileStream(jugadorDir + "/jugador.txt", FileMode.Open);
                        SaveDataJugador dataJugador   = (SaveDataJugador)formatter.Deserialize(streamJugador);

                        Jugador jugador = new Jugador(dataJugador);

                        streamJugador.Close();

                        #region Estadisticas globales jugadores
                        //CARGAR ESTADISTICAS GLOBALES
                        if (File.Exists(jugadorDir + "/estGlobalPartido.txt"))
                        {
                            FileStream           estPartidoStream = new FileStream(jugadorDir + "/estGlobalPartido.txt", FileMode.Open);
                            SaveDataEstadisticas dataEstPartido   = (SaveDataEstadisticas)formatter.Deserialize(estPartidoStream);
                            jugador.CargarEstadisticasGlobalesPartido(new Estadisticas(dataEstPartido));
                            estPartidoStream.Close();
                        }
                        if (File.Exists(jugadorDir + "/estGlobalPractica.txt"))
                        {
                            FileStream           estPracticaStream = new FileStream(jugadorDir + "/estGlobalPractica.txt", FileMode.Open);
                            SaveDataEstadisticas dataEstPractica   = (SaveDataEstadisticas)formatter.Deserialize(estPracticaStream);
                            jugador.CargarEstadisticasGlobalesPractica(new Estadisticas(dataEstPractica));
                            estPracticaStream.Close();
                        }
                        #endregion

                        #region Partidos jugadores
                        //CARGAR PARTIDOS
                        if (Directory.Exists(jugadorDir + "/partidos"))
                        {
                            string pathPartidos = jugadorDir + "/partidos";

                            string[] partidosDirectories = Directory.GetDirectories(pathPartidos);

                            foreach (var partidoDir in partidosDirectories)
                            {
                                //string pathPartido = pathPartidos + partidoDir;

                                FileStream      streamPartido = new FileStream(partidoDir + "/partido.txt", FileMode.Open);
                                SaveDataPartido dataPartido   = (SaveDataPartido)formatter.Deserialize(streamPartido);

                                FileStream streamPosicion = new FileStream(partidoDir + "/posicion.txt", FileMode.Open);
                                string     dataPosicion   = (string)formatter.Deserialize(streamPosicion);

                                FileStream           streamEstadisticas = new FileStream(partidoDir + "/estadisticas.txt", FileMode.Open);
                                SaveDataEstadisticas dataEstadisticas   = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas);

                                FileStream streamResultado = new FileStream(partidoDir + "/resultado.txt", FileMode.Open);

                                Partido _partido = new Partido(dataPartido, dataEstadisticas, jugador, dataPosicion);

                                if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley)
                                {
                                    SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado);
                                    ResultadoSets         _res           = new ResultadoSets(resPartidoSets);
                                    _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets);
                                }
                                else
                                {
                                    SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado);
                                    ResultadoNormal         _res             = new ResultadoNormal(resPartidoNormal);
                                    _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal);
                                }

                                jugador.CargarPartido(_partido);

                                streamPartido.Close();
                                streamEstadisticas.Close();
                            }
                        }
                        #endregion

                        #region Practicas jugadores
                        //CARGAR PRACTICAS
                        if (Directory.Exists(jugadorDir + "/practicas"))
                        {
                            string pathPracticas = jugadorDir + "/practicas";

                            string[] practicasDirectories = Directory.GetDirectories(pathPracticas);

                            foreach (var practicaDir in practicasDirectories)
                            {
                                //string pathPractica = pathPracticas + practicaDir;

                                FileStream      streamPractica = new FileStream(practicaDir + "/partido.txt", FileMode.Open);
                                SaveDataPartido dataPractica   = (SaveDataPartido)formatter.Deserialize(streamPractica);

                                FileStream streamPosicion = new FileStream(practicaDir + "/posicion.txt", FileMode.Open);
                                string     dataPosicion   = (string)formatter.Deserialize(streamPosicion);
                                Debug.Log("POS LOAD: " + jugador.GetPosicionActual());

                                FileStream           streamEstadisticas = new FileStream(practicaDir + "/estadisticas.txt", FileMode.Open);
                                SaveDataEstadisticas dataEstadisticas   = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas);

                                FileStream streamResultado = new FileStream(practicaDir + "/resultado.txt", FileMode.Open);

                                Partido _partido = new Partido(dataPractica, dataEstadisticas, jugador, dataPosicion);

                                if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley)
                                {
                                    SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado);
                                    ResultadoSets         _res           = new ResultadoSets(resPartidoSets);
                                    _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets);
                                }
                                else
                                {
                                    SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado);
                                    ResultadoNormal         _res             = new ResultadoNormal(resPartidoNormal);
                                    _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal);
                                }

                                jugador.CargarPractica(_partido);

                                streamPractica.Close();
                                streamEstadisticas.Close();
                            }
                        }
                        #endregion
                        equipo.CargarJugador(jugador);
                    }
                }
                #endregion

                #region Jugador Favorito
                string favPlayerPath = pathEquipo + "/favouritePlayer.txt";
                if (File.Exists(favPlayerPath))
                {
                    FileStream streamFavPlayer = new FileStream(favPlayerPath, FileMode.Open);
                    string     jugadorFavorito = (string)formatter.Deserialize(streamFavPlayer);

                    equipo.SetJugadorFavorito(jugadorFavorito);
                }
                #endregion

                #region Estadisticas globales equipo
                //CARGAR ESTADISTICAS GLOBALES
                if (File.Exists(pathEquipo + "/estGlobalPartido.txt"))
                {
                    FileStream           estPartidoStream = new FileStream(pathEquipo + "/estGlobalPartido.txt", FileMode.Open);
                    SaveDataEstadisticas dataEstPartido   = (SaveDataEstadisticas)formatter.Deserialize(estPartidoStream);
                    Estadisticas         est = new Estadisticas(dataEstPartido);
                    equipo.CargarEstadisticasGlobalesPartido(est);
                    estPartidoStream.Close();
                }
                if (File.Exists(pathEquipo + "/estGlobalPractica.txt"))
                {
                    FileStream           estPracticaStream = new FileStream(pathEquipo + "/estGlobalPractica.txt", FileMode.Open);
                    SaveDataEstadisticas dataEstPractica   = (SaveDataEstadisticas)formatter.Deserialize(estPracticaStream);
                    equipo.CargarEstadisticasGlobalesPractica(new Estadisticas(dataEstPractica));
                    estPracticaStream.Close();
                }
                #endregion

                #region Partidos equipo
                //CARGAR PARTIDOS
                if (Directory.Exists(pathEquipo + "/partidos"))
                {
                    string pathPartidos = pathEquipo + "/partidos";

                    string[] partidosDirectories = Directory.GetDirectories(pathPartidos);

                    foreach (var partidoDir in partidosDirectories)
                    {
                        //string pathPartido = pathPartidos + partidoDir;

                        FileStream      streamPartido = new FileStream(partidoDir + "/partido.txt", FileMode.Open);
                        SaveDataPartido dataPartido   = (SaveDataPartido)formatter.Deserialize(streamPartido);

                        FileStream           streamEstadisticas = new FileStream(partidoDir + "/estadisticas.txt", FileMode.Open);
                        SaveDataEstadisticas dataEstadisticas   = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas);

                        FileStream streamResultado = new FileStream(partidoDir + "/resultado.txt", FileMode.Open);

                        Partido _partido = new Partido(dataPartido, dataEstadisticas, equipo);

                        if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley)
                        {
                            SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado);
                            ResultadoSets         _res           = new ResultadoSets(resPartidoSets);
                            _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets);
                        }
                        else
                        {
                            SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado);
                            ResultadoNormal         _res             = new ResultadoNormal(resPartidoNormal);
                            _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal);
                        }


                        equipo.CargarPartido(_partido);

                        streamPartido.Close();
                        streamEstadisticas.Close();
                    }
                }
                #endregion

                #region Practica equipo
                //CARGAR PRACTICAS
                if (Directory.Exists(pathEquipo + "/practicas"))
                {
                    string pathPracticas = pathEquipo + "/practicas";

                    string[] practicasDirectories = Directory.GetDirectories(pathPracticas);

                    foreach (var practicaDir in practicasDirectories)
                    {
                        //string pathPractica = pathPracticas + practicaDir;

                        FileStream      streamPractica = new FileStream(practicaDir + "/partido.txt", FileMode.Open);
                        SaveDataPartido dataPractica   = (SaveDataPartido)formatter.Deserialize(streamPractica);

                        FileStream           streamEstadisticas = new FileStream(practicaDir + "/estadisticas.txt", FileMode.Open);
                        SaveDataEstadisticas dataEstadisticas   = (SaveDataEstadisticas)formatter.Deserialize(streamEstadisticas);

                        FileStream streamResultado = new FileStream(practicaDir + "/resultado.txt", FileMode.Open);

                        Partido _partido = new Partido(dataPractica, dataEstadisticas, equipo);

                        if (equipo.GetDeporte() == Deportes.DeporteEnum.Tenis || equipo.GetDeporte() == Deportes.DeporteEnum.Padel || equipo.GetDeporte() == Deportes.DeporteEnum.Voley)
                        {
                            SaveDataResultadoSets resPartidoSets = (SaveDataResultadoSets)formatter.Deserialize(streamResultado);
                            ResultadoSets         _res           = new ResultadoSets(resPartidoSets);
                            _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Sets);
                        }
                        else
                        {
                            SaveDataResultadoNormal resPartidoNormal = (SaveDataResultadoNormal)formatter.Deserialize(streamResultado);
                            ResultadoNormal         _res             = new ResultadoNormal(resPartidoNormal);
                            _partido.AgregarResultadoEntradaDatos(_res, Partido.TipoResultadoPartido.Normal);
                        }

                        equipo.CargarPractica(_partido);

                        streamPractica.Close();
                        streamEstadisticas.Close();
                    }
                }
                #endregion
                #endregion



                #region Planillas
                //CARGAR PLANILLAS
                string pathPlanillas = pathEquipos + equipo.GetNombre() + "/planillas";

                if (Directory.Exists(pathPlanillas))
                {
                    string[] planillasDirectories = Directory.GetDirectories(pathPlanillas);            //Vector de Carpetas de Planillas

                    for (int j = 0; j < planillasDirectories.Length; j++)                               //Para cada carpeta de planillas
                    {
                        string pathPlanillaAsistencia = Directory.GetFiles(planillasDirectories[j])[0]; //Obtengo la dirección de la carpeta actual

                        FileStream streamPlanillaAsistencia = new FileStream(pathPlanillaAsistencia, FileMode.Open);
                        SaveDataPlanillaAsistencia dataPlanillaAsistencia = (SaveDataPlanillaAsistencia)formatter.Deserialize(streamPlanillaAsistencia);

                        equipo.AgregarPlanillaAsistencia(dataPlanillaAsistencia);

                        string[] detallesFiles = Directory.GetFiles(planillasDirectories[j] + "/Detalles"); //Vector de todos los detalles en la carpeta actual

                        for (int k = 0; k < detallesFiles.Length; k++)                                      //Para cada detalle
                        {
                            FileStream streamDetalles = new FileStream(detallesFiles[k], FileMode.Open);

                            SaveDataPlanilla dataDetalle = (SaveDataPlanilla)formatter.Deserialize(streamDetalles);

                            //Agregar la Planilla al Equipo
                            equipo.AgregarDetalle(new DetalleAsistencia(dataDetalle), dataDetalle.GetNombrePlanilla());

                            streamDetalles.Close();
                        }
                    }
                }
                #endregion

                //Agregar Equipo a la lista de Equipos
                AppController.instance.AgregarEquipo(equipo);
            }
        }

        #region Jugadas
        //Cargar imagenes
        if (Directory.Exists(pathImagenJugadas))
        {
            //Por cada imagen guardada creo un objeto imagen
            string[] pathsCarpeta = Directory.GetDirectories(pathImagenJugadas);

            for (int i = 0; i < pathsCarpeta.Length; i++)
            {
                string _nombreCarpeta = Path.GetFileName(pathsCarpeta[i]);
                if (_nombreCarpeta == "-")
                {
                    _nombreCarpeta = SaveSystem.carpetaEspecialEspañol;
                }

                CarpetaJugada _carpeta = new CarpetaJugada(_nombreCarpeta);

                string[] pathCarpetasJugadas = Directory.GetDirectories(pathsCarpeta[i]);

                for (int k = 0; k < pathCarpetasJugadas.Length; k++)
                {
                    string[] pathArchivos = Directory.GetFiles(pathCarpetasJugadas[k]);

                    byte[] bytes     = null;
                    string nombre    = string.Empty;
                    string categoria = string.Empty;

                    for (int j = 0; j < pathArchivos.Length; j++)
                    {
                        if (Path.GetExtension(pathArchivos[j]) == ".png")
                        {
                            nombre = Path.GetFileNameWithoutExtension(pathArchivos[j]);

                            bytes = File.ReadAllBytes(pathArchivos[j]);
                        }
                        else
                        {
                            FileStream streamCategoria = new FileStream(pathArchivos[j], FileMode.Open);
                            categoria = (string)formatter.Deserialize(streamCategoria);
                        }
                    }

                    ImagenBiblioteca _imagenBiblioteca = new ImagenBiblioteca(bytes, nombre, categoria, _carpeta);
                    //AppController.instance.AgregarImagen(_imagenBiblioteca);
                    _carpeta.AgregarJugada(_imagenBiblioteca);
                }
                AppController.instance.AgregarCarpetaJugada(_carpeta);
            }

            if (!Directory.Exists(pathImagenJugadas + "-"))
            {
                Directory.CreateDirectory(pathImagenJugadas + "-");
                AppController.instance.AgregarCarpetaJugada(new CarpetaJugada(SaveSystem.carpetaEspecialEspañol));
            }
        }
        else
        {
            Directory.CreateDirectory(pathImagenJugadas + "-");
            AppController.instance.AgregarCarpetaJugada(new CarpetaJugada(SaveSystem.carpetaEspecialEspañol));
        }
        #endregion

        #region Settings
        string settingsPath = Application.persistentDataPath + "/" + SaveSystem.carpetaPrincipal + "/settings.txt";
        if (File.Exists(settingsPath))
        {
            FileStream       streamSettings = new FileStream(settingsPath, FileMode.Open);
            SaveDataSettings dataSettings   = (SaveDataSettings)formatter.Deserialize(streamSettings);

            AppController.instance.SetSettings(dataSettings);
        }

        string equipoFavPath = Application.persistentDataPath + "/" + SaveSystem.carpetaPrincipal + "/favouriteTeam.txt";
        if (File.Exists(equipoFavPath))
        {
            FileStream streamFavTeam  = new FileStream(equipoFavPath, FileMode.Open);
            string     equipoFavorito = (string)formatter.Deserialize(streamFavTeam);

            AppController.instance.SetTeamAsFavourite(equipoFavorito);
        }
        #endregion
    }
Ejemplo n.º 44
0
 public Brush GetPaintColor(Jugador j, int x, int y)
 {
     if (celdas[x][y] == TypeCelda.Muro)
     {
         return Brushes.Brown;
     }
     else if (celdas[x][y] == TypeCelda.Pasillo)
     {
         return Brushes.Khaki;
     }
     else if (celdas[x][y] == TypeCelda.Puerta)
     {
         Puerta p = puertas[new Point(x,y)];
         if (p.Opener == null)
         {
             return Brushes.BlueViolet;
         }
         else if (p.Opener == j)
         {
             return Brushes.Khaki;
         }
         else
         {
             return Brushes.Red;
         }
     }
     return Brushes.Gray;
 }
Ejemplo n.º 45
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            Jugador oJugador = new Jugador();

            switch (formMode)
            {
            case FormMode.insert:
                if (ValidarCampos())
                {
                    oJugador.Nombre        = txt_nombre.Text;
                    oJugador.Apellido      = txt_apellido.Text;
                    oJugador.NroDocumento  = Int32.Parse(txt_nroDoc.Text);
                    oJugador.Club          = (Club)cbo_club.SelectedItem;
                    oJugador.EstadoActual  = (EstadoActual)cbo_estado.SelectedItem;
                    oJugador.Posicion      = (Posicion)cbo_posicion.SelectedItem;
                    oJugador.TipoDocumento = (TipoDocumento)cbo_tipoDoc.SelectedItem;
                    oJugador.Costo         = nud_costo.Value;
                    if (ValidarRepetidos(oJugador))
                    {
                        if (JugadorService.InsertarJugador(oJugador))
                        {
                            MessageBox.Show("Jugador agregado con exito!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            FrmJugador frmJugador = Owner as FrmJugador;
                            frmJugador.ActualizarGrilla();
                        }
                        else
                        {
                            MessageBox.Show("Error, fecha no agregada!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        this.Close();
                    }
                }
                break;

            case FormMode.update:
                if (ValidarCampos())
                {
                    var dniAnterior = jugadorSinModificar.NroDocumento;
                    oJugador.Nombre        = txt_nombre.Text;
                    oJugador.Apellido      = txt_apellido.Text;
                    oJugador.NroDocumento  = Int32.Parse(txt_nroDoc.Text);
                    oJugador.Club          = (Club)cbo_club.SelectedItem;
                    oJugador.EstadoActual  = (EstadoActual)cbo_estado.SelectedItem;
                    oJugador.Posicion      = (Posicion)cbo_posicion.SelectedItem;
                    oJugador.TipoDocumento = (TipoDocumento)cbo_tipoDoc.SelectedItem;
                    oJugador.Costo         = nud_costo.Value;
                    if (dniAnterior != oJugador.NroDocumento)
                    {
                        if (ValidarRepetidos(oJugador))
                        {
                            if (JugadorService.ModificarJugador(oJugador))
                            {
                                MessageBox.Show("Jugador modificado con exito!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                FrmJugador frmJugador = Owner as FrmJugador;
                                frmJugador.ActualizarGrilla();
                            }
                            else
                            {
                                MessageBox.Show("Error, jugador no modificado!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            }
                            this.Close();
                        }
                    }
                    else
                    {
                        if (JugadorService.ModificarJugador(oJugador))
                        {
                            MessageBox.Show("Jugador modificado con exito!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            FrmJugador frmJugador = Owner as FrmJugador;
                            frmJugador.ActualizarGrilla();
                        }
                        else
                        {
                            MessageBox.Show("Error, jugador no modificado!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        this.Close();
                    }
                }
                break;

                /*
                 * case FormMode.delete:
                 * break;
                 */
            }
        }
Ejemplo n.º 46
0
 public override void EjecutarEfecto(Jugador jugador)
 {
     MessageBox.Show("Soy el servicio: " + Nombre + " - Posicion: " + Posicion);
 }
Ejemplo n.º 47
0
        static void Main(string[] args)
        {
            Casino casi = new Casino();//jugadores y jugadas

            BoletoChances boleto  = new BoletoChances(2);
            List <Moneda> monedas = new List <Moneda>();
            Moneda        moni    = new Moneda(34, 6, ETipoMoneda.bronce, 2);
            Moneda        moni2   = new Moneda(50, 2, ETipoMoneda.plata, 4);

            monedas += moni;
            monedas += moni;

            if (monedas.Count == 1)
            {
                Console.WriteLine("No se agregó");
            }

            monedas += moni2;

            if (monedas.Count > 1)
            {
                Console.WriteLine("Se agregó");
            }

            Jugador uno  = new Jugador(11, 100, boleto, monedas);
            Jugador dos  = new Jugador(12, 3000, boleto, monedas);
            Jugador tres = new Jugador(13, 3000, boleto, monedas);

            casi += dos;
            casi += uno;



            if (Casino.BuscarJugador(casi, uno.DNI.ToString()) != null)
            {
                Console.WriteLine($"{uno.DNI.ToString()} se encuentra en el casino");
            }
            if (Casino.BuscarJugador(casi, tres.DNI.ToString()) == null)
            {
                Console.WriteLine($"{tres.DNI.ToString()} no se encuentra en el casino");
            }

            Jugada juego = new Jugada(uno, -20, ETipoTransaccion.pierde);

            Console.WriteLine("----------------------------------------------");
            Console.WriteLine("");
            Console.WriteLine("Billetera de Jugadores: ");
            foreach (Jugador item in casi.Jugadores)
            {
                Console.WriteLine(item.DNI);
                Console.WriteLine(item.ToString());
                Console.WriteLine("");
            }

            casi += juego;

            Console.WriteLine("Partidas: ");
            foreach (Jugada item in casi.Jugadas)
            {
                Console.WriteLine(item.ToString());
            }

            Console.ReadKey();
        }
Ejemplo n.º 48
0
    // Update is called once per frame
    void Update() {
        if (!pausa&&!findeljuego)
        { cont += 0.0166f;
            cont2 += 0.0166f;
            energiaactual = energiajugador.GetComponent<Slider>().value;
            if (cont >= SpawnTime && !findeljuego)
            {
                posX = UnityEngine.Random.Range(minspawn, maxspawn);
                pos = new Vector3(posX, 10f, 0f);
                GameObject clone = (GameObject)Instantiate(Asteroide, pos, Quaternion.identity);
                cont = 0;
            }
            if (energiaactual < nivelminimo)
            {
                if (cont2 >= spawnenergia && !findeljuego)
                {
                    posX = UnityEngine.Random.Range(minspawn, maxspawn);
                    pos = new Vector3(posX, 10f, 0f);
                    GameObject clone = (GameObject)Instantiate(enegiaplus, pos, Quaternion.identity);
                    cont2 = 0;
                    
                }
            }
        }
        if (findeljuego && finvideo) {
            finvideo = false;
            if (Jugador.jugador == null)
            {
                Jugador.jugador = new Jugador();
                player = Jugador.jugador;
                player.setmonedas(0);
                player.setpuntos(puntje.text);
                player.setpuntoalto(puntje.text);
                Jugador.jugador = player;

            }
            else
            {
                if (int.Parse(player.getpuntajealto()) < int.Parse(puntje.text))
                {
                    Jugador.jugador = new Jugador();
                    player = Jugador.jugador;
                    player.setmonedas(0);
                    player.setpuntos(puntje.text);
                    player.setpuntoalto(puntje.text);
                    Jugador.jugador = player;
                }
                else
                {
                    Jugador.jugador = new Jugador();
                    player = Jugador.jugador;
                    player.setmonedas(0);
                    player.setpuntos(puntje.text);
                    Jugador.jugador = player;
                }
            }
            GuardarJuego.guardar();
            SceneManager.LoadScene(2);
        }

    }
Ejemplo n.º 49
0
        public IActionResult GuardarEdicion(string nombre, string apellido, string posicion, int salario, string club)
        {
            Singleton.Instance.listaDoble.Editar = false;
            Jugador nuevoJugador = new Jugador();

            try
            {
                if (Singleton.Instance.ListaArtesanalActiva)
                {
                    if (nombre == null)
                    {
                        nuevoJugador.Nombre = Convert.ToString(Singleton.Instance.listaDoble.ObtenerValor(Singleton.Instance.listaDoble.PosEditar).Nombre);
                    }
                    else
                    {
                        nuevoJugador.Nombre = nombre;
                    }


                    if (apellido == null)
                    {
                        nuevoJugador.Apellido = Convert.ToString(Singleton.Instance.listaDoble.ObtenerValor(Singleton.Instance.listaDoble.PosEditar).Apellido);
                    }
                    else
                    {
                        nuevoJugador.Apellido = apellido;
                    }


                    if (posicion == null)
                    {
                        nuevoJugador.Posicion = Convert.ToString(Singleton.Instance.listaDoble.ObtenerValor(Singleton.Instance.listaDoble.PosEditar).Posicion);
                    }
                    else
                    {
                        nuevoJugador.Posicion = posicion;
                    }


                    if (salario == 0)
                    {
                        nuevoJugador.Salario = Convert.ToInt16(Singleton.Instance.listaDoble.ObtenerValor(Singleton.Instance.listaDoble.PosEditar).Salario);
                    }
                    else
                    {
                        nuevoJugador.Salario = salario;
                    }


                    if (club == null)
                    {
                        nuevoJugador.Club = Convert.ToString(Singleton.Instance.listaDoble.ObtenerValor(Singleton.Instance.listaDoble.PosEditar).Club);
                    }
                    else
                    {
                        nuevoJugador.Club = club;
                    }
                }
                else
                {
                    if (nombre == null)
                    {
                        nuevoJugador.Nombre = Convert.ToString(Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar].Nombre);
                    }
                    else
                    {
                        nuevoJugador.Nombre = nombre;
                    }


                    if (apellido == null)
                    {
                        nuevoJugador.Apellido = Convert.ToString(Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar].Apellido);
                    }
                    else
                    {
                        nuevoJugador.Apellido = apellido;
                    }


                    if (posicion == null)
                    {
                        nuevoJugador.Posicion = Convert.ToString(Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar].Posicion);
                    }
                    else
                    {
                        nuevoJugador.Posicion = posicion;
                    }


                    if (salario == 0)
                    {
                        nuevoJugador.Salario = Convert.ToInt16(Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar].Salario);
                    }
                    else
                    {
                        nuevoJugador.Salario = salario;
                    }


                    if (club == null)
                    {
                        nuevoJugador.Club = Convert.ToString(Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar].Club);
                    }
                    else
                    {
                        nuevoJugador.Club = club;
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            if (Singleton.Instance.ListaArtesanalActiva)
            {
                Singleton.Instance.listaDoble.CambiarEnPosicion(Singleton.Instance.listaDoble.PosEditar, nuevoJugador);
            }
            else
            {
                Singleton.Instance.ListaCSharp[Singleton.Instance.listaDoble.PosEditar] = nuevoJugador;
            }
            return(View("Privacy"));
        }
Ejemplo n.º 50
0
 public abstract void Correr(Jugador jugador, List <Heroe> heroes, List <LugarClave> lugares, LeerArchHistoria lah, Villano villano);
Ejemplo n.º 51
0
        private async void MiMetodoReceptorMesaEsperaHelper(string strIp, string strMensaje)
        {
            try
            {
                if (!string.IsNullOrEmpty(strIp) && !string.IsNullOrEmpty(strMensaje))
                {
                    var mensaje = strMensaje.Split(new string[] { Constantes.SEPARADOR }, StringSplitOptions.None);
                    #region Jugador se une
                    if (mensaje[0] == Constantes.UnirseEnviameConfirmacion)
                    {
                        //mensaje[0] => Acción (UnirseEnviameConfirmacion)
                        //mensaje[1] => mesaSeleccionada
                        //mensaje[2] => objJugador.Ip
                        //mensaje[3] => objJugador.Nombre
                        //mensaje[4] => strBytes (imagen del jugador)
                        if (mensaje.Length != 5)
                        {
                            return;
                        }

                        //Verificar que es la mesa seleccionada
                        if (mensaje[1] != objJuego.JuegoID)
                        {
                            return;
                        }

                        //Verificar que la mesa no esté llena
                        if (objJuego.JugadoresConectados.Count >= 4)
                        {
                            return;
                        }

                        //Notificar al nuevo jugador que se ha unido a la mesa
                        await App.objSDK.ConnectStreamSocket(new HostName(mensaje[2]));

                        await App.objSDK.StreamPing(Constantes.ConfirmacionUnirseMesa + Constantes.SEPARADOR +
                                                    objJuego.Ip + Constantes.SEPARADOR +
                                                    objJuego.JuegoID + Constantes.SEPARADOR +
                                                    objJuego.TipoMapa);

                        //Agregar al jugador a la mesa
                        var jugador = new Jugador();
                        jugador.Ip     = mensaje[2];
                        jugador.Nombre = mensaje[3];
                        if (!mensaje[4].Equals(Constantes.SIN_IMAGEN))
                        {
                            jugador.Imagen = Convert.FromBase64String(mensaje[4]);
                        }

                        //Validar jugador no se ha unido aún
                        if (!ValidaJugadorExistexIP(jugador.Ip))
                        {
                            objJuego.JugadoresConectados.Add(jugador);
                        }

                        //Mostrar datos de los jugadores en pantalla
                        MostrarDatosJugadoresEnPantalla();
                    }
                    #endregion
                    #region Jugador se retira
                    else if (mensaje[0] == Constantes.JugadorSaleMesa)
                    {
                        //mensaje[0] => Acción (JugadorSaleMesa)
                        //mensaje[1] => objJugador.Ip
                        if (mensaje.Length != 2)
                        {
                            return;
                        }

                        //Eliminar al jugador de la mesa
                        var ipJugadorRetirado = mensaje[1];
                        for (int i = 0; i < objJuego.JugadoresConectados.Count; i++)
                        {
                            if (objJuego.JugadoresConectados[i].Ip.Equals(ipJugadorRetirado))
                            {
                                objJuego.JugadoresConectados.RemoveAt(i);
                                ((TextBlock)FindName("lblIpJugador" + (i + 1))).Text = "0.0.0.0";
                                break;
                            }
                        }

                        //Mostrar datos de los jugadores en pantalla
                        MostrarDatosJugadoresEnPantalla();
                    }
                    #endregion
                }
                //Habilitar o deshabilitar el boton de Jugar
                btnJugar.Visibility = (objJuego.JugadoresConectados.Count >= 2 ? Visibility.Visible : Visibility.Collapsed);
            }
            catch (Exception ex)
            {
                Helper.MensajeOk(ex.Message);
            }
        }
Ejemplo n.º 52
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponentInChildren <Jugador>();
 }
Ejemplo n.º 53
0
 public void Ejecutar(PaqueteEntrada mensaje, Jugador jugador, ClienteMonopolio.Modelo.Juego juego, ClienteMonopolio.Graficos.GestionarVentanas grafico)
 {
     MessageBox.Show(mensaje.PopString());
     grafico.CerrarVentanas();
 }
Ejemplo n.º 54
0
 public override void EjecutarEfecto(Jugador jugador)
 {
     throw new NotImplementedException();
 }
 void Start()
 {
     localScale = transform.localScale;
     myParent   = transform.parent.gameObject;
     jugador    = GameObject.FindGameObjectWithTag("Player").GetComponent <Jugador>();
 }
Ejemplo n.º 56
0
 public override void EjecutarEfecto(Jugador jugador)
 {
     MessageBox.Show("Soy la arca comunal, Posicion: " + Posicion);
 }
 public ListaTextosController(Jugador jugador)
 {
     listaTexto = new ListaTextos(jugador);
     listaTexto.Show();
 }
Ejemplo n.º 58
0
 public void AddJugador(Jugador jugador)
 {
     this.repository.AddJugador(jugador);
 }
Ejemplo n.º 59
0
 public void Inicializar()
 {
     _jugador = new Jugador();
 }
Ejemplo n.º 60
0
 public void UpdateJugador(Jugador jugador)
 {
     this.repository.UpdateJugador(jugador);
 }