Example #1
0
    private MJliangcard mCard;  //操作的牌

    public void SetCards(OptItemStruct optList, MJliangcard cards, CallBack <OptItemStruct, MJliangcard> callback)
    {
        mOpt = optList;
        MJliangcard gangCards = new MJliangcard();

        if (gangCards.card == null)
        {
            gangCards.card = new List <int>();
        }
        gangCards.card.AddRange(cards.card);
        mCard   = gangCards;
        cardNum = gangCards.card[0];
        //mCard = cards;
        mCallback = callback;
        for (int i = 0; i < gangCards.card.Count; i++)
        {
            mCardObj[i].SetActive(true);

            mCardSpr[i].spriteName = "top_" + gangCards.card[i];
        }
        for (int i = gangCards.card.Count; i < mCardSpr.Length; i++)
        {
            mCardObj[i].SetActive(false);
        }
        mGrid.Reposition();
        mWidget.width = (int)mGrid.cellWidth * gangCards.card.Count;
    }
Example #2
0
    /// <summary>
    /// 特殊操作点击返回
    /// </summary>
    /// <param name="opt"></param>
    /// <param name="cards"></param>
    public void OnSpeciaInsItemCall(OptItemStruct opt, MJliangcard cards)
    {
        ResetUI();
        OptRequest req = new OptRequest();

        if (opt.ins == eMJInstructionsType.GANG)
        {
            req.ins    = eMJInstructionsType.GANG;
            cards.card = new List <int>();
        }
        //else if (opt.ins == eMJInstructionsType.chi)
        //    opt.type = cards.type;
        opt.cards = cards.card;
        req.cards.Add(cards.card[0]);
        Global.Inst.GetController <MJGameController>().SendInstructions(req, null);
    }
Example #3
0
    /// <summary>
    /// 设置特殊操作
    /// </summary>
    /// <param name="info"></param>
    public void SetSpeciaInstructions(OptItemStruct info)
    {
        mSpeciaInstructionRoot.SetActive(true);
        List <MJliangcard> list = new List <MJliangcard>();

        mChiTipsObj.SetActive(false);

        /*
         * if (info.ins == eMJInstructionsType.baojiao)//报叫
         * {
         *  mChiTipsObj.SetActive(true);
         *  for (int i = 0; i < info.card.Count; i++)
         *  {
         *      MJliangcard lc = new MJliangcard();
         *      List<int> l = new List<int>();
         *      l.Add(info.card[i]);
         *      lc.card = l;
         *      list.Add(lc);
         *  }
         *  MJGameModel.Inst.mIsTing = true;//听牌状态
         * }
         * else if (info.ins == eMJInstructionsType.chi)//吃
         * {
         *
         *  list = GetChiCards();
         * }
         */
        if (info.ins == eMJInstructionsType.GANG)//杠
        {
            for (int i = 0; i < info.cards.Count; i++)
            {
                MJliangcard lc = new MJliangcard();
                List <int>  l  = new List <int>();
                for (int j = 0; j < 4; j++)
                {
                    l.Add(info.cards[i]);
                }
                lc.card = l;
                list.Add(lc);
            }
        }
        InitSpecia(info, list);
    }
Example #4
0
    public List <MJliangcard> GetChiCards()
    {
        List <MJliangcard> cards = new List <MJliangcard>();
        int        card          = MJGameModel.Inst.mLastOutCard;
        int        myseat        = MJGameModel.Inst.mMySeatId;
        List <int> handcard      = MJGameModel.Inst.allPlayersCardsInfoStruct[myseat].handList;

        if (handcard.Contains(card - 2) && handcard.Contains(card - 1) && card % 10 > 2)//有两张左边的牌,吃的牌是3,有1和2 后
        {
            MJliangcard lc = new MJliangcard();
            List <int>  c  = new List <int>();
            c.Add(card - 2);
            c.Add(card - 1);
            c.Add(card);
            lc.card = c;
            lc.type = (int)eMJChiType.HOU;
            cards.Add(lc);
        }
        if (handcard.Contains(card - 1) && handcard.Contains(card + 1) && card % 10 > 1)//有左右边的牌,吃的牌是3,有2和4 中
        {
            MJliangcard lc = new MJliangcard();
            List <int>  c  = new List <int>();
            c.Add(card - 1);
            c.Add(card);
            c.Add(card + 1);
            lc.card = c;
            lc.type = (int)eMJChiType.ZHONG;
            cards.Add(lc);
        }
        if (handcard.Contains(card + 1) && handcard.Contains(card + 2) && card > 0)//有两张左边的牌,吃的牌是3,有4和5 前
        {
            MJliangcard lc = new MJliangcard();
            List <int>  c  = new List <int>();
            c.Add(card);
            c.Add(card + 1);
            c.Add(card + 2);
            lc.card = c;
            lc.type = (int)eMJChiType.QIAN;
            cards.Add(lc);
        }
        return(cards);
    }