예제 #1
0
    public void OnShaked(CardBase clickedCard, CardGrid cardGrid, bool bShaked = true)
    {
        clickedCard.img.raycastTarget = false;
        cardGrid.Set(clickedCard);
        OnShakedCallback.Invoke(); // 이거 없으면 지랄난거라 널체크하면 안될듯..
        OnShakedCallback = null;

        if (bShaked)
        {
            rule.Shake();
        }
    }
예제 #2
0
    void PlaceCard()                                      // 알아서 4번 돌림
    {
        CardBase card = gm.GetRandomCard(gm.useCardList); // 랜덤으로 하나 뽑고
        CardGrid grid = CardFinder.GetSameMonthCardsGrid(gm.cardGrids, card);

        if (grid == null)
        {
            grid = gm.GetNullGrid();
        }

        grid.Set(card);
        card.gameObject.SetActive(true);
    }
예제 #3
0
    public void Putcard()
    {
        CardBase followCard = GameManager.Instance.followUpCardQueue.Dequeue();

        followCard.gameObject.SetActive(true);

        CardGrid followCardTargetGrid = CardFinder.GetSameMonthCardsGrid(GameManager.Instance.cardGrids, followCard);

        if (followCardTargetGrid == null) // 같은 월이 깔린게 없으면 그냥 비어있는데에 내려놓습니다.
        {
            followCardTargetGrid = GameManager.Instance.GetNullGrid();
            followCardTargetGrid.Set(followCard);
        }
        else
        {
            int count = followCardTargetGrid.placedCards.Count;
            switch (count)
            {
            case 1:     // 뒷패를 깠는데 하나만 있다는 거면, 무조건 가져오면 됨.
                GameManager.Instance.OnScored(followCard);
                GameManager.Instance.OnScored(followCardTargetGrid.placedCards[0], followCardTargetGrid);
                followCardTargetGrid.Reset();
                break;

            case 2:     // 두 개가 있다는 거면 둘 중 하나를 선택하게 하면 됨.
                followCard.MoveCardToGrid(followCardTargetGrid);

                GameManager.Instance.choiceCallBackQueue.Enqueue(() =>
                                                                 GameManager.Instance.ChoiceCard(followCardTargetGrid.placedCards[0], followCardTargetGrid.placedCards[1], followCardTargetGrid));
                GameManager.Instance.putCardQueue.Enqueue(followCard);
                break;

            case 3:     // 3개 있으면 다 가져오고
                while (followCardTargetGrid.placedCards.Count > 0)
                {
                    GameManager.Instance.OnScored(followCardTargetGrid.placedCards[0], followCardTargetGrid);
                }

                GameManager.Instance.OnScored(followCard);     // 내가 낸 것도 가져오기.
                GameManager.Instance.choiceCallBackQueue.Clear();
                followCardTargetGrid.Reset();
                break;
            }
        }

        GameManager.Instance.TryExecuteChoiceCallback();
    }
예제 #4
0
    }//함수의 끝.

    public void FollowCord(CardBase putCard)
    {
        CardBase followCard = followUpCardQueue.Dequeue();

        followCard.gameObject.SetActive(true);

        CardGrid followCardTargetGrid = CardFinder.GetSameMonthCardsGrid(cardGrids, followCard);

        if (followCardTargetGrid == null) // 같은 월이 깔린게 없으면 그냥 비어있는데에 내려놓습니다.
        {
            followCardTargetGrid = GetNullGrid();
            followCardTargetGrid.Set(followCard);
        }
        else
        {
            int count = followCardTargetGrid.placedCards.Count;
            switch (count)
            {
            case 1:     // 뒷패를 깠는데 하나만 있다는 거면, 무조건 가져오면 됨.
                if (putCard.cardData.cardMonth == followCard.cardData.cardMonth)
                {
                    rule.Kiss();
                }

                OnScored(followCard);
                OnScored(followCardTargetGrid.placedCards[0], followCardTargetGrid);
                followCardTargetGrid.Reset();
                break;

            case 2:     // 두 개가 있다는 거면 둘 중 하나를 선택하게 하면 됨.
                followCard.MoveCardToGrid(followCardTargetGrid);

                if (putCard.cardData.cardMonth == followCard.cardData.cardMonth)     //뻑임
                {
                    rule.Paulk();
                }
                else
                {
                    choiceCallBackQueue.Enqueue(() =>
                                                ChoiceCard(followCardTargetGrid.placedCards[0], followCardTargetGrid.placedCards[1], followCardTargetGrid));
                    putCardQueue.Enqueue(followCard);
                }
                break;

            case 3:     // 3개 있으면 다 가져오고
                if (putCard.cardData.cardMonth == followCard.cardData.cardMonth)
                {
                    //따닥
                }


                while (followCardTargetGrid.placedCards.Count > 0)
                {
                    OnScored(followCardTargetGrid.placedCards[0], followCardTargetGrid);
                }

                OnScored(followCard);     // 내가 낸 것도 가져오기.
                choiceCallBackQueue.Clear();
                followCardTargetGrid.Reset();
                TakeOtherPlayerCard();
                break;
            }
        }
        CardManager.Instance.TakePairCard(targetGrid);
        TryExecuteChoiceCallback();


        targetGrid = null;
    }
