Exemple #1
0
        private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionState state)
        {
            switch (state.CurrentStage)
            {
            case MultiplayerSessionConnectionStage.ESTABLISHING_SERVER_POLICY:
                Log.InGame("Requesting session policy information...");
                break;

            case MultiplayerSessionConnectionStage.AWAITING_RESERVATION_CREDENTIALS:
                if (multiplayerSession.SessionPolicy.RequiresServerPassword)
                {
                    Log.InGame("Waiting for Server Password Input...");
                    showingPasswordWindow = true;
                    shouldFocus           = true;
                }
                Log.InGame("Waiting for user input...");
                RightSideMainMenu.OpenGroup("Join Server");
                FocusPlayerNameTextbox();
                break;

            case MultiplayerSessionConnectionStage.SESSION_RESERVED:
                Log.InGame("Launching game...");
                multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler;
                preferencesManager.Save();

#pragma warning disable CS0618 // God Damn it UWE...
                IEnumerator startNewGame = (IEnumerator)uGUI_MainMenu.main.ReflectionCall("StartNewGame", false, false, GameMode.Survival);
#pragma warning restore CS0618 // God damn it UWE...
                StartCoroutine(startNewGame);
                LoadingScreenVersionText.Initialize();

                break;

            case MultiplayerSessionConnectionStage.SESSION_RESERVATION_REJECTED:
                Log.InGame("Reservation rejected...");

                MultiplayerSessionReservationState reservationState = multiplayerSession.Reservation.ReservationState;

                string reservationRejectionNotification = reservationState.Describe();

                NotifyUser(
                    reservationRejectionNotification,
                    () =>
                {
                    multiplayerSession.Disconnect();
                    multiplayerSession.Connect(ServerIp, ServerPort);
                });
                break;

            case MultiplayerSessionConnectionStage.DISCONNECTED:
                Log.Info("Disconnected from server");
                break;
            }
        }
Exemple #2
0
        private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionState state)
        {
            switch (state.CurrentStage)
            {
            case MultiplayerSessionConnectionStage.EstablishingServerPolicy:
                Log.InGame("Requesting session policy information...");
                break;

            case MultiplayerSessionConnectionStage.AwaitingReservationCredentials:
                Log.InGame("Waiting for User Input...");

                RightSideMainMenu.OpenGroup("Join Server");
                FocusPlayerNameTextbox();

                break;

            case MultiplayerSessionConnectionStage.SessionReserved:
                Log.InGame("Launching game...");

                multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler;
                preferencesManager.Save();

#pragma warning disable CS0618 // God Damn it UWE...
                IEnumerator startNewGame = (IEnumerator)uGUI_MainMenu.main.ReflectionCall("StartNewGame", false, false, GameMode.Survival);
#pragma warning restore CS0618 // God damn it UWE...
                StartCoroutine(startNewGame);

                break;

            case MultiplayerSessionConnectionStage.SessionReservationRejected:
                Log.InGame("Reservation rejected...");

                MultiplayerSessionReservationState reservationState = multiplayerSession.Reservation.ReservationState;

                string reservationRejectionNotification = reservationState.Describe();

                NotifyUser(
                    reservationRejectionNotification,
                    () =>
                {
                    multiplayerSession.Disconnect();
                    multiplayerSession.Connect(ServerIp, ServerPort);
                });

                break;

            case MultiplayerSessionConnectionStage.Disconnected:
                Log.Info("Disconnected from server");
                break;
            }
        }
Exemple #3
0
        private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionState state)
        {
            switch (state.CurrentStage)
            {
            case MultiplayerSessionConnectionStage.EstablishingServerPolicy:
                Log.InGame("Запрос информации о политике сеанса...");
                break;

            case MultiplayerSessionConnectionStage.AwaitingReservationCredentials:
                Log.InGame("Ожидание ввода пользователя...");

                RightSideMainMenu.OpenGroup("Join Server");
                FocusPlayerNameTextbox();

                break;

            case MultiplayerSessionConnectionStage.SessionReserved:
                Log.InGame("Запуск игры...");

                multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler;
                preferencesManager.Save();

                IEnumerator startNewGame = (IEnumerator)uGUI_MainMenu.main.ReflectionCall("StartNewGame", false, false, GameMode.Survival);
                StartCoroutine(startNewGame);

                break;

            case MultiplayerSessionConnectionStage.SessionReservationRejected:
                Log.InGame("Резервирование отклонено...");

                MultiplayerSessionReservationState reservationState = multiplayerSession.Reservation.ReservationState;

                string reservationRejectionNotification = reservationState.Describe();

                NotifyUser(
                    reservationRejectionNotification,
                    () =>
                {
                    multiplayerSession.Disconnect();
                    multiplayerSession.Connect(ServerIp, serverPort);
                });

                break;

            case MultiplayerSessionConnectionStage.Disconnected:
                Log.Info("Отключен от сервера");
                break;
            }
        }
Exemple #4
0
        private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionState state)
        {
            switch (state.CurrentStage)
            {
            case MultiplayerSessionConnectionStage.EstablishingServerPolicy:
                Log.InGame("Requesting session policy information...");
                break;

            case MultiplayerSessionConnectionStage.AwaitingReservationCredentials:
                Log.InGame("Waiting for User Input...");

                RightSideMainMenu.OpenGroup("Join Server");
                FocusPlayerNameTextbox();

                break;

            case MultiplayerSessionConnectionStage.SessionReserved:
                Log.InGame("Launching game...");

                multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler;
                preferencesManager.Save();
                StartCoroutine(LaunchSession());

                break;

            case MultiplayerSessionConnectionStage.SessionReservationRejected:
                Log.InGame("Reservation rejected...");

                MultiplayerSessionReservationState reservationState = multiplayerSession.Reservation.ReservationState;

                string reservationRejectionNotification = reservationState.Describe();

                NotifyUser(
                    reservationRejectionNotification,
                    () =>
                {
                    multiplayerSession.Disconnect();
                    multiplayerSession.Connect(ServerIp);
                });

                break;

            case MultiplayerSessionConnectionStage.Disconnected:
                Log.Info("Disconnected from server");
                break;
            }
        }
 public void Save()
 {
     PlayerPreferenceManager.Save(current);
 }