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); }
private void load() { if (this.openFileDialog1.ShowDialog() == DialogResult.Cancel) { return; } currentFileName = this.openFileDialog1.FileName; GameShape g = SaveAndLoad.loadGame(this.openFileDialog1.FileName); panel.applyGameShape(g); }
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 void newGame() { applyGameShape(GameShape.getDefault()); }
public WhatsYourName(GameShape g) { this.g = g; InitializeComponent(); }