private void NetworkHandler_NetworkInitializingFinished(InitializeNetworkHandler handler)
        {
            try
            {
                handler.NetworkInitializingFinished -= NetworkHandler_NetworkInitializingFinished;

                ConnectionLobby.Status = handler.Message;

                if (!handler.Error)
                {
                    Network = handler.Network;

                    SessionInformation = new SessionConnectParameters(handler.ConnectParameters.ServerIP, ParentControl.NetworkDeathHandler, Network.ClientSession);
                    ShowReconnectOptions();

                    if (handler.ConnectParameters.GameReconnect)
                    {
                        ParentControl.StatusControl.SetReconnecting();
                        ParentControl.SwitchMode(GameMode.Status);
                    }
                    else
                    {
                        ParentControl.OptionControl.SetServerIP(handler.ConnectParameters.ServerIP.ToString());
                        ParentControl.SwitchMode(GameMode.Options);
                    }
                }
            }
            finally
            {
                Connecting = false;
            }
        }
        private void HandleInitResponse(ServerInitializeGameResponse initResponse)
        {
            if (initResponse.m_players == null || initResponse.m_ball == null || initResponse.m_field == null)
            {
                IntiializeDelayedCancel();
                StatusLobby.SetStatus("Invalid server response!");
                return;
            }

            ParentControl.GameControl.InitializeGame(initResponse.m_players, initResponse.m_field, initResponse.m_ball);
            ParentControl.SwitchMode(GameMode.Game);
        }
        private void ApplyConfiguration()
        {
            switch (GameOptionLobby.SelectedOption)
            {
            case RequestOptions.Matchmaking:
                ParentControl.RegistrationControl.MaxPlayers = GameOptionLobby.PlayerCount;
                ParentControl.RegistrationControl.ResetSelection();
                ParentControl.SwitchMode(GameMode.Registration);
                break;

            case RequestOptions.Observe:
                Network.SendClientObserve(GameOptionLobby.PlayerCount);
                ParentControl.SwitchMode(GameMode.Status);
                break;
            }
        }
 private void Cancel()
 {
     ParentControl.SwitchMode(GameMode.Connect);
 }
 private void OnReady()
 {
     Network.SendClientQueueMatchmaking(MaxPlayers, RegistrationLobby.PlayerTeamWishes);
     ParentControl.SwitchMode(GameMode.Status);
 }
Esempio n. 6
0
 private void SetGameFinished(ServerGameControlPackage package)
 {
     ParentControl.FinishControl.ProcessFinishPackage(package);
     ParentControl.SwitchMode(GameMode.Finish);
 }