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; } }
private void SessionConnectionStateChangedHandler(IMultiplayerSessionConnectionState state) { switch (state.CurrentStage) { case MultiplayerSessionConnectionStage.AwaitingReservationCredentials: AuthenticationContext authenticationContext = new AuthenticationContext(userName); multiplayerSession.RequestSessionReservation(new PlayerSettings(RandomColorGenerator.GenerateColor()), authenticationContext); break; case MultiplayerSessionConnectionStage.SessionReserved: multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler; Multiplayer.Main.StartSession(); break; case MultiplayerSessionConnectionStage.SessionReservationRejected: Log.InGame($"Cannot join server: {multiplayerSession.Reservation.ReservationState.ToString()}"); multiplayerSession.Disconnect(); break; case MultiplayerSessionConnectionStage.Disconnected: multiplayerSession.ConnectionStateChanged -= SessionConnectionStateChangedHandler; break; default: Log.InGame($"Current Stage: {multiplayerSession.CurrentState.CurrentStage}"); break; } }
public static void Prefix() { IMultiplayerSession multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>(); multiplayerSession.Disconnect(); Application.Quit(); }
public static void Prefix() { // TODO: Remove this patch after fixing that no MP resources are left on disconnect. So that we can return to main menu. IMultiplayerSession multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>(); multiplayerSession.Disconnect(); Application.Quit(); }
public static void Prefix() { IMultiplayerSession multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>(); if (multiplayerSession.Client.IsConnected) { multiplayerSession.Disconnect(); } }
public void StopCurrentSession() { SceneManager.sceneLoaded -= SceneManager_sceneLoaded; multiplayerSession.Disconnect(); OnAfterMultiplayerEnd?.Invoke(); //Always do this last. NitroxServiceLocator.EndCurrentLifetimeScope(); }
public static void Prefix() { IMultiplayerSession multiplayerSession = NitroxServiceLocator.LocateService <IMultiplayerSession>(); if (multiplayerSession.Client.IsConnected) { multiplayerSession.Disconnect(); // Should really be put into several different methods } }
public void StopCurrentSession() { SceneManager.sceneLoaded -= SceneManager_sceneLoaded; multiplayerSession.Disconnect(); PlayerManager remotePlayerManager = NitroxServiceLocator.LocateService <PlayerManager>(); remotePlayerManager.RemoveAllPlayers(); packetReceiver.Flush(); }
public override void Process(PlayerKicked packet) { string message = Language.main.Get("Nitrox_PlayerKicked"); if (!string.IsNullOrEmpty(packet.Reason)) { message += $"\n {packet.Reason}"; } session.Disconnect(); Modal.Get <KickedModal>()?.Show(message); }
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; } }
public void StopCurrentSession() { SceneManager.sceneLoaded -= SceneManager_sceneLoaded; if (multiplayerSession.CurrentState.CurrentStage != MultiplayerSessionConnectionStage.DISCONNECTED) { multiplayerSession.Disconnect(); } OnAfterMultiplayerEnd?.Invoke(); //Always do this last. NitroxServiceLocator.EndCurrentLifetimeScope(); }
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; } }
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; } }
private void RenderUnableToJoinDialog(int windowId) { Event e = Event.current; if (e.isKey) { switch (e.keyCode) { case KeyCode.Return: joiningServer = true; notifyingUnableToJoin = false; break; case KeyCode.Escape: joiningServer = true; notifyingUnableToJoin = false; break; } } GUISkinUtils.RenderWithSkin(GetGUISkin("dialogs.server.rejected", 490), () => { using (new GUILayout.VerticalScope("Box")) { using (new GUILayout.HorizontalScope()) { MultiplayerSessionReservationState reservationState = multiplayerSession.Reservation.ReservationState; string reservationStateDescription = reservationState.Describe(); GUILayout.Label(reservationStateDescription); } if (GUILayout.Button("OK")) { notifyingUnableToJoin = false; multiplayerSession.Disconnect(); multiplayerSession.Connect(ServerIp); } } }); }
public override void Process(PlayerKicked packet) { session.Disconnect(); PlayerKickedModal.Instance.Show(); }
public override void Process(PlayerKicked packet) { session.Disconnect(); }