コード例 #1
0
        private static void CorrectDeck2_AddItemToHand()
        {
            string cardname = "apollobow";

            CardManager.Card chosenCard = null;

            foreach (CardManager.Card card in Game.instance.currentDeck)
            {
                if (card.name.Equals(cardname))
                {
                    chosenCard = card;
                    break;
                }
            }

            foreach (CardManager.Card card in Game.instance.reserveDeck)
            {
                if (card.name.Equals(cardname))
                {
                    chosenCard = card;
                    break;
                }
            }



            if (chosenCard != null)
            {
                Game.instance.currentDeck.Remove(chosenCard);
                SameDistanceChildren distance = Visual.instance.TreasureHand.GetComponent <SameDistanceChildren>();
                int        emptySlotIndex     = distance.GetOccupiedSlotsNumber();
                GameObject treasureslot       = distance.slots[emptySlotIndex];
                OneCardManager.CreateOneCardManager(chosenCard, treasureslot);
            }
        }
コード例 #2
0
        private IEnumerator MoveTreasureToHandCoroutine()
        {
            List <OneCardManager> trList = new List <OneCardManager>();


            List <OneCardManager> curEnc = Visual.instance.GetCurrentEncounter();

            foreach (OneCardManager cardManager in curEnc)
            {
                if ((cardManager.cardAsset.type == CardType.treasure) && (cardManager.cardAsset.resolved == ResolvedType.resolved_win))
                {
                    trList.Add(cardManager);
                }
            }

            if (trList.Count == 0)
            {
                yield return(new WaitForSeconds(.05f));
            }
            else
            {
                SameDistanceChildren distance = Visual.instance.TreasureHand.GetComponent <SameDistanceChildren>();
                int emptySlotIndex            = distance.GetOccupiedSlotsNumber();

                foreach (OneCardManager cardManager in trList)
                {
                    cardManager.transform.SetParent(null);
                    Sequence   sequence = DOTween.Sequence();
                    GameObject slot     = distance.slots[emptySlotIndex];
                    emptySlotIndex++;
                    sequence.Append(cardManager.transform.DOMove(slot.transform.position, TimeMovement1));
                    sequence.OnComplete(() =>
                    {
                        MoveCardToCurrentEncounterGroup(cardManager, slot.transform);

                        if (cardManager.cardAsset.useType == UseType.continuous)
                        {
                            GameLogicEvents.eventNewEffect.Invoke(cardManager.cardAsset.effecttype);
                        }

                        //GameLogicEvents.eventNewEffect.Invoke(cardManager.cardAsset.effecttype);
                    });
                }
                yield return(new WaitForSeconds(TimeMovement1));
            }



            Command.CommandExecutionComplete();
        }