/// <summary>
 /// 捡起物品槽中指定数量的物品
 /// </summary>
 /// <param name="itemUI"></param>
 /// <param name="amount"></param>
 public void PickedItemUI(Item item, int amount)
 {
     PickedItem.SetItem(item, amount); //将当前物品信息复制给PickedItem(跟随鼠标移动)
     isPickedItem = true;              //当前鼠标上有物品了
     PickedItem.ShowItemUI();          //显示PickedItem
     toolTip.Hide();                   //隐藏物品信息框的提示
 }
示例#2
0
    public void PickUpItem(Item item, int amount = 1)
    {
        PickedItem.SetItem(item, amount);
        isPickedItem = true;

        PickedItem.Show();
        this.toolTip.Hide();
    }
    /**
     * 获取物品槽里的指定数量的物品
     */
    public void PickUpItem(ItemDetail item, int amount)
    {
        PickedItem.SetItem(item, amount);
        this.isPickedItem = true;
        PickedItem.Show();
        this.toolTip.Hide();

        Vector2 postionPickeItem;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, Input.mousePosition, null, out postionPickeItem);
        pickedItem.SetLocalPosition(postionPickeItem);
    }
    //获取(拾取)物品槽里的指定数量的(amount)物品UI
    public void PickUpItem(_Item item, int amount)
    {
        PickedItem.SetItem(item, amount);
        this.isPickedItem = true;
        PickedItem.Show();   //获取到物品之后把跟随鼠标的容器(用来盛放捡起的物品的容器)显示出来
        this.toolTip.Hide(); //同时隐藏物品信息提示框

        //控制盛放物品的容器UI跟随鼠标移动
        Vector2 postionPickeItem;

        RectTransformUtility.ScreenPointToLocalPointInRectangle(canvas.transform as RectTransform, Input.mousePosition, null, out postionPickeItem);
        pickedItem.SetLocalPosition(postionPickeItem);//设置容器的位置,二维坐标会自动转化为三维坐标但Z坐标为0
    }
示例#5
0
 /// <summary>
 /// 设置抓取格子中的物品 (出售,交换位置,放置快捷栏)
 /// </summary>
 public void SetPickedItem(Item item, int count)
 {
     isPicked = true;
     pickedItem.SetItem(item, count);
 }