Ejemplo n.º 1
0
        /// <summary>
        /// 为了处理一炮多响的情况
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="desUid"></param>
        /// <param name="huType"></param>
        /// <param name="card"></param>
        /// <param name="card1"></param>
        public void ZhuoPaoResult(string uid, string desUid, int card1, int card2)
        {
            foreach (var row in Players)
            {
                if (row.PlayerUser.Uid != desUid && (row.CheckHu(card1)))
                {
                    row.ResetEvent.WaitOne();
                }
                if (card2 != -1 && row.PlayerUser.Uid != desUid && (row.CheckHu(card2)))
                {
                    row.ResetEvent.WaitOne();
                }
            }


            LinkedListNode <CsGamePlayer> desNode = FindPlayer(desUid);

            bool llNodeListLocked = false;

            try
            {
                roomLock.Enter(ref llNodeListLocked);
                dianPaoNumber++;
                //一炮多响,放炮人为庄
                if (dianPaoNumber > 1)
                {
                    this.Player = desNode;
                }
                else
                {
                    this.Player = FindPlayer(uid);
                }
                if (dianPaoNumber != 1)
                {
                    return;
                }
            }
            finally
            {
                if (llNodeListLocked)
                {
                    roomLock.Exit();
                }
            }


            Tuple <int, int> niao     = this.ZhuaNiao();
            string           niaoUid1 = this.GetUidWithNiao(niao.Item1);
            string           niaoUid2 = this.GetUidWithNiao(niao.Item2);

            CalculationScore.Calculation(this.Players, niaoUid1, niaoUid2);

            SendA1021Response(niao, niaoUid1, niaoUid2, desUid);


            this.EndGame();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 自摸
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="huType"></param>
        public void Zimo(string uid, int huType)
        {
            LogManager.Log.Debug("自摸开始");

            if (this.IsFrist)
            {
                foreach (var row in Players)
                {
                    if ((row.CheckKaiJuHu()) && row.PlayerUser.Uid != uid)
                    {
                        LogManager.Log.Debug("开局胡等待" + row.PlayerUser.Uid + "wait");
                        row.ResetEvent.WaitOne();
                        LogManager.Log.Debug("开局胡等待处理完毕" + row.PlayerUser.Uid + "wait");
                    }
                }
            }



            LinkedListNode <CsGamePlayer> node = FindPlayer(uid);

            this.Player = node;
            this.Player.Value.HuType |= huType;
            Tuple <int, int> niao     = this.ZhuaNiao();
            string           niaoUid1 = this.GetUidWithNiao(niao.Item1);
            string           niaoUid2 = this.GetUidWithNiao(niao.Item2);

            CalculationScore.Calculation(this.Players, niaoUid1, niaoUid2);

            SendA1013Response(node.Value.PlayerUser.Uid, niao, niaoUid1, niaoUid2);
            this.OutCardState = OutCardState.Hu;
            this.SetAllResetEvent();
            this.IsEnd = true;

            actionStorage.PushHu(uid, huType);
            this.EndGame();
        }