示例#1
0
        /// <summary>
        /// 显示玩家的特殊胡牌牌型
        /// </summary>
        /// <param name="index"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        string ShowSpecialWinType(int index, sbyte[,] value)
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;
            // Debug.LogError("_____"+MahjongCommonMethod.Instance.iPlayingMethod);
            StringBuilder str = new StringBuilder();

            for (int i = 0; i < MahjongGame_AH.Network.Message.NetMsg.F_TOTAL_NUM; i++)
            {
                // Debug.LogWarning("用户:"+index +"胡牌牌型:" + i + "value:" + value[index, i]);
                if (MahjongCommonMethod.Instance._cfgSpecialTypeCardName.data[i].index == 49 && MahjongCommonMethod.Instance.iPlayingMethod == 20001)
                {
                    // if (value[index, i] > 0)
                    str.AppendFormat(MahjongCommonMethod.Instance._cfgSpecialTypeCardName.data[i].name + (value[index, i] > 0 ? "+" : ""), pbd.resultType[0].byFanTiles[0]);
                    str.Append(value[index, i]);
                    str.Append("    ");
                }
                else if (value[index, i] != 0)
                {
                    if (MahjongCommonMethod.Instance.iPlayingMethod == 20001 && i == 0)
                    {
                        str.Append(MahjongCommonMethod.Instance._cfgSpecialTypeCardName.data[i].name_a + (value[index, i] > 0 ? "+" : ""));
                    }
                    else
                    {
                        str.Append(MahjongCommonMethod.Instance._cfgSpecialTypeCardName.data[i].name + (value[index, i] > 0 ? "+" : ""));
                    }
                    str.Append(value[index, i]);
                    str.Append("    ");
                }
            }
            return(str.ToString());
        }
示例#2
0
        /// <summary>
        ///  补花回应
        /// </summary>
        /// <param name="message"></param>
        void HandleClientAppliqueRes(string message)
        {
            //解析数据
            int seatNum = System.Convert.ToByte(message[0].ToString()) * 16 +
                          System.Convert.ToByte(message[1].ToString()); //保存玩家座位号

            //保存玩家的补牌数量
            int byTileNum = (System.Convert.ToByte(message[2].ToString()) * 16 +
                             System.Convert.ToByte(message[3].ToString()));

            List <byte> byaFlowerTile = new List <byte>();

            //保存玩家的花牌
            for (int i = 0; i < byTileNum * 2; i += 2)
            {
                byte temp = (byte)(System.Convert.ToByte(message[i + 4].ToString()) * 16 +
                                   System.Convert.ToByte(message[i + 5].ToString()));
                byaFlowerTile.Add(temp);
            }



            //保存玩家的补牌
            List <byte> byaTileNum = new List <byte>();

            for (int i = 0; i < byTileNum * 2; i += 2)
            {
                byte temp = (byte)(System.Convert.ToByte(message[i + 4 + byTileNum * 2].ToString()) * 16 +
                                   System.Convert.ToByte(message[i + 5 + byTileNum * 2].ToString()));
                byaTileNum.Add(temp);
            }

            PlayBackData pbd    = MahjongLobby_AH.GameData.Instance.PlayBackData;
            int          index_ = PlayBackMahjongPanel.Instance.GetPlayerIndex(seatNum); //获取玩家所在位置的下标

            PlayBackMahjongPanel.Instance.SpwanSpeaiclTypeRemind(index_, seatNum, 16);   //产生吃碰杠胡 补花等 特殊提示

            int index = PlayBackMahjongPanel.Instance.GetPlayerIndex(seatNum);

            //更新花牌数量
            PlayBackMahjongPanel.Instance.UpdateFlower(index, byTileNum);

            //删除花牌,同时产生玩家新的补牌
            for (int i = 0; i < byaFlowerTile.Count; i++)
            {
                //删除玩家刚摸的那张手牌
                PlayBackMahjongPanel.Instance.DelPlayerHandleCard(byaFlowerTile[i], seatNum);
            }

            PlayBackMahjongPanel.Instance.SpwanHandCard(byaTileNum.ToArray(), seatNum, false);

            //重新排序
            PlayBackMahjongPanel.Instance.UpdatePlayerAllCard(seatNum);

            PlayBackMahjongPanel.Instance.DelayOrderByPlayBack_Ie(0.5f, iDoneDealNum);
        }
示例#3
0
        /// <summary>
        /// 显示玩家的吃碰杠胡的信息
        /// </summary>
        /// <param name="message"></param>
        void HandleSpecialTileRes_Delay(string message)
        {
            PlayBackData pbd     = MahjongLobby_AH.GameData.Instance.PlayBackData;
            int          seatNum = System.Convert.ToByte(message[0].ToString()) * 16 + System.Convert.ToByte(message[1].ToString());
            int          type    = System.Convert.ToByte(message[8].ToString()) * 16 + System.Convert.ToByte(message[9].ToString());
            int          index   = -1;

            //如果是杠 直接减去手牌数量
            if (type == 3)
            {
                if (pbd.playingMethodConf_2.byReserveMode > 0 || pbd.playingMethodConf.byReserveMode > 0)
                {
                    if (pbd.playingMethodConf.byReserveMode != 5)
                    {
                        pbd.iLeftCardNum -= 2;
                        PlayBackMahjongPanel.Instance.UpdatePrograssing();
                    }
                }
            }

            if (type == 0)
            {
                index = 6;
            }
            else if (type == 2)
            {
                index = 2;
            }
            else if (type == 3)
            {
                index = 3;
            }
            else if (type == 4)
            {
                index = 4;
            }
            else if (type == 5 || type == 1)
            {
                index = 0;
            }
            else if (type == 6)
            {
                index = 1;
            }
            else if (type == 7)
            {
                index = 5;
            }


            PlayBackMahjongPanel.Instance.ShowPlayerClickAnimation(seatNum, index, message);
        }
示例#4
0
        /// <summary>
        /// 处理玩家能跑能下的通知消息
        /// </summary>
        /// <param name="message"></param>
        void HandleCanDownOrEscapeNotice(string message)
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;
            int          iSeatNum;      //座位号
            int          iDownOrEscape; //庄闲跑或下的类型

            iSeatNum      = System.Convert.ToByte(message[0].ToString()) * 16 + System.Convert.ToByte(message[1].ToString());
            iDownOrEscape = System.Convert.ToByte(message[2].ToString()) * 16 + System.Convert.ToByte(message[3].ToString());

            //如果等于展示的座位号
            if (iSeatNum == pbd.ShowSeatNum)
            {
                PlayBackMahjongPanel.Instance.ShowCanDownRu(iDownOrEscape);
            }

            PlayBackMahjongPanel.Instance.DelayOrderByPlayBack_Ie(0, iDoneDealNum);
        }
        public void AnslyGameRuleParam(int MethodId)
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;

            switch (MethodId)
            {
            case 1:
                break;

            case 2:
                break;

            case 3:
                break;
            }
            gameObject.SetActive(true);
            SpwanPayNum(MethodId);
            SpwanMethod(MethodId);
        }
示例#6
0
        /// <summary>
        /// 玩家的听的回应消息
        /// </summary>
        /// <param name="message"></param>
        void HandleTingRes(string message)
        {
            PlayBackData pbd     = MahjongLobby_AH.GameData.Instance.PlayBackData;
            int          seatNum = System.Convert.ToByte(message[0].ToString()) * 16 + System.Convert.ToByte(message[1].ToString());
            int          type    = System.Convert.ToByte(message[2].ToString()) * 16 + System.Convert.ToByte(message[3].ToString());

            pbd.iChoiceTing      = 1 - type;
            SpecialNoticeType[0] = 0;
            SpecialNoticeType[1] = 0;
            SpecialNoticeType[2] = 0;
            SpecialNoticeType[3] = 0;
            SpecialNoticeType[4] = 0;
            SpecialNoticeType[5] = 1;
            SpecialNoticeType[6] = 1;
            //显示玩家的吃碰杠胡提示信息
            PlayBackMahjongPanel.Instance.ShowSpecialTileNotice((byte)seatNum, SpecialNoticeType, 1);

            //0.5s之后显示播放动画
            PlayBackMahjongPanel.Instance.DelayShowPlayerClickAnimation_(seatNum, 5, message);
        }
