Ejemplo n.º 1
0
    private void SetCard(MJGameSettlementPlayerInfo info)
    {
        GameUtils.ClearChildren(mCardTable.transform);
        //空白
        GameObject other = NGUITools.AddChild(mCardTable.gameObject, mOther);

        other.SetActive(true);
        //杠
        CreateCardList(info.gang, eMJInstructionsType.GANG);
        //吃
        //CreateCardList(info.chi, eMJInstructionsType.chi);
        //碰
        if (info.peng != null)
        {
            for (int i = 0; i < info.peng.Count; i++)
            {
                InitPengItems(mThreeLie, info.peng[i].cards[0], info.peng[i].cards[0], info.peng[i].cards[0]);
            }
        }
        //亮
        //CreateCardList(info.liang, eMJInstructionsType.liang);
        //手牌
        CreateHandCard(info.shoupai);
        //胡牌
        if (info.huPai.Count > 0)
        {
            for (int i = 0; i < info.huPai.Count; i++)
            {
                GameObject obj = NGUITools.AddChild(mCardTable.gameObject, mCardOneItem);
                obj.SetActive(true);
                obj.transform.GetChild(0).GetComponent <UISprite>().spriteName = "top_" + info.huPai[i].card;
            }
        }
        mCardTable.Reposition();
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 小结算
    /// </summary>
    /// <param name="msg"></param>
    private void OnSettlement(MessageData msg)
    {
        litSemResponse data = msg.Read <litSemResponse>();

        CardsInfoStruct[] playerCardsDatas = MJGameModel.Inst.allPlayersCardsInfoStruct;
        bool isNoWinner = true;//是否是流局

        for (int i = 0; i < playerCardsDatas.Length; i++)
        {
            if (playerCardsDatas[i] != null && playerCardsDatas[i].huList != null && playerCardsDatas[i].huList.Count > 0)
            {
                isNoWinner = false;
                break;
            }
        }
        if (isNoWinner) //流局
        {
            mGameUI.ServerNoWinner();
        }
        #region 小结算数据处理
        MJGameSettlementInfo mSettlData = new MJGameSettlementInfo();
        MJGameModel.Inst.mLitSem   = data;
        mSettlData.isEnd           = true;
        mSettlData.isHu            = !isNoWinner;
        mSettlData.settleContainer = new List <MJGameSettlementPlayerInfo>();
        for (int i = 0; i < data.litSemList.Count; i++)
        {
            MJGameSettlementPlayerInfo oneSettlementPlayerInfo = new MJGameSettlementPlayerInfo();
            int seatID = data.litSemList[i].seatId;
            PlayerInfoStruct onePData = MJGameModel.Inst.mRoomPlayers[seatID];              //玩家信息
            CardsInfoStruct  cdata    = MJGameModel.Inst.allPlayersCardsInfoStruct[seatID]; //牌信息
            oneSettlementPlayerInfo.seatId   = seatID;
            oneSettlementPlayerInfo.userId   = onePData.uId;
            oneSettlementPlayerInfo.nickName = onePData.nickName;
            oneSettlementPlayerInfo.score    = data.litSemList[i].currScore;
            oneSettlementPlayerInfo.headUrl  = onePData.headUrl;
            oneSettlementPlayerInfo.shoupai  = data.litSemList[i].handList;
            oneSettlementPlayerInfo.peng     = cdata.pengList;
            oneSettlementPlayerInfo.gang     = cdata.gangList;
            oneSettlementPlayerInfo.huPai    = cdata.huList;
            oneSettlementPlayerInfo.huOrder  = data.litSemList[i].huOrder;
            oneSettlementPlayerInfo.huDes    = data.litSemList[i].huIntro;
            mSettlData.settleContainer.Add(oneSettlementPlayerInfo);
        }
        #endregion

        MJGameModel.Inst.mSettlData = mSettlData;
        MJGameModel.Inst.mState     = eMJRoomStatus.GAMEOVER;
        MJGameModel.Inst.mStartGameData.roomInfo.roomState = eRoomState.GAMEOVER;//改变房间状态
        SetTimeout.add(1, ChangHandsCardsShow);

        SetTimeout.add(5, ShowSmallSettle);

        //清理离开游戏的玩家
        if (mGameUI != null)
        {
            mGameUI.SetAllPlayerOutLine();
        }
    }
Ejemplo n.º 3
0
 private void InitBestCards(MJGameSettlementPlayerInfo info)
 {
     if (info == null)
     {
         return;
     }
     mName.text = info.nickName;
     SetCard(info);
 }
Ejemplo n.º 4
0
    /// <summary>
    /// 小结算
    /// </summary>
    /// <param name="msg"></param>
    public void OnSettlement()
    {
        if (mModel.CurRecordDetailData == null)
        {
            return;
        }
        litSemResponse data = mModel.CurRecordDetailData.semData;

        if (data == null)
        {
            return;
        }
        CardsInfoStruct[] playerCardsDatas = MJGameModel.Inst.allPlayersCardsInfoStruct;
        bool isNoWinner = true;//是否是流局

        for (int i = 0; i < playerCardsDatas.Length; i++)
        {
            if (playerCardsDatas[i] != null && playerCardsDatas[i].huList != null && playerCardsDatas[i].huList.Count > 0)
            {
                isNoWinner = false;
                break;
            }
        }
        if (isNoWinner) //流局
        {
            mGameUI.ServerNoWinner();
        }
        #region 小结算数据处理
        MJGameSettlementInfo mSettlData = new MJGameSettlementInfo();

        mSettlData.isEnd           = true;
        mSettlData.isHu            = !isNoWinner;
        mSettlData.settleContainer = new List <MJGameSettlementPlayerInfo>();
        for (int i = 0; i < data.litSemList.Count; i++)
        {
            MJGameSettlementPlayerInfo oneSettlementPlayerInfo = new MJGameSettlementPlayerInfo();
            int seatID = data.litSemList[i].seatId;
            PlayerInfoStruct onePData = MJGameModel.Inst.mRoomPlayers[seatID];              //玩家信息
            CardsInfoStruct  cdata    = MJGameModel.Inst.allPlayersCardsInfoStruct[seatID]; //牌信息
            oneSettlementPlayerInfo.seatId   = seatID;
            oneSettlementPlayerInfo.userId   = onePData.uId;
            oneSettlementPlayerInfo.nickName = onePData.nickName;
            oneSettlementPlayerInfo.score    = data.litSemList[i].currScore;
            oneSettlementPlayerInfo.headUrl  = onePData.headUrl;
            oneSettlementPlayerInfo.shoupai  = data.litSemList[i].handList;
            oneSettlementPlayerInfo.peng     = cdata.pengList;
            oneSettlementPlayerInfo.gang     = cdata.gangList;
            oneSettlementPlayerInfo.huPai    = cdata.huList;
            oneSettlementPlayerInfo.huDes    = data.litSemList[i].huIntro;
            mSettlData.settleContainer.Add(oneSettlementPlayerInfo);
        }
        #endregion

        MJGameModel.Inst.mSettlData = mSettlData;
        mGameUI.GetChaJiaoData(data.flowSemList);
    }
Ejemplo n.º 5
0
    private int mMaxFanshu;            //封顶番数


    public void SetData(MJGameSettlementPlayerInfo info, int maxFanshu, bool isBigWinner)
    {
        mMaxFanshu = maxFanshu;

        {
            Assets.LoadIcon(info.headUrl, (t) =>
            {
                mIcon.mainTexture = t;
            });
        }

        if (info.isZhuang == true)
        {
            if (mZhuangSprite != null)
            {
                mZhuangSprite.gameObject.SetActive(true);
            }
        }
        else
        {
            if (mZhuangSprite != null)
            {
                mZhuangSprite.gameObject.SetActive(false);
            }
        }

        //名字
        //mName.text = GameUtils.GetClampText(info.nickName, mName);
        mName.text = info.nickName;
        //id
        mId.text = info.userId.ToString();
        //分数
        mPoint.text  = info.score >= 0 ? ("+" + info.score) : info.score.ToString();
        mPoint.color = info.score < 0 ? NGUIText.ParseColor("d53535") : NGUIText.ParseColor("46a30e");
        //胡牌细节
        mHuType.text = info.huDes;
        //牌型
        SetCard(info);
        //大赢家
        mBigWinner.SetActive(isBigWinner);
        //胡牌顺序
        if (info.huOrder > 0 && info.huOrder < 5)
        {
            mHuOrder.spriteName = "hu_" + info.huOrder;
            DelayRun((info.huOrder - 1) * 0.2f, () =>
            {
                mHuOrder.gameObject.SetActive(true);
            });
        }
    }
Ejemplo n.º 6
0
 private void SetCard(MJGameSettlementPlayerInfo info)
 {
     GameUtils.ClearChildren(mCardTable.transform);
     //杠
     CreateCardList(info.gang, eMJInstructionsType.GANG);
     //吃
     //CreateCardList(info.chi, eMJInstructionsType.CHI);
     //碰
     if (info.peng != null)
     {
         for (int i = 0; i < info.peng.Count; i++)
         {
             InitPengItems(mThreeLie, info.peng[i].cards[0], info.peng[i].cards[0], info.peng[i].cards[0]);
         }
     }
     //亮
     //CreateCardList(info.liang, eMJInstructionsType.LIANG);
     //手牌
     CreateHandCard(info.shoupai);
     //胡牌
     if (info.huPai != null && info.huPai.Count > 0)
     {
         Dictionary <int, UILabel> huList = new Dictionary <int, UILabel>();
         for (int i = 0; i < info.huPai.Count; i++)
         {
             if (huList.ContainsKey(info.huPai[i].card))
             {
                 int count = int.Parse(huList[info.huPai[i].card].text) + 1;
                 huList[info.huPai[i].card].text = count.ToString();
                 huList[info.huPai[i].card].gameObject.SetActive(true);
             }
             else
             {
                 GameObject obj = NGUITools.AddChild(mCardTable.gameObject, mCardOneItem);
                 obj.SetActive(true);
                 obj.transform.GetChild(0).GetComponent <UISprite>().spriteName = "top_" + info.huPai[i].card;
                 huList.Add(info.huPai[i].card, obj.transform.GetChild(1).GetComponent <UILabel>());
                 obj.transform.GetChild(2).gameObject.SetActive(true);
             }
         }
     }
     mCardTable.Reposition();
 }
Ejemplo n.º 7
0
    /// <summary>
    /// 得到胡牌类型
    /// </summary>
    /// <param name="info"></param>
    /// <returns></returns>
    public string GetHuType(MJGameSettlementPlayerInfo info)
    {
        if (info == null)
        {
            return("");
        }
        string            str = "";
        MJGameHupaiConfig con = null;//ConfigManager.Create().mHuPaiType.data[0];

        if (info.des != null)
        {
            #region 闭门听

            /* int bimenting = 0;
             * for (int i = 0; i < info.des.Count; i++)
             * {
             *    if (info.des[i] == 38 || info.des[i] == 17)//报听和不开门同时存在显示闭门听
             *    {
             *        bimenting++;
             *        if (bimenting >= 2)
             *        {
             *            if (info.des.Contains(29))//点炮
             *                str += "闭门炮" + "   ";
             *            else if (info.score > 0)
             *                str += "闭门听" + "   ";
             *            else if (info.score == 0 && !info.des.Contains(30))//不存在闭门
             *                str += "闭门" + "   ";
             *            break;
             *        }
             *    }
             * }
             */
            #endregion
            for (int i = 0; i < info.des.Count; i++)
            {
                if (info.des[i] >= con.hupaiType.Length)
                {
                    continue;
                }
                //else if (bimenting >= 2 && (info.des[i] == 38 || info.des[i] == 17))//如果是闭门听就不显示报听和不开门
                //    continue;
                else
                {
                    str += con.hupaiType[info.des[i]] + "   ";
                }
            }
        }
        bool isMGangZFB = false;                       //是否有明杠中发白
        bool isAGangZFB = false;                       //是否有暗杠中发白
                                                       //if (info.gang != null && info.huDePai > 0)//必须要胡牌的人才显示杠的类型
        if (info.gang != null && info.huPai.Count > 0) //必须要胡牌的人才显示杠的类型
        {
            GangStruct            card;
            Dictionary <int, int> gangNum = new Dictionary <int, int>();//杠类型对应数量
            for (int i = 0; i < info.gang.Count; i++)
            {
                card = info.gang[i];

                /*
                 * if (card.cards[0] >= 41 && card.cards[0] <= 43)//杠的中发白不计入杠,单独显示明杠中发白,暗杠中发白
                 * {
                 *  if (card.type != 2 && !isMGangZFB)//明杠中发白
                 *  {
                 *      if (gangNum.ContainsKey((int)eMJGangType.MingGangZFB))
                 *          gangNum[(int)eMJGangType.MingGangZFB]++;
                 *      else
                 *          gangNum[(int)eMJGangType.MingGangZFB] = 1;
                 *  }
                 *  else if (card.type == 2 && !isAGangZFB)//暗杠中发白
                 *  {
                 *      if (gangNum.ContainsKey((int)eMJGangType.AnGangZFB))
                 *          gangNum[(int)eMJGangType.AnGangZFB]++;
                 *      else
                 *          gangNum[(int)eMJGangType.AnGangZFB] = 1;
                 *  }
                 * }
                 * else*/
                {
                    if (gangNum.ContainsKey((int)card.gangType))
                    {
                        gangNum[(int)card.gangType]++;
                    }
                    else
                    {
                        gangNum[(int)card.gangType] = 1;
                    }
                }
            }
            foreach (KeyValuePair <int, int> item in gangNum)
            {
                if (item.Value > 1)
                {
                    str += con.gangType[item.Key] + "x" + item.Value + "  ";
                }
                else
                {
                    str += con.gangType[item.Key] + "  ";
                }
            }
        }
        return(str);
    }