Example #1
0
    public void Insert(DragDropObject dropObject, int index)
    {
        //If Holder capacity is overwhelm
        int childCount = transform.childCount;

        if (maximumItems >= 0 && childCount >= maximumItems)
        {
            dropObject.Reset();
            return;
        }

        dropObject.transform.SetParent(transform);

        if (index >= 0)
        {
            dropObject.transform.SetSiblingIndex(index);
        }
    }
    private void OnDropObject(DragDropObject ddObject)
    {
        //If current inside a drop holder
        if (currentDropHolder != null)
        {
            currentDropHolder.Insert(ddObject);

            TaskDataSlot task = GetTaskData(ddObject);
            if (task != null && currentDropHolder.mount)
            {
                taskDataSlots.Add(task);
                UpdateCalculationResult();
            }
        }
        else
        {
            ddObject.Reset();
        }

        NotifyUIRelease();
        currentDragObject = null;
    }