Exemple #1
0
        protected void btn2direita_Click(object sender, ImageClickEventArgs e)
        {
            Sonda2s.Value = MovimentaDireita(Sonda2s.Value);
            Image img2 = (Image)PainelPlanalto.FindControl("x" + Sonda2x.Value + "y" + Sonda2y.Value);

            if (img2 != null)
            {
                img2.ImageUrl = "~/img/2" + Sonda2s.Value + ".png";
            }
        }
Exemple #2
0
        protected void ImageButton9_Click(object sender, ImageClickEventArgs e)
        {
            Sonda3s.Value = MovimentaDireita(Sonda3s.Value);
            Image img3 = (Image)PainelPlanalto.FindControl("x" + Sonda3x.Value + "y" + Sonda3y.Value);

            if (img3 != null)
            {
                img3.ImageUrl = "~/img/3" + Sonda3s.Value + ".png";
            }
        }
Exemple #3
0
        protected void btn1esquerda_Click(object sender, ImageClickEventArgs e)
        {
            Sonda1s.Value = MovimentaEsquerda(Sonda1s.Value);
            Image img1 = (Image)PainelPlanalto.FindControl("x" + Sonda1x.Value + "y" + Sonda1y.Value);

            if (img1 != null)
            {
                img1.ImageUrl = "~/img/1" + Sonda1s.Value + ".png";
            }
        }
Exemple #4
0
        protected void btn3seguir_Click(object sender, ImageClickEventArgs e)
        {
            int valorx = Convert.ToInt32(Sonda3x.Value);
            int valory = Convert.ToInt32(Sonda3y.Value);

            switch (Sonda3s.Value)
            {
            case "n":
                valory = valory + 1;
                break;

            case "e":
                valorx = valorx + 1;
                break;

            case "s":
                valory = valory - 1;
                break;

            case "w":
                valorx = valorx - 1;
                break;
            }
            if (!UltrapassaLimitex(valorx) && !UltrapassaLimitey(valory))
            {
                //verifica o proximo pornto
                Image img1 = (Image)PainelPlanalto.FindControl("x" + valorx + "y" + valory);
                if (img1 != null)
                {
                    //Verifica se o ponto esta vazio
                    if (img1.ImageUrl == "~/img/fundo01.png")
                    {
                        //ponto antigo recebe imagem padrão
                        Image img2 = (Image)PainelPlanalto.FindControl("x" + Sonda3x.Value + "y" + Sonda3y.Value);
                        if (img2 != null)
                        {
                            img2.ImageUrl = "~/img/fundo01.png";
                        }
                        Sonda3x.Value = valorx.ToString();
                        Sonda3y.Value = valory.ToString();
                        img1.ImageUrl = "~/img/3" + Sonda3s.Value + ".png";
                    }
                }
            }
        }
Exemple #5
0
        protected void BtnNovaSonda_Click(object sender, ImageClickEventArgs e)
        {
            if (CordX.Text != String.Empty && CordY.Text != String.Empty)
            {
                if (Helper.IsNumeric(CordX.Text) && Helper.IsNumeric(CordY.Text))
                {
                    int cordx = Convert.ToInt32(CordX.Text);
                    int cordy = Convert.ToInt32(CordY.Text);
                    if (!UltrapassaLimitex(cordx) && !UltrapassaLimitey(cordy))
                    {
                        if (sonda2.Visible == true)
                        {
                            //Captura ponto de entrada
                            Image img3 = (Image)PainelPlanalto.FindControl("x" + CordX.Text + "y" + CordY.Text);
                            if (img3 != null)
                            {
                                //Verifica se o ponto esta vazio
                                if (img3.ImageUrl == "~/img/fundo01.png")
                                {
                                    sonda3.Visible = true;
                                    Sonda3x.Value  = CordX.Text;
                                    Sonda3y.Value  = CordY.Text;
                                    Sonda3s.Value  = DDSentido.SelectedValue;

                                    img3.ImageUrl = "~/img/3" + Sonda3s.Value + ".png";

                                    NovaSonda.Visible = false;
                                }
                            }
                        }
                        else if (sonda1.Visible == true)
                        {  //Captura ponto de entrada
                            Image img2 = (Image)PainelPlanalto.FindControl("x" + CordX.Text + "y" + CordY.Text);
                            if (img2 != null)
                            {
                                //Verifica se o ponto esta vazio
                                if (img2.ImageUrl == "~/img/fundo01.png")
                                {
                                    sonda2.Visible = true;
                                    Sonda2x.Value  = CordX.Text;
                                    Sonda2y.Value  = CordY.Text;
                                    Sonda2s.Value  = DDSentido.SelectedValue;
                                    img2.ImageUrl  = "~/img/2" + Sonda2s.Value + ".png";
                                }
                            }
                        }
                        else
                        {
                            PainelControles.Visible = true;
                            sonda1.Visible          = true;
                            Sonda1x.Value           = CordX.Text;
                            Sonda1y.Value           = CordY.Text;
                            Sonda1s.Value           = DDSentido.SelectedValue;
                            Image img1 = (Image)PainelPlanalto.FindControl("x" + Sonda1x.Value + "y" + Sonda1y.Value);
                            if (img1 != null)
                            {
                                img1.ImageUrl = "~/img/1" + Sonda1s.Value + ".png";
                            }
                        }
                        CordX.Text = "";
                        CordY.Text = "";
                    }
                }
            }
        }