public MainForm(string fileName) { try { using (FileStream stream = File.Open(fileName, FileMode.Open)) { using (BinaryReader reader = new BinaryReader(stream)) { mLevel = new Level(reader); } } } catch (FileNotFoundException) { mLevel = new Level(); GridRow row = new GridRow(); for (int i = 0; i < 30; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); numGravity_ValueChanged(null, null); numOxygen_ValueChanged(null, null); } InitializeComponent(); //tileOptions1.EntryUpdated += new DSRoads.LevelEditor.Controls.EntryUpdated(tileOptions1_EntryUpdated); tileOptions1.EntryUpdated += delegate() { gridDisplay1.Invalidate(); }; gridDisplay1.SelectionChanged += new DSRoads.LevelEditor.Controls.SelectionChangedEvent(tileOptions1.Select); numGravity.Value = (decimal)(mLevel.Gravity); numOxygen.Value = (decimal)(20 * (float)mLevel.OxygenLeak / 0.004f); }
public MainForm() { mLevel = new Level(); GridRow row = new GridRow(); for (int i = 0; i < 30; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); InitializeComponent(); tileOptions1.EntryUpdated += new DSRoads.LevelEditor.Controls.EntryUpdated(tileOptions1_EntryUpdated); gridDisplay1.SelectionChanged += new DSRoads.LevelEditor.Controls.SelectionChangedEvent(tileOptions1.Select); numGravity_ValueChanged(null, null); numOxygen_ValueChanged(null, null); }
private void PaintRow(Graphics aGraphics, Point aTopLeft, GridRow aRow) { using (Brush brush = new SolidBrush(aRow.Selected ? mGrabColor : mHandleColor)) { Rectangle handleRec = new Rectangle(aTopLeft, new Size(mHandleWidth, mRowHeight)); aGraphics.FillRectangle(brush, handleRec); } aTopLeft.X += mHandleWidth; for (int i = 0; i < 7; ++i) { PaintEntry(aGraphics, aTopLeft, aRow[i]); aTopLeft.X += mEntryWidth; } }
public GridDisplay() { mLevel = new Level(); GridRow row = new GridRow(); row[0].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[0].Tile = false; row[1].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[1].Tile = false; row[2].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); row[2].Tile = false; row[3].Tile = true; for (int i = 0; i < 10; ++i) mLevel.Grid.AddLast(new LinkedListNode<GridRow>(new GridRow(row))); DoubleBuffered = true; InitializeComponent(); AutoScrollMinSize = ContentSize; mLevel.Grid.GridChanged += new Grid.GridChangedEventHandler(GridChangedHandler); AutoScrollMinSize = ContentSize; mWindow = new DisplayWindow(this); mOldHeight = this.Height; }
public void Addrow(int aCount) { if (mGrabNode == null) return; if (aCount < 1 || 40 < aCount) return; for (int count = 0; count < aCount; ++count) { GridRow row = new GridRow(); for (int i = 0; i < 7; ++i) row[i] = new GridEntry(mGrabNode.Value[i]); LinkedListNode<GridRow> node = new LinkedListNode<GridRow>(row); mLevel.Grid.AddAfter(mGrabNode, node); } AutoScrollMinSize = ContentSize; mWindow.Recalculate(); Invalidate(); }
public Grid(BinaryReader reader, string version) { mRowData = new LinkedList<GridRow>(); byte[] buf = new byte[2]; while (reader.Read(buf, 0, 1) > 0) { reader.BaseStream.Seek(-1, SeekOrigin.Current); GridRow row = new GridRow(); for (int i = 0; i < 7; ++i) row[i] = new GridEntry(reader, version); mRowData.AddLast(new GridRow(row)); } }
public GridRow(GridRow aOther) { for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry(aOther[i]); }