コード例 #1
0
 public override void OnPointerDown(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Right)
     {
         //右键脱下装备
         if (grid_item == null)
         {
             return;
         }
         if (Inventory.Instance.PutItemByID(grid_item.m_ID))
         {
             m_PlayerInfoPanel.PutOff(grid_item);
             ResetGrid();
         }
     }
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         if (Inventory.Instance.isPicked)
         {
             if (IsRightGrid(Inventory.Instance.pickedItem.picked_Item))
             {
                 if (grid_item == null)
                 {
                     m_PlayerInfoPanel.PutOn(Inventory.Instance.pickedItem.picked_Item, this);
                     //StoreItem(Inventory.Instance.pickedItem.picked_Item);//格子预制体搞错了 此方法不能用
                     SetItem(Inventory.Instance.pickedItem.picked_Item);
                     Inventory.Instance.pickedItem.ResetItem();
                 }
                 else
                 {
                     m_DressedItem = grid_item;
                     m_PlayerInfoPanel.PutOn(Inventory.Instance.pickedItem.picked_Item, this);
                     SetItem(Inventory.Instance.pickedItem.picked_Item);
                     Inventory.Instance.pickedItem.ResetItem();
                 }
             }
         }
         else
         {
             if (grid_item != null)
             {
                 m_PlayerInfoPanel.PutOff(grid_item);
                 Inventory.Instance.pickedItem.SetItem(grid_item, current_count);
                 ResetGrid();
             }
         }
     }
 }