コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #5
0
 public WhatsYourName(GameShape g)
 {
     this.g = g;
     InitializeComponent();
 }
コード例 #6
0
 public void newGame()
 {
     applyGameShape(GameShape.getDefault());
 }