public static void saveGame(GameShape g, string filename)
        {
            Stream          s = File.Open(filename, FileMode.Create);
            BinaryFormatter b = new BinaryFormatter();

            b.Serialize(s, g);
            s.Close();
        }
        public static GameShape loadGame(string filename)
        {
            Stream          s = File.Open(filename, FileMode.Open);
            BinaryFormatter b = new BinaryFormatter();
            GameShape       g = (GameShape)b.Deserialize(s);

            s.Close();
            return(g);
        }
Ejemplo n.º 3
0
        private void load()
        {
            if (this.openFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            currentFileName = this.openFileDialog1.FileName;
            GameShape g = SaveAndLoad.loadGame(this.openFileDialog1.FileName);

            panel.applyGameShape(g);
        }
Ejemplo n.º 4
0
        public void applyGameShape(GameShape gameShape)
        {
            this.gameShape = gameShape;
            isSelected     = false;
            isLocking      = false;
            mainForm.setStepBack(false);
            stopAllThread();
            timeThread = new TimeThread(this);

            int[,] matrix = gameShape.matrix;

            repaintPieces(matrix);
            repaintNextColor(matrix);
            repaintYScore(gameShape.scores);
            repaintHScore(HighScoresFunctions.getMaxScores());
            repaintHour(gameShape.hours);
            repaintMinutes(gameShape.minutes);
            repaintSeconds(gameShape.seconds);
        }
 public WhatsYourName(GameShape g)
 {
     this.g = g;
     InitializeComponent();
 }
Ejemplo n.º 6
0
 public void newGame()
 {
     applyGameShape(GameShape.getDefault());
 }