Esempio n. 1
0
        private void openFile()
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Balls doc file (*.bls)|*.bls";
            openFileDialog.Title  = "Open balls doc file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater   = new BinaryFormatter();
                        SaveObject saveObject = (SaveObject)formater.Deserialize(fileStream);
                        BallController = saveObject.BallController;
                        Plane          = saveObject.Plane;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
                Invalidate(true);
            }
        }
Esempio n. 2
0
        private void startNew()
        {
            FileName = null;
            BackgroundImageLayout = ImageLayout.Stretch;
            BallController        = new BallController(0, this.Width, this.Height);
            Plane = new Plane(BallController);
            this.BackgroundImage = Plane.getImage();
            this.DoubleBuffered  = true;
            Paused = false;

            this.MouseClick += new MouseEventHandler(this.mouse_click);
        }
Esempio n. 3
0
        public Plane(BallController ballController)
        {
            //At the beginnig the state is straight
            State  = 2;
            Images = new List <Bitmap>();
            Images.Add(Game.Properties.Resources.leftleftplane);
            Images.Add(Game.Properties.Resources.leftplane);
            Images.Add(Game.Properties.Resources.plane);
            Images.Add(Game.Properties.Resources.rightplane);
            Images.Add(Game.Properties.Resources.rightrightplane);

            BallController = ballController;
        }
Esempio n. 4
0
 public void fireBallShoot()
 {
     BallController.addFireBall();
 }