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

        // Debug.Log(d.gameObject.GetComponent<CardView>().cName.text);
        //  Debug.Log("Drop on card" + cCard.boardPosition[0] + "/" + cCard.boardPosition[1] + " " + ctrl.currentAction);
        if (d != null &&
            ctrl.isOurTurn)
        {
            Debug.Log("switch");
            switch (ctrl.currentAction)
            {
            case "attacking":
                if (d.GetComponent <CardView>().isOnHAnd || isMyCard)
                {
                    return;
                }
                ctrl.CmdAttackToUnit(cCard.boardPosition[0], cCard.boardPosition[1]);
                break;

            case "spellcasting":
                if (isOnHAnd)
                {
                    return;
                }
                Debug.Log("carview spellcasting");
                Debug.Log(cCard.boardPosition[0] + " / " + cCard.boardPosition[1]);
                NetworkIdentity     netID  = NetworkClient.connection.identity;
                My_PlayerController player = netID.GetComponent <My_PlayerController>();


                if (checkCurrentTarget(player.targetType))
                {
                    player.castSpell(cCard.boardPosition[0], cCard.boardPosition[1], hasAuthority);
                    Debug.Log("checking tags");
                }
                break;

            default:
                break;
            }
        }
    }