示例#7
0
        /// <summary>
        /// 处理玩家的吃碰杠胡的通知消息
        /// </summary>
        /// <param name="message"></param>
        void HandleSpecialTileNotice(string message)
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;
            //为吃碰杠胡通知消息添加补位字段
            string content = message + "00";

            //获取通知的数据
            byte[] notice = GetByteToString(content, 8);

            int ioffset = 0;

            MahjongGame_AH.Network.Message.NetMsg.ClientSpecialTileNotice msg = new MahjongGame_AH.Network.Message.NetMsg.ClientSpecialTileNotice();
            ioffset = msg.parseBytes(notice, ioffset);

            //获取数据
            SpecialNoticeType[0] = msg.byThirteenOrphansChow;
            SpecialNoticeType[1] = msg.byThirteenOrphansRob;
            SpecialNoticeType[2] = msg.byPong;
            SpecialNoticeType[3] = msg.byKong;
            SpecialNoticeType[4] = msg.byWin;
            SpecialNoticeType[5] = 0;
            SpecialNoticeType[6] = 1;

            //显示玩家的吃碰杠胡提示信息
            PlayBackMahjongPanel.Instance.ShowSpecialTileNotice(msg.cSeatNum, SpecialNoticeType, 1);

            //如果玩家下步操作是继续显示其他玩家的碰杠操作
            if (string.Equals(pbd.sPlayBackMessageData[iDoneDealNum].Substring(0, 4), "0411"))
            {
                PlayBackMahjongPanel.Instance.DelayOrderByPlayBack_Ie(0, iDoneDealNum);
            }
            else
            {
                Debug.LogError("=======================");
                PlayBackMahjongPanel.Instance.DelayOrderByPlayBack_Ie(1f, iDoneDealNum);
            }
        }
示例#8
0
        /// <summary>
        /// 产生对应的手牌
        /// </summary>
        public void SpwanPlayerCard()
        {
            //Debug.LogError("产生玩家手牌");
            PlayBackData pbd       = MahjongLobby_AH.GameData.Instance.PlayBackData;
            Vector3      initpos_0 = initPos.transform.localPosition; //普通麻将的初始位置

            if (initpos_0.y > 80)
            {
                initpos_0 = new Vector3(initpos_0.x, 80, 0);
            }
            int  mahjongNum_0 = 0; //麻将产生数量
            byte bLastTile    = 0; //最后一张得到的牌
            int  winNum       = 0; //显示胡牌的数量
            //存储玩家的手牌
            List <byte> mahvalue = new List <byte>();

            for (int i = 0; i < 14; i++)
            {
                if (pbd.bHandleTiles[iseatNum - 1, i] != 0)
                {
                    mahvalue.Add(pbd.bHandleTiles[iseatNum - 1, i]);
                }
            }

            //添加玩家最后获取的一张牌,会添加一个胡牌的标志图片
            if (pbd.resultType[iseatNum - 1].lastTile.bySuit != 0 && pbd.byaWinSrat[iseatNum - 1] == 1)
            {
                bLastTile = (byte)(pbd.resultType[iseatNum - 1].lastTile.bySuit * 16 + pbd.resultType[iseatNum - 1].lastTile.byValue);

                if (!bSelfWin)
                {
                    mahvalue.Add(bLastTile);
                }
            }


            //移除对应的顺子牌的麻将值
            for (int i = 0; i < pbd.resultType[iseatNum - 1].bySequenceNum; i++)
            {
                byte value = (byte)(pbd.resultType[iseatNum - 1].sequenceType[i].bySuit * 16
                                    + pbd.resultType[iseatNum - 1].sequenceType[i].byFirstValue);
                mahvalue.Remove(value);
                mahvalue.Remove((byte)(value + 1));
                mahvalue.Remove((byte)(value + 2));
            }

            //移除手牌中的刻子牌的花色值
            for (int i = 0; i < pbd.resultType[iseatNum - 1].byTripletNum; i++)
            {
                byte value = (byte)(pbd.resultType[iseatNum - 1].tripletType[i].bySuit * 16
                                    + pbd.resultType[iseatNum - 1].tripletType[i].byValue);
                //如果是碰,删除两张手牌
                if (pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType == 1)
                {
                    mahvalue.Remove(value);
                    mahvalue.Remove(value);
                }

                //如果是杠,删除3张手牌
                if (pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType == 2 || pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType == 3)
                {
                    mahvalue.Remove(value);
                    mahvalue.Remove(value);
                    mahvalue.Remove(value);
                }
            }

            //移除玩家十三幺的牌的花色值
            for (int i = 0; i < pbd.resultType[iseatNum - 1].byThirteenOrphansNum; i++)
            {
                byte value = (byte)(pbd.resultType[iseatNum - 1].thirteenOrphansType[i].bySuit * 16
                                    + pbd.resultType[iseatNum - 1].thirteenOrphansType[i].byValue);

                mahvalue.Remove(value);
            }

            mahvalue.Sort(iCompareList);

            //Debug.LogError("玩家座位号:" + iseatNum + ",手牌的数量:" + mahvalue.Count);

            //产生手牌
            for (int i = 0; i <= mahvalue.Count; i++)
            {
                if (i == mahvalue.Count)
                {
                    GameObject go = null;
                    go = PoolManager.Spawn("Game/Ma/", "showVCardPre");
                    go.transform.SetParent(playerCard.transform);
                    go.transform.SetAsFirstSibling();
                    go.transform.localScale       = Vector3.one;
                    go.transform.localEulerAngles = Vector3.zero;
                    go.transform.Find("Image/num").transform.localEulerAngles = Vector3.zero;
                    go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
                    go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
                    go.transform.localPosition = initpos_0;

                    if (bLastTile == mahvalue[0] && winNum == 0 && pbd.byaWinSrat[iseatNum - 1] == 1)
                    {
                        go.transform.Find("win").gameObject.SetActive(true);
                        winNum++;
                    }
                    go.transform.Find("point").gameObject.SetActive(false);
                    go.transform.Find("Image/num").GetComponent <Image>().sprite = PlayBackMahjongPanel.Instance.UpdateCardValue(mahvalue[0]);
                }
                else
                {
                    if (mahvalue[i] != 0)
                    {
                        GameObject go = null;
                        go = PoolManager.Spawn("Game/Ma/", "showVCardPre");
                        go.transform.SetParent(playerCard.transform);
                        go.transform.SetAsFirstSibling();
                        go.transform.localScale       = Vector3.one;
                        go.transform.localEulerAngles = Vector3.zero;
                        go.transform.Find("Image/num").transform.localEulerAngles = Vector3.zero;
                        go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
                        go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
                        go.transform.localPosition = initpos_0 + new Vector3(mahjongNum_0 * 42f, 0, 0);

                        mahjongNum_0++;
                        if (bLastTile == mahvalue[i] && winNum == 0 && pbd.byaWinSrat[iseatNum - 1] == 1)
                        {
                            go.transform.Find("win").gameObject.SetActive(true);
                            winNum++;
                        }
                        go.transform.Find("point").gameObject.SetActive(false);
                        go.transform.Find("Image/num").GetComponent <Image>().sprite = PlayBackMahjongPanel.Instance.UpdateCardValue(mahvalue[i]);
                    }
                    else
                    {
                        break;
                    }
                }
            }

            //为玩家的第一个牌重新产生
            Vector3 initpos_1    = initPos_special.transform.localPosition; //特殊麻将的初始位置
            int     mahjongNum_1 = 0;

            //产生顺子牌
            for (int i = 0; i < pbd.resultType[iseatNum - 1].bySequenceNum; i++)
            {
                GameObject go    = null;
                byte       value = 0; //顺子的第一个值
                go = PoolManager.Spawn("Game/Ma/", "pegaUCardsPre");
                go.transform.SetParent(playerCard.transform);
                go.transform.SetAsFirstSibling();
                go.transform.localScale       = Vector3.one;
                go.transform.localEulerAngles = Vector3.zero;
                go.transform.localPosition    = initpos_1 + new Vector3(mahjongNum_0 * 42f + 20f + mahjongNum_1 * 145f, 0, 0);
                //更新牌面
                value = (byte)(pbd.resultType[iseatNum - 1].sequenceType[i].bySuit * 16 + pbd.resultType[iseatNum - 1].sequenceType[i].byFirstValue);
                UpdateCard(go, value, 0);
                mahjongNum_1++;
            }

            //产生刻子牌
            for (int i = 0; i < pbd.resultType[iseatNum - 1].byTripletNum; i++)
            {
                GameObject go    = null;
                byte       value = 0; //对应牌的花色值

                go = PoolManager.Spawn("Game/Ma/", "pegaUCardsPre");
                go.transform.SetParent(playerCard.transform);
                go.transform.SetAsFirstSibling();
                go.transform.localScale       = Vector3.one;
                go.transform.localEulerAngles = Vector3.zero;
                go.transform.localPosition    = initpos_1 + new Vector3(mahjongNum_0 * 42f + 20f + mahjongNum_1 * 145f, 0, 0);
                //更新牌面的花色值
                value = (byte)(pbd.resultType[iseatNum - 1].tripletType[i].bySuit * 16 + pbd.resultType[iseatNum - 1].tripletType[i].byValue);
                Debug.Log("刻子牌的花色值:" + value);
                UpdateCard(go, value, pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType);
                mahjongNum_1++;
            }

            //产生吃抢的牌
            for (int i = 0; i < pbd.resultType[iseatNum - 1].byThirteenOrphansNum; i++)
            {
                byte value = 0;  //对应牌的花色值
                                 //更新牌面的花色值
                value = (byte)(pbd.resultType[iseatNum - 1].thirteenOrphansType[i].bySuit * 16 + pbd.resultType[iseatNum - 1].thirteenOrphansType[i].byValue);
                GameObject go = null;
                go = PoolManager.Spawn("Game/Ma/", "showVCardPre");
                go.transform.SetParent(playerCard.transform);
                go.transform.SetAsFirstSibling();
                go.transform.localScale       = Vector3.one;
                go.transform.localEulerAngles = Vector3.zero;
                go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 0);
                go.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 0);
                go.transform.localPosition = initpos_0 + new Vector3(mahjongNum_0 * 42f + 20f, 0, 0);
                go.transform.Find("Image/num").GetComponent <Image>().sprite = PlayBackMahjongPanel.Instance.UpdateCardValue(value);
                mahjongNum_0++;
            }
        }
