Ejemplo n.º 1
0
 private void reiniciar(bool re)
 {
     foreach (Casilla c in grid)
     {
         if (c.actor != null)
         {
             c.HideActor();
         }
         c.actor   = null;
         c.okupada = false;
         c.setPasto();
     }
     if (kib != null)
     {
         kib.detenerHilo();
         kib.HideKibus();
         kib.detenerAbejas();
         kib = null;
     }
     if (hs != null)
     {
         hs.casa.Hide();
         hs = null;
     }
     placeKibus            = false;
     KibusPlaced           = false;
     HousePlaced           = false;
     placeTrees            = false;
     placeRocks            = false;
     placeForest           = true;
     placeHouse            = false;
     eraseActor            = true;
     click                 = false;
     lista.dgMapas.Enabled = true;
     if (re)
     {
         hiloOpenArch.Abort();
         hiloOpenArch = new Thread(new ThreadStart(openMap));
         hiloOpenArch.Start();
     }
 }
Ejemplo n.º 2
0
        internal void clickAction(object sender, EventArgs e)
        {
            PictureBox aux = (PictureBox)sender;

            if ((String)aux.Tag == "F1link")
            {
                aux.Focus();
                aux.BringToFront();
            }
            else
            {
                int x = (aux.Location.X - 205) / 50, y = (aux.Location.Y - 15) / 50;
                if (!grid[x, y].okupada)
                {
                    if (placeKibus && !KibusPlaced)
                    {
                        if (kib == null)
                        {
                            kib = new kibus(x, y, this);
                            this.Controls.Add(kib.mono);
                            kib.mono.MouseClick += new System.Windows.Forms.MouseEventHandler(MDown);
                            kib.velocidad(trkVel.Value);
                            kib.mono.BringToFront();
                            kib.mono.BackColor = Color.Transparent;
                            kib.mono.Focus();
                            kib.iniciaHilo();
                            //placeKibus = false;
                            //KibusPlaced = true;
                            placeForest           = false;
                            lista.dgMapas.Enabled = false;
                            hiloOpenArch.Abort();
                        }
                        else
                        {
                            kib.p.X           = (x * 50) + 205;
                            kib.p.Y           = (y * 50) + 15;
                            kib.mono.Location = kib.memoria = kib.aux = kib.p;
                        }
                    }
                    if (placeHouse && !HousePlaced)
                    {
                        //grid[x, y].okupada = true;
                        grid[x, y].heat = 100;
                        hs = new Casita(x, y);
                        this.Controls.Add(hs.casa);
                        hs.casa.BringToFront();
                        hs.casa.BackColor = Color.Transparent;
                        //setHeat(x, y);
                        if (kib != null)
                        {
                            kib.mono.BringToFront();
                        }
                        placeForest = false;
                        placeHouse  = false;
                        HousePlaced = true;
                    }
                    if (placeTrees)
                    {
                        grid[x, y].posActor("sTree");
                    }
                    if (placeRocks)
                    {
                        grid[x, y].posActor("sRock");
                    }
                }
                if (eraseActor)
                {
                    grid[x, y].HideActor();
                }
            }
        }