Beispiel #1
0
        private static void OnSessionConnected()
        {
            Plugin.Log?.Info("Multiplayer session is now connected.");

            IsConnected        = true;
            DisconnectedReason = DisconnectedReason.Unknown;
        }
Beispiel #2
0
 protected override async ValueTask OnClosingAsync(DisconnectedReason reason)
 {
     if (reason == DisconnectedReason.UserDisconnected)
     {
         await State !.OutputPump.SendMessageAsync(null, OutgoingDisconnect.Instance);  // TODO: We need a logger here.
     }
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="JsonRpcDisconnectedEventArgs"/> class.
        /// </summary>
        /// <param name="description">The description.</param>
        /// <param name="reason">The reason for disconnection.</param>
        /// <param name="exception">The exception.</param>
        public JsonRpcDisconnectedEventArgs(string description, DisconnectedReason reason, Exception?exception)
        {
            Requires.NotNullOrWhiteSpace(description, nameof(description));

            this.Description = description;
            this.Reason      = reason;
            this.Exception   = exception;
        }
Beispiel #4
0
 private void HandleDisconnected(DisconnectedReason reason)
 {
     PlatformManager.Heart.SetActive(_config.ShowHeart);
     PlatformManager.Heart.GetComponent <InstancedMaterialLightWithId>().ColorWasSet(Color.magenta);
     if (_config.ShowInMenu)
     {
         ChangeToPlatform(PlatformType.Singleplayer);
     }
 }
Beispiel #5
0
        protected override async ValueTask OnClosed(DisconnectedReason reason)
        {
            StateHolder state = _state !;
            await Task.WhenAll(state.Input.CloseAsync(), state.OutputPump.CloseAsync());

            await base.OnClosed(reason);

            _state = null;
        }
Beispiel #6
0
        void DisconnectConnection(Connection connection, DisconnectedReason reason, bool sendToOtherPeer = true)
        {
            if (sendToOtherPeer)
            {
                SendCommand(connection, Commands.Disconnect, (byte)reason);
            }

            connection.ChangeState(ConnectionState.Disconnected);
            connection.DisconnectTime = _clock.ElapsedInSeconds;
            OnDisconnected?.Invoke(connection, reason);
        }
 private static void OnSessionDisconnected(DisconnectedReason reason)
 {
     ConnectedMultiplay = false;
     connectedPlayers.Clear();
     LobbyAvatarPlaceList.Clear();
     Logger.log.Info($"SessionManager Disconnected {reason}");
     if (PluginConfig.Instance.MenuProfile != "" && PluginConfig.Instance.ProfileSceneChange)
     {
         CameraUtilities.ProfileChange(PluginConfig.Instance.MenuProfile);
     }
 }
Beispiel #8
0
 private static void OnSessionDisconnected(DisconnectedReason reason)
 {
     ConnectedMultiplay = false;
     connectedPlayers.Clear();
     LobbyAvatarPlaceList.Clear();
     Logger.Log($"SessionManager Disconnected {reason}", LogLevel.Info);
     if (Plugin.Instance._rootConfig.MenuProfile != "" && Plugin.Instance._rootConfig.ProfileSceneChange)
     {
         Plugin.Instance._profileChanger.ProfileChange(Plugin.Instance._rootConfig.MenuProfile);
     }
 }
Beispiel #9
0
        void Close(DisconnectedReason reason, string message = null)
        {
            tracer.Info(Properties.Resources.Client_Closing, Id, reason);

            CloseClientSession();
            packetsSubscription?.Dispose();
            packetListener?.Dispose();
            Channel?.Dispose();
            IsConnected = false;
            Id          = null;

            Disconnected(this, new MqttEndpointDisconnected(reason, message));
        }
Beispiel #10
0
        private static void OnSessionDisconnected(DisconnectedReason reason)
        {
            Plugin.Log?.Info($"Multiplayer session is now disconnected ({reason}).");

            IsConnected        = false;
            DisconnectedReason = reason;

            // Restore the user's preferred master server
            MpConnect.ClearMasterServerOverride();

            // Clear any notifications
            FloatingNotification.Instance.DismissMessage();
        }
Beispiel #11
0
        void Close(DisconnectedReason reason, string message = null)
        {
            tracer.Info(Properties.Resources.Client_Disposing, Id, reason);

            receiver?.OnCompleted();
            packetsSubscription?.Dispose();
            packetListener?.Dispose();
            packetChannel?.Dispose();
            (clientSender as IDisposable)?.Dispose();
            IsConnected = false;
            Id          = null;

            Disconnected(this, new MqttEndpointDisconnected(reason, message));
        }
Beispiel #12
0
    private void DisconnectInternal(DisconnectedReason disconnectedReason = DisconnectedReason.UserInitiated, ConnectionFailedReason connectionFailedReason = ConnectionFailedReason.Unknown)
    {
        if (this._connectionState == LiteNetLibConnectionManager.ConnectionState.Unconnected)
        {
            return;
        }
        bool flag = this._connectionState == LiteNetLibConnectionManager.ConnectionState.Connecting;

        this._connectionState = LiteNetLibConnectionManager.ConnectionState.Unconnected;
        CancellationTokenSource backgroundSentryDisconnectCts = this._backgroundSentryDisconnectCts;

        if (backgroundSentryDisconnectCts != null)
        {
            backgroundSentryDisconnectCts.Cancel();
        }
        this._netManager.DisconnectAll();
        this._netManager.PollEvents();
        if (flag)
        {
            Action <ConnectionFailedReason> action = this.onConnectionFailedEvent;
            if (action == null)
            {
                return;
            }
            action(connectionFailedReason);
            return;
        }
        else
        {
            Action <DisconnectedReason> action2 = this.onDisconnectedEvent;
            if (action2 == null)
            {
                return;
            }
            action2(disconnectedReason);
            return;
        }
    }
Beispiel #13
0
 private static void OnMultiplayerDisconnected(DisconnectedReason reason)
 {
     Plugin.Log.Debug("Multiplayer disconnected");
     mpconnected = false;
 }
Beispiel #14
0
 protected override ValueTask OnClosed(DisconnectedReason reason)
 {
     State !.Channel.Close(_config.InputLogger);
     return(base.OnClosed(reason));
 }
 public JsonRpcDisconnectedEventArgs(string description, DisconnectedReason reason, JToken?lastMessage)
     : this(description, reason, lastMessage : lastMessage, exception : null)
 {
 }
Beispiel #16
0
 public void OnMultiplayerDisconnected(DisconnectedReason reason)
 {
     CleanUpMultiplayer();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonRpcDisconnectedEventArgs"/> class.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <param name="reason">The reason for disconnection.</param>
 public JsonRpcDisconnectedEventArgs(string description, DisconnectedReason reason)
     : this(description, reason, (Exception?)null)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="JsonRpcDisconnectedEventArgs"/> class.
 /// </summary>
 /// <param name="description">The description.</param>
 /// <param name="reason">The reason for disconnection.</param>
 /// <param name="exception">The exception.</param>
 public JsonRpcDisconnectedEventArgs(string description, DisconnectedReason reason, Exception exception)
     : this(description, reason, lastMessage : null, exception : exception)
 {
 }
 private void SessionManager_Disconnected(DisconnectedReason obj)
 {
     Plugin.Log?.Info($"SessionManager Disconnected");
     IsConnected = false;
     PlayerReceivers.Clear();
 }
 public static void Postfix(MultiplayerLevelScenesTransitionSetupDataSO multiplayerLevelScenesTransitionSetupData, DisconnectedReason disconnectedReason)
 {
     SiraEvents.SendDisconnectEvent(multiplayerLevelScenesTransitionSetupData, disconnectedReason);
 }
Beispiel #21
0
 internal static void SendDisconnectEvent(MultiplayerLevelScenesTransitionSetupDataSO data, DisconnectedReason reason)
 {
     MultiplayerDisconnected?.Invoke(data, reason);
 }
Beispiel #22
0
 public void Disconnect(DisconnectedReason disconnectedReason = DisconnectedReason.UserInitiated)
 {
     this.DisconnectInternal(disconnectedReason, ConnectionFailedReason.ConnectionCanceled);
 }
 public DisconnectedEventArgs(DisconnectedReason reason)
 {
     Reason = reason;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MqttEndpointDisconnected" /> class,
 /// specifying the disconnection reason and an optional disconnection message
 /// </summary>
 /// <param name="reason">
 /// Reason of the disconnection.
 /// See <see cref="DisconnectedReason" /> for more details about the possible options
 /// </param>
 /// <param name="message">Optional message for the disconnection</param>
 public MqttEndpointDisconnected(DisconnectedReason reason, string message = null)
 {
     Reason  = reason;
     Message = message;
 }
 private static void OnSessionDisconnected(object sender, DisconnectedReason e)
 {
     cells.Clear();
 }
 public static string Client_Closing(string id, DisconnectedReason reason) => $"Client {id} - Closing. Reason: {reason.ToString()}";
 private void OnDisconnected(DisconnectedReason reason)
 {
     SessionDisconnected?.RaiseEventSafe(this, reason, nameof(SessionDisconnected));
 }
 private void SiraEvents_MultiplayerDisconnected(MultiplayerLevelScenesTransitionSetupDataSO setupData, DisconnectedReason reason)
 {
     LocalPlayerDidDisconnectFromMultiplayer?.Invoke(setupData, reason);
     MultiplayerLevelDisconnected?.Invoke(reason);
 }