Ejemplo n.º 1
0
 /// <summary>
 /// Put item into this cell.
 /// </summary>
 /// <param name="item">Item.</param>
 private void PlaceItem(DragAndDropItem item)
 {
     if (item != null)
     {
         DestroyItem();                                                              // Remove current item from this cell
         myDadItem = null;
         DragAndDropCell cell = item.GetComponentInParent <DragAndDropCell>();
         if (cell != null)
         {
             if (cell.unlimitedSource == true)
             {
                 string itemName = item.name;
                 item      = Instantiate(item);                                              // Clone item from source cell
                 item.name = itemName;
             }
         }
         item.transform.SetParent(transform, false);
         item.transform.localPosition = Vector3.zero;
         item.MakeRaycast(true);
         myDadItem = item;
         Image dadImage = myDadItem.GetComponent <Image>();
         if (dadImage.color.a == 0)
         {
             float r = dadImage.color.r;
             float g = dadImage.color.g;
             float b = dadImage.color.b;
             dadImage.color = new Color(r, g, b, 1);
         }
     }
     UpdateBackgroundState();
 }
    static public event DragEvent OnItemDragEndEvent;                               // Drag end event

    /// <summary>
    /// This item is dragged
    /// </summary>
    /// <param name="eventData"></param>
    public void OnBeginDrag(PointerEventData eventData)
    {
        sourceCell  = GetComponentInParent <DragAndDropCell>();                     // Remember source cell
        draggedItem = this;                                                         // Set as dragged item
        icon        = new GameObject("Icon");                                       // Create object for item's icon
        Image image = icon.AddComponent <Image>();

        image.sprite        = draggedItem.GetComponent <Image>().sprite;
        image.raycastTarget = false;                                                // Disable icon's raycast for correct drop handling
        RectTransform iconRect = icon.GetComponent <RectTransform>();

        // Set icon's dimensions
        //iconRect.sizeDelta = new Vector2(   GetComponent<RectTransform>().sizeDelta.x,
        //                                    GetComponent<RectTransform>().sizeDelta.y);
        iconRect.sizeDelta = new Vector2(96, 140);
        Canvas canvas = GetComponentInParent <Canvas>();                             // Get parent canvas

        if (canvas != null)
        {
            // Display on top of all GUI (in parent canvas)
            icon.transform.SetParent(canvas.transform, true);                       // Set canvas as parent
            icon.transform.SetAsLastSibling();                                      // Set as last child in canvas transform
        }
        if (OnItemDragStartEvent != null)
        {
            OnItemDragStartEvent(this);                                             // Notify all about item drag start
        }
    }
Ejemplo n.º 3
0
 public void setPlayerName(string name)
 {
     if (draggedItem != null)
     {
         int itemToSend = draggedItem.GetComponent <PhotonView>().ViewID;
         //GetComponent<PhotonView>().RPC("PlaceNameSync", RpcTarget.AllBuffered, itemToSend, PhotonNetwork.LocalPlayer.NickName);
         GetComponent <PhotonView>().RPC("PlaceNameSync", RpcTarget.AllBuffered, itemToSend, PhotonNetwork.LocalPlayer.NickName);
     }
 }
