private void HandleHostGameScreenButtons(Control sender) { if (sender.Name == "Start") { gameType = Client.Client.GameType.hosted; StartServer(gameType); } if (sender.Name == "BackButton") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } }
void StartServer(Client.Client.GameType gameType) { int maxConnections = 0; if (gameType == Client.Client.GameType.local) { maxConnections = 1; } else { maxConnections = hostGameScreen.MaxConnections; } server = new Server.Server(this, spriteBatch, gameConfigName, maxConnections); Components.Add(server); //server.Hide(); StartClient(); }
private void HandleStartScreenButtons(Control sender) { if (sender.Name == "StartGame") { gameType = Client.Client.GameType.local; StartServer(gameType); } if (sender.Name == "NetworkGame") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } if (sender.Name == "QuitGame") { this.Exit(); } /* if (CheckKey(Keys.Enter)) * { * if (startScreen.SelectedIndex == 0) //start * { * gameType = Client.Client.GameType.local; * StartServer(gameType); * //activeScreen.Hide(); * //activeScreen = actionScreen; * //activeScreen.Show(); * } * * if (startScreen.SelectedIndex == 1) //Multiplayer game * { * activeScreen.Hide(); * activeScreen = networkScreen; * activeScreen.Show(); * } * * if (startScreen.SelectedIndex == 2) //quit * { * this.Exit(); * } * }*/ }
private void HandleJoinGameScreenButtons(Control sender) { if (sender.Name == "ScanLan") { //TODO: Only start client if local game is found gameType = Client.Client.GameType.scanLan; StartClient(); Console.WriteLine("SCAN LAN!"); } if (sender.Name == "Connect") //Join a network game by address { gameType = Client.Client.GameType.hosted; Console.WriteLine("Connect to {0}:{1}", joinGameScreen.Address, joinGameScreen.Port); } if (sender.Name == "BackButton") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } }
private void HandleNetworkSelectScreenButtons(Control sender) { if (sender.Name == "HostGame") { gameType = Client.Client.GameType.hosted; activeScreen.Hide(); activeScreen = hostGameScreen; activeScreen.Show(); } if (sender.Name == "JoinGame") { //load join screen activeScreen.Hide(); activeScreen = joinGameScreen; activeScreen.Show(); } if (sender.Name == "BackButton") { //go back to startScreen activeScreen.Hide(); activeScreen = startScreen; activeScreen.Show(); } }
private void HandleStartScreenButtons(Control sender) { if (sender.Name == "StartGame") { gameType = Client.Client.GameType.local; StartServer(gameType); } if (sender.Name == "NetworkGame") { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } if (sender.Name == "QuitGame") { this.Exit(); } /* if (CheckKey(Keys.Enter)) { if (startScreen.SelectedIndex == 0) //start { gameType = Client.Client.GameType.local; StartServer(gameType); //activeScreen.Hide(); //activeScreen = actionScreen; //activeScreen.Show(); } if (startScreen.SelectedIndex == 1) //Multiplayer game { activeScreen.Hide(); activeScreen = networkScreen; activeScreen.Show(); } if (startScreen.SelectedIndex == 2) //quit { this.Exit(); } }*/ }