Beispiel #1
0
 /// <summary>
 /// 交换两个物品槽中的物品
 /// </summary>
 public void ExchangeItem(Item item, int amount)
 {
     PreviousSlot.StoreItem(item);
     PreviousSlot.GetComponentInChildren <ItemUI>().SetItem(item, amount);
     PickedItem.Hide();
     IsPicked = false;
 }
Beispiel #2
0
 private void Awake()
 {
     ParseItemJson();
     toolTip    = GameObject.FindObjectOfType <ToolTip>();
     canvas     = GameObject.Find("Canvas").GetComponent <Canvas>();
     PickedItem = GameObject.Find("PickedItem").GetComponent <ItemUi>();
     PickedItem.Hide();
 }
Beispiel #3
0
 public void RemoveItem(int amount)
 {
     PickedItem.ReduceAmount(amount);
     if (PickedItem.Amount <= 0)
     {
         isPickedItem = false;
         PickedItem.Hide();
     }
 }
 //从鼠标上减少(移除)指定数量的物品
 public void ReduceAmountItem(int amount = 1)
 {
     this.pickedItem.RemoveItemAmount(amount);
     if (pickedItem.Amount <= 0)
     {
         isPickedItem = false;
         PickedItem.Hide();//如果鼠标上没有物品了那就隐藏了
     }
 }
Beispiel #5
0
 public void RemoveItemByAmount(int amount)
 {
     PickedItem.ReduceAmount(amount);
     if (PickedItem.m_amount <= 0)
     {
         PickedItem.Hide();
         m_isPickedItem = false;
     }
 }
Beispiel #6
0
 public void RemoveItem(int amount = 1)
 {
     amount = -amount;
     PickedItem.AddAmount(amount);
     if (PickedItem.Amount <= 0)
     {
         isPickedItem = false;
         PickedItem.Hide();
     }
 }
Beispiel #7
0
 private void Update()
 {
     if (isPickedItem)
     {
         PickedItem.SetPosition(MousePosition());
     }
     else if (toolTipShow)
     {
         toolTip.SetLocalPosition(MousePosition() + toolTipPositionOffSet);
     }
     if (isPickedItem && Input.GetMouseButtonDown(0) && !UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject(-1))
     {
         isPickedItem = false;
         PickedItem.Hide();
     }
 }
Beispiel #8
0
 //移除物品
 public void RemoveItem()
 {
     isPickedItem = false;
     PickedItem.Hide();
 }