public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath) { // Get the appropriate puzzle var puzzle = GetPuzzleForPath(indexPath); // Populate view from puzzle data PuzzlesListCellViewController cell = PuzzlesListCellViewController.Create(puzzle); return(cell); }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { lastSelectedCell.UnsetSelected (); var cell = collectionView.CellForItem (indexPath) as PuzzlesListCellViewController; lastSelectedCell = cell; cell.SetSelected (); var puzzle = GetPuzzleForPath (indexPath); MenuPlayViewController menu = ParentViewController as MenuPlayViewController; menu.SetSelectedPuzzle (puzzle); }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { lastSelectedCell.UnsetSelected(); var cell = collectionView.CellForItem(indexPath) as PuzzlesListCellViewController; lastSelectedCell = cell; cell.SetSelected(); var puzzle = GetPuzzleForPath(indexPath); MenuPlayViewController menu = ParentViewController as MenuPlayViewController; menu.SetSelectedPuzzle(puzzle); }
internal void SelectPuzzleManually(PuzzleData selectedPuzzle) { int index = -1; int section = -1; if (puzzlesPxn.Contains(selectedPuzzle)) { section = 0; index = puzzlesPxn.IndexOf(selectedPuzzle); } else if (puzzlesCustom.Contains(selectedPuzzle)) { section = 1; index = puzzlesCustom.IndexOf(selectedPuzzle); } NSIndexPath path = NSIndexPath.FromItemSection(index, section); var cell = CollectionView.CellForItem(path) as PuzzlesListCellViewController; cell.SetSelected(); lastSelectedCell = cell; }
public static PuzzlesListCellViewController Create(PuzzleData puzzle) { PuzzlesListCellViewController cell = Nib.Instantiate(null, null) [0] as PuzzlesListCellViewController; cell.UpdatePuzzleView(puzzle); // Get components. Check XCode for tags. // 1 = image // 2 = friends icon // 3 = completed icon UIImageView imageView = cell.ViewWithTag(1) as UIImageView; imageView.Image = UIImage.FromFile(puzzle.Filename); UIImageView friendsIcon = cell.ViewWithTag(2) as UIImageView; friendsIcon.Hidden = !(puzzle.IsCustom); UIImageView completedIcon = cell.ViewWithTag(3) as UIImageView; completedIcon.Hidden = (puzzle.GetBestPlayerScore(GameCenterHelper.LocalPlayer.PlayerID).HasValue == false); return(cell); }
internal void SelectPuzzleManually(PuzzleData selectedPuzzle) { int index = -1; int section = -1; if (puzzlesPxn.Contains (selectedPuzzle)) { section = 0; index = puzzlesPxn.IndexOf (selectedPuzzle); } else if (puzzlesCustom.Contains (selectedPuzzle)) { section = 1; index = puzzlesCustom.IndexOf (selectedPuzzle); } NSIndexPath path = NSIndexPath.FromItemSection (index, section); var cell = CollectionView.CellForItem (path) as PuzzlesListCellViewController; cell.SetSelected (); lastSelectedCell = cell; }