/// <summary> /// Stops given peer. /// </summary> private static void InternalStopPeer([NotNull] QNetPeer peer, string stopReason) { if (peer == null) { throw new ArgumentNullException(nameof(peer)); } if (!InternalRunningPeers.Contains(peer)) { throw new InvalidOperationException( "Unable to stop given peer. Given peer can't be stopped while not started."); } // remove this peer InternalRunningPeers.Remove(peer); // rebuild array RunningPeers = InternalRunningPeers.ToArray(); // and then stop peer.Stop(stopReason); }
/// <summary> /// Generates outgoing message. /// </summary> public static QNetMessageWriter GenerateOutgoingMessage(this QNetPeer peer, QNetUnityLocalHeader messageHeader, params object[] obj) { return(peer.GenerateOutgoingMessage((ushort)messageHeader, obj)); }