Exemple #1
0
        private void PaintEntry(Graphics aGraphics, Point aTopLeft, GridEntry aEntry)
        {
            Color backColor;

            if(aEntry.Hovering) 
                backColor = Color.LightGray;
            else
                backColor = aEntry.Selected ? Color.DarkKhaki : BackColor;

            using (SolidBrush brush = new SolidBrush(backColor))
            {
                Rectangle rec = new Rectangle(aTopLeft, new Size(mEntryWidth, mRowHeight));
                aGraphics.FillRectangle(brush, rec);
                brush.Color = ForeColor;
                aGraphics.DrawString(aEntry.Altitude.ToString(), this.Font, brush, new PointF(aTopLeft.X, aTopLeft.Y));
                if (aEntry.Tile)
                {
                    brush.Color = mLevel.Palette[aEntry.TilePaletteIndex];
                    aGraphics.FillRectangle(brush, new Rectangle(aTopLeft.X, aTopLeft.Y + mRowHeight / 3, mEntryWidth / 2, 2 * mRowHeight / 3));
                }
                if (aEntry.Tunnel || aEntry.Block)
                {
                    brush.Color = mLevel.Palette[aEntry.BlockPaletteIndex];
                    aGraphics.FillRectangle(brush, new Rectangle(aTopLeft.X + mEntryWidth / 2, aTopLeft.Y + mRowHeight / 3, mEntryWidth / 2, 2 * mRowHeight / 3));
                }
            }
        }
Exemple #2
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();
        }
Exemple #3
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));
            }
        }
Exemple #4
0
 public GridRow(GridRow aOther)
 {
     for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry(aOther[i]);
 }
Exemple #5
0
 public GridRow()
 {
     for (int i = 0; i < 7; i++) mEntry[i] = new GridEntry();
 }
Exemple #6
0
 public GridEntry(GridEntry aOther)
 {
     mAltitude = aOther.mAltitude;
     mTilePaletteIndex = aOther.mTilePaletteIndex;
     mBlockPaletteIndex = aOther.mBlockPaletteIndex;
     mTile = aOther.mTile;
     mTunnel = aOther.mTunnel;
     mBlock = aOther.mBlock;
     mExit = aOther.mExit;
 }