public static RemoveItem ( object name, int number ) : bool | ||
name | object | |
number | int | |
Résultat | bool |
public void Use() { dragAndDrop = ItemUI.gameObject.GetComponent <DragAndDrop>(); if (item.type == ItemType.Food) { FoodObject food = (FoodObject)item; playerInfo.AddHp(food.HealthRestore); playerInfo.AddMana(food.ManaRestore); playerInfo.AddStanima(food.HungerRestore); dragAndDrop.IfSetSlotsOccupied(false, false); inventoryData.RemoveItem(item); Destroy(ItemUI.gameObject); Debug.Log("Used"); Destroy(gameObject); } }
public string removeItemName(params string[] args) { string name; int num; try { name = args[0].Replace("_", " "); } catch (Exception e) { return("Missing Item Name"); } try { num = int.Parse(args[1]); } catch (Exception e) { return("Missing Quantity"); } bool used = InventoryData.RemoveItem(name, num); if (used) { return("Item removed from inventory"); } else { return("Item could not be removed"); } }
void DropItem() { if (currentItem != null) { inventory.RemoveItem(currentItem); itemsDataView.Remove(currentItem); if (itemsDataView.Count == 0) { ItemPreview.gameObject.SetActive(false); } } }
public void OutRange(PointerEventData eventData) { DropX = eventData.position.x; DropY = eventData.position.y; SlotX = (int)((DropX - inventory.x) / 80); SlotY = (int)((DropY - inventory.y) / 80); if ((DropX - inventory.x - 80 * SlotX) % 80 >= 40) { SlotX++; } if ((DropY - inventory.y - 80 * SlotY) % 80 >= 40) { SlotY++; } Debug.Log(SlotX + "de" + SlotY); if (SlotX < 0 || SlotY < 0 || SlotX > 11 || SlotY > 7) { Instantiate(itemOnMOuse.SceneImage, PlayerTransform.position, Quaternion.identity); inventoryData.RemoveItem(itemOnMOuse); Destroy(gameObject); } }
public void Drop() { InventoryData.RemoveItem(this, 1); }
public void Use() { Debug.Log("I feel used"); InventoryData.RemoveItem(this, 1); }
public void CheckFirstQuest() { switch (FindQuest(firstQuest).GetCurrentEvent().order) { case 1: Debug.Log("first event"); if (ItemCheck(FindQuest(firstQuest).GetCurrentEvent().GetID())) { Debug.Log("itemCheck true"); OKButton.GetComponent <Button>().interactable = true; OKButton.GetComponent <Button>().onClick.AddListener(delegate() { Debug.Log(FindQuest(firstQuest)); Debug.Log(FindQuest(firstQuest).GetCurrentEvent()); foreach (Item item in itemCheck[FindQuest(firstQuest).GetCurrentEvent().GetID()]) { inventoryData.RemoveItem(item); } FindQuest(firstQuest).GetCurrentEvent().UpDateQuestEvent(QuestEvent.EventStatus.done); questManager.GetComponent <QuestManager>().Initialize(); OKButton.GetComponent <Button>().onClick.RemoveAllListeners(); OKButton.GetComponent <Button>().interactable = false; }); } else { Debug.Log("check no"); } break; case 2: foreach (bool bC in boolCheck[FindQuest(firstQuest).questEvents[1].GetID()]) { if (!bC) { Debug.Log("not true"); break; } OKButton.GetComponent <Button>().interactable = true; OKButton.GetComponent <Button>().onClick.AddListener(delegate() { Debug.Log("Second event done"); FindQuest(firstQuest).GetCurrentEvent().UpDateQuestEvent(QuestEvent.EventStatus.done); questManager.GetComponent <QuestManager>().Initialize(); OKButton.GetComponent <Button>().onClick.RemoveAllListeners(); OKButton.GetComponent <Button>().interactable = false; }); } break; case 3: OKButton.GetComponent <Button>().interactable = true; OKButton.GetComponent <Button>().onClick.AddListener(delegate() { foreach (Item item in FindQuest(firstQuest).questReward.items) { inventoryData.AddItem(item); } int n = 0; do { FindQuest(firstQuest).questReward.flags[n] = true; n++; } while (n < FindQuest(firstQuest).questReward.flags.Count); Debug.Log("third event done"); FindQuest(firstQuest).GetCurrentEvent().UpDateQuestEvent(QuestEvent.EventStatus.done); questManager.GetComponent <QuestManager>().Initialize(); OKButton.GetComponent <Button>().onClick.RemoveAllListeners(); OKButton.GetComponent <Button>().interactable = false; }); break; default: Debug.Log("default"); break; } Debug.Log("current" + FindQuest(firstQuest).GetCurrentEvent().eventName); }
// 設定甜點數量 public void RemoveItem(Item item) { m_inventoryData.RemoveItem(item); }