Esempio n. 1
0
    private void analysisPaiInfo(HupaiResponseItem parms)
    {
        var    itemData   = parms.totalInfo;
        string gangpaiStr = itemData.gang;

        if (gangpaiStr != null && gangpaiStr.Length > 0)
        {
            string[] gangtemps = gangpaiStr.Split(',');
            for (int i = 0; i < gangtemps.Length; i++)
            {
                var        itemList   = gangtemps[i].Split(':');
                GangpaiObj gangpaiObj = new GangpaiObj();
                gangpaiObj.uuid      = int.Parse(itemList[0]);
                gangpaiObj.cardPiont = int.Parse(itemList[1]);
                gangpaiObj.type      = itemList[2];
                //增加判断是否为自己的杠牌的操作

                paiArray [gangpaiObj.cardPiont] -= 4;
                gangPaiList.Add(gangpaiObj);

                if (gangpaiObj.type == "an")
                {
                    mdesCribe += "暗杠  ";
                }
                else
                {
                    mdesCribe += "明杠  ";
                }
            }
        }


        string pengpaiStr = itemData.peng;

        if (pengpaiStr != null && pengpaiStr.Length > 0)
        {
            pengpaiList = pengpaiStr.Split(',');


            //string[] pengpaiListTTT = pengpaiList;
            List <string> pengpaiListTTT = new List <string>();
            for (int i = 0; i < pengpaiList.Length; i++)
            {
                if (paiArray [int.Parse(pengpaiList [i])] >= 3)
                {
                    paiArray [int.Parse(pengpaiList [i])] -= 3;
                    pengpaiListTTT.Add(pengpaiList [i]);
                }
            }
            pengpaiList = pengpaiListTTT.ToArray();
        }


        string chipaiStr = itemData.chi;

        if (chipaiStr != null && chipaiStr.Length > 0)
        {
            string[] chitemps = chipaiStr.Split(',');
            for (int i = 0; i < chitemps.Length; i++)
            {
                string    item      = chitemps[i];
                ChipaiObj chipaiObj = new ChipaiObj();
                string[]  pointStr  = item.Split(':');
                chipaiObj.cardPionts = pointStr;
                chipaiList.Add(chipaiObj);
                paiArray [int.Parse(chipaiObj.cardPionts[0])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[1])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[2])] -= 1;
            }
        }


        string hupaiStr = itemData.hu;
        int    huType   = -1;

        if (!string.IsNullOrEmpty(hupaiStr))
        {
            var strList = hupaiStr.Split(':');
            hupaiObj.uuid      = int.Parse(strList[0]);
            hupaiObj.cardPiont = int.Parse(strList[1]);
            hupaiObj.type      = strList[2];
            //增加判断是否是自己胡牌的判断

            huType = MyMahjongScript.checkAvarHupai(parms.uuid, itemData.hu);
            if (huType == 0)
            {
                mdesCribe += "点炮";
            }
            else
            {
                if (huType == 1)
                {
                    mdesCribe += "接炮";
                }
                else if (huType == 2)
                {
                    mdesCribe += "自摸";
                }

                if (hupaiObj.type == "qingyise")
                {
                    mdesCribe += "清一色";
                }
                if (hupaiObj.type == "qixiaodui")
                {
                    mdesCribe += "七小对";
                }
                if (hupaiObj.type == "gangshanghua")
                {
                    mdesCribe += "杠上花";
                }
                huFlagImg.SetActive(true);
                paiArray[hupaiObj.cardPiont] -= 1;
            }
        }
        print(" >>>>>>>>>>>   hu pai result  <<<<<<<<<<<<" + resultDes);
        resultDes.text = mdesCribe;
        maPais         = parms.getMaPoints();
        arrangePai(huType);
    }
