当前位置: 首页>>代码示例>>C#>>正文


C# Grid.GetCell方法代码示例

本文整理汇总了C#中Grid.GetCell方法的典型用法代码示例。如果您正苦于以下问题:C# Grid.GetCell方法的具体用法?C# Grid.GetCell怎么用?C# Grid.GetCell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Grid的用法示例。


在下文中一共展示了Grid.GetCell方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplyStyle

 public void ApplyStyle(Grid grid, Range range)
 {
     for (int r = range.Start.Row; r <= range.End.Row; r++)
         for (int c = range.Start.Column; c <= range.End.Column; c++)
             ApplyStyle(grid.GetCell(r, c));
 }
开发者ID:zhuangyy,项目名称:Motion,代码行数:6,代码来源:StyleGrid.cs

示例2: GetNeighbors

    private static List<Cell> GetNeighbors(Grid grid,Cell cell)
    {
        List<Cell> neighbors = new List<Cell> ();
        int x = (int)cell.position.x;
        int y = (int)cell.position.y;

        if (grid.GetCell (x - 1, y) != null) {
            neighbors.Add(grid.GetCell(x - 1,y));
        }
        if (grid.GetCell (x + 1, y) != null) {
            neighbors.Add(grid.GetCell(x + 1, y));
        }
        if (grid.GetCell (x, y - 1) != null) {
            neighbors.Add(grid.GetCell (x, y - 1));
        }
        if (grid.GetCell (x, y + 1) != null) {
            neighbors.Add(grid.GetCell (x, y + 1));
        }
        /*
        // check voor diagonale cellen
        if(grid.GetCell(x-1, y-1) != null) {
            neighbors.Add(grid.GetCell(x-1, y-1));
        }
        if(grid.GetCell(x+1, y-1) != null) {
            neighbors.Add(grid.GetCell(x+1, y-1));
        }
        if(grid.GetCell(x+1, y+1) != null) {
            neighbors.Add(grid.GetCell(x+1, y+1));
        }
        if(grid.GetCell(x-1, y+1) != null) {
            neighbors.Add(grid.GetCell(x-1, y+1));
        }*/
        return neighbors;
    }
开发者ID:Darkfafi,项目名称:LJ3_Project1_Fighter,代码行数:34,代码来源:AStar.cs

示例3: initializeNeighbors

    public void initializeNeighbors(Grid grid)
    {
        down = grid.GetCell(location + Point.up);
        up = grid.GetCell(location - Point.up);
        right = grid.GetCell(location + Point.right);
        left = grid.GetCell(location - Point.right);

        if(down == null) isBottomEdge = true;
        if(up == null) isTopEdge = true;
        if(right == null) isRightEdge = true;
        if(left == null) isLeftEdge = true;
    }
开发者ID:TheCapn,项目名称:PuzzleChallenge,代码行数:12,代码来源:Cell.cs

示例4: Search

    public static List<Cell> Search(Grid grid, Vector2 start, Vector2 end)
    {
        grid.Reset ();

        List<Cell> openList = new List<Cell> ();
        List<Cell> closedList = new List<Cell> ();
        Cell currentCell;
        Cell neighbor;
        float gScore;
        bool gScoreIsBest;
        List<Cell> neighbors;

        int maxJumpHeight = 8;
        int maxDubbleJumpHeight = 2;

        int currentMaxJumpHeight = maxJumpHeight;

        currentCell = grid.GetCell ((int)start.x, (int)start.y);

        if (currentCell.isWall) {
            currentCell.isGround = true;
            currentCell.isWall = false;
            currentCell.tempGroundTile = true;
        }

        openList.Add (currentCell);

        while (openList.Count > 0) {
            openList.Sort(SortOnF);

            currentCell = openList[0];

            if(currentCell.position.Equals(end)){
                List<Cell> path = new List<Cell>();

                while(currentCell.parent != null){
                    path.Add(currentCell);
                    currentCell = currentCell.parent;
                }

                path.Reverse();

                return path;
            }

            openList.Remove(currentCell);
            closedList.Add(currentCell);
            currentCell.isClosed = true;
            currentCell.isOpen = false;

            if(currentCell.neighbors == null){
                currentCell.neighbors = GetNeighbors(grid,currentCell);
            }

            if(currentCell.j >= maxJumpHeight && currentMaxJumpHeight == maxJumpHeight){
                currentMaxJumpHeight += maxDubbleJumpHeight;
            }

            neighbors = currentCell.neighbors;

            int l = neighbors.Count;

            for(int i = 0; i < l; i++){
                neighbor = neighbors[i];

                if(neighbor.isClosed || currentCell.isBlocked){
                    continue; // ignore cell
                }

                if(IsDiagonal(currentCell,neighbor)){
                    gScore = currentCell.g + diagonalScore;
                }else{
                    gScore = currentCell.g + horizontalScore;
                }

                if(currentCell.j > 0 && !neighbor.isGround && !neighbor.isPassableGround && !neighbor.isWall){
                    if(GetNonDiagonalDirection(currentCell,neighbor) != Vector2.left && GetNonDiagonalDirection(currentCell,neighbor) != Vector2.right){
                        neighbor.j = currentCell.j + 1;
                    }else{
                        neighbor.j = currentCell.j + 0.5f;
                    }
                }else if(currentCell.j > 0){
                    if((GetNonDiagonalDirection(currentCell,neighbor) != Vector2.left && GetNonDiagonalDirection(currentCell,neighbor) != Vector2.right && currentCell.parent != null && GetNonDiagonalDirection(currentCell,currentCell.parent) == Vector2.up) || neighbor.isWall){
                        neighbor.j = 0;
                        neighbor.th = 0;
                    }else{
                        continue;
                    }
                }

                if(GetNonDiagonalDirection(currentCell,neighbor) == Vector2.up){
                    //neighbor.infoCell.GetComponent<SpriteRenderer>().color = Color.cyan;
                    if(currentCell.j == 0){
                        neighbor.j = 2;
                    }else if(currentCell.j % 2 != 0){
                        neighbor.j = currentCell.j + 1;
                    }

                    /*else{
                        neighbor.j = currentCell.j + 1;
//.........这里部分代码省略.........
开发者ID:Darkfafi,项目名称:LJ3_Project1_Fighter,代码行数:101,代码来源:AStar.cs

示例5: Bug0001

		public void Bug0001()
		{
			var grid1 = new Grid();
			grid1.Redim(4, 12);
			grid1.FixedRows = 2;
			
			grid1[0, 3] = new Cell("5 Column Header");
			grid1[0, 3].ColumnSpan = 5;

			//2 Header Row
			grid1[1, 0] = new Cell("1");
			grid1[1, 1] = new Cell("2");
			
			var cell = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false);
			grid1[2, 2] = cell;
			grid1[2, 2].ColumnSpan = 2;
			grid1[2, 2].RowSpan = 2;
			
			// test that all cells point to the same cell
			Assert.AreEqual(cell, grid1.GetCell(2, 3));
			Assert.AreEqual(cell, grid1.GetCell(3, 2));
			Assert.AreEqual(cell, grid1.GetCell(3, 3));
		}
开发者ID:wsrf2009,项目名称:KnxUiEditor,代码行数:23,代码来源:TestGrid_Span.cs


注:本文中的Grid.GetCell方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。