public void Deal(int playerId)
 {
     // if (IsChipinClose) {
     if (CurrentStage != EStage.CanChipIning)
     {
         NotifySinglePlayer(WebscoketSendObjs.RoomMessage(playerId, "不是押底阶段,不能发牌!"), playerId);
         return;
     }
     // if (JoinSeats.Count() != InningeGame.NotEmptySeats().Count()) {
     if (JoinSeats.Count() < 2)
     {
         NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "押底人数不足2人,不能发牌"));
         return;
     }
     CheckDateTime = DateTime.Now;
     //  IsChipinClose = true;//?
     PokerManager.Riffile();
     lock (this) {
         for (int i = 0; i < JoinSeats.Count(); i++)
         {
             ThreeCards threeCards = new ThreeCards(PokerManager.TackOut(3));
             JoinSeats[i].Pokers      = threeCards;
             JoinSeats[i].PreChipType = EChipinType.PlayerChipIn;
         }
         CurrentStage = EStage.Running;
     }
     CheckDateTime = DateTime.Now;
     NotifyRoomPlayers(new FreshGameFace(0));
     NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "发牌完毕,庄家开始下注"));
 }
Beispiel #2
0
        public override void AfterPlayerLeave(object inningeGame, EventArgs e)
        {
            var notEmptySeatsCount = ((IInningeGame)inningeGame).NotEmptySeats().Count();

            if (notEmptySeatsCount > 0)
            {
                if (CurrentStage == EStage.Running && JoinSeats.Count() == 1)
                {
                    CompareAll();
                    NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "有玩家要离开,人数不足,自动结算"));
                }
                else if (notEmptySeatsCount == 1)
                {
                    CurrentStage = EStage.CanChipIning;
                    if (JoinSeats.Count() == 1)
                    {
                        var onlySeat = JoinSeats[0];
                        if (onlySeat.IsChipIned)
                        {
                            onlySeat.IsChipIned = false;
                            IsDecutMoneySuccess(onlySeat.IPlayer, -onlySeat.ChipinAmount);
                        }
                        onlySeat.IsGaveUp = false;
                        onlySeat.IsLooked = false;
                        NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "有玩家要离开,人数不足,退还你的押底"));
                    }
                    NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "有玩家要离开,人数不足,取消押底"));
                }
                base.AfterPlayerLeave(inningeGame, e);
                NotifyRoomPlayers(new FreshGameFace(0));
            }
        }
 public override void Stoped(object inningeGame, EventArgs e)
 {
     //     if (!IsChipinClose) {
     if (CurrentStage == EStage.CanChipIning)
     {
         for (int i = 0; i < JoinSeats.Count(); i++)
         {
             var seat = JoinSeats[0];
             if (seat.IsChipIned)
             {
                 seat.IPlayer.DecutMoney(-seat.ChipinAmount);
             }
         }
     }
     InningeGame.GameOver();
     base.Stoped(inningeGame, e);
 }