/* * Display the join table UI * UC-02 R02 */ /* public void displayJoinGameUI() { joinTableUI = new JoinTableUI(this); joinTableUI.ShowDialog(); } */ /* * Send the Join Game request to the Server. */ public void joinGame(string nickname, IPAddress serverIP) { this.nickname = nickname; client = new Client(this, nickname); client.InitializeConnection(serverIP); if (!client.Connected) return; //set hasGame to true hasGame = true; //Display the non-host player version of TableUI sendToHost("J" + nickname); tableUI = new TableUI(this); /* I commented these lines out. Previously, they were only enabled if you were the creator. Which kind of makes sense. tableUI.addAIButton.IsEnabled = false; tableUI.removeAIButton.IsEnabled = false; tableUI.leaders_Checkbox.IsEnabled = false; */ tableUI.ShowDialog(); if (playerNames == null) { // If we get here and playerNames is null, the user closed the table UI dialog box // before pressing the ready button (or another player didn't press the ready button) // In that case, we will quit the game without showing the Main Window. hasGame = false; client.CloseConnection(); } // create the leader draft window if the Leaders expansion is enabled. if (isLeadersEnabled) leaderDraftWindow = new LeaderDraft(this, false); }
/** * Function called by MainWindow for creating a new game * UC-01 R02 */ public void createGame() { //create a GM Coordinator // JDF - this shouldn't be needed any more, the GMCoordinator has moved to a separate process. // gmCoordinator = new GMCoordinator(); hasGame = true; //automatically set the nickname to Host if the nickname is currently blank (which is the default) if (nickname == "") { nickname = "Host"; } //get my IP IPAddress myIP = myIPAddress(); //create the TCP Client client = new Client(this, nickname); client.InitializeConnection(myIP); if (!client.Connected) return; //display the TableUI tableUI = new TableUI(this); //join the game as a player //UC-01 R03 sendToHost("J" + nickname); tableUI.ShowDialog(); }