コード例 #1
0
    private void Update()
    {
        if (handModel.getDraggingModel() != null)
        {
            Debug.Log(handModel.getDraggingModel().State);
        }
        int currentNumOfCards = handModel.Cards.Count;

        // find card that is currently being dragged
        // dragging is set in BuffModelController
        handModel.setDraggingCard();
        // removed dragging card from hand
        int draggingCardIndex = handModel.getIndexOfDraggingCard();

        if (draggingCardIndex != -1)
        {
            handModel.Cards.RemoveAt(draggingCardIndex);
        }
        if (handModel.DraggingCard)
        {
            BuffCardModel buff = handModel.getDraggingModel();
            // return card back to hand if not dragging or applied
            if (buff.State == BuffCardState.movingToHand)
            {
                // insert dragging card back into hand list
                handModel.Cards.Insert(handModel.getGameObjectIndex(handModel.DraggingCard.gameObject), buff.transform.parent.gameObject);
                updateHandFanning();
                handModel.DraggingCard = null;
            }
            // clear reference if card is applied
            else if (buff.State != BuffCardState.dragging && !buff.isDraggingOverApplied())
            {
                updateHandFanning();
                appliedCardsMap.Add(buff.GetInstanceID(), buff);
                handModel.DraggingCard = null;
            }
        }
        // update fanning when cards in hand number changes
        checkIfAppliedCardsMovingBackToHand();
        if (previousNumOfCards != currentNumOfCards)
        {
            updateHandFanning();
            previousNumOfCards = currentNumOfCards;
        }
    }