コード例 #1
0
    public void OnDrop(PointerEventData eventData)
    {
        Draggable d = eventData.pointerDrag.GetComponent <Draggable>();

        // Debug.Log(d.gameObject.GetComponent<CardView>().cName.text);

        if (d != null &&
            !hasCard &&
            d.GetComponent <Draggable>().canBePLayedFromHand() &&
            d.GetComponent <CardView>().cCard.type != "spell"
            )
        {
            if (zone == "enemy")
            {
                return;
            }
            d.parentToReturn = this.transform;
            d.GetComponent <CardView>().isOnHAnd = false;
            hasCard = true;

            /*battleController.GetComponent<BattleController>().addCardToField(
             *  new int[] { zoneCol, zoneRow },
             *  d.gameObject,
             *  d.GetComponent<CardView>().player);
             */
            NetworkIdentity networkIdentity = NetworkClient.connection.identity;
            playerController = networkIdentity.GetComponent <My_PlayerController>();
            playerController.playCard(d.gameObject, new int[] { zoneCol, zoneRow });
        }
        if (d != null &&
            d.GetComponent <Draggable>().canBePLayedFromHand() &&
            !hasCard &&
            d.GetComponent <CardView>().cCard.type == "spell")
        {
            // ex: summon thing on empty space
        }
    }