Beispiel #1
0
        /// <summary>
        /// 游戏结束
        /// </summary>
        /// <param name="room"></param>
        private void GameOver(FightRoom room)
        {
            PlayerDto        winPlayer = null;
            List <PlayerDto> loseList  = new List <PlayerDto>();

            foreach (var player in room.playerList)
            {
                // 胜利的玩家
                if (!room.IsGiveUpCard(player.id) && !room.IsLeaveRoom(player.id))
                {
                    winPlayer = player;
                }
                // 失败的玩家们
                else
                {
                    loseList.Add(player);
                }
            }
            DatabaseManager.UpdateCoin(winPlayer.id, room.stakesSum);
            gameOverDto.Change(winPlayer, loseList, room.stakesSum);
            room.Broadcast(OpCode.Fight, FightCode.GameOver_BRO, gameOverDto);
            //销毁房间
            fightCache.DesRoom(room);
            //清空定时任务
            TimerManager.Instance.Clear();
        }