Example #1
0
 private void GridUI_OnLeftBeginDrag(Transform gridTransform)
 {
     if (gridTransform.childCount == 0)
     {
         return;
     }
     else
     {
         Item item = ItemModel.GetItem(gridTransform.name);
         DragItemUI.UpdateImage(item.Icon);
         Destroy(gridTransform.GetChild(0).gameObject);
         isDrag = true;
     }
 }
Example #2
0
    //鼠标开始拖动事件
    public void GridUI_onLeftBeginDrag(Transform gridTransform)
    {
        //如果点的格子里没有物品
        if (gridTransform.childCount == 0)
        {
            return;
        }
        // 格子里有物品
        else
        {
            Item   item = ItemModel.GetItem(gridTransform.name);
            Sprite s    = Resources.Load("Pictures/" + item.Name, typeof(Sprite)) as Sprite;


            DragITemUI.UpdateImage(s);
            Destroy(gridTransform.GetChild(0).gameObject);

            isDrag = true;
        }
    }