protected void OnPlayerLeftWatchRoom(ulong roomUid, NetworkingPlayer player, NetLeftRoomResult ret) { if (playerLeftWatchRoom != null) { playerLeftWatchRoom(roomUid, player, ret); } }
// 服务器反馈, 离开房间 private void OnLeftWatchRoom(NetworkingPlayer player, Binary frame) { ulong roomUid = frame.StreamData.GetBasicType <ulong>(); NetLeftRoomResult ret = (NetLeftRoomResult)frame.StreamData.GetBasicType <int>(); if (room != null) { room.OnLeftRoom(); room = null; } OnPlayerLeftWatchRoom(roomUid, player, ret); }
// 客户端断开连接 private void OnPlayerDisconnected(NetworkingPlayer player, NetWorker sender) { Loger.LogFormat("LobbyServer OnPlayerDisconnected {0}", player.NetworkId); // 离开房间 NetLeftRoomResult ret = LeftRoom(player, true); if (ret == NetLeftRoomResult.Failed_RoomNoPlayer) { // 如果房间没有这玩家,就离开观看房间 LeftWatchRoom(player, true); } }