public static void WriteMap(Object[,] map, string fileName) { BinaryWriter bw; try { bw = new BinaryWriter(new FileStream(fileName, FileMode.Create)); } catch (IOException e) { Console.WriteLine(e.Message); return; } try { for (int i = 0; i < 13; i++) { for (int j = 0; j < 13; j++) { Type type = map[j, i].type; bw.Write((int)type); bw.Flush(); } } } catch (IOException e) { Console.WriteLine(e.Message); } bw.Close(); }
public Object(Type type) { this.type = type; this.destructible = false; this.drivable = false; this.crossable = false; TypeChanged(); }
public Form_construct(From_menu from_menu) { InitializeComponent(); this.from_menu = from_menu; this.pen = Type.Road; this.map = new Object[13, 13]; this.penDown = false; }
public static Object[,] ReadMap(string fileName) { Object[,] map = new Object[13, 13]; BinaryReader br; try { br = new BinaryReader(new FileStream(fileName, FileMode.Open)); } catch (IOException e) { Console.WriteLine(e.Message); return(null); } try { for (int i = 0; i < 13; i++) { for (int j = 0; j < 13; j++) { Type type = (Type)br.ReadInt32(); map[j, i].Size = new Size(32, 32); map[j, i].Top = j * 32; map[j, i].Left = i * 32; } } } catch (IOException e) { Console.WriteLine(e.Message); } br.Close(); return(map); }
private void bushToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Bush; }
private void waterToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Water; }
private void steelToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Steel; }
private void brickToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Brick; }
private void eraserToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Road; }
private void iceToolStripMenuItem_Click(object sender, EventArgs e) { pen = Type.Ice; }