예제 #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++;
    }
예제 #2
0
    /// <summary>
    /// 激活出牌按钮
    /// </summary>
    void ActivePopButton(bool canReject)
    {
        if (LandlordsModel.Instance.IsTuoGuan || LandlordsMainPlayer.CheckIsLastCanAutoPop())
        {
            return;
        }
        List <Card> cards = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString());

        chongxuanBtn.gameObject.SetActive(true);
        chongxuanBtn.interactable = cards.Count > 0;
        tipsBtn.SetActive(true);
        playBtn.gameObject.SetActive(true);
        noPlayBtn.gameObject.SetActive(true);
        noPlayBtn.interactable = canReject;
        playBtn.interactable   = cards.Count > 0;
    }
예제 #3
0
    public override void RoundEnter(bool isCanNoPlay)
    {
        base.RoundEnter(isCanNoPlay);
        switch (OrderController.Instance.CurInterationType)
        {
        case InterationType.CallLandlords:
            clock.Init(LandlordsPage.wait_CallLandlordsTime, 10, 5, null, true);
            break;

        case InterationType.QiangLandlords:
            clock.Init(LandlordsPage.wait_QiangTime, 10, 5, null, true);
            break;

        case InterationType.CallFen:
            clock.Init(LandlordsPage.wait_CallFenTime, 10, 5, () => AutoCallLandlord(), true);
            break;

        case InterationType.PopCard:
            if (LandlordsModel.Instance.IsTuoGuan)
            {
                //如果是托管状态
                return;
            }
            List <Card> cards = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString());
            if (CheckIsLastCanAutoPop())
            {
                SetTimeout.add(1.5f, () =>
                {
                    AutoPop();
                });
                return;
            }
            if (cards.Count == 0)
            {
                clock.Init(LandlordsPage.wait_canNotPopTime, 4, 5, () => AutoPop(), true);
            }
            else
            {
                clock.Init(LandlordsPage.wait_PopTime, 10, 5, () => AutoPop(), true);
            }
            break;

        default:
            break;
        }
    }
예제 #4
0
    /// <summary>
    /// 根据手牌提示
    /// </summary>
    /// <param name="isCanTips">提示是否可以出牌</param>
    /// <returns></returns>
    public List <Card> Tips(out bool isCanTips)
    {
        isCanTips = false;
        List <Card> exclude = GetCardByLastTips();
        List <Card> cards   = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString(), exclude);

        if (cards.Count > 0)
        {
            if (CheckWeight(cards) && DeskCardsCache.Instance.Rule != CardsType.None)
            {//如果本次提示和上次的一样-->再找
                lastTip.Add(cards);
                bool isHaveTips = false;
                cards = Tips(out isHaveTips);
            }
            else
            {
                lastTip.Add(cards);
            }
            isCanTips = true;
        }
        else
        {
            if (lastTip.Count > 0)
            {//证明之前有提示牌
                lastTip.Clear();
                bool isHaveTips = false;
                cards     = Tips(out isHaveTips);
                isCanTips = true;
            }
            else
            {
                isCanTips = false;
            }
        }
        return(cards);
    }
예제 #5
0
    public List <Card> Tips2(List <Card> exclude)
    {
        List <Card> cards = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString(), exclude);

        return(cards);
    }
예제 #6
0
    // 检查是否是最后一手牌,是-->自动出
    public static bool CheckIsLastCanAutoPop()
    {
        List <Card> cards = CardRules.DelayDiscardCard(UserInfoModel.userInfo.userId.ToString());

        return(LandlordsModel.Instance.MyInfo.CardsCount - cards.Count == 0);
    }