Exemplo n.º 1
0
 private void Juego_OnModificar(object sender, AgregarUsuarioEventArgs e)
 {
     usuario.Score = e.Score;
     Data.Add(usuario);
     using (Stream stream = new FileStream("Data.bin", FileMode.Create, FileAccess.Write, FileShare.None))
     {
         IFormatter formatter = new BinaryFormatter();
         formatter.Serialize(stream, Data);
         stream.Close();
     }
 }
Exemplo n.º 2
0
 private void pictureBox1_LocationChanged(object sender, EventArgs e)
 {
     if (pictureBox1.Bounds.IntersectsWith(pictureBox2.Bounds))
     {
         pictureBox2.Location = new System.Drawing.Point(800, 800);
         pictureBox4.Location = new System.Drawing.Point(800, 800);
         MessageBox.Show("Juego Terminado\nPuntuacion: " + label2.Text);
         timer.Interval = 10000;
         timer.Stop();
         AgregarUsuarioEventArgs mod = new AgregarUsuarioEventArgs();
         mod.Score = Convert.ToInt32(label2.Text);
         OnModificar(this, mod);
         Inicio main = new Inicio(Data);
         main.Show();
         this.Close();
     }
     if (pictureBox1.Bounds.IntersectsWith(pictureBox4.Bounds))
     {
         pictureBox2.Location = new System.Drawing.Point(800, 800);
         pictureBox4.Location = new System.Drawing.Point(800, 800);
         MessageBox.Show("Juego Terminado\nPuntuacion: " + label2.Text);
         timer.Interval = 10000;
         timer.Stop();
         AgregarUsuarioEventArgs mod = new AgregarUsuarioEventArgs();
         mod.Score = Convert.ToInt32(label2.Text);
         OnModificar(this, mod);
         Inicio main = new Inicio(Data);
         main.Show();
         this.Close();
     }
     if (pictureBox1.Bounds.IntersectsWith(pictureBox3.Bounds))
     {
         pictureBox3.Hide();
         pictureBox3.Location = new System.Drawing.Point(800, 800);
         label2.Text          = (Convert.ToInt32(label2.Text) + 15).ToString();
     }
     if (pictureBox1.Bounds.IntersectsWith(pictureBox5.Bounds))
     {
         pictureBox5.Hide();
         pictureBox5.Location = new System.Drawing.Point(800, 800);
         label2.Text          = (Convert.ToInt32(label2.Text) + 10).ToString();
     }
 }