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 ) // { // Debug.Log("Client dropping error"); // } // } // else // { //Only clear slot(while moving, as prediction is shit in this situation) currentSlot.Clear(); // } //Message lps.playerNetworkActions.DropItem(currentSlot.eventName); SoundManager.Play("Click01"); Debug.Log("Drop Button"); }
private void Swap(UI_ItemSlot slot1, UI_ItemSlot slot2) { if (slot1.TrySetItem(slot2.Item)) { slot2.Clear(); } }
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.MainSprite; 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 ) // { // Debug.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"); Debug.Log("Drop Button"); }