public void Connect(IConnection connection, IGameMatch gameMatch, Authentication autentization, int leaguesID, int roundsID) { if (gameMatch != null) // gameMatch is returned from "server" { try { gameMatch.SetNetworkConnection(connection); } catch (InvalidStateException e) { MessageBoxShow("Error in setting up network game occured: " + e.Message); } } else // "client" doesn't have GameDeskControl opened by default { string questXml = this.getRequestOnServer("/remote/GetLeague/" + leaguesID + "/" + roundsID); if (questXml != "error" && questXml != "") { OpeningMode openingMode = (roundsID == -1) ? OpeningMode.League : OpeningMode.Round; Quest q = new Quest(openingMode, questXml, this /*gameServerCommunication*/); IGameMatch gm = this.QuestSelected(leaguesID, roundsID, q, GameMode.TwoPlayers, connection); } else { consolePane.ErrorMessage(ErrorMessageSeverity.Medium, "MainProgram", "Server returned empty response. The problem is propably at server-side."); MessageBoxShow("The league cannot be opened. A problem is probably on the side of server."); connection.CloseConnection(); } } }
/// <summary> /// For testing purposes /// </summary> public void Add(string questXml) { Quest q = new Quest(questXml); this.Add(q); }