private void OnAnyItemDragStart(Dnditem item) { UpdateMyItem(); if (mydadItem != null) { mydadItem.MakeRaycast(false); if (mydadItem == item) { if (cellType == CellType.DropOnly) { Dnditem.icon.SetActive(false); } } } }
public void PlaceItem(Dnditem item, bool dir) { if (item != null) { DestroyItem(); mydadItem = null; DndCell cell = item.GetComponentInParent <DndCell>(); if (cell != null) { if (cell.unlimitedSource == true) { string itemName = item.name; item = Instantiate(item); item.name = itemName; } } item.transform.SetParent(transform, false); if (item.width % 2 == 1) { item.GetComponent <RectTransform>().sizeDelta = new Vector2(96 * item.width, 96); } else { RectTransform rt = item.GetComponent <RectTransform>(); if (dir) { rt.anchoredPosition = new Vector2(rt.anchoredPosition.x + 48, rt.anchoredPosition.y); rt.sizeDelta = new Vector2(96 * item.width, 96); } else { rt.anchoredPosition = new Vector2(rt.anchoredPosition.x - 48, rt.anchoredPosition.y); rt.sizeDelta = new Vector2(96 * item.width, 96); } } item.GetComponent <RectTransform>().GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(60, 60); item.MakeRaycast(true); mydadItem = item; } }