Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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));
            }
        }
Exemplo n.º 7
0
 public GridRow(GridRow aOther)
 {
     for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry(aOther[i]);
 }