コード例 #1
0
    //When the mouse is being held down
    public void ClickSlot(GameObject slot)
    {
        clickedOn = slot;
        //Debug.Log("Home base clicked: " + data.pointerCurrentRaycast.gameObject.name);
        MenuSlot slotClicked = clickedOn.GetComponent <MenuSlot>();

        if (grabbedSlot == null)
        {
            //Grab the selected item if nothing is currently being selected
            if (slotClicked != null)
            {
                //If there's something in the slot to grab
                if (slotClicked.getItem() != null)
                {
                    if (slotClicked.getItem().count > 0)
                    {
                        //If it's a slot with an item then grab it
                        slotClicked.grabItem();
                        grabbedSlot = slotClicked;
                        grabbedSlot.getItem().grab();
                    }
                }
            }
        }
        else
        {
            if (slotClicked.gameObject.name == "sellFlowerSlot" && grabbedSlot.getItem().isFlower != (currentTab == TabType.Flowers))
            {
            }
            else
            {
                grabbedSlot.getItem().release();
                grabbedSlot.releaseItem(slotClicked);
                grabbedSlot = null;
            }
        }
    }