// Send out request to connect to the network public void TryJoinGame(string ip, ushort port, string name) { peerManager = new PeerManager(ListenPort, name); List <byte> peerBytes = LocalPeer().GetByteData(); sender.QueuePacket(new Packet(peerBytes, 0, PacketType.connectToNetwork, PacketValue.addUpdate, ip, port, true)); }
// Invoke the disconnect event and the extra events which are assigned before the LeaveGame function public void WaitForDisconnect(PacketStatus status) { InvokeDisconnect(status != null ? status.packet.peerId : LocalId); afterDisconnectEvent?.Invoke(); afterDisconnectEvent.RemoveAllListeners(); peerManager = null; }
// Open and join a lobby public void TryHostLobby(string name) { peerManager = new PeerManager(ListenPort, name, true); JoinLobby(true); }