Esempio n. 2
0
    private void analysisPaiInfo(HupaiResponseItem parms)
    {
        itemData = parms.totalInfo;
        string gangpaiStr = itemData.gang;

        if (gangpaiStr != null && gangpaiStr.Length > 0)
        {
            string[] gangtemps = gangpaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < gangtemps.Length; i++)
            {
                string     item       = gangtemps [i];
                GangpaiObj gangpaiObj = new GangpaiObj();
                gangpaiObj.uuid = item.Split(new char[1] {
                    ':'
                })[0];
                gangpaiObj.cardPiont = int.Parse(item.Split(new char[1] {
                    ':'
                })[1]);
                gangpaiObj.type = item.Split(new char[1] {
                    ':'
                })[2];
                //增加判断是否为自己的杠牌的操作

                paiArray [gangpaiObj.cardPiont] -= 4;
                gangPaiList.Add(gangpaiObj);

                if (gangpaiObj.type == "an")
                {
                    mdesCribe += "暗杠  ";
                }
                else
                {
                    mdesCribe += "明杠  ";
                }
            }
        }


        //20171102
        if (GlobalDataScript.roomVo.roomType == 11)
        {
            if (parms.shanghuo)
            {
                mdesCribe += "上火  ";
            }
            else
            {
                mdesCribe += "不上火  ";
            }
            mdesCribe += "飘数:" + parms.piao + "  ";
        }


        string pengpaiStr = itemData.peng;

        if (pengpaiStr != null && pengpaiStr.Length > 0)
        {
            pengpaiList = pengpaiStr.Split(new char[1] {
                ','
            });


            //string[] pengpaiListTTT = pengpaiList;
            List <string> pengpaiListTTT = new List <string>();
            for (int i = 0; i < pengpaiList.Length; i++)
            {
                string[] temp = pengpaiList [i].Split(':');
                if (paiArray [int.Parse(temp [0])] >= 3)
                {
                    paiArray [int.Parse(temp [0])] -= 3;
                    pengpaiListTTT.Add(temp [0]);
                }
            }
            pengpaiList = pengpaiListTTT.ToArray();
        }


        string chipaiStr = itemData.chi;

        if (chipaiStr != null && chipaiStr.Length > 0)
        {
            string[] chitemps = chipaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < chitemps.Length; i++)
            {
                string    item      = chitemps[i];
                ChipaiObj chipaiObj = new ChipaiObj();
                string[]  pointStr  = item.Split(new char[1] {
                    ':'
                });
                chipaiObj.cardPionts = pointStr;
                chipaiList.Add(chipaiObj);
                paiArray [int.Parse(chipaiObj.cardPionts[0])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[1])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[2])] -= 1;
            }
        }

        string hupaiStr = itemData.hu;

        if (hupaiStr != null && hupaiStr.Length > 0)
        {
            bool     isJian = false;
            string[] hupai  = hupaiStr.Split(new char[1] {
                ','
            });
            foreach (string hu in hupai)
            {
                if (hu == null || hu.Length == 0)
                {
                    continue;
                }
                hupaiObj.uuid = hu.Split(new char[1] {
                    ':'
                }) [0];
                hupaiObj.cardPiont = int.Parse(hu.Split(new char[1] {
                    ':'
                }) [1]);
                hupaiObj.type = hu.Split(new char[1] {
                    ':'
                }) [2];
                //增加判断是否是自己胡牌的判断

                if (hupaiStr.Contains("d_other"))                   //排除一炮多响的情况
                {
                    mdesCribe += "点炮";
                }
                else if (hupaiStr.Contains("other_common"))                     //排除一炮多响的情况

                {
                }
                else
                {
                    if (hupaiObj.type == "menqing")
                    {
                        mdesCribe += "门清";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "zi_common")
                    {
                        mdesCribe += "自摸";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "d_self")
                    {
                        mdesCribe += "接炮";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qiyise")
                    {
                        mdesCribe += "清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "zi_qingyise")
                    {
                        mdesCribe += "自摸清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qixiaodui")
                    {
                        mdesCribe += "七小对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "self_qixiaodui")
                    {
                        mdesCribe += "七小对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "gangshangpao")
                    {
                        mdesCribe += "杠上炮";
                    }
                    else if (hupaiObj.type == "gangshanghua")
                    {
                        mdesCribe += "杠上花";
                        huFlagImg.SetActive(true);
                    }
                    //红中宝
                    else if (hupaiObj.type == "tian_hu")
                    {
                        mdesCribe += "天胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "di_hu")
                    {
                        mdesCribe += "地胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "chaochaoqidui")
                    {
                        mdesCribe += "超超豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "chaoqidui")
                    {
                        mdesCribe += "超豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "haohuaqidui")
                    {
                        mdesCribe += "豪华七对";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "quanfengtou")
                    {
                        mdesCribe += "全风头";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "qingyise")
                    {
                        mdesCribe += "清一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "hunyise")
                    {
                        mdesCribe += "混一色";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "quanyaojiu")
                    {
                        mdesCribe += "全幺九";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "hunyaojiu")
                    {
                        mdesCribe += "混幺九";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "shisanyao")
                    {
                        mdesCribe += "十三幺";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "shibaluohan")
                    {
                        mdesCribe += "十八罗汉";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "kankanhu")
                    {
                        mdesCribe += "坎坎胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "pengpenghu")
                    {
                        mdesCribe += "碰碰胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "haidilao")
                    {
                        mdesCribe += "海底捞X2";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "dasixi")
                    {
                        mdesCribe += "大四喜";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "xiaosixi")
                    {
                        mdesCribe += "小四喜";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "dasanyuan")
                    {
                        mdesCribe += "大三元";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "xiaosanyuan")
                    {
                        mdesCribe += "小三元";
                        huFlagImg.SetActive(true);
                    }
                    //瑞金
                    else if (hupaiObj.type == "tian_hu")
                    {
                        mdesCribe += "天胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "di_hu")
                    {
                        mdesCribe += "地胡";
                        huFlagImg.SetActive(true);
                    }
                    else if (hupaiObj.type == "jing_diao")
                    {
                        mdesCribe += "飞牌";
                        huFlagImg.SetActive(true);
                    }

                    if (!isJian)
                    {
                        paiArray [hupaiObj.cardPiont] -= 1;
                        isJian = true;
                    }
                }

                mdesCribe += " ";
            }
        }

        if (mHupaiResponseItemData.huType != null)
        {
            mdesCribe += mHupaiResponseItemData.huType;
        }

        resultDes.text = mdesCribe;
        maPais         = parms.getMaPoints();
        arrangePai(hupaiStr);
    }
Esempio n. 3
0
    private void analysisPaiInfo(HupaiResponseItem parms)
    {
        itemData = parms.totalInfo;
        string gangpaiStr = itemData.gang;

        if (gangpaiStr != null && gangpaiStr.Length > 0)
        {
            string[] gangtemps = gangpaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < gangtemps.Length; i++)
            {
                string     item       = gangtemps [i];
                GangpaiObj gangpaiObj = new GangpaiObj();
                gangpaiObj.uuid = item.Split(new char[1] {
                    ':'
                })[0];
                gangpaiObj.cardPiont = int.Parse(item.Split(new char[1] {
                    ':'
                })[1]);
                gangpaiObj.type = item.Split(new char[1] {
                    ':'
                })[2];
                //增加判断是否为自己的杠牌的操作

                paiArray [gangpaiObj.cardPiont] -= 4;
                gangPaiList.Add(gangpaiObj);

                if (gangpaiObj.type == "an")
                {
                    mdesCribe += "暗杠  ";
                }
                else
                {
                    mdesCribe += "明杠  ";
                }
            }
        }


        string pengpaiStr = itemData.peng;

        if (pengpaiStr != null && pengpaiStr.Length > 0)
        {
            pengpaiList = pengpaiStr.Split(new char[1] {
                ','
            });


            //string[] pengpaiListTTT = pengpaiList;
            List <string> pengpaiListTTT = new List <string>();
            for (int i = 0; i < pengpaiList.Length; i++)
            {
                if (paiArray [int.Parse(pengpaiList [i])] >= 3)
                {
                    paiArray [int.Parse(pengpaiList [i])] -= 3;
                    pengpaiListTTT.Add(pengpaiList [i]);
                }
            }
            pengpaiList = pengpaiListTTT.ToArray();
        }


        string chipaiStr = itemData.chi;

        if (chipaiStr != null && chipaiStr.Length > 0)
        {
            string[] chitemps = chipaiStr.Split(new char[1] {
                ','
            });
            for (int i = 0; i < chitemps.Length; i++)
            {
                string    item      = chitemps[i];
                ChipaiObj chipaiObj = new ChipaiObj();
                string[]  pointStr  = item.Split(new char[1] {
                    ':'
                });
                chipaiObj.cardPionts = pointStr;
                chipaiList.Add(chipaiObj);
                paiArray [int.Parse(chipaiObj.cardPionts[0])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[1])] -= 1;
                paiArray [int.Parse(chipaiObj.cardPionts[2])] -= 1;
            }
        }



        string hupaiStr = itemData.hu;

        if (hupaiStr != null && hupaiStr.Length > 0)
        {
            hupaiObj.uuid = hupaiStr.Split(new char[1] {
                ':'
            }) [0];
            hupaiObj.cardPiont = int.Parse(hupaiStr.Split(new char[1] {
                ':'
            }) [1]);
            hupaiObj.type = hupaiStr.Split(new char[1] {
                ':'
            }) [2];
            //增加判断是否是自己胡牌的判断

            if (hupaiStr.Contains("d_other"))               //排除一炮多响的情况
            {
                mdesCribe += "点炮";
            }
            else if (hupaiObj.type == "zi_common")
            {
                mdesCribe += "自摸";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "d_self")
            {
                mdesCribe += "接炮";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "qiyise")
            {
                mdesCribe += "清一色";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "zi_qingyise")
            {
                mdesCribe += "自摸清一色";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "qixiaodui")
            {
                mdesCribe += "七小对";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "self_qixiaodui")
            {
                mdesCribe += "自摸七小对";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
            else if (hupaiObj.type == "gangshangpao")
            {
                mdesCribe += "杠上炮";
            }
            else if (hupaiObj.type == "gangshanghua")
            {
                mdesCribe += "杠上花";
                huFlagImg.SetActive(true);
                paiArray [hupaiObj.cardPiont] -= 1;
            }
        }

        if (mHupaiResponseItemData.huType != null)
        {
            mdesCribe += mHupaiResponseItemData.huType;
        }

        resultDes.text = mdesCribe;
        maPais         = parms.getMaPoints();
        arrangePai();
    }
    public void setUI(HupaiResponseItem itemData, List <int> validMas, int mainuuid)
    {
        _itemData     = itemData;
        this.validMas = validMas;

        nickName.text   = itemData.nickname;
        totalScroe.text = itemData.totalScore.ToString();
        gangScore.text  = itemData.gangScore.ToString();
        fanCount.text   = itemData.fanCount.ToString();

        huFlag.SetActive(false);
        zhongMaFlag.SetActive(false);
        if (itemData.totalInfo.genzhuang == "1" && itemData.uuid == mainuuid)
        {
            GenzhuangFlag.SetActive(true);
        }
        else
        {
            GenzhuangFlag.SetActive(false);
        }

        string    mdesCribe = "";
        TotalInfo totalInfo = _itemData.totalInfo;

        int[] paiArray = _itemData.paiArray;

        var gangs = totalInfo.getGangInfos();

        for (int i = 0; i < gangs.Length; i++)
        {
            var info = gangs [i];
            paiArray [info.cardPoint] -= 4;
            if (info.type == "an")
            {
                mdesCribe += "暗杠  ";
            }
            else
            {
                mdesCribe += "明杠  ";
            }
        }

        var pengs = totalInfo.getPengInfos();

        for (int i = 0; i < pengs.Length; i++)
        {
            var info = pengs [i];
            if (paiArray [info.cardPoint] >= 3)
            {
                paiArray [info.cardPoint] -= 3;
            }
            else
            {
                pengs [i] = null;
            }
        }

        var chis = totalInfo.getChiInfos();

        for (int i = 0; i < chis.Length; i++)
        {
            var info = chis [i];
            paiArray [info.cardPionts [0]] -= 1;
            paiArray [info.cardPionts [1]] -= 1;
            paiArray [info.cardPionts [2]] -= 1;
        }


        var hu = totalInfo.getHuInfo();

        if (hu != null)
        {
            var kind = GameHelper.getHelper().getHuType(hu);
            mdesCribe += GameHelper.getHelper().getHuString(hu);
            if (kind == HuType.ZI_MO || kind == HuType.JIE_PAO)
            {
                huFlag.SetActive(true);
                paiArray [hu.cardPiont] -= 1;
            }
        }

        if (_itemData.huType != null)
        {
            mdesCribe += _itemData.huType;
        }

        resultDes.text = mdesCribe;

        //显示手牌
        float      startPosition = 30f;
        GameObject card;

        for (int i = 0; i < gangs.Length; i++)
        {
            TGangInfo info = gangs [i];
            if (info.type == "an")
            {
                for (int j = 0; j < 3; j++)
                {
                    createCard(info.cardPoint, startPosition, true);
                    startPosition += 36f;
                }
                createCard(info.cardPoint, startPosition);
                startPosition += 36f;
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    createCard(info.cardPoint, startPosition);
                    startPosition += 36f;
                }
            }
        }
        startPosition = startPosition + (gangs.Length > 0 ? 8f : 0f);

        var ii = 0;

        for (int i = 0; i < pengs.Length; i++)
        {
            if (pengs [i] != null)
            {
                for (int j = 0; j < 3; j++)
                {
                    createCard(pengs [i].cardPoint, startPosition);
                    startPosition += 36f;
                }
            }
            else
            {
                ii++;
            }
        }
        startPosition = startPosition + (pengs.Length - ii > 0 ? 8f : 0f);

        for (int i = 0; i < chis.Length; i++)
        {
            TChiInfo info = chis [i];
            for (int j = 0; j < 3; j++)
            {
                createCard(info.cardPionts[j], startPosition);
                startPosition += 36f;
            }
        }
        startPosition = startPosition + (chis.Length > 0 ? 8f : 0f);

        for (int i = 0; i < paiArray.Length; i++)
        {
            if (paiArray [i] > 0)
            {
                for (int j = 0; j < paiArray [i]; j++)
                {
                    createCard(i, startPosition);
                    startPosition += 36f;
                }
            }
        }
        startPosition += 8f;

        if (hu != null)
        {
            if (GameHelper.getHelper().isHu(hu.type))
            {
                createCard(hu.cardPiont, startPosition);
            }
            startPosition = startPosition + 36f + 52f;
        }
        else
        {
            startPosition = startPosition + 52f;
        }

        List <int> maPais = _itemData.getMaPoints();
        bool       flag   = false;

        if (maPais != null && maPais.Count > 0)
        {
            for (int i = 0; i < maPais.Count; i++)
            {
                flag = flag || isMaValid(maPais [i]);

                card = Instantiate(Resources.Load("Prefab/ThrowCard/ZhongMa")) as GameObject;
                card.transform.SetParent(paiArrayPanel.transform);
                card.GetComponent <PutoutCardView> ().setPoint(maPais [i]);
                card.transform.localScale    = new Vector3(0.8f, 0.8f, 1f);
                card.transform.localPosition = new Vector3((20 + i) * 36f, 0, 0);
            }
            zhongMaFlag.SetActive(flag);
        }

        if (GlobalData.getInstance().roomVO.roomType == GameType.HUA_SHUI)
        {
            card = Instantiate(Resources.Load("Prefab/Image_yu")) as GameObject;
            card.transform.SetParent(paiArrayPanel.transform);
            card.GetComponent <yuSetScript> ().setCount(GlobalData.getInstance().roomVO.xiaYu);
            card.transform.localScale    = Vector3.one;
            card.transform.localPosition = new Vector3(20 * 36f, 0, 0);
        }
    }