示例#9
0
        bool bSelfWin;                     //是否自摸的标志位



        /// <summary>
        /// 更新界面的玩家信息
        /// </summary>
        /// <param name="index"></param>
        public void MessageVlaue()
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;

            anhui.MahjongCommonMethod.Instance.GetPlayerAvatar(headImage, pbd.sHeadUrl[iseatNum - 1]);
            NickName.text = pbd.sName[iseatNum - 1];
            if (pbd.bResultPoint[iseatNum - 1] > 0)
            {
                PlayerScore.font = font[0];
                PlayerScore.text = "+" + pbd.bResultPoint[iseatNum - 1].ToString();
            }
            else if (pbd.bResultPoint[iseatNum - 1] < 0)
            {
                PlayerScore.font = font[1];
                PlayerScore.text = pbd.bResultPoint[iseatNum - 1].ToString();
            }
            else
            {
                PlayerScore.font = font[1];
                PlayerScore.text = pbd.bResultPoint[iseatNum - 1].ToString();
            }
            StringBuilder str = new StringBuilder();

            //确定是否显示庄家标志图片
            if (iseatNum == pbd.byDealerSeat)
            {
                Banker.gameObject.SetActive(true);
            }
            else
            {
                Banker.gameObject.SetActive(false);
            }


            #region 处理明暗杠
            //获取明杠暗杠数量
            for (int i = 0; i < pbd.resultType[iseatNum - 1].byTripletNum; i++)
            {
                if (pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType == 2)
                {
                    iMingGongNum++;
                }
                else if (pbd.resultType[iseatNum - 1].tripletType[i].byPongKongType == 3)
                {
                    iAnGangGongNum++;
                }
            }

            //添加明杠
            if (pbd.resultType[iseatNum - 1].cExposedKongPoint != 0)
            {
                str.Append("明杠");
                int point = pbd.resultType[iseatNum - 1].cExposedKongPoint;
                if (point > 0)
                {
                    str.Append("+");
                }

                //添加被杠,额外扣分
                if (pbd.playingMethodConf.byFanExtraExposedExtra > 0)
                {
                    str.Append(point);
                }
                else
                {
                    str.Append(point);
                }

                str.Append("    ");
            }

            //添加暗杠
            if (pbd.resultType[iseatNum - 1].cConcealedKongPoint != 0)
            {
                str.Append("暗杠");
                if (pbd.resultType[iseatNum - 1].cConcealedKongPoint > 0)
                {
                    str.Append("+");
                }
                str.Append(pbd.resultType[iseatNum - 1].cConcealedKongPoint);
                str.Append("    ");
            }
            #endregion

            int winCount_ = 0; //赢家的数量

            //添加自摸
            for (int i = 0; i < 4; i++)
            {
                // Debug.LogWarning(i + "自摸检测byaWinSrat[i]" + pbd.byaWinSrat[i]);
                if (pbd.byaWinSrat[i] > 0)
                {
                    winCount_++;
                    winSeat      = i + 1;
                    iDrawSeatNum = i + 1;
                }
            }
            //判断一局结束是否是自摸  没有放炮  有赢家
            if (winCount_ > 0 && pbd.byShootSeat <= 0)
            {
                bSelfWin = true;
            }
            else
            {
                iDrawSeatNum = 0;
            }

            if (iDrawSeatNum == iseatNum)
            {
                winMessage_Image.gameObject.SetActive(true);
                winMessage_Image.sprite = image_round[1];
            }

            //判断自己接炮胡
            if (pbd.byaWinSrat[iseatNum - 1] > 0 && !bSelfWin)
            {
                winMessage_Image.gameObject.SetActive(true);
                winMessage_Image.sprite = image_round[0];
            }

            //如果玩家点炮显示点炮信息
            if (pbd.byShootSeat == iseatNum)
            {
                winMessage_Image.gameObject.SetActive(true);
                winMessage_Image.sprite = image_round[2];
            }


            int iKongWin = 0;
            //判断是否荒庄
            for (int i = 0; i < 4; i++)
            {
                // Debug.LogError(i + "pbd.byaWinSrat[i]" + pbd.byaWinSrat[i]);
                if (pbd.byaWinSrat[i] > 0)
                {
                    iKongWin++;
                }
            }


            //判断抢杠胡收几家
            bool isRobbingWin = false;
            if (iDrawSeatNum == 0 && pbd.playingMethodConf.byFanRobbingKongWin > 0)
            {
                for (int i = 0; i < 4; i++)
                {
                    if (pbd.byaWinSrat[i] > 0 && pbd.resultType[i].lastTile.byRobbingKong == 1)
                    {
                        isRobbingWin = true;
                    }
                }
            }

            //如果不是荒庄 显示底分倍数
            if (iKongWin > 0)
            {
                str.Append(ShowSpecialWinType(iseatNum - 1, pbd.caFanResult));

                if (iDrawSeatNum > 0)//自摸
                {
                }
                else//放炮
                {
                    #region 放炮
                    //一炮多响  放炮收三家
                    //if (pbd.playingMethodConf.byWinPointMultiPay > 0 || pbd.playingMethodConf.byWinPointMultiShoot > 0)
                    //{
                    //    if (iseatNum == pbd.byShootSeat)
                    //    {
                    //        str.Append(ShowSpecialWinType(iseatNum - 1, pbd.caFanResult));
                    //        for (int i = 0; i < 4; i++)
                    //        {
                    //            if (pbd.byaWinSrat[i] > 0)
                    //            {
                    //                str.Append(ShowSpecialWinType(i, pbd.caFanResult));
                    //            }
                    //        }
                    //    }
                    //    else
                    //    {
                    //        if (pbd.byaWinSrat[iseatNum - 1] > 0)
                    //        {
                    //            str.Append(ShowSpecialWinType(iseatNum - 1, pbd.caFanResult));
                    //        }
                    //        else
                    //        {
                    //            for (int i = 0; i < 4; i++)
                    //            {
                    //                if (pbd.byaWinSrat[i] > 0)
                    //                {
                    //                    str.Append(ShowSpecialWinType(i, pbd.caFanResult));
                    //                    break;
                    //                }
                    //            }
                    //        }
                    //    }
                    //}//放炮收一家
                    //else
                    //{
                    //    if (pbd.byaWinSrat[iseatNum - 1] > 0)
                    //    {
                    //        str.Append(ShowSpecialWinType(iseatNum - 1, pbd.caFanResult));
                    //    }

                    //    if (iseatNum == pbd.byShootSeat)
                    //    {
                    //        for (int i = 0; i < 4; i++)
                    //        {
                    //            if (pbd.byaWinSrat[i] > 0)
                    //            {
                    //                str.Append(ShowSpecialWinType(i, pbd.caFanResult));
                    //                break;
                    //            }
                    //        }
                    //    }

                    //}
                    #endregion 放炮

                    #region 点

                    if (pbd.playingMethodConf.byWinPoint > 0 && pbd.byShootSeat == 0)
                    {
                        int iValue = pbd.resultType[iseatNum - 1].lastTile.bySuit;
                        int point  = 0;
                        if (iValue != 0 && pbd.byaWinSrat[iseatNum - 1] > 0)
                        {
                            int suit  = iValue / 16;
                            int value = iValue % 16;
                            if (suit < 4)
                            {
                                if (value < 4)
                                {
                                    point = 1;
                                }
                                else if (value > 3 && value < 7)
                                {
                                    point = 2;
                                }
                                else
                                {
                                    point = 3;
                                }
                            }
                            else
                            {
                                point = 3;
                            }
                        }
                        str.Append("点+");
                        str.Append(point);
                        str.Append("    ");
                    }



                    #endregion

                    #region 坎(三张一样的算一坎)
                    //int kong_count = 0;  //坎的数量
                    ////如果设置了坎,则计算坎的分数
                    //if (pbd.playingMethodConf.byWinKong > 0 && pbd.byaWinSrat[iseatNum - 1] > 0)
                    //{
                    //    byte[] temp = new byte[14];
                    //    for (int i = 0; i < 14; i++)
                    //    {
                    //        temp[i] = pbd.bHandleTiles[winSeat - 1, i];
                    //    }
                    //    byte[,] value =SwitchArray(temp);
                    //    for (int i = 0; i < 5; i++)
                    //    {
                    //        for (int j = 1; j < 10; j++)
                    //        {
                    //            //如果玩家手牌有三张相同的记为1坎
                    //            if (value[i, j] > 2)
                    //            {
                    //                kong_count++;
                    //            }
                    //        }
                    //    }

                    //    //如果下地的三张是不是也要算入坎中
                    //    //if (pbd.playingMethodConf.byWinKongFlagNum > 0)
                    //    //{
                    //    //    for (int i = 0; i < pbd.usersCardsInfo[0].listSpecialCards.Count; i++)
                    //    //    {
                    //    //        if (pbd.usersCardsInfo[0].listSpecialCards[i].type == 2 && pbd.usersCardsInfo[0].listSpecialCards[i].mahValue[0] / 16 > 3)
                    //    //        {
                    //    //            kong_count++;
                    //    //        }
                    //    //    }
                    //    //}

                    //    if (kong_count > 0)
                    //    {

                    //        str.Append("坎+" + kong_count);
                    //        str.Append("    ");
                    //    }
                    //}

                    #endregion

                    #region 庄闲倍数
                    //if (pbd.playingMethodConf.byWinPointDealerMultiple > 1 && pbd.playingMethodConf.byWinPointPlayerMultiple > 1)
                    //{
                    //    string sZhuangContent = "";
                    //    if (pbd.lcDealerMultiple == 1)
                    //    {
                    //        sZhuangContent = "庄*3";
                    //    }
                    //    else
                    //    {
                    //        sZhuangContent = "庄*" + pbd.playingMethodConf.byWinPointDealerMultiple;
                    //    }
                    //    string sXianContent = "闲*1";

                    //    //添加庄闲倍数
                    //    if (iDrawSeatNum > 0)
                    //    {
                    //        if (iDrawSeatNum == pbd.byDealerSeat)
                    //        {
                    //            str.Append(sZhuangContent);
                    //            str.Append("    ");
                    //        }
                    //        else
                    //        {
                    //            if (iseatNum == pbd.byDealerSeat)
                    //            {
                    //                str.Append(sZhuangContent);
                    //                str.Append("    ");
                    //            }
                    //            else
                    //            {
                    //                str.Append(sXianContent);
                    //                str.Append("    ");
                    //            }
                    //        }
                    //    }
                    //    else
                    //    {
                    //        //如果接炮收三家 或者 抢杠胡收三家
                    //        if (pbd.playingMethodConf.byWinPointMultiPay == 1 || isRobbingWin)
                    //        {
                    //            if (iseatNum == pbd.byDealerSeat)
                    //            {
                    //                str.Append(sZhuangContent);
                    //            }
                    //            else
                    //            {
                    //                //如果庄家胡牌
                    //                if (pbd.byaWinSrat[pbd.byDealerSeat - 1] > 0)
                    //                {
                    //                    str.Append(sZhuangContent);
                    //                }
                    //                else
                    //                {
                    //                    str.Append(sXianContent);
                    //                }
                    //            }
                    //            str.Append("    ");
                    //        }
                    //        else
                    //        {
                    //            if (pbd.byaWinSrat[iseatNum - 1] > 0 || iseatNum == pbd.byShootSeat)
                    //            {
                    //                if (iseatNum == pbd.byDealerSeat)
                    //                {
                    //                    str.Append(sZhuangContent);
                    //                }
                    //                else
                    //                {
                    //                    if (winSeat == pbd.byDealerSeat || pbd.byShootSeat == pbd.byDealerSeat)
                    //                    {
                    //                        str.Append(sZhuangContent);
                    //                    }
                    //                    else
                    //                    {
                    //                        str.Append(sXianContent);
                    //                    }
                    //                }
                    //                str.Append("    ");
                    //            }
                    //        }
                    //    }
                    //}
                    #endregion

                    #region 自摸
                    if (iDrawSeatNum > 0 && anhui.MahjongCommonMethod.Instance.iPlayingMethod != 20001)
                    {
                        //平顺自摸不翻倍
                        if (pbd.playingMethodConf.byWinPointSelfDrawnMultiple == 1)
                        {
                            str.Append("自摸*" + pbd.playingMethodConf.byWinPointSelfDrawnMultiple);
                        }
                        else
                        {
                            str.Append("自摸*" + pbd.playingMethodConf.byWinPointSelfDrawnMultiple);
                        }
                        str.Append("    ");
                    }
                    #endregion

                    #region 底分
                    //int basePoint = pbd.playingMethodConf.byWinPointBasePoint < 1 ? 1 : pbd.playingMethodConf.byWinPointBasePoint;  //底分
                    //string sPointContent = "";
                    //// Debug.LogError("是否自摸:"+bSelfWin);
                    //if (MahjongCommonMethod.Instance.iPlayingMethod == 20001 && bSelfWin)//如果是红中麻将
                    //{
                    //    sPointContent = "自摸";
                    //}
                    //else
                    //{
                    //    sPointContent = "底分";
                    //}
                    ////如果自摸
                    //if (iDrawSeatNum > 0 || pbd.playingMethodConf.byWinPointMultiPay == 1 || isRobbingWin)
                    //{
                    //    str.Append(sPointContent);
                    //    if (iseatNum == iDrawSeatNum || pbd.byaWinSrat[iseatNum - 1] > 0)
                    //    {
                    //        str.Append("+" + basePoint * 3);
                    //    }
                    //    else
                    //    {
                    //        str.Append("-" + basePoint);
                    //    }
                    //    str.Append("    ");
                    //}
                    //else
                    //{
                    //    if (iseatNum == pbd.byShootSeat)
                    //    {
                    //        //如果支持一炮多响
                    //        if (pbd.playingMethodConf.byWinPointMultiShoot > 0)
                    //        {
                    //            for (int i = 0; i < 4; i++)
                    //            {
                    //                if (pbd.byaWinSrat[i] > 0)
                    //                {
                    //                    basePoint += pbd.playingMethodConf.byWinPointBasePoint;
                    //                }
                    //            }
                    //            basePoint -= pbd.playingMethodConf.byWinPointBasePoint;
                    //        }
                    //        str.Append(sPointContent);
                    //        str.Append("-" + basePoint);
                    //        str.Append("    ");
                    //    }
                    //    else
                    //    {
                    //        if (pbd.byaWinSrat[iseatNum - 1] > 0)
                    //        {
                    //            str.Append(sPointContent);
                    //            str.Append("+" + basePoint);
                    //            str.Append("    ");
                    //        }
                    //    }
                    //}
                    #endregion

                    #region 添加额外接炮放炮信息
                    Debug.Log("添加额外接炮放炮信息" + pbd.playingMethodConf.byWinPointMultiPay + "__" + pbd.playingMethodConf.byWinPointMultiPayExtraMode);
                    //添加接炮的信息
                    if (pbd.playingMethodConf.byWinPointMultiPay > 0 && pbd.playingMethodConf.byWinPointMultiPayExtraMode > 0)
                    {
                        if (pbd.playingMethodConf.byWinPointMultiPayExtra > 0)
                        {
                            if (pbd.byaWinSrat[iseatNum - 1] > 0 && iDrawSeatNum == 0 && pbd.resultType[iseatNum - 1].cRobbingKongPoint == 0)
                            {
                                str.Append("接炮+" + pbd.playingMethodConf.byWinPointMultiPayExtra);
                                str.Append("    ");
                            }

                            if (pbd.byShootSeat == iseatNum && pbd.resultType[iseatNum - 1].cRobbingKongPoint == 0)
                            {
                                str.Append("放炮-" + pbd.playingMethodConf.byWinPointMultiPayExtra);
                                str.Append("    ");
                            }
                        }
                    }
                    #endregion
                }
                //  Debug.LogError("补杠" + pbd.resultType[iseatNum - 1].cTripletToKongPoint);
                if (pbd.resultType[iseatNum - 1].cTripletToKongPoint != 0)
                {
                    str.Append("补杠");
                    if (pbd.resultType[iseatNum - 1].cTripletToKongPoint > 0)
                    {
                        str.Append("+");
                    }
                    str.Append(pbd.resultType[iseatNum - 1].cTripletToKongPoint);
                    str.Append("    ");
                }
            }

            //  Debug.Log("num" + num);
            //改变显示特殊牌型文字说明的长度
            if (str.Length > 0)
            {
                winMessage.gameObject.SetActive(true);
                winMessage_text.gameObject.SetActive(true);
                winMessage_text.text = str.ToString();
                if (winMessage_text.preferredWidth > 605f)
                {
                    winMessage.rectTransform.sizeDelta = new Vector2(625f, 31f);
                }
                else
                {
                    winMessage.rectTransform.sizeDelta = new Vector2(winMessage_text.preferredWidth + 20f, 31f);
                }
                winMessage.transform.localPosition = new Vector3(winMessage.transform.localPosition.x + (winMessage.rectTransform.rect.width - 60f) / 2f, 8f, 0);
            }
        }
