/// <summary> /// 客户端离开请求的处理 /// </summary> /// <param name="client"></param> private void LeaveRoom(ClientPeer client) { SingleExecute.Instance.Execute(() => { //不在战斗房间,忽略 if (fightCache.IsFighting(client.Id) == false) { return; } FightRoom room = fightCache.GetFightRoomByUserId(client.Id); room.leaveUserIdList.Add(client.Id); DatabaseManager.UpdateCoinCount(client.Id, -(room.bottomStakes * 20)); room.Broadcast(OpCode.Fight, FightCode.Leave_BRO, client.Id); //离开的玩家是本次下注的玩家 //这样的需转换下一个玩家下注 if (room.roundModel.CurrentStakesUserId == client.Id) { //轮换下注 Turn(client); } if (room.giveUpCardUserIdList.Count >= 1 && room.leaveUserIdList.Count >= 1) { GameOver(room); } //游戏结束 if (room.leaveUserIdList.Count == 2) { GameOver(room); return; } if (room.leaveUserIdList.Count == 3) { fightCache.DestoryRoom(room); } }); }