예제 #1
0
 void setAllNodes(StandardCell _target)
 {
     //Debug.Log(">>>>> " + m_maze);
     for (int x = 0; x < m_maze.Size.x; x++)
     {
         for (int y = 0; y < m_maze.Size.y; y++)
         {
             StandardCell tmpCell = m_maze.Cells[x, y];
             tmpCell.Node.G = Mathf.Infinity;
             tmpCell.Node.H = Vector3.Distance(tmpCell.transform.position, _target.transform.position);
         }
     }
 }
예제 #2
0
    Stack reconstructPath(StandardCell _start, Node _solution)
    {
        //Debug.Log("_start: " + _start.name + " | _currentNode: " + _currentNode.name + " | _currentNode.Parent: " + _currentNode.Parent);
        Node  node = _solution;
        Stack path = new Stack();

        while (node != _start.Node)
        {
            path.Push(node);
            node = node.Parent;
        }

        m_path = path;
        return(path);
    }
예제 #3
0
    //BeginCell beingCellPrefab;
    //EndCell endCellPrefab;

    public ACell makeStandardCell(Vector2Int _coordinates)
    {
        Vector3 position = new Vector3(_coordinates.x * floorPrefab.transform.lossyScale.x + floorPrefab.transform.lossyScale.x,
                                       0f,
                                       _coordinates.y * floorPrefab.transform.lossyScale.z + floorPrefab.transform.lossyScale.z);

        StandardCell newCell = Instantiate(standardCellPrefab, position, new Quaternion()) as StandardCell;

        newCell.Coordinates = position;
        newCell.FloorPrefab = floorPrefab;
        newCell.WallPrefab  = wallPrefab;
        newCell.name        = "Maze StandardCell " + _coordinates.x + ", " + _coordinates.y;
        newCell.Maze        = m_gameController.MazeInstance;
        newCell.Generate();

        return(newCell);
    }
예제 #4
0
 //This will be called when the property changed has been completed. It will call
 //the cellHandler so that the UI can be updated.
 protected void OnCellPropertyChanged(StandardCell currCell, string text)
 {
     //Set the handler to the CellPropertyChanged
     PropertyChangedEventHandler cellHandler = CellPropertyChanged;
     //Call the cellHandler if changes have been made
     if (cellHandler != null)
         cellHandler(currCell, new PropertyChangedEventArgs(text));
 }
            UITableViewCell GetStandardCell( UITableView tableView, int rowIndex )
            {
                StandardCell cell = tableView.DequeueReusableCell(StandardCell.Identifier) as StandardCell;

                // convert the position to the appropriate image index.
                int leftImageIndex = 1 + ( rowIndex * 2 );

                // if there are no cells to reuse, create a new one
                if (cell == null)
                {
                    cell = new StandardCell (UITableViewCellStyle.Default, StandardCell.Identifier);
                    cell.SelectionStyle = UITableViewCellSelectionStyle.Default;
                    cell.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color );
                    cell.ParentSource = this;
                }
                cell.Bounds = new CGRect( cell.Bounds.X, cell.Bounds.Y, tableView.Bounds.Width, cell.Bounds.Height );

                cell.LeftImageIndex = leftImageIndex;


                // first set the left item
                if ( leftImageIndex < News.Count )
                {
                    if ( News[ leftImageIndex ].Image != null )
                    {
                        cell.LeftImage.Image = News[ leftImageIndex ].Image;
                    }
                    else
                    {
                        cell.LeftImage.Image = ImagePlaceholder;
                    }

                    cell.LeftPrivateOverlay.Hidden = !News[ leftImageIndex ].News.Developer_Private;
                }
                else
                {
                    cell.LeftImage.Image = null;
                    cell.LeftPrivateOverlay.Hidden = true;
                }

                // now if there's a right item, set it
                int rightImageIndex = leftImageIndex + 1;
                if ( rightImageIndex < News.Count )
                {
                    if ( News[ rightImageIndex ].Image != null )
                    {
                        cell.RightImage.Image = News[ rightImageIndex ].Image;
                    }
                    else
                    {
                        cell.RightImage.Image = ImagePlaceholder;
                    }

                    cell.RightPrivateOverlay.Hidden = !News[ rightImageIndex ].News.Developer_Private;
                }
                else
                {
                    cell.RightImage.Image = null;
                    cell.RightPrivateOverlay.Hidden = true;
                }

                // scale down the image to the width of the device
                nfloat imageWidth = cell.LeftImage.Image.Size.Width;
                nfloat imageHeight = cell.LeftImage.Image.Size.Height;

                // set the cell and child bounds
                nfloat aspectRatio = (float) (imageHeight / imageWidth);
                cell.Bounds = new CGRect( 0, 0, tableView.Bounds.Width, (tableView.Bounds.Width / 2) * aspectRatio );

                cell.LeftImage.Frame = new CGRect( cell.Bounds.X, cell.Bounds.Y, cell.Bounds.Width / 2, cell.Bounds.Height );
                cell.LeftButton.Frame = cell.LeftImage.Frame;
                cell.LeftPrivateOverlay.Frame = new CGRect( cell.Bounds.X, 0, cell.Bounds.Width / 2, 30 );

                cell.RightImage.Frame = new CGRect( cell.LeftImage.Frame.Right, cell.Bounds.Y, cell.Bounds.Width / 2, cell.Bounds.Height );
                cell.RightButton.Frame = cell.RightImage.Frame;
                cell.RightPrivateOverlay.Frame = new CGRect( cell.LeftImage.Frame.Right, 0, cell.Bounds.Width / 2, 30 );

                PendingCellHeight = cell.Bounds.Height;
                return cell;
            }
 public static StandardCell GetStandardCell(string key, StandardCell cell) => Cache.GetOrAdd(key, cell);