示例#10
0
        bool bSelfWin;                 //是否自摸的标志位



        /// <summary>
        /// 更新界面的玩家信息
        /// </summary>
        /// <param name="index"></param>
        public void MessageVlaue()
        {
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;

            MahjongCommonMethod.Instance.GetPlayerAvatar(headImage, pbd.sHeadUrl[iseatNum - 1]);
            NickName.text = pbd.sName[iseatNum - 1];

            int mul = 1;

            if (pbd.iMethodId == 14)
            {
                mul = 100;
            }

            if (pbd.iPoint[iseatNum - 1] > 0)
            {
                PlayerScore.font = font[0];
                PlayerScore.text = "+" + (pbd.iPoint[iseatNum - 1] * mul).ToString();
            }
            else if (pbd.iPoint[iseatNum - 1] < 0)
            {
                PlayerScore.font = font[1];
                PlayerScore.text = (pbd.iPoint[iseatNum - 1] * mul).ToString();
            }
            else
            {
                PlayerScore.font = font[1];
                PlayerScore.text = (pbd.iPoint[iseatNum - 1] * mul).ToString();
            }

            //处理明暗杠,自摸信息,调整位置长度
            int           num = 0; //用来表示要显示几个特殊牌型
            StringBuilder str = new StringBuilder();

            //确定是否显示庄家标志图片
            if (iseatNum == pbd.byDealerSeat)
            {
                Banker.gameObject.SetActive(true);
            }
            else
            {
                Banker.gameObject.SetActive(false);
            }

            //获取明杠暗杠数量
            for (int i = 0; i < pbd.resultType_2[iseatNum - 1].byTripletNum; i++)
            {
                if (pbd.resultType_2[iseatNum - 1].tripletType[i].byPongKongType == 2)
                {
                    iMingGongNum++;
                }
                else if (pbd.resultType_2[iseatNum - 1].tripletType[i].byPongKongType == 3)
                {
                    iAnGangGongNum++;
                }
            }

            //添加明杠
            if (pbd.resultType_2[iseatNum - 1].cExposedKongPoint != 0)
            {
                num++;
                str.Append("明杠");
                if (pbd.resultType_2[iseatNum - 1].cExposedKongPoint > 0)
                {
                    str.Append("+");
                }
                str.Append(pbd.resultType_2[iseatNum - 1].cExposedKongPoint);
                str.Append("    ");
            }

            //添加暗杠
            if (pbd.resultType_2[iseatNum - 1].cConcealedKongPoint != 0)
            {
                num++;
                str.Append("暗杠");
                if (pbd.resultType_2[iseatNum - 1].cConcealedKongPoint > 0)
                {
                    str.Append("+");
                }
                str.Append(pbd.resultType_2[iseatNum - 1].cConcealedKongPoint);
                str.Append("    ");
            }

            int iDrawSeatNum = 0; //自摸座位号
            int winCount_    = 0; //赢家的数量

            //添加自摸
            for (int i = 0; i < 4; i++)
            {
                if (pbd.byaWinSrat[i] > 0)
                {
                    winCount_++;
                    iDrawSeatNum = i + 1;
                }
            }

            if (winCount_ > 0 && pbd.byShootSeat <= 0)
            {
                bSelfWin = true;
                if (iDrawSeatNum == iseatNum)
                {
                    winMessage_Image.gameObject.SetActive(true);
                    winMessage_Image.sprite = image_round[1];
                }
            }
            else
            {
                iDrawSeatNum = 0;
            }

            //判断自己接炮胡
            if (pbd.byaWinSrat[iseatNum - 1] == 1 && !bSelfWin)
            {
                winMessage_Image.gameObject.SetActive(true);
                winMessage_Image.sprite = image_round[0];
            }


            //如果玩家点炮显示点炮信息
            if (pbd.byShootSeat == iseatNum)
            {
                winMessage_Image.gameObject.SetActive(true);
                winMessage_Image.sprite = image_round[2];
            }


            int iKongWin = 0;

            //判断是否荒庄

            for (int i = 0; i < 4; i++)
            {
                if (pbd.byaWinSrat[i] == 1)
                {
                    iKongWin++;
                }
            }

            //本玩法的底分,默认为1分,沁县的底分为5分
            int iBaseScore = 1;

            //添加前抬后和
            //for (int i = 0; i < 2; i++)
            //{
            //    if (pbd.resultType_2[iseatNum - 1].cRaisePoint[i] != 0)
            //    {
            //        if (i == 0)
            //        {
            //            str.Append("前抬");
            //        }
            //        else
            //        {
            //            str.Append("后和");
            //        }

            //        if (pbd.resultType_2[iseatNum - 1].cRaisePoint[i] > 0)
            //        {
            //            str.Append("+");
            //        }
            //        str.Append(pbd.resultType_2[iseatNum - 1].cRaisePoint[i]);
            //        str.Append("    ");
            //        num++;
            //    }
            //}


            //如果是荒庄不显示底分倍数
            if (iKongWin > 0)
            {
                //表示有人自摸
                if (iDrawSeatNum > 0)
                {
                    //如果自摸的人是自己
                    if (iseatNum == iDrawSeatNum)
                    {
                        str.Append("底分+" + iBaseScore * 3f);
                        str.Append("    ");
                    }
                    else
                    {
                        str.Append("底分-" + iBaseScore * 1f);
                        str.Append("    ");
                    }

                    //如果是庄自摸
                    if (iDrawSeatNum == pbd.byDealerSeat)
                    {
                        str.Append("庄*2");
                        str.Append("    ");
                    }
                    else
                    {
                        //如果自己是庄家
                        if (iseatNum == pbd.byDealerSeat)
                        {
                            str.Append("庄*2");
                            str.Append("    ");
                        }
                        else
                        {
                            str.Append("闲*1");
                            str.Append("    ");
                        }
                    }
                    num++;
                }
                //无人自摸
                else
                {
                    if (pbd.byaWinSrat[iseatNum - 1] == 1)
                    {
                        if (pbd.playingMethodConf.byWinPointMultiPay == 1)
                        {
                            str.Append("底分+" + iBaseScore * 3f);
                            str.Append("    ");
                        }
                        else
                        {
                            str.Append("底分+" + iBaseScore * 1f);
                            str.Append("    ");
                        }
                        //如果自己是庄家
                        if (iseatNum == pbd.byDealerSeat)
                        {
                            str.Append("庄*2");
                            str.Append("    ");
                        }
                        else
                        {
                            str.Append("闲*1");
                            str.Append("    ");
                        }
                        num++;
                    }
                    else
                    {
                        int winSeat = -1;
                        for (int i = 0; i < 4; i++)
                        {
                            if (pbd.byaWinSrat[i] == 1)
                            {
                                winSeat = i;
                            }
                        }

                        int winCount = 0; //赢得人的数量
                        if (pbd.byShootSeat == iseatNum)
                        {
                            for (int i = 0; i < 4; i++)
                            {
                                if (pbd.byaWinSrat[i] > 0)
                                {
                                    winCount++;
                                }
                            }
                            if (winCount > 0)
                            {
                                Debug.LogWarning("=========================seatNum:" + iseatNum);
                                str.Append("底分-");
                                str.Append(winCount * iBaseScore);
                                str.Append("    ");

                                if (iseatNum == pbd.byDealerSeat)
                                {
                                    str.Append("庄*2");
                                    str.Append("    ");
                                }
                                else
                                {
                                    if (winSeat == pbd.byDealerSeat - 1)
                                    {
                                        str.Append("庄*2");
                                        str.Append("    ");
                                    }
                                    else
                                    {
                                        str.Append("闲*1");
                                        str.Append("    ");
                                    }
                                }
                                num++;
                            }

                            //如果是自己放炮,同时有特殊胡牌类型
                            for (int l = 0; l < 4; l++)
                            {
                                if (pbd.byaWinSrat[l] > 0)
                                {
                                    //特殊牌型,加减分数
                                    for (int i = 0; i < 5; i++)
                                    {
                                        if (pbd.caFanResult[l, i] != 0)
                                        {
                                            switch (i)
                                            {
                                            //十三不靠
                                            case 1:
                                                str.Append("十三不靠*");
                                                str.Append(pbd.caFanResult[l, i]);
                                                str.Append("    ");
                                                num++;
                                                break;

                                            //十三幺
                                            case 2:
                                                str.Append("十三幺*");
                                                str.Append(pbd.caFanResult[l, i]);
                                                str.Append("    ");
                                                num++;
                                                break;

                                            //七对
                                            case 3:
                                                str.Append("七对*");
                                                str.Append(pbd.caFanResult[l, i]);
                                                str.Append("    ");
                                                num++;
                                                break;

                                            case 4:
                                                str.Append("七对*");
                                                str.Append(pbd.caFanResult[l, i]);
                                                str.Append("    ");
                                                num++;
                                                break;
                                            }
                                        }
                                    }
                                }
                            }
                            num++;
                        }
                        else if (pbd.playingMethodConf.byWinPointMultiPay == 1)
                        {
                            winCount += 1;
                            str.Append("底分-");
                            str.Append(winCount * iBaseScore);
                            str.Append("    ");

                            if (iseatNum == pbd.byDealerSeat)
                            {
                                str.Append("庄*2");
                                str.Append("    ");
                            }
                            else
                            {
                                str.Append("闲*1");
                                str.Append("    ");
                            }

                            num++;
                        }
                    }
                }

                //如果有玩家自摸,添加特殊牌型
                if (iDrawSeatNum > 0)
                {
                    //特殊牌型,加减分数
                    for (int i = 0; i < 5; i++)
                    {
                        if (pbd.caFanResult[iDrawSeatNum - 1, i] != 0)
                        {
                            switch (i)
                            {
                            //十三不靠
                            case 1:
                                str.Append("十三不靠*");
                                str.Append(pbd.caFanResult[iDrawSeatNum - 1, i]);
                                str.Append("    ");
                                num++;
                                break;

                            //十三幺
                            case 2:
                                str.Append("十三幺*");
                                str.Append(pbd.caFanResult[iDrawSeatNum - 1, i]);
                                str.Append("    ");
                                num++;
                                break;

                            //七对
                            case 3:
                                str.Append("七对*");
                                str.Append(pbd.caFanResult[iDrawSeatNum - 1, i]);
                                str.Append("    ");
                                break;

                            case 4:
                                str.Append("七对*");
                                str.Append(pbd.caFanResult[iDrawSeatNum - 1, i]);
                                str.Append("    ");
                                break;
                            }
                            num++;
                        }
                    }
                }
                else
                {
                    //特殊牌型,加减分数
                    for (int i = 0; i < 5; i++)
                    {
                        if (pbd.caFanResult[iseatNum - 1, i] != 0)
                        {
                            switch (i)
                            {
                            //十三不靠
                            case 1:
                                str.Append("十三不靠*");
                                str.Append(pbd.caFanResult[iseatNum - 1, i]);
                                str.Append("    ");
                                num++;
                                break;

                            //十三幺
                            case 2:
                                str.Append("十三幺*");
                                str.Append(pbd.caFanResult[iseatNum - 1, i]);
                                str.Append("    ");
                                num++;
                                break;

                            //七对
                            case 3:
                            case 4:
                                str.Append("七对*");
                                str.Append(pbd.caFanResult[iseatNum - 1, i]);
                                str.Append("    ");
                                num++;
                                break;
                            }
                            num++;
                        }
                    }
                }

                if (iDrawSeatNum > 0)
                {
                    str.Append("自摸*2");
                    str.Append("    ");
                    num++;
                }
            }



            if (num == -1)
            {
                winMessage.gameObject.SetActive(false);
                winMessage_text.gameObject.SetActive(false);
            }

            //改变显示特殊牌型文字说明的长度
            if (num > 0)
            {
                winMessage.gameObject.SetActive(true);
                winMessage_text.gameObject.SetActive(true);
                winMessage_text.text = str.ToString();
                winMessage.rectTransform.sizeDelta = new Vector2(winMessage_text.preferredWidth + 20f, 31f);
                winMessage.transform.localPosition = new Vector3(winMessage.transform.localPosition.x + (winMessage.rectTransform.rect.width - 60f) / 2f, 8f, 0);
            }
        }
