Пример #1
0
    public Card getCardType(Dragable Obj)
    {
        List <string> types = new List <string> {
            "AdventureCard", "AllyCard", "FoeCard", "EquipmentCard", "QuestCard", "TournamentCard"
        };

        foreach (string s in types)
        {
            //this checks if the obj has a component attached. if it doesn't it will be null
            //example: an event card wont have an ally script
            if (Obj.GetComponent(s) != null)
            {
                return((Card)Obj.GetComponent(s));
            }
        }
        return(null);
    }
Пример #2
0
 public void AcceptDrag(Dragable target, bool notify = true)
 {
     target.transform.SetParent(transform);
     target.GetComponent <RectTransform>().localPosition = Vector3.zero;
     if (notify)
     {
         OnDropEvent.Invoke(target.gameObject, index);
     }
 }
Пример #3
0
    public override void DragEffectEndIn()
    {
        CookingStep addStep = drag.GetComponent <CookingStep>(); // 被拖的步骤

        /* foreach(var step in addStep.Control) // 依赖addStep且在时间条上的自动弹回菜单栏
         * {
         *  if(!step.DependNotSatisfied.Exists(t => t.name == addStep.name))
         *  {
         *      step.DependNotSatisfied.Add(addStep);
         *      step.transform.SetParent(transform);
         *      step.GetComponent<Dragable>().SetDragSize(unitSize);
         *      step.canDrag = false;
         *      step.Belong = null;
         *      step.GetComponent<Dragable>().ImageChange();
         *  }
         * } */
        drag.transform.SetParent(transform);
        drag.GetComponent <CookingStep>().Belong = null;
        drag.SetDragSize(unitSize);
        drag = null;
    }
Пример #4
0
    //Cuando suelto la carta y si esta sobre un slot valido la emparento a el
    public void OnDrop(PointerEventData eventData)
    {
        if (eventData.pointerDrag.GetComponent <Dragable>() != null)
        {
            d = eventData.pointerDrag.GetComponent <Dragable>();

            int i = transform.childCount;
            if (typeOfHand == d.typeOfHand && i == 0)
            {
                d.previousParent = this.transform;
                d.GetComponent <CardUImanagement>().cardUse = true;
            }
        }

        //cuando sueltas la carta automaticamente el componente que determina la carta desaparece
        d = null;
    }
Пример #5
0
    public void Switch(DropHandler other, bool notify = true)
    {
        Dragable ownDragable = GetComponentInChildren <Dragable>();

        ownDragable.transform.SetParent(other.transform);
        ownDragable.GetComponent <RectTransform>().localPosition = Vector3.zero;
        Dragable otherDragable = other.GetComponentInChildren <Dragable>();

        otherDragable.transform.SetParent(transform);
        otherDragable.GetComponent <RectTransform>().localPosition = Vector3.zero;
        if (notify)
        {
            OnDropEvent.Invoke(other.transform.gameObject, index);
            other.OnDropEvent.Invoke(ownDragable.gameObject, other.index);
            OnSwapEvent.Invoke(other.index, index);
        }
    }
Пример #6
0
    public void Recieve()
    {
        Transform[] childList = GetComponentsInChildren <Transform>(true);
        if (childList.Length > 1)
        {
            for (int i = 0; i < childList.Length; i++)
            {
                if (childList[i] != transform)
                {
                    Destroy(childList[i].gameObject);
                }
            }
            draw.Withdraw(int.Parse(Block_name));
        }

        Dropable Card  = GameObject.Find("Deck").GetComponent <Dropable>();
        Dropable Block = GameObject.Find("Deck").GetComponent <Dropable>();

        card_received = Card.card_to_block;//넘겨 줄때 카드 자체를 넘겨줌!!
        //Block_name = card_received.GetComponentInChildren<Transform>().Find("Image").GetComponent<Image>().sprite.name;



        //int인 체력 저항력 받아오는 부분
        CardStatus Card_int_info = card_received.GetComponent <CardStatus>();

        hp     = Card_int_info.GetHP();
        resist = Card_int_info.GetResistance();
        speed  = Card_int_info.GetSpeed();
        iType  = int.Parse(Card_int_info.GetName());
        //string인 카드 이름 받아오는 부분
        Block_name = Card_int_info.GetName();
        Debug.Log(hp);
        Debug.Log(resist);
        Debug.Log(Block_name);


        //Debug.Log(card_received.GetComponentInChildren<Transform>().Find("CardStrength").GetComponent<Text>().text);//카드를 보냈으니 체력을 받는지 확인!!
        //Block_name = Block.picture.name;
        //Debug.Log(Block_name);
        // MyBlockImg = GetComponent<SpriteRenderer>();
        // bMar = GameObject.Find("Blockmanager").GetComponent<Blockmanager>();

        Blockmanager temp = GameObject.Find("BlockManager").GetComponent <Blockmanager>();

        temp.CreateAdBlock(Block_name);

        /*
         * if (Block_name == "A")
         * {
         *  print("A");
         *  //Blockmanager.CreateAdBlock(Block_name);
         * }
         * if (Block_name == "B")
         * {
         *  //Blockmanager.CreateAdBlock(a);
         * }
         * if (Block_name == "C")
         * {
         *  print("e");
         * }
         * if (Block_name == "D")
         * {
         *  print("e");
         * }
         * if (Block_name == "E")
         * {
         *  print("e");
         * }*/
    }
Пример #7
0
 public override void DragEffectBegin(Dragable d) {
     dragRect = d.GetComponent<RectTransform>();
     dragStep = d.GetComponent<CookingStep>();
     ShadowRect.sizeDelta = new Vector2(minScale * dragStep.Time - minScale * 7 / 60, SelfRect.sizeDelta.y);
 }
    void PickupArtefact()
    {
        draggedObject = hitInfo.collider.gameObject.GetComponent<Dragable>();
        if(draggedObject.IsDragging) return;

        isDraggingArtefact = true;
        draggedObject.hitPoint = hitInfo.point;

        draggedObject.playerTransform = this.transform;
        draggedObject.StartDragging();
        CmdChangeAuthority(draggedObject.GetComponent<NetworkIdentity>().netId, GetComponent<NetworkIdentity>().netId, true);

        rotateArtefactIcon.PopUp();
        dropArtefactIcon.PopUp();
    }