示例#1
0
    protected void DumpLine(LXFMLGrid grid, int row)
    {
        var s = new StringBuilder();

        s.Append("<size=22><b>");

        for (int x = 0; x < grid.Width; ++x)
        {
            var cell = grid.GetCellAt(x, row);

            if (cell.IsEmpty)
            {
                s.Append("<color=grey>[O]</color>");
            }
            else
            {
                Color32 color       = (Color32)LXFMLHelper.GetBrickColor(cell.Data.Brick.materialId);
                var     colorString = color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2");

                var str = string.Format("<color=#{0}>[O]</color>", colorString);

                s.Append(str);
            }
        }

        s.Append("</b></size>");

        Debug.Log(s.ToString());
    }
示例#2
0
 override public void Dump(LXFMLGrid grid)
 {
     for (int y = 0; y < grid.Height; ++y)
     {
         DumpLine(grid, y);
     }
 }
示例#3
0
 override public void Dump(LXFMLGrid grid)
 {
     for (int y = grid.Height - 1; y >= 0; --y)
     {
         DumpLine(grid, y);
     }
 }
 public LXFMLConstruction()
 {
     _grid             = new LXFMLGrid(LXFMLHelper.kGridSize, LXFMLHelper.kGridSize, new LXFMLBottomLeftLinker());
     _bricks           = new Dictionary <int, BrickData>();
     _bricksCellsCache = new Dictionary <int, LXFMLCell[]>();
     _gridRect         = new Rect();
 }
    public LXFMLConstruction(IList <BrickData> allBricks)
    {
        _grid             = new LXFMLGrid(LXFMLHelper.kGridSize, LXFMLHelper.kGridSize, new LXFMLBottomLeftLinker());
        _bricks           = new Dictionary <int, BrickData>();
        _bricksCellsCache = new Dictionary <int, LXFMLCell[]>();
        _gridRect         = new Rect();

        for (int i = 0; i < allBricks.Count; i++)
        {
            AddBrick(allBricks[i]);
        }
    }
示例#6
0
    override public void Link(LXFMLCell[] cells, LXFMLGrid grid)
    {
        LXFMLCell cell;

        for (int i = 0, n = cells.Length; i < n; ++i)
        {
            cell = cells[i];

            cell.NeighbourTopLeft     = grid.GetCellAt(new Vector2(cell.Coordinates.x - 1, cell.Coordinates.y - 1));
            cell.NeighbourTop         = grid.GetCellAt(new Vector2(cell.Coordinates.x, cell.Coordinates.y - 1));
            cell.NeighbourTopRight    = grid.GetCellAt(new Vector2(cell.Coordinates.x + 1, cell.Coordinates.y - 1));
            cell.NeighbourLeft        = grid.GetCellAt(new Vector2(cell.Coordinates.x - 1, cell.Coordinates.y));
            cell.NeighbourRight       = grid.GetCellAt(new Vector2(cell.Coordinates.x + 1, cell.Coordinates.y));
            cell.NeighbourBottomLeft  = grid.GetCellAt(new Vector2(cell.Coordinates.x - 1, cell.Coordinates.y + 1));
            cell.NeighbourBottom      = grid.GetCellAt(new Vector2(cell.Coordinates.x, cell.Coordinates.y + 1));
            cell.NeighbourBottomRight = grid.GetCellAt(new Vector2(cell.Coordinates.x + 1, cell.Coordinates.y + 1));
        }
    }
示例#7
0
 abstract public void Dump(LXFMLGrid grid);
示例#8
0
 abstract public void Link(LXFMLCell[] cells, LXFMLGrid grid);