示例#11
0
        /// <summary>
        /// 产生玩法数量的预置体
        /// </summary>
        /// <param name="MethodId">玩法id</param>
        void SpwanPayNum(int MethodId)
        {
            PlayBackData pbd         = MahjongLobby_AH.GameData.Instance.PlayBackData;
            int          ChoiceIndex = -1;

            anhui.MahjongCommonMethod mcm = anhui.MahjongCommonMethod.Instance;

            //玩法局或圈的数量
            int[] sum = new int[5];
            //玩法数量对应支付的房卡数量
            int[] pay = new int[5];

            //获取对应的游戏局或者圈的数量
            if (mcm._dicMethodConfig[MethodId].sum.Contains("|"))
            {
                string[] str_0 = mcm._dicMethodConfig[MethodId].sum.Split('|')[0].Split('_');
                string[] str_1 = mcm._dicMethodConfig[MethodId].sum.Split('|')[1].Split('_');
                for (int i = 0; i < 3; i++)
                {
                    sum[i] = Convert.ToInt16(str_0[i]);
                }

                for (int i = 0; i < 2; i++)
                {
                    sum[i + 3] = Convert.ToInt16(str_1[i]);
                }
            }
            else
            {
                string[] str_0 = mcm._dicMethodConfig[MethodId].sum.Split('_');
                for (int i = 0; i < 3; i++)
                {
                    if (i < str_0.Length)
                    {
                        sum[i] = Convert.ToInt16(str_0[i]);
                    }
                    else
                    {
                        sum[i] = 0;
                    }
                }
                sum[3] = 0;
                sum[4] = 0;
            }

            //获取玩家对应的支付数量
            if (mcm._dicMethodConfig[MethodId].pay.Contains("|"))
            {
                string[] str_0 = mcm._dicMethodConfig[MethodId].pay.Split('|')[0].Split('_');
                string[] str_1 = mcm._dicMethodConfig[MethodId].pay.Split('|')[1].Split('_');
                for (int i = 0; i < 3; i++)
                {
                    pay[i] = Convert.ToInt16(str_0[i]);
                }

                for (int i = 0; i < 2; i++)
                {
                    pay[i + 3] = Convert.ToInt16(str_1[i]);
                }
            }
            else
            {
                string[] str_0 = mcm._dicMethodConfig[MethodId].pay.Split('_');
                for (int i = 0; i < 3; i++)
                {
                    if (i < str_0.Length)
                    {
                        pay[i] = Convert.ToInt16(str_0[i]);
                    }
                    else
                    {
                        pay[i] = 0;
                    }
                }
                pay[3] = 0;
                pay[4] = 0;
            }

            int count = 0;

            //根据付费数量,判断出玩家的信息
            for (int i = 0; i < 5; i++)
            {
                if (pbd.playingMethodConf_2.byBillingNumber == sum[i] && pbd.playingMethodConf_2.byBillingPrice == pay[i])
                {
                    ChoiceIndex = i;
                }
            }

            //删除自己的之前的房间规则信息
            CreatRoomChoiceMethod[] method = PayNumParent.Find("GameNumbers").GetComponentsInChildren <CreatRoomChoiceMethod>();
            if (method.Length > 0)
            {
                for (int i = 0; i < method.Length; i++)
                {
                    Destroy(method[i].gameObject);
                }
            }

            //产生对应的玩法数据
            for (int i = 0; i < sum.Length; i++)
            {
                if (sum[i] == 0)
                {
                    continue;
                }

                GameObject go = Instantiate(Resources.Load <GameObject>("Lobby/PlayerMethodPanel/CreatRoomChoiceMethod"));
                go.name = "CreatRoomChoiceMethod";
                go.transform.SetParent(PayNumParent.Find("GameNumbers"));
                go.transform.localPosition = new Vector3(go.transform.localPosition.x, go.transform.localPosition.y, 0);
                go.transform.localScale    = Vector3.one;
                if (i == ChoiceIndex)
                {
                    go.transform.GetComponent <Toggle>().isOn = true;
                }
                else
                {
                    go.transform.GetComponent <Toggle>().isOn = false;
                }

                go.transform.GetComponent <Toggle>().interactable = false;
                CreatRoomChoiceMethod crcm = go.GetComponent <CreatRoomChoiceMethod>();

                crcm.type = pbd.playingMethodConf_2.byBillingMode;
                crcm.num  = sum[i];
                crcm.pay  = pay[i];
                crcm.UpdateShow();
                count++;
            }

            PayNumParent.GetComponent <LayoutElement>().minHeight = 60f + ((int)(count / 3f + 0.5f) - 1f) * 45;
        }
