Ejemplo n.º 1
0
        //main constructor
        public gameBoardForm(ServiceClient server, int playerId, int rivalId, string mode, bool turn)
        {
            InitializeComponent();
            MainMenu.inGame = true;
            elementHost1 = new ElementHost();
            this.Turn = turn;
            this.server = server;
            this.playerId = playerId;
            this.rivalId = rivalId;
            this.mode = mode;

            if (Turn)
                this.turn_label.Text = "Please make a move";
            else
                this.turn_label.Text = "Please wait to your turn";

            SuspendLayout();
            next_btn.Enabled = false;
            back_btn.Enabled = false;
            next_btn.Visible = false;
            back_btn.Visible = false;
            switch (mode)
            {
                case "Easy":
                    build3on3();
                    break;

                case "Medium":
                    build4on4();
                    break;

                case "Hard":
                    build5on5();
                    break;
            }
            ResumeLayout(false);

            if (viewButton)
            {
                this.turn_label.Text = "";
                moveCounter = 0;
                allMoves = server.getMovesGameByGameId(gameBoardForm.gameId);
                if (allMoves.Length == 0)
                {
                    showMsg("this game has no moves");
                    next_btn.Enabled = false;
                    back_btn.Enabled = false;
                }
            }

            this.Text = "Game #" + gameId;
        }