/// <summary> /// Removes the Peer from this Scope and adds them to the specified targetScope. /// </summary> /// <param name="peer">The Peer.</param> /// <param name="targetScope">The Scope to handover the Peer to.</param> public void HandoverPeer(TPeer peer, BaseServerScope <TPeer> targetScope) { // tell the peer about this handover ScopeUtils.SendScopeSwitchedMessage(this, targetScope, peer); // remove peer from this scope RemovePeer(peer, false); // add peer to target scope targetScope.AddPeer(peer, false); }
// Called (event-handler) when a Peer connects organically void OnPeerConnectedMsg(NetworkMessage msg) { // create the peer TPeer peer = (TPeer)msg.conn; // add to peers peers.Add(peer); peer.OnDisconnect += Peer_OnDisconnect; // notify event listeners OnPeerConnected(peer); // add this peer to the default scope defaultScope.AddPeer(peer, true); }