示例#1
0
 private void SelectSlot(ItemSlot slot)
 {
     selectedSlot = slot;
     if (selectedSlot != null && selectedSlot.ItemInSlot == null)
     {
         selectedSlot = null;
     }
     if (selectedSlot != null)
     {
         selectedText.text    = selectedSlot.ItemInSlot.Name;
         iconImage.sprite     = selectedSlot.ItemInSlot.icon ?? defaultIcon;
         descriptionText.text = selectedSlot.ItemInSlot.Description;
         equipButton.gameObject.SetActive(selectedSlot.ItemInSlot.useItemType != UseItemType.None && ItemsController.IsEquiped(selectedSlot.ItemInSlot) == false);
         if (equipButton.gameObject.activeSelf)
         {
             equipButton.enabled = ItemsController.CheckUseItem(selectedSlot.ItemInSlot);
         }
         takeOffButton.gameObject.SetActive(selectedSlot.ItemInSlot.useItemType != UseItemType.None && ItemsController.IsEquiped(selectedSlot.ItemInSlot) == true);
     }
     else
     {
         selectedText.text    = "";
         iconImage.sprite     = defaultIcon;
         descriptionText.text = "";
         equipButton.gameObject.SetActive(false);
         takeOffButton.gameObject.SetActive(false);
     }
 }