private static void HandleReservation(IMultiplayerSessionConnectionContext sessionConnectionContext) { IMultiplayerSessionConnectionState nextState = sessionConnectionContext.Reservation.ReservationState == MultiplayerSessionReservationState.Reserved ? new SessionReserved() : new SessionReservationRejected() as IMultiplayerSessionConnectionState; sessionConnectionContext.UpdateConnectionState(nextState); }
public virtual void Disconnect(IMultiplayerSessionConnectionContext sessionConnectionContext) { sessionConnectionContext.ClearSessionState(); sessionConnectionContext.Client.Stop(); Disconnected newConnectionState = new Disconnected(); sessionConnectionContext.UpdateConnectionState(newConnectionState); }
private static void HandleReservation(IMultiplayerSessionConnectionContext sessionConnectionContext) { IMultiplayerSessionConnectionState nextState = sessionConnectionContext.Reservation.ReservationState switch { MultiplayerSessionReservationState.RESERVED => new SessionReserved(), _ => new SessionReservationRejected(), }; sessionConnectionContext.UpdateConnectionState(nextState); }
private static void EstablishSessionPolicy(IMultiplayerSessionConnectionContext sessionConnectionContext, IClient client) { string policyRequestCorrelationId = Guid.NewGuid().ToString(); MultiplayerSessionPolicyRequest requestPacket = new MultiplayerSessionPolicyRequest(policyRequestCorrelationId); client.Send(requestPacket); EstablishingSessionPolicy nextState = new EstablishingSessionPolicy(policyRequestCorrelationId); sessionConnectionContext.UpdateConnectionState(nextState); }
public void UpdateStateShouldRaiseEvent() { // Arrange IClient client = Substitute.For <IClient>(); IMultiplayerSession multiplayerSession = new MultiplayerSessionManager(client); IMultiplayerSessionConnectionContext connectionContext = (IMultiplayerSessionConnectionContext)multiplayerSession; IMonitor <IMultiplayerSession> monitor = multiplayerSession.Monitor(); // Act connectionContext.UpdateConnectionState(TestConstants.TEST_CONNECTION_STATE); // Assert monitor.Should().Raise("ConnectionStateChanged"); }
private void AwaitSessionReservation(IMultiplayerSessionConnectionContext sessionConnectionContext, string reservationCorrelationId) { AwaitingSessionReservation nextState = new AwaitingSessionReservation(reservationCorrelationId); sessionConnectionContext.UpdateConnectionState(nextState); }
private void ChangeState(IMultiplayerSessionConnectionContext sessionConnectionContext) { SessionJoined nextState = new SessionJoined(); sessionConnectionContext.UpdateConnectionState(nextState); }
private void AwaitReservationCredentials(IMultiplayerSessionConnectionContext sessionConnectionContext) { AwaitingReservationCredentials nextState = new AwaitingReservationCredentials(); sessionConnectionContext.UpdateConnectionState(nextState); }