/// <summary> /// 플레이어를 삭제합니다. /// </summary> /// <param name="serial"></param> /// <returns></returns> public bool DeletePlayer(int serial) { if (playerContainer.ContainsKey(serial) == false) { return(false); } MNetworkPlayer player = FindPlayer(serial); if (player == null) { return(false); } playerContainer.Remove(player.Serial); MNetworkRoom room = FindRoom(player.RoomKey); if (room != null) { room.LeavePlayer(player); } if (room.PlayerCount == 0) { DeleteRoom(room.roomKey); } if (player.PlayerState == MNetworkPlayer.MPlayerState.LoginSuccess) { playerNameContainer.Remove(player.UserName); } return(true); }
/// <summary> /// 방에서 플레이어를 퇴장시킵니다. /// </summary> /// <param name="room"></param> /// <param name="player"></param> /// <returns></returns> public bool ExitFromRoom(string roomKey, MNetworkPlayer player) { MNetworkRoom room = FindRoom(roomKey); if (room == null) { return(false); } room.LeavePlayer(player.Serial); return(true); }
/// <summary> /// 방에서 플레이어를 퇴장시킵니다. /// </summary> /// <param name="room"></param> /// <param name="player"></param> /// <returns></returns> public bool ExitFromRoom(MNetworkRoom room, MNetworkPlayer player) { if (room == null) { return(false); } if (player == null) { return(false); } room.LeavePlayer(player.Serial); return(true); }