예제 #1
0
        private void GenerateCardUI(CardContent cc)
        {
            var go = GameObject.Instantiate(cardGo, deckPos.transform.position, deckPos.transform.rotation, deckPos.transform);

            go.SetCard(cc, false, false);
            cc.bUI = go;
        }
예제 #2
0
 public void DeselectCard(CardContent cc)
 {
     if (outList.Contains(cc))
     {
         outList.Remove(cc);
     }
 }
예제 #3
0
        private List <CardContent> GetCurrentList(CardContent cc)
        {
            switch (cc.bUI.position)
            {
            case CardPosition.Hand:
                return(handPile);

            case CardPosition.Deck:
                return(deckPile);

            case CardPosition.Discard:
                return(discardPile);

            case CardPosition.Used:
                return(usedPile);

            case CardPosition.Exhaust:
                return(exhaustPile);

            case CardPosition.Temp:
                return(tempPile);

            default:
                return(deckPile);
            }
        }
예제 #4
0
 /// <summary>
 /// 设置卡牌信息
 /// </summary>
 /// <param name="cc">卡牌</param>
 /// <param name="canSelect">是否能显示选择框</param>
 /// <param name="canScale">是否鼠标移入有放大</param>
 public void SetCard(CardContent cc, bool canSelect = false, bool canScale = true)
 {
     this.cc        = cc;
     this.name      = cc.name;
     this.canSelect = canSelect;
     this.canZoom   = canScale;
     RefreshUI();
 }
예제 #5
0
        private IEnumerator IGoTo(CardContent cc, CardPosition position)
        {
            GetCurrentList(cc).Remove(cc);
            cc.bUI.position = position;
            switch (position)
            {
            case CardPosition.Deck:
                deckPile.Add(cc);
                cc.bUI.transform.SetParent(deckPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                yield return(new WaitForSeconds(nextstep));

                break;

            case CardPosition.Discard:
                discardPile.Add(cc);
                cc.bUI.transform.SetParent(discardPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                yield return(new WaitForSeconds(nextstep));

                break;

            case CardPosition.Exhaust:
                exhaustPile.Add(cc);
                cc.bUI.transform.SetParent(exhaustPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                yield return(new WaitForSeconds(nextstep));

                break;

            case CardPosition.Hand:
                handPile.Add(cc);
                cc.bUI.transform.SetParent(handPos.transform, true);
                break;

            case CardPosition.Used:
                usedPile.Add(cc);
                cc.bUI.transform.SetParent(usedPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                yield return(new WaitForSeconds(nextstep));

                break;

            case CardPosition.Temp:
                tempPile.Add(cc);
                break;
            }
            yield break;
        }
예제 #6
0
        public IEnumerator IDraw(List <CardContent> outlist, int count)
        {
            var leftCount = count;

            while (leftCount > 0)
            {
                if (deckPile.Count == 0)
                {
                    if (discardPile.Count > 0)
                    {
                        yield return(IRefreshUI());

                        yield return(IShuffle());

                        continue;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    CardContent card = deckPile[0];
                    yield return(IGoTo(card, CardPosition.Hand));

                    leftCount--;
                    card.OnDraw();
                    if (outlist != null)
                    {
                        outlist.Add(card);
                    }
                    if (leftCount == 0)
                    {
                        break;
                    }
                }
            }
            yield return(IRefreshUI());

            yield break;
        }
예제 #7
0
        //等决定动画后再逐步废除
        private void GoTo(CardContent cc, CardPosition position)
        {
            GetCurrentList(cc).Remove(cc);
            cc.bUI.position = position;
            switch (position)
            {
            case CardPosition.Deck:
                deckPile.Add(cc);
                cc.bUI.transform.SetParent(deckPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                break;

            case CardPosition.Discard:
                discardPile.Add(cc);
                cc.bUI.transform.SetParent(discardPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                break;

            case CardPosition.Exhaust:
                exhaustPile.Add(cc);
                cc.bUI.transform.SetParent(exhaustPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                break;

            case CardPosition.Hand:
                handPile.Add(cc);
                cc.bUI.transform.SetParent(handPos.transform, true);
                break;

            case CardPosition.Used:
                usedPile.Add(cc);
                cc.bUI.transform.SetParent(usedPos.transform);
                cc.bUI.transform.DOLocalMove(Vector3.zero, duration);
                break;

            case CardPosition.Temp:
                tempPile.Add(cc);
                break;
            }
        }
예제 #8
0
 public void GenerateCardTo(CardContent cc, CardPosition position)
 {
     GenerateCardUI(cc);
     GoTo(cc, position);
     cc.RefreshUI();
 }
예제 #9
0
 public void TempUse(CardContent cc)
 {
     GoTo(cc, CardPosition.Temp);
 }
예제 #10
0
 public void ReturnToHand(CardContent cc)
 {
     GoTo(cc, CardPosition.Hand);
     RefreshUI();
 }
예제 #11
0
 public void ReturnToDeck(CardContent cc)
 {
     GoTo(cc, CardPosition.Deck);
     RefreshUI();
 }
예제 #12
0
 public void Used(CardContent cc)
 {
     GoTo(cc, CardPosition.Used);
     RefreshUI();
 }
예제 #13
0
 public void Exhaust(CardContent cc)
 {
     GoTo(cc, CardPosition.Exhaust);
     RefreshUI();
 }
예제 #14
0
 public void Discard(CardContent cc)
 {
     GoTo(cc, CardPosition.Discard);
     cc.OnDiscard();
     RefreshUI();
 }
예제 #15
0
 public void SelectCard(CardContent cc) => outList.Add(cc);