Exemplo n.º 1
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            ServidorIPEstatica.WebService1SoapClient servidor = new ServidorIPEstatica.WebService1SoapClient();

            servidor.colocarUnidadesNivel0(txtNivel0.Text);
            servidor.colocarUnidadesNivel1(txtNivel1.Text);
            servidor.colocarUnidadesNivel2(txtNivel2.Text);
            servidor.colocarUnidadesNivel3(txtNivel3.Text);
            servidor.colocarTamañoX(txtX.Text);
            servidor.colocarTamañoY(txtY.Text);
            servidor.colocarTipoJuego(DropDownList1.SelectedValue);


            if (!txtTiempo.Text.Equals(""))
            {
                string[] tiempo  = txtTiempo.Text.Trim().Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
                int      minutos = Int32.Parse(tiempo[0]);
                minutos = minutos * 60;
                servidor.colocarTiempo(minutos.ToString());
            }
            servidor.cargarDatos();

            servidor.Close();

            Label1.Text = obtenerEstadoDeJuego();
        }
Exemplo n.º 2
0
        public void separarComas(string texto)
        {
            string[] result    = texto.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries);
            int      contador  = 0;
            string   jugador1  = "";
            string   jugador2  = "";
            string   naves0    = "";
            string   naves1    = "";
            string   naves2    = "";
            string   naves3    = "";
            string   tamañoX   = "";
            string   tamañoY   = "";
            string   tipoJuego = "";
            string   minutos   = "";

            foreach (string s in result)
            {
                if (contador == 0)
                {
                    jugador1 = s.Trim();
                }
                else if (contador == 1)
                {
                    jugador2 = s.Trim();
                }
                else if (contador == 2)
                {
                    naves0 = s;
                }
                else if (contador == 3)
                {
                    naves1 = s;
                }
                else if (contador == 4)
                {
                    naves2 = s;
                }
                else if (contador == 5)
                {
                    naves3 = s;
                }
                else if (contador == 6)
                {
                    tamañoX = s;
                }
                else if (contador == 7)
                {
                    tamañoY = s;
                }
                else if (contador == 8)
                {
                    tipoJuego = s;
                }
                else if (contador == 9)
                {
                    string[] tiempo = s.Split(new[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
                    minutos = tiempo[0];
                    int tiempo1 = Int32.Parse(minutos);
                    tiempo1 = tiempo1 * 60;
                    minutos = tiempo1.ToString();
                }

                contador++;
            }

            ServidorIPEstatica.WebService1SoapClient servidor = new ServidorIPEstatica.WebService1SoapClient();
            servidor.colocarUnidadesNivel0(naves0);
            txtNivel0.Text = naves0;
            servidor.colocarUnidadesNivel1(naves1);
            txtNivel1.Text = naves1;
            servidor.colocarUnidadesNivel2(naves2);
            txtNivel2.Text = naves2;
            servidor.colocarUnidadesNivel3(naves3);
            txtNivel3.Text = naves3;
            servidor.colocarTamañoX(tamañoX);
            txtX.Text = tamañoX;
            servidor.colocarTamañoY(tamañoY);
            txtY.Text = tamañoY;
            servidor.colocarTipoJuego(tipoJuego);
            servidor.colocarTiempo(minutos);
            servidor.cargarDatos();



            if (servidor.estaIniciado().Equals("false"))
            {
                servidor.insertarJugador(jugador1);
                servidor.insertarJugador(jugador2);
            }

            txtX.Text = jugador1 + " - " + jugador2;
            servidor.iniciarJuego();

            servidor.Close();

            Label1.Text = obtenerEstadoDeJuego();
        }