Ejemplo n.º 1
0
        public void Compare(int playerId)
        {
            CheckDateTime = DateTime.Now;
            if (CurrentStage != EStage.Running)
            {
                return;
            }
            Seat seat = GetJionSeatByPlayerId(playerId);

            if (IsNotPassedCheck(seat))
            {
                return;
            }
            bool iHadLook    = seat.IsLooked;
            Seat opponetSeat = GetOnlyOpponentSeat(playerId);

            if (null == opponetSeat)
            {
                return;
            }
            CheckDateTime = DateTime.Now;
            decimal chipInAmount = PreSeatAmount;

            if (iHadLook != PreSeatIsLook)
            {
                if (PreSeatIsLook)
                {
                    chipInAmount = chipInAmount / 2;
                }
                else
                {
                    chipInAmount = chipInAmount * 2;
                }
            }
            if (chipInAmount > LimitAmount)
            {
                chipInAmount = LimitAmount;
            }
            if (!IsDecutMoneySuccess(seat.IPlayer, chipInAmount))
            {
                return;
            }
            AddCurrentTotal(chipInAmount);
            seat.PreChipInAmount = chipInAmount;
            seat.PreChipType     = EChipinType.Compare;
            WinnerSeat           = GetWinner(seat, opponetSeat);
            decimal playerWinAmount = 0;

            playerWinAmount = SystemTax(playerWinAmount);
            WinnerSeat.IPlayer.DecutMoney(-playerWinAmount);
            FirstSeat    = WinnerSeat;//新庄家
            CurrentSeat  = WinnerSeat;
            CurrentStage = EStage.Computed;
            NotifyRoomPlayers(WebscoketSendObjs.RoomMessage(0, "开牌"));
            NotifyRoomPlayers(new ChipinAnimation(0, chipInAmount, playerId, EChipinType.Compare));
            NotifyRoomPlayers(new FreshGameFace(0));
            NotifySinglePlayer(WebscoketSendObjs.RoomMessage(0, "你赢了"), WinnerSeat.IPlayer.Id);
            NotifySinglePlayer(WebscoketSendObjs.RoomMessage(0, playerWinAmount + "分"), WinnerSeat.IPlayer.Id);
            NotifyRoomPlayersExcept(WebscoketSendObjs.RoomMessage(0, "你输了"), WinnerSeat.IPlayer.Id);
            InningeGame.GameOver(false, false);
        }
Ejemplo n.º 2
0
 private void RemoveFromJoinSeats(Seat seat)
 {
     JoinSeats.Remove(seat);
 }