Beispiel #1
0
 public void UI_ItemDrag(UI_ItemSlot fromSlot)
 {
     if (fromSlot.Item != null && !isDragging)
     {
         DropInteracted    = false;
         FromSlotCache     = fromSlot;
         isDragging        = true;
         dragDummy.enabled = true;
         dragDummy.sprite  = fromSlot.Image.sprite;
         fromSlot.Clear();
         DraggedItem = fromSlot.ItemObject;
     }
 }
    public void Drop()
    {
        PlayerScript lps = PlayerManager.LocalPlayerScript;

        if (!lps || lps.canNotInteract())
        {
            return;
        }
        UI_ItemSlot currentSlot = UIManager.Hands.CurrentSlot;

//			Vector3 dropPos = lps.gameObject.transform.position;
        if (!currentSlot.CanPlaceItem())
        {
            return;
        }
        //            if ( isNotMovingClient(lps) )
        //            {
        //               // Full client simulation(standing still)
        //                var placedOk = currentSlot.PlaceItem(dropPos);
        //                if ( !placedOk )
        //                {
        //                    Logger.Log("Client dropping error");
        //                }
        //            }
        //            else
        //            {
        //Only clear slot(while moving, as prediction is shit in this situation)
//			GameObject dropObj = currentSlot.Item;
//			CustomNetTransform cnt = dropObj.GetComponent<CustomNetTransform>();
//			It is converted to LocalPos in transformstate struct
//			cnt.AppearAtPosition(PlayerManager.LocalPlayer.transform.position);
        currentSlot.Clear();
        //            }
        //Message
        lps.playerNetworkActions.RequestDropItem(currentSlot.eventName, false);
        SoundManager.Play("Click01");
        Logger.Log("Drop Button", Category.UI);
    }