Пример #1
0
        public void endGame(string msg)
        {
            if (!ended)
            {
                ended = true;

                switch (dim)
                {
                case 3:
                    ctrl3.stopGame();
                    ctrl3.disableBoard();
                    break;

                case 4:
                    ctrl4.stopGame();
                    ctrl4.disableBoard();
                    break;

                case 5:
                    ctrl5.stopGame();
                    ctrl5.disableBoard();
                    break;
                }

                showMessage(msg);
            }
        }
Пример #2
0
        // game history display constructor
        public BoardForm(GameData game, MainForm mainForm)
        {
            InitializeComponent();

            switch (game.BoardSize)
            {
            case 3:
                ctrl3 = new Board3Control(this);
                boardElementHost.Child = ctrl3;
                ctrl3.disableBoard();
                break;

            case 4:
                ctrl4 = new Board4Control(this);
                boardElementHost.Child = ctrl4;
                ctrl4.disableBoard();
                break;

            case 5:
                ctrl5 = new Board5Control(this);
                boardElementHost.Child = ctrl5;
                ctrl5.disableBoard();
                break;
            }

            this.dim         = game.BoardSize;
            this.mainForm    = mainForm;
            this.Text        = "Board " + dim + "x" + dim;
            ended            = true;
            this.gameHistory = game;
            this.historyMode = true;
            btnNext.Visible  = true;

            string str = string.Format("{0}  vs.  {1}",
                                       "[" + gameHistory.Player1_Name.Replace(" ", string.Empty) + "]",
                                       "[" + gameHistory.Player2_Name.Replace(" ", string.Empty) + "]");

            showMessage(str);

            this.moves = getGameMovesFromString(gameHistory.Moves);     // simple string
            if (moves != null && moves.Length > 0)
            {
                btnNext.Enabled = true;
                currentMove     = 0;
            }
            else
            {
                MessageBox.Show("No moves available for this game", "Moves", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }