public ChessBoardController(ChessBoardView theView, Position theModel)
 {
     view = theView;
     view.SquareClicked += HandleClickedSquare;
     model = theModel;
     SetAllSquares();
 }
Beispiel #2
0
        public ChessGame()
        {
            aChessBoard       = new ChessBoard();
            aPieceManipulator = new PieceManipulator();
            aChessBoardView   = new ChessBoardView(
                aChessBoard, aPieceManipulator, Brushes.White, Brushes.Black);

            NewGame();
        }
Beispiel #3
0
 public MainForm(EwnController controller)
 {
     InitializeComponent();
     mainController = controller;
     chessBoardView = new ChessBoardView(controller, chessPanel.Height, chessPanel.Width);
     mainController.chessBoardView = chessBoardView;
     mainController.diceLabel      = diceLabel;
     diceLabel.Text = mainController.moveChessNum.ToString();
     mainController.player1Label = playerLabel1;
     mainController.player2Label = playerLabel2;
     chessPanel.Controls.Add(chessBoardView);
     chessBoardView.SetPlayer1(mainController.player1);
     chessBoardView.SetPlayer2(mainController.player2);
 }
        //-----------------------------------------------------------------------------------------------------------------------------------------

        public void onMenuStartBtnClicked()
        {
            Boolean isGameReady = false;

            switch (mSelectedGameType)
            {
            case GameType.CUSTOM_GAME:
            {
                CustomBoardViewModel customBoardViewModel = new CustomBoardViewModel(selectedColor, selectedStartingColor, playerOneAlgorithm, playerTwoAlgorithm);
                customBoardViewModel.closeCustomBoardView += new EventHandler(onCloseCustomBoardView);
                mCustomBoardView             = new CustomBoardView();
                mCustomBoardView.DataContext = customBoardViewModel;
                mCustomBoardView.ShowDialog();
                mChessBoardModel = customBoardViewModel.chessBoardModel;
                isGameReady      = customBoardViewModel.isStartBtnClicked;
            } break;

            case GameType.STANDARD_GAME:
            {
                isGameReady = standardGameSetup();
            }
            break;
            }

            if (!isGameReady)
            {
                return;
            }

            mChessBoardModel.gameOver  += new EventHandler <Colors>(onGameOver);
            mChessBoardView             = new ChessBoardView();
            mChessBoardView.Closed     += onChessBoardViewClosed;
            mChessBoardViewModel        = new ChessBoardViewModel(mChessBoardModel);
            mChessBoardView.DataContext = mChessBoardViewModel;
            mChessBoardView.ShowDialog();
        }
Beispiel #5
0
 public ChessGame()
 {
     chessGame = new ChessBoardView();
 }
 public static void InitializeServices()
 {
     ChessSprites   = Services._GetTaggedComponent <ChessSprites>("ChessSprites");
     ChessBoardView = Services._GetTaggedComponent <ChessBoardView>("ChessBoardView");
 }