public override void OnPlayerLeftRoom(Player otherPlayer) { if (_gameController.IsGameStart) { OnNetworkErrorEvent?.Invoke("A player left the game.", "A player left the game while the game was in progress. "); } OnPlayerLeftEvent?.Invoke(); }
public void OnPlayerLeft(int peerId) { accessesInUse.Remove(peerId); if (!connectedPlayers.TryGetValue(peerId, out IPeer playerPeer)) { return; } OnPlayerLeftEvent?.Invoke(playerPeer); }
/// <summary> /// Fires when room player is disconnected /// </summary> /// <param name="peer"></param> private void Server_OnPeerDisconnectedEvent(IPeer peer) { var roomUserExtension = peer.GetExtension <RoomUserPeerExtension>(); if (roomUserExtension != null) { roomPlayersByMsfPeerId.Remove(roomUserExtension.MasterPeerId); roomPlayersByRoomPeerId.Remove(peer.Id); roomPlayersByUsername.Remove(roomUserExtension.Username); var roomServer = Server as RoomServerBehaviour; roomServer.CurrentRoomController.NotifyPlayerLeft(roomUserExtension.MasterPeerId); OnPlayerLeftEvent?.Invoke(roomUserExtension); } }