示例#12
0
        /// <summary>
        /// 规则id
        /// </summary>
        /// <param name="MethodId"></param>
        bool JudgeIsShow(int MethodId)
        {
            bool         isShow = false;
            PlayBackData pppd   = MahjongLobby_AH.GameData.Instance.PlayBackData;

            switch (MethodId)
            {
            //十三幺
            case 1001:
                if (pppd.playingMethodConf.byWinSpecialThirteenOrphans == 1)
                {
                    isShow = true;
                }
                break;

            //七对
            case 1002:
                Debug.Log("七对可胡:  " + pppd.playingMethodConf.byWinSpecialSevenPairs);
                if (pppd.playingMethodConf.byWinSpecialSevenPairs == 1)
                {
                    isShow = true;
                }
                break;

            //十三不靠
            case 1004:
                if (pppd.playingMethodConf.byWinSpecialThirteenIndepend == 1)
                {
                    isShow = true;
                }
                break;

            //明杠收三家
            case 1005:
                if (pppd.playingMethodConf.byFanExtraExposedMode == 2)
                {
                    isShow = true;
                }
                break;

            //四杠荒庄
            case 1006:
                if (pppd.playingMethodConf.byDrawFourKong == 1)
                {
                    isShow = true;
                }
                break;

            //自摸翻倍
            case 1007:
                if (pppd.playingMethodConf.byWinPointSelfDrawnMultiple == 2 && pppd.iMethodId == 7)
                {
                    isShow = true;
                }
                break;

            //一炮单响
            case 2002:
                if (pppd.playingMethodConf.byWinPointMultiShoot == 0)
                {
                    isShow = true;
                }
                break;

            //一炮多响
            case 2003:
                if (pppd.playingMethodConf.byWinPointMultiShoot == 1)
                {
                    isShow = true;
                }
                break;

            //接炮收一家
            case 2007:
                if (pppd.playingMethodConf.byWinPointMultiPay == 0)
                {
                    isShow = true;
                }
                break;

            //接炮收三家
            case 2008:
                if (pppd.playingMethodConf.byWinPointMultiPay == 1)
                {
                    isShow = true;
                }
                break;

            //一人付
            case 2009:
                if (pppd.playingMethodConf.byFanExtraExposedBase == 0)
                {
                    isShow = true;
                }
                break;

            //多人付
            case 2010:
                if (pppd.playingMethodConf.byFanExtraExposedBase == 1)
                {
                    isShow = true;
                }
                break;

            //坐庄
            case 2011:
                if (pppd.playingMethodConf.byWinPointMultiPay == 1)
                {
                    isShow = true;
                }
                break;

            //带字牌
            case 2018:
                if (pppd.playingMethodConf.byCreateModeHaveWind > 0 && pppd.playingMethodConf.byCreateModeHaveDragon > 0)
                {
                    isShow = true;
                }
                break;

            //点炮三分
            case 2019:

                break;

            //轮庄
            case 2020:
                if (pppd.playingMethodConf.byDealerDraw == 2 || pppd.playingMethodConf.byDealerDealer == 2)
                {
                    isShow = true;
                }
                break;

            //放炮玩法
            case 2021:
                if (pppd.playingMethodConf.byDealerPlayer == 2)
                {
                    isShow = true;
                }
                break;

            //带庄
            case 2022:
                if (pppd.playingMethodConf.byWinPointDealerMultiple == 2)
                {
                    isShow = true;
                }
                break;

            //自摸胡
            case 2023:
                if (pppd.playingMethodConf.byWinLimitSelfDrawn == 1)
                {
                    isShow = true;
                }
                break;

            //可接炮
            case 3001:
                if (pppd.playingMethodConf.byWinLimitSelfDrawn == 0)
                {
                    isShow = true;
                }
                break;

            //杠随胡走
            case 2024:
                if (pppd.playingMethodConf.byFanExtraMode == 2)
                {
                    isShow = true;
                }
                break;

            //可吃牌
            case 3003:

                if (pppd.playingMethodConf.byDiscardChow == 1)
                {
                    isShow = true;
                }
                break;

            //逼头金
            case 3004:
                //if (pppd.playingMethodConf.byDiscardOutGold == 1)
                //{
                //    isShow = true;
                //}
                break;

            //逼二金
            case 3005:
                //if (pppd.playingMethodConf.byDiscardOutGold == 2)
                //{
                //    isShow = true;
                //}
                break;

            //不逼金
            case 3006:
                //if (pppd.playingMethodConf.byDiscardOutGold == 0)
                //{
                //    isShow = true;
                //}
                break;

            //暗杠可见
            case 3007:
                //if (pppd.playingMethodConf.byDiscardSeeConcealedKong == 1)
                //{
                //    isShow = true;
                //}
                break;

            //1嘴
            case 3014:
                if (pppd.iMethodId == 20016 && pppd.playingMethodConf.byWinPointBasePoint == 1)
                {
                    isShow = true;
                }
                break;

            //5嘴
            case 3015:
                if (pppd.iMethodId == 20016 && pppd.playingMethodConf.byWinPointBasePoint == 5)
                {
                    isShow = true;
                }
                break;

            //10嘴
            case 3016:
                if (pppd.iMethodId == 20016 && pppd.playingMethodConf.byWinPointBasePoint == 10)
                {
                    isShow = true;
                }
                break;

            //平胡
            case 3017:
                if (pppd.iMethodId == 20016 && pppd.playingMethodConf.byFanSameColor == 0 &&
                    pppd.playingMethodConf.byFanMixedOneSuit == 0 && pppd.playingMethodConf.byFanLackSuit == 0 &&
                    pppd.playingMethodConf.byFanCouplesHand == 0)
                {
                    isShow = true;
                }
                break;

            //大胡
            case 3018:
                if (pppd.iMethodId == 20016 && pppd.playingMethodConf.byFanSameColor > 0 &&
                    pppd.playingMethodConf.byFanMixedOneSuit > 0 && pppd.playingMethodConf.byFanLackSuit > 0 &&
                    pppd.playingMethodConf.byFanCouplesHand > 0)
                {
                    isShow = true;
                }
                break;

            //坎
            case 3024:
                if (pppd.playingMethodConf.byWinKong == 1)
                {
                    isShow = true;
                }
                break;

            //缺门
            case 3025:
                if (pppd.playingMethodConf.byWinLack == 1)
                {
                    isShow = true;
                }
                break;

            //点数
            case 3027:
                if (pppd.playingMethodConf.byWinPoint == 1)
                {
                    isShow = true;
                }
                break;

            //见面
            case 3028:
                if (pppd.playingMethodConf.byWinMeet == 1)
                {
                    isShow = true;
                }
                break;

            //幺九将
            case 3029:
                if (pppd.playingMethodConf.byOneNineJong == 1)
                {
                    isShow = true;
                }
                break;

            //六连
            case 3030:
                if (pppd.playingMethodConf.byContinuousSix == 1)
                {
                    isShow = true;
                }
                break;

            //断独幺
            case 3031:
                if (pppd.playingMethodConf.byFanBrokenOrphas == 1)
                {
                    isShow = true;
                }
                break;
            }

            return(isShow);
        }
