コード例 #1
0
    public void SpawnCard(Card c, CardInventory parent)
    {
        CardGrid cardGrid = Instantiate(cardGridPrefab);

        if (parent)
        {
            parent.draggedCard = cardGrid;
        }
        cardGrid.Init(this, c, parent, parent == null ? CardGrid.CardSource.OTHER : CardGrid.CardSource.PLAYER);
        if (activeCard != null)
        {
            activeCard.CancelMoveFromInventory();
        }
        activeCard = cardGrid;
        confirmButton.interactable = true;
    }
コード例 #2
0
 public void OnCardRelease(CardGrid card)
 {
     if (!CanPlaceCard(card.x, card.y))
     {
         if (card.firstDrag)
         {
             card.CancelMoveFromInventory();
             return;
         }
         card.CancelMoveSnapBack();
     }
     UpdateCardBonus(card);
     card.transform.localPosition = new Vector3(card.x, card.y, 0);
     rotateButton.gameObject.SetActive(true);
     rotateButton.transform.position =
         Camera.main.WorldToScreenPoint(card.transform.position) +
         new Vector3(80, 80, 0);
 }