Beispiel #1
0
 /// <summary>
 /// 设置插牌动作数据
 /// </summary>
 /// <param name="handStyle"></param>
 /// <param name="orgPaiIdx"></param>
 /// <param name="dstHandPaiIdx"></param>
 /// <param name="orgPaiType"></param>
 /// <param name="adjustDirection"></param>
 /// <param name="opCmdNode"></param>
 public void SetChaPaiData(
     PlayerType handStyle, int orgPaiIdx, int dstHandPaiIdx, HandPaiType orgPaiType,
     HandPaiAdjustDirection adjustDirection,
     LinkedListNode <MahjongMachineCmd> opCmdNode = null)
 {
     this.handStyle           = handStyle;
     this.orgPaiIdx           = orgPaiIdx;
     this.chaPaiDstHandPaiIdx = dstHandPaiIdx;
     this.chaPaiHandPaiType   = orgPaiType;
     this.adjustDirection     = adjustDirection;
     this.opCmdNode           = opCmdNode;
 }
Beispiel #2
0
        /// <summary>
        /// 插牌
        /// </summary>
        /// <param name="seatIdx">对应的玩家座号</param>
        /// <param name="orgPaiIdx">原始需要插牌的麻将号</param>
        /// <param name="dstHandPaiIdx">目标位置号</param>
        /// <param name="orgPaiType">需要插牌的麻将类型</param>
        /// <param name="adjustDirection">插排后手牌列表移动的方向</param>
        public void ChaPai(int seatIdx, PlayerType handStyle, int orgPaiIdx, int dstHandPaiIdx, HandPaiType orgPaiType,
                           HandPaiAdjustDirection adjustDirection, LinkedListNode <MahjongMachineCmd> opCmdNode = null)
        {
            StopSelectPaiActionState(seatIdx);

            if (playerStateData[seatIdx].playerHandActionState != HandActionState.ACTION_END ||
                mjSeatHandPaiLists[seatIdx].Count == 0 || mjSeatHandPaiLists[seatIdx][0] == null)
            {
                RemoveHandActionOpCmd(seatIdx, opCmdNode);
                return;
            }

            if (orgPaiType == HandPaiType.HandPai)
            {
                if (orgPaiIdx >= mjSeatHandPaiLists[seatIdx].Count)
                {
                    RemoveHandActionOpCmd(seatIdx, opCmdNode);
                    {
                        RemoveHandActionOpCmd(seatIdx, opCmdNode);
                        return;
                    }
                }
            }
            else
            {
                if (orgPaiIdx >= mjSeatMoPaiLists[seatIdx].Count)
                {
                    RemoveHandActionOpCmd(seatIdx, opCmdNode);
                    return;
                }
            }

            if (dstHandPaiIdx >= mjSeatHandPaiLists[seatIdx].Count)
            {
                RemoveHandActionOpCmd(seatIdx, opCmdNode);
                return;
            }

            playerStateData[seatIdx].SetChaPaiData(handStyle, orgPaiIdx, dstHandPaiIdx, orgPaiType, adjustDirection, opCmdNode);
            playerStateData[seatIdx].SetPlayerState(HandActionState.CHA_PAI_START, Time.time, -1);
        }