Exemplo n.º 1
0
        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();
                }
            }
        }
Exemplo n.º 2
0
        public void Show(string ipAddress, int port, int leaguesID, int roundsID, IProfileRepository profileRepository, IErrorMessagesPresenter errorPresenter, IConnectionRelayer connectionRelayer, IGameMatch gameMatch)
        {
            if (connectionDialog != null)
            {
                connectionDialog.Close();
            }

            connectionDialog = new ConnectionDialog(ipAddress, port, leaguesID, roundsID,
                    ProfileRepository.Instance, consolePane, this, null);
            connectionDialog.Owner = this;
            connectionDialog.Closing += new System.ComponentModel.CancelEventHandler(modalWindow_Closing);
            connectionDialog.Show();
        }
Exemplo n.º 3
0
        public void Connect(IConnection connection, IGameMatch gameMatch, Authentication autentization, int leaguesID, int roundsID)
        {
            DebuggerIX.WriteLine(DebuggerTag.Net, "Connected", "Auth: " + autentization.Name + " " + autentization.IP);
            DebuggerIX.WriteLine(DebuggerTag.Net, "Connected", "Game = {LeaguesID: " + leaguesID + "; RoundsID: " + roundsID + "}");

            if (conn1 == null)
            {
                conn1 = connection;
            }
            else
            {
                conn2 = connection;
                runTests();
            }
        }
Exemplo n.º 4
0
        public InitConnection(int leaguesID, int roundsID, IProfileRepository profileRepository, 
            IErrorMessagesPresenter errorPresenter, IConnectionRelayer connectionRelayer,
            IGameMatch gameMatch)
        {
            InitializeComponent();
            this.DataContext = this;
            IpAddress = "Automatic";
            this.leaguesID = leaguesID;
            this.roundsID = roundsID;
            this.profile = profileRepository;
            this.errorPresenter = errorPresenter;
            this.connectionRelayer = connectionRelayer;
            this.gameMatch = gameMatch;

            auth = new Authentication(profileRepository.Username, profileRepository.IPAddress);
        }
Exemplo n.º 5
0
        public ConnectionDialog(string ipAddress, int port, int leaguesID, int roundsID, 
            IProfileRepository profileRepository, IErrorMessagesPresenter errorPresenter, 
            IConnectionRelayer connectionRelayer, IGameMatch gameMatch)
        {
            InitializeComponent();
            this.DataContext = this;
            this.leaguesID = leaguesID;
            this.roundsID = roundsID;
            this.profile = profileRepository;
            this.errorPresenter = errorPresenter;
            this.connectionRelayer = connectionRelayer;
            this.port = port;
            this.ipAddress = ipAddress;
            this.gameMatch = gameMatch;
            endTheThread = 0;

            auth = new Authentication(profileRepository.Username, profileRepository.IPAddress);
        }