Beispiel #1
0
        //choose game to watch
        private void submit_btn_Click(object sender, EventArgs e)
        {
            gameBoardForm.viewButton = true;
            gameBoardForm.gameId = games[comboBox.SelectedIndex].gameId;
            string mode = games[comboBox.SelectedIndex].gameMode.Trim();
            gameBoardForm temp = new gameBoardForm(server, -1, -1, mode, true);
            
            this.Hide();
            temp.ShowDialog(this);
            this.Close();

        }
        public Board3x3(bool turn,ServiceClient Server,int playerid,int rivalid,gameBoardForm gbf)
        {
            
            InitializeComponent();
            moveCounter = 0;
            this.gameBoard = gbf;
            this.Turn=turn;
            this.playerId = playerid;
            this.rivalId = rivalid;
            this.win = false;
            this.draw = false;

            for (int i = 0; i < BOARD_SIZE; i++)
            {
                for (int z = 0; z < BOARD_SIZE; z++)
                {
                    gameBoardForm.boardGame3x3[i,z] = 2;
                }
            }
            //Determine who is cross or circle
            if (Turn)
            {
                shape = 1;
                gameBoard.turn_label.Text = "Please make a move";
            }
            else
            {
                gameBoard.turn_label.Text = "Please wait to your turn";
                shape = 0;
            }
            
            this.server = Server;

            refernceArr.Clear();
            IEnumerable<StackPanel> collection = grid.Children.OfType<StackPanel>();
            foreach (var item in collection)
            {
                refernceArr.Add(item);

            }

        
           
       

        }