Example #1
0
        void CargarNivelesToolStripMenuItemClick(object sender, EventArgs e)
        {
            System.IO.FileInfo[] nivelesEncontrados = { };
            int        amplada = 10, altura = 40;
            NivelExtra nivel;

            System.IO.StreamReader str;
            pnlCrearNivel.Visible   = false;
            pnlNivelesExtra.Visible = true;
            pnlNivelesExtra.Controls.Clear();
            //cargo los niveles que encuentre
            nivelesEncontrados = new System.IO.DirectoryInfo(System.IO.Directory.GetCurrentDirectory()).GetFiles(".ZinLevel", true);
            //pongo los niveles
            for (int i = 0; i < nivelesEncontrados.Length; i++)
            {
                str   = new System.IO.StreamReader(nivelesEncontrados[i].FullName, Encoding.UTF8);
                nivel = new NivelExtra(str.ReadLine(), str.ReadLine(), Convert.ToInt32(str.ReadLine()));
                str.Close();
                nivel.Location = new Point(amplada, altura);
                amplada       += nivel.Width;
                if (amplada > Width - 40)
                {
                    amplada = 0;
                    altura += nivel.Height;
                }
                nivel.Mapa += PonMapaCargado;
                pnlNivelesExtra.Controls.Add(nivel);
            }
        }
Example #2
0
 void CargarNivelesToolStripMenuItemClick(object sender, EventArgs e)
 {
     System.IO.FileInfo[] nivelesEncontrados = { };
     int amplada = 10, altura = 40;
     NivelExtra nivel;
     System.IO.StreamReader str;
     pnlCrearNivel.Visible = false;
     pnlNivelesExtra.Visible = true;
     pnlNivelesExtra.Controls.Clear();
     //cargo los niveles que encuentre
     nivelesEncontrados = new System.IO.DirectoryInfo(System.IO.Directory.GetCurrentDirectory()).GetFiles(".ZinLevel", true);
     //pongo los niveles
     for (int i = 0; i < nivelesEncontrados.Length; i++) {
         str = new System.IO.StreamReader(nivelesEncontrados[i].FullName, Encoding.UTF8);
         nivel = new NivelExtra(str.ReadLine(), str.ReadLine(), Convert.ToInt32(str.ReadLine()));
         str.Close();
         nivel.Location = new Point(amplada, altura);
         amplada += nivel.Width;
         if (amplada > Width - 40) {
             amplada = 0;
             altura += nivel.Height;
         }
         nivel.Mapa += PonMapaCargado;
         pnlNivelesExtra.Controls.Add(nivel);
     }
 }