Exemplo n.º 1
0
    //Trigger once you release the mouse after dragging an item around the UI
    public void StopDragging(DraggableUIComponent DraggingSlot)
    {
        //Stop dragging the icon around, place it back where it came from in the UI
        DraggingComponent = false;
        CurrentComponent.SetVisibility(true);
        CurrentComponent = null;
        DraggingObject.SetActive(false);

        //First we need to check if the item the user stopped dragging was dragged out from their inventory, from their equipment screen or from the action bar
        switch (DraggingSlot.UIType)
        {
        //Items dragged out of the inventory
        case (UIComponentType.InventorySlot):
            StopDraggingFromInventory(DraggingSlot);
            break;

        //Gear dragged out of the equipment screen
        case (UIComponentType.EquipmentSlot):
            StopDraggingFromEquipment(DraggingSlot);
            break;

        //Gem dragged off the ability bar
        case (UIComponentType.ActionBarSlot):
            StopDraggingFromAbilityBar(DraggingSlot);
            break;
        }
    }
Exemplo n.º 2
0
 //Triggered by interacting with UI components while playing the game
 public void StartDragging(DraggableUIComponent UIComponent)
 {
     //Log.Print("start dragging " + UIComponent.transform.name);
     DraggingComponent = true;
     CurrentComponent  = UIComponent;
     CurrentComponent.SetVisibility(false);
     DraggingObject.SetActive(true);
     DraggingName.text   = UIComponent.ItemData.DisplayName;
     DraggingIcon.sprite = UIComponent.ItemData.Icon;
 }