Ejemplo n.º 4
0
    public DragAndDropItem CreateBox(KeyValuePair <int, Color32> item, RectTransform rect)
    {
        DragAndDropItem it = Instantiate(box, rect, false);

        it.GetComponent <Image>().color = item.Value;

        RectTransform r = it.GetComponent <RectTransform>();

        r.sizeDelta = GetMenuSize();

        it.GetComponentInChildren <Text>().text = LayersConstants.LAYER_NAMES[item.Key];

        it.GetComponentInChildren <Text>().color = new Color32(255, 255, 255, 255);

        it.name = LayersConstants.LAYER_NAMES[item.Key];

        it.isIcon = true;

        return(it);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// Swap items between two cells
    /// </summary>
    /// <param name="firstCell"> Cell </param>
    /// <param name="secondCell"> Cell </param>
    public void SwapItems(DragAndDropCell firstCell, DragAndDropCell secondCell)
    {
        if ((firstCell != null) && (secondCell != null))
        {
            DragAndDropItem firstItem  = DragAndDropItem.draggedItem;       // Get item from first cell
            DragAndDropItem secondItem = secondCell.GetItem();              // Get item from second cell
                                                                            // Swap items
            if (secondItem != null)
            {
                if (secondItem.transform.parent != null)
                {
                    secondItem.transform.parent.DetachChildren();
                    DragAndDropItem tempItem = Instantiate(secondItem);
                    tempItem.GetComponent <PorteScript>().SetEntree1(false);
                    tempItem.GetComponent <PorteScript>().SetEntree2(false);
                    tempItem.GetComponent <PorteScript>().SetSortie(false);

                    Destroy(secondItem.gameObject);
                    secondItem = null;
                    secondItem = tempItem;
                }
                secondItem.transform.SetParent(firstCell.transform, false);
                secondItem.transform.localPosition = Vector3.zero;
                secondItem.MakeRaycast(true);
            }
            if (firstItem != null)
            {
                firstItem.transform.SetParent(secondCell.transform, false);
                firstItem.transform.localPosition = Vector3.zero;
                firstItem.MakeRaycast(true);
            }

            // Update states
            firstCell.UpdateMyItem();
            secondCell.UpdateMyItem();
            //Debug.Log(secondItem.GetComponent<PorteScript>().IsSortie());
            //firstCell.UpdateBackgroundState();
            //secondCell.UpdateBackgroundState();
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Put item into this cell.
    /// </summary>
    /// <param name="item">Item.</param>
    private void PlaceItem(DragAndDropItem item)
    {
        if (item != null)
        {
            /*DestroyItem();                                                // Remove current item from this cell
             *          myDadItem = null;
             *          DragAndDropCell cell = item.GetComponentInParent<DragAndDropCell>();
             *          if (cell != null)
             *          {
             *                  if (cell.unlimitedSource == true)
             *                  {
             *                          string itemName = item.name;
             *                          item = Instantiate(item);                               // Clone item from source cell
             *                          item.name = itemName;
             *                  }
             *          }*/
            if (item.transform.parent != null)
            {
                item.transform.parent.DetachChildren();
                DragAndDropItem tempItem = Instantiate(item);
                tempItem.GetComponent <PorteScript>().SetEntree1(false);
                tempItem.GetComponent <PorteScript>().SetEntree2(false);
                tempItem.GetComponent <PorteScript>().SetSortie(false);

                Destroy(item.gameObject);
                item = null;
                item = tempItem;
            }

            item.transform.SetParent(this.transform, false);
            item.transform.localPosition = Vector3.zero;
            item.MakeRaycast(true);

            /*item.transform.SetParent(transform, false);
             *          item.transform.localPosition = Vector3.zero;
             *          item.MakeRaycast(true);
             *          myDadItem = item;*/
        }
        UpdateBackgroundState();
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Put item into this cell.
    /// </summary>
    /// <param name="item">Item.</param>
    private void PlaceItem(DragAndDropItem item)
    {
        if (item != null)
        {
            DestroyItem();                                                              // Remove current item from this cell
            myDadItem = null;
            DragAndDropCell cell = item.GetComponentInParent <DragAndDropCell>();
            if (cell != null)
            {
                if (cell.unlimitedSource == true)
                {
                    string itemName = item.name;
                    item      = Instantiate(item);                                              // Clone item from source cell
                    item.name = itemName;
                }
            }
            item.transform.SetParent(transform, false);
            item.transform.localPosition = Vector3.zero;
            item.MakeRaycast(true);

            myDadItem = item;
            myDadItem.GetComponent <CanvasGroup>().alpha = 0.5f; //Hace que el item no sea visible cuando llega a la boca

            GameObject       canvas    = gameObject.transform.parent.gameObject;
            AtributosMascota atributos = canvas.transform.Find("MANAGER CANVAS").GetComponent <AtributosMascota>();

            Animator anim = LINCE.GetComponent <Animator>();
            anim.SetInteger("estaComiendo", 2);

            GestionComida gestorComida = canvas.transform.Find("Plato").GetComponent <GestionComida>();
            GameObject    comida       = canvas.transform.Find("Plato").gameObject.transform.Find("Comida").gameObject;
            TMP_Text      porcentaje   = canvas.transform.Find("Plato").gameObject.transform.Find("Porcentaje").gameObject.GetComponent <TMP_Text>();
            comida.GetComponent <DragAndDropItem>().enabled = false;;
            atributos.subirHambre(int.Parse(porcentaje.text));
            gestorComida.EliminarItem(item.gameObject);
            Image imagen = comida.GetComponent <Image>();
            imagen.color = new Color(imagen.color.r, imagen.color.g, imagen.color.b, 0.5f); //Item del plato

            StartCoroutine(ExecuteAfterTime(3));
        }

        UpdateBackgroundState();
    }
Ejemplo n.º 8
0
    /// <summary>
    /// This item is dropped
    /// </summary>
    /// <param name="eventData"></param>
    public void OnEndDrag(PointerEventData eventData)
    {
        if (icon != null)
        {
            Destroy(icon);                                                          // Destroy icon on item drop
        }
        MakeVisible(true);                                                          // Make item visible in cell
        if (OnItemDragEndEvent != null)
        {
            OnItemDragEndEvent(this);                                               // Notify all cells about item drag end
        }
        GameObject child      = draggedItem.transform.GetChild(0).gameObject;
        GameObject parentCell = draggedItem.transform.parent.gameObject;

        draggedItem.GetComponent <RectTransform> ().sizeDelta = parentCell.GetComponent <RectTransform> ().sizeDelta;
        child.GetComponent <RectTransform> ().sizeDelta       = parentCell.GetComponent <RectTransform> ().sizeDelta;
        draggedItem = null;
        icon        = null;
        sourceCell  = null;
    }
Ejemplo n.º 9
0
    private void Start()
    {
        KeyValuePair <int, Color32> kv = new KeyValuePair <int, Color32>(
            Constants.LayersConstants.INPUT,
            Constants.LayersConstants.LAYER_COLORS[Constants.LayersConstants.INPUT]
            );

        DragAndDropItem item = GenerateLayers.Instance.CreateBox(kv, ContentSpace.instance.MyRect);

        item.id     = ++DragAndDropItem.count;
        item.isIcon = false;
        item.tag    = DragAndDropItem.myTag;
        item.transform.GetChild(0).tag = DragAndDropItem.myTag;

        RectTransform rec = item.GetComponent <RectTransform>();

        rec.anchorMin = new Vector2(0.5f, .5f);
        rec.anchorMax = new Vector2(0.5f, .5f);
        rec.SetParent(ContentSpace.instance.transform);

        rec.anchoredPosition3D = new Vector3(0f, 200f, -10f);

        StateManager.Instance.LayerLookUp[item.id.ToString()] = item.gameObject;
    }
Ejemplo n.º 10
0
 public void OnDrop(DragAndDropCell cellFrom, DragAndDropCell cellTo, DragAndDropItem item)
 {
     if ((item != null) && (cellFrom != cellTo))
     {
         DropDescriptor descriptor2 = new DropDescriptor {
             item            = item,
             sourceCell      = cellFrom,
             destinationCell = cellTo
         };
         DropDescriptor descriptor = descriptor2;
         if (!this.CellIsTankSlot(cellTo))
         {
             descriptor.destinationCell.PlaceItem(descriptor.item);
             if (this.onDrop != null)
             {
                 descriptor2 = new DropDescriptor();
                 this.onDrop(descriptor, descriptor2);
             }
         }
         else if (this.CellIsTankSlot(cellFrom))
         {
             descriptor2 = new DropDescriptor {
                 destinationCell = descriptor.sourceCell,
                 item            = descriptor.destinationCell.GetItem(),
                 sourceCell      = descriptor.destinationCell
             };
             DropDescriptor descriptor3 = descriptor2;
             descriptor.destinationCell.PlaceItem(descriptor.item);
             if (descriptor3.item != null)
             {
                 descriptor.sourceCell.PlaceItem(descriptor3.item);
             }
             if (this.onDrop != null)
             {
                 this.onDrop(descriptor, descriptor3);
             }
         }
         else
         {
             DragAndDropItem item2     = descriptor.destinationCell.GetItem();
             DragAndDropCell component = null;
             if (item2 != null)
             {
                 ModuleItem moduleItem = item2.GetComponent <SlotItemView>().ModuleItem;
                 component = CollectionView.slots[moduleItem].GetComponent <DragAndDropCell>();
             }
             descriptor2 = new DropDescriptor {
                 destinationCell = component,
                 item            = item2,
                 sourceCell      = descriptor.destinationCell
             };
             DropDescriptor descriptor4 = descriptor2;
             descriptor.destinationCell.PlaceItem(descriptor.item);
             if (descriptor4.item != null)
             {
                 descriptor4.destinationCell.PlaceItem(descriptor4.item);
             }
             if (this.onDrop != null)
             {
                 this.onDrop(descriptor, descriptor4);
             }
         }
     }
 }
Ejemplo n.º 11
0
    /// <summary>
    /// Swap items between two cells
    /// </summary>
    /// <param name="firstCell"> Cell </param>
    /// <param name="secondCell"> Cell </param>
    public SwapType SwapItems(DragAndDropCell firstCell, DragAndDropCell secondCell)
    {
        var swapType = SwapType.None;

        if ((firstCell != null) && (secondCell != null))
        {
            DragAndDropItem firstDragAndDropItem  = firstCell.GetItem();               // Get item from first cell
            DragAndDropItem secondDragAndDropItem = secondCell.GetItem();              // Get item from second cell

            //try stack
            var isStacked = false;
            if (firstDragAndDropItem != null && secondDragAndDropItem != null)
            {
                var firstItemBehaviour  = firstDragAndDropItem.GetComponent <SlotItemBehaviour>();
                var secondItemBehaviour = secondDragAndDropItem.GetComponent <SlotItemBehaviour>();
                if (firstItemBehaviour != null && secondItemBehaviour != null)
                {
                    if (firstItemBehaviour.Item.Id.Equals(secondItemBehaviour.Item.Id))
                    {
                        if (secondItemBehaviour.Item.Quantity < secondItemBehaviour.Item.MaxStack)
                        {
                            //requirements match for stack we can stack here
                            var stackableAmount = secondItemBehaviour.Item.MaxStack - secondItemBehaviour.Item.Quantity;

                            if (firstItemBehaviour.Item.Quantity <= stackableAmount)
                            {
                                // all of them will be stacked to second cell
                                var inventoryBehaviour = secondItemBehaviour.GetComponentInParent <InventoryBehavior>();
                                var itemToStack        = inventoryBehaviour.ItemDatabase.getItemByID(firstItemBehaviour.Item.Id);
                                itemToStack.Quantity = firstItemBehaviour.Item.Quantity;
                                secondItemBehaviour.Stack(itemToStack);



                                //remove first Item slot
                                var firstItemSlotBehaviour = firstItemBehaviour.GetComponentInParent <SlotBehaviour>();
                                firstItemSlotBehaviour.RemoveItem();

                                swapType = SwapType.FullyStacked;
                            }
                            else
                            {
                                var initialFirstAmount  = firstItemBehaviour.Item.Quantity;
                                var initialSecondAmount = secondItemBehaviour.Item.Quantity;

                                secondItemBehaviour.Item.Quantity = firstItemBehaviour.Item.MaxStack;
                                firstItemBehaviour.Item.Quantity  = initialSecondAmount - (secondItemBehaviour.Item.MaxStack - initialFirstAmount);

                                firstItemBehaviour.SetItemAmount(firstItemBehaviour.Item.Quantity);
                                secondItemBehaviour.SetItemAmount(secondItemBehaviour.Item.Quantity);

                                if (firstItemBehaviour.Item.Quantity == 0)
                                {
                                    var firstItemSlotBehaviour = firstItemBehaviour.GetComponentInParent <SlotBehaviour>();
                                    firstItemSlotBehaviour.RemoveItem();
                                }

                                swapType = SwapType.PartiallyStacked;
                            }


                            isStacked = true;
                            //stacking process is done here
                        }
                    }
                }
            }

            if (!isStacked)
            {
                // Swap items
                if (firstDragAndDropItem != null)
                {
                    firstDragAndDropItem.transform.SetParent(secondCell.transform, false);
                    firstDragAndDropItem.transform.localPosition = Vector3.zero;
                    firstDragAndDropItem.MakeRaycast(true);
                }
                if (secondDragAndDropItem != null)
                {
                    secondDragAndDropItem.transform.SetParent(firstCell.transform, false);
                    secondDragAndDropItem.transform.localPosition = Vector3.zero;
                    secondDragAndDropItem.MakeRaycast(true);
                }

                swapType = SwapType.Swapped;
            }

            firstCell.UpdateMyItem();
            firstCell.UpdateBackgroundState();

            secondCell.UpdateMyItem();
            secondCell.UpdateBackgroundState();
        }
        return(swapType);
    }
Ejemplo n.º 12
0
        private void OnAnyItemDragStart(DragAndDropItem item, PointerEventData eventData)
        {
            SlotItemView component = item.GetComponent <SlotItemView>();

            this.Select(component);
        }
Ejemplo n.º 13
0
    /// <summary>
    /// Item is dropped in this cell
    /// </summary>
    /// <param name="data"></param>
    public void OnDrop(PointerEventData data)
    {
        DragAndDropCell sourceCell = DragAndDropItem.sourceCell;

        if (DragAndDropItem.icon != null)
        {
            if (DragAndDropItem.icon.activeSelf == true)                    // If icon inactive do not need to drop item in cell
            {
                DragAndDropItem item = DragAndDropItem.draggedItem;
                try
                {
                    UInt16 selectedItem = Convert.ToUInt16(item.GetComponent <Image>().sprite.name.ToString());
                    UInt16 sourceItem   = Convert.ToUInt16(gameObject.GetComponent <Image>().sprite.name.ToString());
                    Debug.Log("childCount: " + gameObject.transform.childCount.ToString());
                    if (selectedItem != sourceItem || gameObject.transform.childCount >= 1)
                    {
                        sourceCell.GetComponent <AudioSource>().clip    = item.GetComponent <number>().FalseSound;
                        sourceCell.GetComponent <AudioSource>().enabled = true;
                        sourceCell.GetComponent <AudioSource>().Play();
                        score -= 10;
                        GameObject.Find("cark").GetComponent <gamePlayManager>().printToText(score);
                        //( StartCoroutine();
                        return;
                    }
                } catch (System.Exception e)
                {
                    Debug.Log("Hata : " + e.Message);
                }
                DropDescriptor desc = new DropDescriptor();
                if ((item != null) && (sourceCell != this))
                {
                    switch (sourceCell.cellType)                            // Check source cell's type
                    {
                    /*
                     * case CellType.UnlimitedSource:
                     *  string itemName = item.name;
                     *  item = Instantiate(item);                       // Clone item from source cell
                     *  item.name = itemName;
                     *  break;
                     */
                    default:
                        // Nothing to do
                        break;
                    }
                    switch (cellType)                                       // Check this cell's type
                    {
                    case CellType.Swap:
                        DragAndDropItem currentItem = GetComponentInChildren <DragAndDropItem>();
                        switch (sourceCell.cellType)
                        {
                        case CellType.Swap:
                            SwapItems(sourceCell, this);                    // Swap items between cells
                            // Fill event descriptor
                            desc.item            = item;
                            desc.sourceCell      = sourceCell;
                            desc.destinationCell = this;
                            // Send message with DragAndDrop info to parents GameObjects
                            StartCoroutine(NotifyOnDragEnd(desc));
                            if (currentItem != null)
                            {
                                // Fill event descriptor
                                desc.item            = currentItem;
                                desc.sourceCell      = this;
                                desc.destinationCell = sourceCell;
                                // Send message with DragAndDrop info to parents GameObjects
                                StartCoroutine(NotifyOnDragEnd(desc));
                            }
                            break;

                        default:
                            PlaceItem(item.gameObject);                     // Place dropped item in this cell
                            // Fill event descriptor
                            desc.item            = item;
                            desc.sourceCell      = sourceCell;
                            desc.destinationCell = this;
                            // Send message with DragAndDrop info to parents GameObjects
                            StartCoroutine(NotifyOnDragEnd(desc));
                            break;
                        }
                        break;

                    case CellType.DropOnly:

                        PlaceItem(item.gameObject);                         // Place dropped item in this cell
                        // Fill event descriptor
                        desc.item       = item;
                        desc.sourceCell = sourceCell;
                        sourceCell.GetComponent <AudioSource>().clip    = item.GetComponent <number>().TrueSound;
                        sourceCell.GetComponent <AudioSource>().enabled = true;
                        sourceCell.GetComponent <AudioSource>().Play();

                        Debug.Log("sourceCell: " + sourceCell.GetComponent <Image>().sprite.name.ToString());

                        //refreshKuyruk(sourceCell, item.gameObject);

                        StartCoroutine(GameObject.Find("cark").GetComponent <gamePlayManager>().reloadKuyruk());
                        //StartCoroutine(GameObject.Find("GameManager").GetComponent<gamePlayManager>().endOfWheel());
                        desc.destinationCell = this;
                        dropCount++;
                        score += 10;
                        GameObject.Find("cark").GetComponent <gamePlayManager>().printToText(score);
                        // StartCoroutine(GameObject.Find("cark").GetComponent<gamePlayManager>().printToText(score));
                        if (dropCount == 8)
                        {
                            StartCoroutine(GameObject.Find("cark").GetComponent <gamePlayManager>().successMethod());
                            dropCount = 0;
                        }
                        Debug.Log("Drop Count: " + dropCount.ToString());
                        // Send message with DragAndDrop info to parents GameObjects
                        /// StartCoroutine(NotifyOnDragEnd(desc));
                        break;

                    default:
                        // Nothing to do
                        break;
                    }
                }
                if (item.GetComponentInParent <DragAndDropCell>() == null)  // If item have no cell after drop
                {
                    Destroy(item.gameObject);                               // Destroy it
                }
            }
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Put item into this cell.
    /// </summary>
    /// <param name="item">Item.</param>
    private void PlaceItem(DragAndDropItem item)
    {
        int itemToSend = item.GetComponent <PhotonView>().ViewID;

        GetComponent <PhotonView>().RPC("PlaceItemSync", RpcTarget.AllBuffered, itemToSend);
    }
Ejemplo n.º 15
0
    /// <summary>
    /// Item is dropped in this cell
    /// </summary>
    /// <param name="data"></param>
    public void OnDrop(PointerEventData data)
    {
        if (DragAndDropItem.icon != null)
        {
            if (DragAndDropItem.icon.activeSelf == true)                    // If icon inactive do not need to drop item in cell
            {
                DragAndDropItem item       = DragAndDropItem.draggedItem;
                DragAndDropCell sourceCell = DragAndDropItem.sourceCell;
                DropDescriptor  desc       = new DropDescriptor();
                if ((item != null) && (sourceCell != this))
                {
                    switch (sourceCell.cellType)                            // Check source cell's type
                    {
                    case CellType.UnlimitedSource:
                        string itemName = item.name;
                        item      = Instantiate(item);                      // Clone item from source cell
                        item.name = itemName;
                        break;

                    default:
                        // Nothing to do
                        break;
                    }
                    switch (cellType)                                       // Check this cell's type
                    {
                    case CellType.Swap:
                        DragAndDropItem currentItem = GetComponentInChildren <DragAndDropItem>();
                        switch (sourceCell.cellType)
                        {
                        case CellType.Swap:
                            SwapItems(sourceCell, this);                    // Swap items between cells
                            // Fill event descriptor
                            desc.item            = item;
                            desc.sourceCell      = sourceCell;
                            desc.destinationCell = this;
                            // Send message with DragAndDrop info to parents GameObjects
                            StartCoroutine(NotifyOnDragEnd(desc));
                            if (currentItem != null)
                            {
                                // Fill event descriptor
                                desc.item            = currentItem;
                                desc.sourceCell      = this;
                                desc.destinationCell = sourceCell;
                                // Send message with DragAndDrop info to parents GameObjects
                                StartCoroutine(NotifyOnDragEnd(desc));
                            }
                            break;

                        default:
                            PlaceItem(item.gameObject);                     // Place dropped item in this cell
                            // Fill event descriptor
                            desc.item            = item;
                            desc.sourceCell      = sourceCell;
                            desc.destinationCell = this;
                            // Send message with DragAndDrop info to parents GameObjects
                            StartCoroutine(NotifyOnDragEnd(desc));
                            break;
                        }
                        break;

                    case CellType.DropOnly:
                        PlaceItem(item.gameObject);                         // Place dropped item in this cell
                        // Fill event descriptor
                        desc.item            = item;
                        desc.sourceCell      = sourceCell;
                        desc.destinationCell = this;
                        // Send message with DragAndDrop info to parents GameObjects
                        StartCoroutine(NotifyOnDragEnd(desc));
                        break;

                    case CellType.UnlimitedTrash:
                        PlaceItem(item.gameObject);                                              // Place dropped item in this cell
                        Image image = item.GetComponent <Image> ();
                        image.color = Color.clear;
                        // Fill event descriptor
                        desc.item            = item;
                        desc.sourceCell      = sourceCell;
                        desc.destinationCell = this;
                        // Send message with DragAndDrop info to parents GameObjects
                        StartCoroutine(NotifyOnDragEnd(desc));
                        break;

                    default:
                        // Nothing to do
                        break;
                    }
                }
                if (item.GetComponentInParent <DragAndDropCell>() == null)  // If item have no cell after drop
                {
                    Destroy(item.gameObject);                               // Destroy it
                }
            }
            if (gameObject.GetComponentInChildren <Text> ())
            {
                gameObject.GetComponentInChildren <Text> ().gameObject.transform.SetAsLastSibling();
            }
        }
    }