예제 #5
0
    public void PutCard(CardBase card) // 내가 낸 그리드를 가지고 있으면 좋을듯?ai.scoreData
    {
        SetTargetUserData();

        targetGrid = CardFinder.GetSameMonthCardsGrid(cardGrids, card);
        List <CardBase> cardList = CardManager.Instance.GetSameMonthCards(card);

        if (targetGrid == null) // 같은 월이 깔린게 없으면 그냥 비어있는데에 내려놓습니다.
        {
            targetGrid       = GetNullGrid();
            OnShakedCallback = () => FollowCord(card);

            if (cardList.Count >= 3)
            {
                targetUserData.utilizeCards.Remove(card);
                UIManager.Instance.shakeUI.SetData(card, targetGrid);
                rule.Shake();
            }
            else
            {
                targetUserData.utilizeCards.Remove(card);
                targetGrid.Set(card);
                FollowCord(card);
            }
        }
        else // 이 경우 자연스럽게 뒷 패도 깜.
        {
            int count = targetGrid.placedCards.Count;
            switch (count)
            {
            case 1:                      // 하나 있으면 그 친구한테 우선 가기. -> 뻑 가능성
                if (cardList.Count == 3) // 폭탄
                {
                    foreach (var item in cardList)
                    {
                        targetUserData.utilizeCards.Remove(item);
                    }
                    rule.Bomb(2);                                    // 연출같은거 여기서?

                    OnScored(targetGrid.placedCards[0], targetGrid); // 바닥 패 먹고
                    while (cardList.Count > 0)
                    {
                        OnScored(cardList[0]);
                        cardList.RemoveAt(0);
                    }
                    TakeOtherPlayerCard();
                }
                else
                {
                    targetUserData.utilizeCards.Remove(card);
                    card.MoveCardToGrid(targetGrid);
                }

                break;

            case 2:     // 두개 있으면 거기로 우선 가기 -> 따닥 가능성
                if (cardList.Count == 2)
                {
                    foreach (var item in cardList)
                    {
                        targetUserData.utilizeCards.Remove(item);
                    }
                    rule.Bomb(1);

                    while (targetGrid.placedCards.Count > 0)
                    {
                        OnScored(targetGrid.placedCards[0], targetGrid);
                    }

                    while (cardList.Count > 0)
                    {
                        OnScored(cardList[0]);
                        cardList.RemoveAt(0);
                    }
                    TakeOtherPlayerCard();
                }
                else
                {
                    targetUserData.utilizeCards.Remove(card);

                    card.MoveCardToGrid(targetGrid);

                    choiceCallBackQueue.Enqueue(() =>
                                                ChoiceCard(targetGrid.placedCards[0], targetGrid.placedCards[1], targetGrid));

                    putCardQueue.Enqueue(card);
                }
                break;

            case 3:     // 3개 있으면 다 가져오고
                targetUserData.utilizeCards.Remove(card);
                while (targetGrid.placedCards.Count > 0)
                {
                    OnScored(targetGrid.placedCards[0], targetGrid);
                }

                OnScored(card);
                rule.Shake();
                targetGrid.Reset();

                TakeOtherPlayerCard();
                break;
            }

            FollowCord(card);
        }
    }//함수의 끝.