示例#13
0
        //一局结果通知消息
        void HandleGameReultNotice(string message)
        {
            Debug.LogWarning("PlayBackData 一局结果通知消息");
            PlayBackData pbd = MahjongLobby_AH.GameData.Instance.PlayBackData;

            //string addLeng = "";
            //switch ((4 - message.Length % 4))
            //{
            //    case 1: addLeng = "0"; break;
            //    case 2: addLeng = "00"; break;
            //    case 3: addLeng = "000"; break;
            //}
            string content = message;

            //保存获取的通知数据
            byte[] notice = GetByteToString(content, 8);

            int ioffset = 0;

            if (pbd.iPlayBackVersion == pbd.iPbVersion_New)
            {
                MahjongGame_AH.Network.Message.NetMsg.ClientGameResultNotice msg = new MahjongGame_AH.Network.Message.NetMsg.ClientGameResultNotice();
                ioffset = msg.parseBytes(notice, ioffset);
                //处理结果消息
                bool isHuangZhuang = true;  //是否是荒庄的标志位

                if (msg.byDismiss != 0)
                {
                    isHuangZhuang = false;
                }

                for (int i = 0; i < 4; i++)
                {
                    if (msg.byaWinSeat[i] != 0)
                    {
                        isHuangZhuang = false;
                    }
                }

                //处理玩家荒庄
                if (isHuangZhuang)
                {
                    //产生hu荒庄的特效结果
                    PlayBackMahjongPanel.Instance.SpwanSpeaiclTypeRemind(4, 0, 9);
                    //延迟2s之后显示结算结果
                    PlayBackMahjongPanel.Instance.DelayShowHuangZhuang(msg);
                }
                //处理玩家的胡牌,显示结果通知
                else
                {
                    //Debug.LogError("玩家胡牌信息:=================================");
                    //直接显示玩家的结算结果
                    pbd.bHandleTiles = msg.bya2HandTiles;
                    pbd.bResultPoint = msg.caResultPoint;
                    pbd.resultType   = msg.aResultType;
                    pbd.byShootSeat  = msg.byShootSeat;
                    //pbd.byIfNormalOrDragon = msg.byIfNormalOrDragon;
                    pbd.byShootSeatReadHand = msg.byShootSeatReadHand;
                    pbd.byaWinSrat          = msg.byaWinSeat;
                    pbd.caFanResult         = msg.caFanResult;
                    for (int i = 0; i < pbd.iPoint.Length; i++)
                    {
                        pbd.iPoint[i] = msg.caResultPoint[i];
                    }
                    if (PlayBackMahjongPanel.Instance.DealHongZhongZhongma(msg.aResultType[0].byFanTiles))
                    {
                        PlayBackMahjongPanel.Instance.DelaySpwanSpeaiclTypeRemind(3f, msg.byaWinSeat);
                    }
                    else
                    {
                        PlayBackMahjongPanel.Instance.DelaySpwanSpeaiclTypeRemind(0, msg.byaWinSeat);
                    }
                }
            }
            else
            {
                MahjongGame_AH.Network.Message.NetMsg.ClientGameResultNotice_2 msg = new MahjongGame_AH.Network.Message.NetMsg.ClientGameResultNotice_2();
                ioffset = msg.parseBytes(notice, ioffset);
                //处理结果消息
                bool isHuangZhuang = true;  //是否是荒庄的标志位

                for (int i = 0; i < 4; i++)
                {
                    if (msg.byaWinSeat[i] != 0)
                    {
                        isHuangZhuang = false;
                    }
                }

                Debug.LogError("解散标志位:" + msg.byDismiss);
                if (msg.byDismiss != 0)
                {
                    isHuangZhuang = false;
                }
                //处理玩家荒庄
                if (isHuangZhuang)
                {
                    //产生荒庄的特效结果
                    PlayBackMahjongPanel.Instance.SpwanSpeaiclTypeRemind(4, ShowSeatNum, 9);
                    //延迟2s之后显示结算结果
                    PlayBackMahjongPanel.Instance.DelayShowHuangZhuang_2(msg);
                }
                //处理玩家的胡牌,显示结果通知
                else
                {
                    //直接显示玩家的结算结果
                    pbd.bHandleTiles = msg.bya2HandTiles;
                    for (int i = 0; i < 4; i++)
                    {
                        pbd.bResultPoint[i] = (int)msg.caResultPoint[i];
                    }
                    pbd.resultType_2 = msg.aResultType;
                    pbd.byShootSeat  = msg.byShootSeat;
                    pbd.byaWinSrat   = msg.byaWinSeat;
                    pbd.caFanResult  = msg.caFanResult;
                    for (int i = 0; i < pbd.iPoint.Length; i++)
                    {
                        pbd.iPoint[i] = msg.caResultPoint[i];
                    }
                    if (PlayBackMahjongPanel.Instance.DealHongZhongZhongma(msg.aResultType[0].byFanTiles))
                    {
                        PlayBackMahjongPanel.Instance.DelaySpwanSpeaiclTypeRemind(3f, msg.byaWinSeat);
                    }
                    else
                    {
                        PlayBackMahjongPanel.Instance.DelaySpwanSpeaiclTypeRemind(0, msg.byaWinSeat);
                    }
                }
            }
        }