public ABCard PlayerGetOnePoker(int playerId)
        {
            Seat seat         = GetSeatByPlayerId(playerId);
            var  player       = seat.IPlayer;
            int  opponentId   = GetOpponentId(playerId);
            Seat opponentSeat = GetSeatByPlayerId(opponentId);

            if (player.AccountNotEnough(ChipInAmount))
            {
                NotifySinglePlayer(WebscoketSendObjs.Alert(player.Id, "账户余额不足"), player.Id);
            }
            if (null == seat.PlayOutPokers && null != seat.GetPoker)
            {
                return(null);
            }
            player.DecutMoney(ChipInAmount);
            lock (Locker)
            {
                if (Poker.RemaindCount > 0)
                {
                    if (null == seat.PlayOutPokers)
                    {
                        var card = Poker.TackOut(1)[0];
                        seat.GetPoker      = card;
                        seat.CompareResult = null;
                        NotifySinglePlayer(WebscoketSendObjs.FreshGameFace(player.Id), player.Id);
                        return(card);
                    }
                    return(null);
                }
                InningeGame.GameOver();//触发游戏结束事件
                return(null);
            }
        }
        /// <summary>
        /// 玩家获得一张牌
        /// </summary>
        /// <param name="playerId_">玩家Id</param>
        /// <returns>获得的牌</returns>
        public ABCard PlayerGetOnePoker(int playerId)
        {
            var seat         = InningeGame.GetSeatByPlayerId(playerId);
            var player       = seat.IPlayer;
            var opponentId   = GetOpponentId(playerId);
            var opponentSeat = InningeGame.GetSeatByPlayerId(opponentId);

            if (player.AccountNotEnough(ChipInAmount))
            {
                Notify?.Invoke(WebscoketSendObjs.Alert(player.Id, "账户余额不足"));
            }
            if (seat.GameDateObj["getPokers"].Count > 0)
            {
                return(null);
            }
            player.DecutMoney(ChipInAmount);
            if (Poker.RemaindCount > 0)
            {
                var card = Poker.TackOut(1)[0];
                seat.GameDateObj["getPokers"].Add(card);
                seat.GameDateObj["compareResult"].Clear();
                Notify?.Invoke(WebscoketSendObjs.FreshGameFace(player.Id));
                return(card);
            }
            InningeGame.GameOver();//触发游戏结束事件
            return(null);
        }
Beispiel #3
0
 /// <summary>
 /// 账户是否够
 /// </summary>
 /// <param name="player"></param>
 /// <param name="amount"></param>
 /// <returns></returns>
 private bool IsAccountEnougth(IPlayerJoinRoom player, decimal amount)
 {
     if (player.AccountNotEnough(amount))
     {
         NotifySinglePlayer(WebscoketSendObjs.Alert(player.Id, "账户余额不足"), player.Id);
         return(false);
     }
     return(true);
 }