Exemple #1
0
        //function to chek, if Image was stitched
        public bool chekFinish(PuzzlePieces piecesList)
        {
            //if there is one or more empty PictureBoxes(cells) - it's not finished
            foreach (Piece piece in listOfParts)
            {
                if (piece.getPiecePicBox() == null)
                {
                    return(false);
                }
            }

            if (listOfParts == null)
            {
                return(false);
            }
            for (int i = 0; i < listOfParts.Count; i++)
            {
                if (!compareImages(listOfParts[i].getPiecePicBox().Image, piecesList.findPieceById(i).getRealImage()))
                {
                    return(false);
                }
            }

            return(true);
        }
 public void startGame(string gameName)
 {
     cleanPieces();
     cleanBoard();
     puzzleBoard = null;
     pieces      = null;
     puzzleBoard = new PuzzleBoard(flowLayoutPanel2);
     puzzleBoard.makeBoard(9);
     pieces = new PuzzlePieces(flowLayoutPanel1, puzzleBoard);
     pieces.takePicture(gameName);
     pieces.addImagesRandomToLayout();
 }