コード例 #1
0
ファイル: UI_ItemSwap.cs プロジェクト: ewy0/unitystation
	public void OnClick()
	{
		//If shift is pressed, don't check anything, just send Examine on contained item if any.
		if (KeyboardInputManager.IsShiftPressed() && itemSlot.Item != null)
		{
			RequestExamineMessage.Send(itemSlot.Item.GetComponent<NetworkIdentity>().netId);
			return;
		}

		SoundManager.Play(SingletonSOSounds.Instance.Click01);
		//if there is an item in this slot, try interacting.
		if (itemSlot.Item != null)
		{
			itemSlot.TryItemInteract();
		}
		//otherwise, try switching hands to this hand if this is our own  hand slot and not already active
		else if (itemSlot == UIManager.Hands.LeftHand && UIManager.Hands.CurrentSlot != itemSlot)
		{
			UIManager.Hands.SetHand(false);
		}
		else if (itemSlot == UIManager.Hands.RightHand && UIManager.Hands.CurrentSlot != itemSlot)
		{
			UIManager.Hands.SetHand(true);
		}
		else
		{
			//otherwise, try just interacting with the blank slot (which will transfer the item
			itemSlot.TryItemInteract();
		}
	}
コード例 #2
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         SoundManager.Play("Click01");
         itemSlot.TryItemInteract();
     }
 }
コード例 #3
0
ファイル: Hands.cs プロジェクト: unitystation/unitystation
        /// <summary>
        /// General function to activate the item's UIInteract
        /// This is the same as clicking the item with the same item's hand
        /// </summary>
        public void Activate()
        {
            if (!IsValidPlayer())
            {
                return;
            }

            // Is there an item in the active hand?
            if (CurrentSlot.Item == null)
            {
                return;
            }
            CurrentSlot.TryItemInteract();
        }
コード例 #4
0
 public void OnClick()
 {
     SoundManager.Play("Click01");
     //if there is an item in this slot, try interacting.
     if (itemSlot.Item != null)
     {
         itemSlot.TryItemInteract();
     }
     //otherwise, try switching hands to this hand if this is a hand slot and not already active
     else if (itemSlot.ItemSlot.NamedSlot == NamedSlot.leftHand && UIManager.Hands.CurrentSlot != itemSlot)
     {
         UIManager.Hands.SetHand(false);
     }
     else if (itemSlot.ItemSlot.NamedSlot == NamedSlot.rightHand && UIManager.Hands.CurrentSlot != itemSlot)
     {
         UIManager.Hands.SetHand(true);
     }
     else
     {
         //otherwise, try just interacting with the blank slot (which will transfer the item
         itemSlot.TryItemInteract();
     }
 }
コード例 #5
0
 public void OnPointerClick(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         SoundManager.Play("Click01");
         // Only try interacting if we're not actually switching hands
         if (UIManager.Hands.hasSwitchedHands)
         {
             UIManager.Hands.hasSwitchedHands = false;
         }
         else
         {
             itemSlot.TryItemInteract();
         }
     }
 }