Ejemplo n.º 1
0
    public void OnPointerClick(PointerEventData data)
    {
        var dropObj = (GameObject)Instantiate(Resources.Load("Prefabs/ObjItem"));
        var itemObj = dropObj.GetComponent <ObjItemController>();

        var originalObj = data.pointerDrag;
        var srcImage    = originalObj.GetComponent <Image>();

        Sprite sp = srcImage.sprite;

        itemObj.image.texture = sp.texture;

        dropObj.name = "ObjItem(" + sp.texture.name + ")";
        dropObj.transform.SetParent(GameObject.Find("Area").transform);

        itemObj.image.rectTransform.sizeDelta = drop.ManualSizes(sp.texture.name);
        itemObj.image.transform.localScale    = new Vector3(1, 1, 1);

        dropObj.transform.localScale    = new Vector3(1, 1, 1);
        dropObj.transform.localPosition = new Vector2(0, 0);

        cmd.AddCmd(dropObj, Operation.Create);
    }