Esempio n. 1
0
    // 自动出牌
    void AutoPop()
    {
        List <Card> cards    = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString());
        bool        isCanPop = cards.Count > 0;

        if (isCanPop)
        {
            List <Card>   select    = new List <Card>();
            List <CardUI> selectUis = new List <CardUI>();
            for (int i = 0; i < GetSpriteUIs().Length; i++)
            {
                if (GetSpriteUIs()[i].Select)
                {
                    select.Add(GetSpriteUIs()[i].Card);
                    selectUis.Add(GetSpriteUIs()[i]);
                }
            }
            //先检测已选择的牌可以出不
            if (PlayCard.IsCanPop(select))
            {
                LandlordsNet.C2G_PopReq(1, select, null, null);
            }
            else
            {
                CardRules.SortCards(cards, true);
                LandlordsNet.C2G_PopReq(1, cards, null, null);
            }
        }
        else
        {
            Interaction.Instance.NoPlayCard(0);
        }
        LandlordsModel.Instance.TimeOutAudioPopCount++;
    }
Esempio n. 2
0
    /// <summary>
    /// 主角请求出牌
    /// </summary>
    public bool MainRolePopReq(CallBack call)
    {
        CardUI[] sprites = GetSpriteUIs();

        //找出所有选中的牌
        List <Card> selectedCardsLists = new List <Card>();

        for (int i = 0; i < sprites.Length; i++)
        {
            if (sprites[i].Select)
            {
                selectedCardsLists.Add(sprites[i].Card);
            }
        }
        //排好序

        CardRules.SortCards(selectedCardsLists, true);
        bool isCanPop = PlayCard.IsCanPop(selectedCardsLists);

        if (isCanPop)
        {
            LandlordsNet.C2G_PopReq(1, selectedCardsLists, call, null);
        }
        else
        {
            List <Card> exclude = new List <Card>();
            for (int i = 0; i < sprites.Length; i++)
            {
                if (!sprites[i].Select)
                {
                    exclude.Add(sprites[i].Card);
                }
            }
            List <Card> popCard = LandlordsModel.Instance.TipsModel.Tips2(exclude);
            isCanPop = popCard.Count > 0;
            if (isCanPop)
            {
                LandlordsNet.C2G_PopReq(1, popCard, call, null);
            }
        }
        return(isCanPop);
    }