Esempio n. 1
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Game save file (*.gsf)|*.gsf";
            openFileDialog.Title  = "Open game save file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        GameDoc    gd       = (GameDoc)formater.Deserialize(fileStream);
                        game = new Game(this.Width, this.Height, this.Location, gd);
                    }
                    axwmp.Ctlcontrols.stop();
                    this.Hide();
                    game.ShowDialog();
                    this.Show();
                    axwmp.Ctlcontrols.play();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName);
                    FileName = null;
                    return;
                }
            }
        }
Esempio n. 2
0
 public Game(int width, int height, Point location, GameDoc gd)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.Width          = width;
     this.Height         = height;
     this.Location       = location;
     flagMove            = false;
     flagPaused          = false;
     this.gd             = gd;
     timer1.Start();
     timer2.Start();
     FileName     = null;
     flagUp       = false;
     flagDown     = false;
     flagLeft     = false;
     flagRight    = false;
     r            = new Random();
     lblTime.Text = gd.time;
     axwmp.URL    = Path.Combine(System.IO.Path.GetFullPath(@"..\..\"), "Resources\\09 - SsSsSsSsSsSsSsSsSs - ingame.mp3");
     axwmp.settings.setMode("loop", true);
     axwmp.Ctlcontrols.play();
     pewplayer = new System.Media.SoundPlayer(Properties.Resources.pew);
     Invalidate(true);
 }
Esempio n. 3
0
        private void btnLoad_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Game save file (*.gsf)|*.gsf";
            openFileDialog.Title  = "Open game save file";
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileName = openFileDialog.FileName;
                try
                {
                    using (FileStream fileStream = new FileStream(FileName, FileMode.Open))
                    {
                        IFormatter formater = new BinaryFormatter();
                        gd           = (GameDoc)formater.Deserialize(fileStream);
                        lblTime.Text = gd.time;
                        Invalidate(true);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not read file: " + FileName + "\n" + ex.Message);
                    FileName = null;
                    return;
                }
            }
        }
Esempio n. 4
0
 public Game(int width, int height, Point location, GameDoc gd)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.Width          = width;
     this.Height         = height;
     this.Location       = location;
     flagMove            = false;
     flagPaused          = false;
     this.gd             = gd;
     timer1.Start();
     timer2.Start();
     FileName  = null;
     flagUp    = false;
     flagDown  = false;
     flagLeft  = false;
     flagRight = false;
     r         = new Random();
     Invalidate(true);
 }
Esempio n. 5
0
 public Game(String name, int width, int height, Point location)
 {
     InitializeComponent();
     this.DoubleBuffered = true;
     this.Width          = width;
     this.Height         = height;
     this.Location       = location;
     flagMove            = false;
     flagPaused          = false;
     gd = new GameDoc(name, width, height, pnlStatus.Height);
     timer1.Start();
     timer2.Start();
     FileName  = null;
     flagUp    = false;
     flagDown  = false;
     flagLeft  = false;
     flagRight = false;
     r         = new Random();
     gd.addDemon(this.Width, this.Height, r);
     Invalidate(true);
 }