コード例 #1
0
 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();
 }
コード例 #2
0
ファイル: RegisteredRoom.cs プロジェクト: xyberviri/MST
        public void OnPlayerLeft(int peerId)
        {
            accessesInUse.Remove(peerId);

            if (!connectedPlayers.TryGetValue(peerId, out IPeer playerPeer))
            {
                return;
            }

            OnPlayerLeftEvent?.Invoke(playerPeer);
        }
コード例 #3
0
        /// <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);
            }
        }